From 865239542a659bacfad4f50e49784ebe4edd17d4 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 12 Mar 2014 12:13:16 -0400 Subject: [PATCH] Cast our strlens to uint32 to avoid compiler warnings. --- IO/src/ImageWriterKTX.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/IO/src/ImageWriterKTX.cpp b/IO/src/ImageWriterKTX.cpp index 8c29972..20712f5 100644 --- a/IO/src/ImageWriterKTX.cpp +++ b/IO/src/ImageWriterKTX.cpp @@ -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(strlen(orientationKey)); + + const char *orientationValue = "S=r,T=d"; + uint32 oValLen = static_cast(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) {