From 9e3d1f6db55231ce44194b3a1c882ce7ae0c0b23 Mon Sep 17 00:00:00 2001 From: Alexander Wood Date: Fri, 8 Oct 2021 16:57:56 -0400 Subject: [PATCH] Build fix. --- tiny_gltf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 23095fd..40b3983 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -7534,13 +7534,13 @@ static void WriteBinaryGltfStream(std::ostream &stream, const uint32_t content_size = uint32_t(content.size()); const uint32_t binBuffer_size = uint32_t(binBuffer.size()); // determine number of padding bytes required to ensure 4 byte alignment - const uint32_t padding_size = content_size % 4 == 0 ? 0 : 4 - content_size % 4; + const uint32_t content_padding_size = content_size % 4 == 0 ? 0 : 4 - content_size % 4; const uint32_t bin_padding_size = binBuffer_size % 4 == 0 ? 0 : 4 - binBuffer_size % 4; // 12 bytes for header, JSON content length, 8 bytes for JSON chunk info. // Chunk data must be located at 4-byte boundary, which may require padding const uint32_t length = - 12 + 8 + content_size + content_padding + + 12 + 8 + content_size + content_padding_size + (binBuffer_size ? (8 + binBuffer_size + bin_padding_size : 0); stream.write(header.c_str(), std::streamsize(header.size())); @@ -7548,7 +7548,7 @@ static void WriteBinaryGltfStream(std::ostream &stream, stream.write(reinterpret_cast(&length), sizeof(length)); // JSON chunk info, then JSON data - const uint32_t model_length = uint32_t(content.size()) + padding_size; + const uint32_t model_length = uint32_t(content.size()) + content_padding_size; const uint32_t model_format = 0x4E4F534A; stream.write(reinterpret_cast(&model_length), sizeof(model_length)); @@ -7557,8 +7557,8 @@ static void WriteBinaryGltfStream(std::ostream &stream, stream.write(content.c_str(), std::streamsize(content.size())); // Chunk must be multiplies of 4, so pad with spaces - if (padding_size > 0) { - const std::string padding = std::string(size_t(padding_size), ' '); + if (content_padding_size > 0) { + const std::string padding = std::string(size_t(content_padding_size), ' '); stream.write(padding.c_str(), std::streamsize(padding.size())); } if (binBuffer.size() > 0) {