From f3532f8a34a9b43bc526265e975b228abaa7dd05 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 26 Dec 2014 17:30:01 +0000 Subject: [PATCH] C-CON: fix 'writearraytofile' for 64-bit platforms. git-svn-id: https://svn.eduke32.com/eduke32@4844 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 92e921bab..3538b4884 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4510,7 +4510,6 @@ finish_qsprintf: } { - FILE *fil; char temp[BMAX_PATH]; if (EDUKE32_PREDICT_FALSE(G_ModDirSnprintf(temp, sizeof(temp), "%s", ScriptQuotes[q]))) @@ -4519,15 +4518,26 @@ finish_qsprintf: continue; } - fil = fopen(temp,"wb"); + FILE *const fil = fopen(temp,"wb"); if (EDUKE32_PREDICT_FALSE(fil == NULL)) { - CON_ERRPRINTF("couldn't open file"); + CON_ERRPRINTF("couldn't open file \"%s\"\n", temp); continue; } - fwrite(aGameArrays[j].plValues,1,sizeof(int) * aGameArrays[j].size,fil); + const int32_t n = aGameArrays[j].size; +#ifdef BITNESS64 + int32_t *const array = (int32_t *)Xmalloc(sizeof(int32_t)*n); + for (int32_t k=0; k