1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 03:03:18 +00:00

Fixed broken while loop

This commit is contained in:
Bryan Roe
2020-07-27 09:58:04 -07:00
parent c986d60132
commit 453b5cdf5b

View File

@@ -189,15 +189,14 @@ int __fastcall utilx_readfile2(char* filename, char** data)
{ {
*data = malloc(1024); *data = malloc(1024);
if (*data == NULL) { fclose(pFile); return 0; } if (*data == NULL) { fclose(pFile); return 0; }
do while((len = fread((*data) + count, 1, 1023, pFile))>0)
{ {
len = fread((*data) + count, 1, 1023, pFile);
count += len; count += len;
if (len == 1023) if (len == 1023)
{ {
if ((*data = realloc(*data, count + 1024)) == NULL) { ILIBCRITICALEXIT(254); } if ((*data = realloc(*data, count + 1024)) == NULL) { ILIBCRITICALEXIT(254); }
} }
} while (len == 100); }
(*data)[count] = 0; (*data)[count] = 0;
fclose(pFile); fclose(pFile);
} }