mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-03 10:00:56 +00:00
open all files in binary mode. ^Z is evil :P
This commit is contained in:
parent
a6104bc0fc
commit
2399e79ca0
3 changed files with 11 additions and 11 deletions
|
@ -211,7 +211,7 @@ preprocess_file (const char *filename, const char *ext)
|
||||||
mktemp (tempname->str);
|
mktemp (tempname->str);
|
||||||
|
|
||||||
{
|
{
|
||||||
FILE *tmp = fopen (tempname->str, "wt");
|
FILE *tmp = fopen (tempname->str, "wb");
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
fprintf (stderr, "%s: qfcc was unable to open\n",
|
fprintf (stderr, "%s: qfcc was unable to open\n",
|
||||||
tempname->str);
|
tempname->str);
|
||||||
|
@ -242,7 +242,7 @@ preprocess_file (const char *filename, const char *ext)
|
||||||
|
|
||||||
if (options.preprocess_only)
|
if (options.preprocess_only)
|
||||||
return 0;
|
return 0;
|
||||||
return fopen (tempname->str, "rt");
|
return fopen (tempname->str, "rb");
|
||||||
#else
|
#else
|
||||||
if (!options.save_temps && !options.preprocess_only)
|
if (!options.save_temps && !options.preprocess_only)
|
||||||
tempfd = mkstemp (tempname->str);
|
tempfd = mkstemp (tempname->str);
|
||||||
|
@ -293,11 +293,11 @@ preprocess_file (const char *filename, const char *ext)
|
||||||
if (options.preprocess_only)
|
if (options.preprocess_only)
|
||||||
return 0;
|
return 0;
|
||||||
else if (options.save_temps)
|
else if (options.save_temps)
|
||||||
return fopen (tempname->str, "rt");
|
return fopen (tempname->str, "rb");
|
||||||
else {
|
else {
|
||||||
return fdopen (tempfd, "rt");
|
return fdopen (tempfd, "rb");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return fopen (filename, "rt");
|
return fopen (filename, "rb");
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ WriteFiles (const char *sourcedir)
|
||||||
dstring_t *filename = dstring_newstr ();
|
dstring_t *filename = dstring_newstr ();
|
||||||
|
|
||||||
dsprintf (filename, "%s%cfiles.dat", sourcedir, PATH_SEPARATOR);
|
dsprintf (filename, "%s%cfiles.dat", sourcedir, PATH_SEPARATOR);
|
||||||
f = fopen (filename->str, "w");
|
f = fopen (filename->str, "wb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf (stderr, "Couldn't open %s", filename->str);
|
fprintf (stderr, "Couldn't open %s", filename->str);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -217,7 +217,7 @@ WriteProgdefs (const char *filename)
|
||||||
|
|
||||||
if (options.verbosity >= 1)
|
if (options.verbosity >= 1)
|
||||||
printf ("writing %s\n", filename);
|
printf ("writing %s\n", filename);
|
||||||
f = fopen (filename, "w");
|
f = fopen (filename, "wb");
|
||||||
|
|
||||||
// print global vars until the first field is defined
|
// print global vars until the first field is defined
|
||||||
fprintf (f,
|
fprintf (f,
|
||||||
|
@ -296,7 +296,7 @@ WriteProgdefs (const char *filename)
|
||||||
|
|
||||||
// do a crc of the file
|
// do a crc of the file
|
||||||
CRC_Init (&crc);
|
CRC_Init (&crc);
|
||||||
f = fopen (filename, "r+");
|
f = fopen (filename, "r+b");
|
||||||
while ((c = fgetc (f)) != EOF)
|
while ((c = fgetc (f)) != EOF)
|
||||||
CRC_ProcessByte (&crc, (byte) c);
|
CRC_ProcessByte (&crc, (byte) c);
|
||||||
|
|
||||||
|
|
|
@ -664,7 +664,7 @@ load_file (const char *fname)
|
||||||
tmpfile = preprocess_file (fname, "i1");
|
tmpfile = preprocess_file (fname, "i1");
|
||||||
if (!tmpfile)
|
if (!tmpfile)
|
||||||
return 0;
|
return 0;
|
||||||
file = Qfopen (tmpfile, "rt");
|
file = Qfopen (tmpfile, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
perror (fname);
|
perror (fname);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -753,11 +753,11 @@ progs_src_compile (void)
|
||||||
mktemp (single_name->str);
|
mktemp (single_name->str);
|
||||||
#else
|
#else
|
||||||
int tempfd = mkstemp (single_name->str);
|
int tempfd = mkstemp (single_name->str);
|
||||||
single = fdopen (tempfd, "wt");
|
single = fdopen (tempfd, "wb");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!single)
|
if (!single)
|
||||||
single = fopen (single_name->str, "wt");
|
single = fopen (single_name->str, "wb");
|
||||||
if (!single) {
|
if (!single) {
|
||||||
perror (single_name->str);
|
perror (single_name->str);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue