open all files in binary mode. ^Z is evil :P

This commit is contained in:
Bill Currie 2007-04-07 10:24:34 +00:00 committed by Jeff Teunissen
parent a6104bc0fc
commit 2399e79ca0
3 changed files with 11 additions and 11 deletions

View file

@ -211,7 +211,7 @@ preprocess_file (const char *filename, const char *ext)
mktemp (tempname->str);
{
FILE *tmp = fopen (tempname->str, "wt");
FILE *tmp = fopen (tempname->str, "wb");
if (tmp == NULL) {
fprintf (stderr, "%s: qfcc was unable to open\n",
tempname->str);
@ -242,7 +242,7 @@ preprocess_file (const char *filename, const char *ext)
if (options.preprocess_only)
return 0;
return fopen (tempname->str, "rt");
return fopen (tempname->str, "rb");
#else
if (!options.save_temps && !options.preprocess_only)
tempfd = mkstemp (tempname->str);
@ -293,11 +293,11 @@ preprocess_file (const char *filename, const char *ext)
if (options.preprocess_only)
return 0;
else if (options.save_temps)
return fopen (tempname->str, "rt");
return fopen (tempname->str, "rb");
else {
return fdopen (tempfd, "rt");
return fdopen (tempfd, "rb");
}
#endif
}
return fopen (filename, "rt");
return fopen (filename, "rb");
}

View file

@ -177,7 +177,7 @@ WriteFiles (const char *sourcedir)
dstring_t *filename = dstring_newstr ();
dsprintf (filename, "%s%cfiles.dat", sourcedir, PATH_SEPARATOR);
f = fopen (filename->str, "w");
f = fopen (filename->str, "wb");
if (!f) {
fprintf (stderr, "Couldn't open %s", filename->str);
return 1;
@ -217,7 +217,7 @@ WriteProgdefs (const char *filename)
if (options.verbosity >= 1)
printf ("writing %s\n", filename);
f = fopen (filename, "w");
f = fopen (filename, "wb");
// print global vars until the first field is defined
fprintf (f,
@ -296,7 +296,7 @@ WriteProgdefs (const char *filename)
// do a crc of the file
CRC_Init (&crc);
f = fopen (filename, "r+");
f = fopen (filename, "r+b");
while ((c = fgetc (f)) != EOF)
CRC_ProcessByte (&crc, (byte) c);

View file

@ -664,7 +664,7 @@ load_file (const char *fname)
tmpfile = preprocess_file (fname, "i1");
if (!tmpfile)
return 0;
file = Qfopen (tmpfile, "rt");
file = Qfopen (tmpfile, "rb");
if (!file) {
perror (fname);
return 0;
@ -753,11 +753,11 @@ progs_src_compile (void)
mktemp (single_name->str);
#else
int tempfd = mkstemp (single_name->str);
single = fdopen (tempfd, "wt");
single = fdopen (tempfd, "wb");
#endif
}
if (!single)
single = fopen (single_name->str, "wt");
single = fopen (single_name->str, "wb");
if (!single) {
perror (single_name->str);
exit (1);