Cast our strlens to uint32 to avoid compiler warnings.

This commit is contained in:
Pavel Krajcevski 2014-03-12 12:13:16 -04:00
parent cc566471e9
commit 865239542a

View file

@ -110,10 +110,12 @@ bool ImageWriterKTX::WriteImage() {
wtr.Write(0x04030201);
const char *orientationKey = "KTXorientation";
const char *orientationValue = "S=r,T=u";
const uint32 kvSz =
strlen(orientationKey) + 1 // key
+ strlen(orientationValue) + 1; // value
uint32 oKeyLen = static_cast<uint32>(strlen(orientationKey));
const char *orientationValue = "S=r,T=d";
uint32 oValLen = static_cast<uint32>(strlen(orientationValue));
const uint32 kvSz = oKeyLen + 1 + oValLen + 1;
uint32 tkvSz = kvSz + 4; // total kv size
tkvSz = (tkvSz + 3) & ~0x3; // 4-byte aligned
@ -153,8 +155,8 @@ bool ImageWriterKTX::WriteImage() {
wtr.Write(1); // numberOfMipmapLevels
wtr.Write(tkvSz); // total key value size
wtr.Write(kvSz); // key value size
wtr.Write(orientationKey, strlen(orientationKey) + 1); // key
wtr.Write(orientationValue, strlen(orientationValue) + 1); // value
wtr.Write(orientationKey, oKeyLen + 1); // key
wtr.Write(orientationValue, oValLen + 1); // value
wtr.Write(orientationKey, tkvSz - kvSz - 4); // padding
if(ci && ci->GetFormat() == FasTC::eCompressionFormat_BPTC) {