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:
driAn
2008-05-17 23:32:06 +00:00
parent 8931f08a6f
commit 3b0fee6c08
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -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;
}