]> granicus.if.org Git - re2c/commitdiff
Open text files with "wb" causes issues on Windows 161/head
authorPaulo Custodio <pauloscustodio@gmail.com>
Sat, 5 Nov 2016 13:00:08 +0000 (13:00 +0000)
committerPaulo Custodio <pauloscustodio@gmail.com>
Sat, 5 Nov 2016 16:01:36 +0000 (16:01 +0000)
Text files need to be opened for writing with "w", so that stdio does
the right thing in respect to the correct line endings for the current OS.
("\r\n" in Windows, "\n" in Linux).

re2c/src/codegen/output.cc

index 5276ef77e0195a771d7090c11783d47c698e1087..8d4f3945d61a0eb1982edf9fa01145cb8498d64f 100644 (file)
@@ -71,7 +71,7 @@ bool OutputFile::open ()
        }
        else
        {
-               file = fopen (file_name, "wb");
+               file = fopen (file_name, "w");
        }
        return file != NULL;
 }
@@ -346,7 +346,7 @@ HeaderFile::HeaderFile (const char * fn)
 
 bool HeaderFile::open ()
 {
-       file = fopen (file_name, "wb");
+       file = fopen (file_name, "w");
        return file != NULL;
 }