fixed file loading for non-binary files, fixed sendmap packet creation
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2025 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -163,12 +163,12 @@ char *loadfile(const char *fn, int *size, const char *mode)
|
||||
buf[len] = 0;
|
||||
size_t rlen = fread(buf, 1, len, f);
|
||||
fclose(f);
|
||||
if(size_t(len)!=rlen)
|
||||
if(size_t(len)!=rlen && (!mode || strchr(mode, 'b')))
|
||||
{
|
||||
delete[] buf;
|
||||
return NULL;
|
||||
}
|
||||
if(size!=NULL) *size = len;
|
||||
if(size!=NULL) *size = rlen;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user