From 6b84e258d20e007fd7c95ac2d4f9244bd93edc13 Mon Sep 17 00:00:00 2001 From: VolTer Date: Sun, 29 Jan 2023 00:52:05 +0100 Subject: Use String.repeat() in more places --- modules/gltf/gltf_document.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/gltf/gltf_document.cpp') diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index b243ba933d..3600e5067b 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -6839,9 +6839,9 @@ PackedByteArray GLTFDocument::_serialize_glb_buffer(Ref p_state, Erro const int32_t header_size = 12; const int32_t chunk_header_size = 8; - for (int32_t pad_i = 0; pad_i < (chunk_header_size + json.utf8().length()) % 4; pad_i++) { - json += " "; - } + int32_t padding = (chunk_header_size + json.utf8().length()) % 4; + json += String(" ").repeat(padding); + CharString cs = json.utf8(); const uint32_t text_chunk_length = cs.length(); -- cgit v1.2.3