Open binary files in mode "rb" instead of "r"

This subtile bug didn't show on unixoid platforms, but led to problems
on Windows.
This commit is contained in:
Yamagi Burmeister 2012-06-03 21:53:51 +02:00
parent e85bf27473
commit d2177bb618
2 changed files with 6 additions and 4 deletions

2
TODO
View file

@ -22,6 +22,8 @@ Windows Port TODO
- Replace rand() with randk() in Windows code.
- Implement Sys_AppActivate() as soon as cl_hwnd is
ported to Yamagi Quake II.
- Check of "rb" is the correct mode to open files in
filesystem.c
The big plan:
1. Get the dedicated server builded (03/06/12)

View file

@ -421,7 +421,7 @@ FS_FOpenFileRead(fsHandle_t * handle)
{
/* PAK */
file_from_pak = 1;
handle->file = fopen(pack->name, "r");
handle->file = fopen(pack->name, "rb");
if (handle->file)
{
@ -461,12 +461,12 @@ FS_FOpenFileRead(fsHandle_t * handle)
/* Search in a directory tree. */
Com_sprintf(path, sizeof(path), "%s/%s", search->path, handle->name);
handle->file = fopen(path, "r");
handle->file = fopen(path, "rb");
if (!handle->file)
{
strlwr(path);
handle->file = fopen(path, "r");
handle->file = fopen(path, "rb");
}
if (!handle->file)
@ -1030,7 +1030,7 @@ FS_LoadPAK(const char *packPath)
dpackheader_t header; /* PAK file header. */
dpackfile_t info[MAX_FILES_IN_PACK]; /* PAK info. */
handle = fopen(packPath, "r");
handle = fopen(packPath, "rb");
if (handle == NULL)
return (NULL);