Updated places to achFormatHint referencing array size.
This commit is contained in:
@@ -413,7 +413,8 @@ protected:
|
||||
|
||||
Write<unsigned int>(&chunk,tex->mWidth);
|
||||
Write<unsigned int>(&chunk,tex->mHeight);
|
||||
chunk.Write( tex->achFormatHint, sizeof(char), 4 );
|
||||
// Write the texture format, but don't include the null terminator.
|
||||
chunk.Write( tex->achFormatHint, sizeof(char), HINTMAXTEXTURELEN - 1 );
|
||||
|
||||
if(!shortened) {
|
||||
if (!tex->mHeight) {
|
||||
|
||||
@@ -535,7 +535,7 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) {
|
||||
|
||||
tex->mWidth = Read<unsigned int>(stream);
|
||||
tex->mHeight = Read<unsigned int>(stream);
|
||||
stream->Read( tex->achFormatHint, sizeof(char), 4 );
|
||||
stream->Read( tex->achFormatHint, sizeof(char), HINTMAXTEXTURELEN - 1 );
|
||||
|
||||
if(!shortened) {
|
||||
if (!tex->mHeight) {
|
||||
|
||||
@@ -798,7 +798,7 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture)
|
||||
if (!pTexture->mWidth) {
|
||||
ReportError("aiTexture::mWidth is zero (compressed texture)");
|
||||
}
|
||||
if ('\0' != pTexture->achFormatHint[3]) {
|
||||
if ('\0' != pTexture->achFormatHint[HINTMAXTEXTURELEN - 1]) {
|
||||
ReportWarning("aiTexture::achFormatHint must be zero-terminated");
|
||||
}
|
||||
else if ('.' == pTexture->achFormatHint[0]) {
|
||||
|
||||
@@ -207,8 +207,7 @@ struct aiTexture {
|
||||
, mHeight(0)
|
||||
, pcData(nullptr)
|
||||
, mFilename() {
|
||||
achFormatHint[0] = achFormatHint[1] = 0;
|
||||
achFormatHint[2] = achFormatHint[3] = 0;
|
||||
memset(achFormatHint, 0, sizeof(achFormatHint));
|
||||
}
|
||||
|
||||
// Destruction
|
||||
|
||||
@@ -800,6 +800,10 @@ void CompareOnTheFlyTexture(comparer_context& comp) {
|
||||
comp.cmp<char>("achFormatHint[1]");
|
||||
comp.cmp<char>("achFormatHint[2]");
|
||||
comp.cmp<char>("achFormatHint[3]");
|
||||
comp.cmp<char>("achFormatHint[4]");
|
||||
comp.cmp<char>("achFormatHint[5]");
|
||||
comp.cmp<char>("achFormatHint[6]");
|
||||
comp.cmp<char>("achFormatHint[7]");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -312,7 +312,8 @@ uint32_t WriteBinaryTexture(const aiTexture* tex)
|
||||
|
||||
len += Write<unsigned int>(tex->mWidth);
|
||||
len += Write<unsigned int>(tex->mHeight);
|
||||
len += static_cast<uint32_t>(fwrite(tex->achFormatHint,1,4,out));
|
||||
// Write the texture format, but don't include the null terminator.
|
||||
len += static_cast<uint32_t>(fwrite(tex->achFormatHint,sizeof(char),HINTMAXTEXTURELEN - 1,out));
|
||||
|
||||
if(!shortened) {
|
||||
if (!tex->mHeight) {
|
||||
|
||||
Reference in New Issue
Block a user