From b01b25bc93a73b9c9990b663c4ce33e4009eace3 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 28 Jul 2017 08:27:28 +0000 Subject: [PATCH] Revise part of r6385 for clarity. git-svn-id: https://svn.eduke32.com/eduke32@6391 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gameexec.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 140856f75..768448645 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -4462,26 +4462,25 @@ finish_qsprintf: continue; } - int const numBytes = Gv_GetArrayAllocSize(arrayNum); - switch (aGameArrays[arrayNum].flags & GAMEARRAY_TYPE_MASK) { case 0: #ifdef BITNESS64 { - int const numElements = aGameArrays[arrayNum].size; - int32_t *const pArray = (int32_t *)Xmalloc(numBytes >> 1); + size_t const numElements = aGameArrays[arrayNum].size; + size_t const numDiskBytes = numElements * sizeof(int32_t); + int32_t *const pArray = (int32_t *)Xmalloc(numDiskBytes); - for (bssize_t k = 0; k < numElements; k++) + for (size_t k = 0; k < numElements; ++k) pArray[k] = Gv_GetArrayValue(arrayNum, k); - Bfwrite(pArray, 1, numBytes >> 1, fil); + Bfwrite(pArray, 1, numDiskBytes, fil); Bfree(pArray); break; } #endif default: - Bfwrite(aGameArrays[arrayNum].pValues, 1, numBytes, fil); + Bfwrite(aGameArrays[arrayNum].pValues, 1, Gv_GetArrayAllocSize(arrayNum), fil); break; }