From: havoc Date: Tue, 4 Sep 2007 20:18:27 +0000 (+0000) Subject: remove a weird loop that was attempting to count the length of the X-Git-Tag: xonotic-v0.1.0preview~2918 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=78ead53c7ca6ac347c03c6a042049f70e8332a1f;p=xonotic%2Fdarkplaces.git remove a weird loop that was attempting to count the length of the strings table in the progs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7557 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/prvm_edict.c b/prvm_edict.c index 8b269d55..947d8972 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1584,14 +1584,11 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required //prog->functions = (dfunction_t *)((unsigned char *)progs + progs->ofs_functions); dfunctions = (dfunction_t *)((unsigned char *)prog->progs + prog->progs->ofs_functions); + if (prog->progs->ofs_strings + prog->progs->numstrings >= (int)filesize) + PRVM_ERROR ("%s: %s strings go past end of file", PRVM_NAME, filename); prog->strings = (char *)prog->progs + prog->progs->ofs_strings; - prog->stringssize = 0; - for (i = 0;i < prog->progs->numstrings;i++) - { - if (prog->progs->ofs_strings + prog->stringssize >= (int)filesize) - PRVM_ERROR ("%s: %s strings go past end of file", PRVM_NAME, filename); - prog->stringssize += (int)strlen (prog->strings + prog->stringssize) + 1; - } + prog->stringssize = prog->progs->numstrings; + prog->numknownstrings = 0; prog->maxknownstrings = 0; prog->knownstrings = NULL;