mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
terminate buf properly (\r\n -> \n translation can cause the bytes read to
be /much/ smaller than expected)
This commit is contained in:
parent
f4e0147345
commit
22fe9de3f9
1 changed files with 5 additions and 3 deletions
|
@ -569,13 +569,15 @@ LoadMapFile (const char *filename)
|
|||
{
|
||||
char *buf;
|
||||
QFile *file;
|
||||
int bytes;
|
||||
|
||||
file = Qopen (filename, "rt");
|
||||
if (!file)
|
||||
Sys_Error ("couldn't open %s. %s", filename, strerror(errno));
|
||||
buf = malloc (Qfilesize (file) + 1);
|
||||
buf[Qfilesize (file)] = 0;
|
||||
Qread (file, buf, Qfilesize (file));
|
||||
bytes = Qfilesize (file);
|
||||
buf = malloc (bytes + 1);
|
||||
bytes = Qread (file, buf, bytes);
|
||||
buf[bytes] = 0;
|
||||
Qclose (file);
|
||||
|
||||
script_file = filename;
|
||||
|
|
Loading…
Reference in a new issue