bin2res should open binary files in binary mode

Pavel Roskin proski at gnu.org
Mon Oct 6 10:16:46 CDT 2003


Hello!

When winefile is compiled on Windows, the folder icons are corrupted.
This happens because bin2res opens the binary resource files in the text
mode and adds "\r" before some occurrences of "\n".

This patch makes bin2res open binary files (icons and bitmaps) in the
binary mode, both for reading and writing.  POSIX systems are not
affected.

wrc already uses "rb" and "wb" when dealing with binary files.

ChangeLog:
	* tools/bin2res.c:
	Read and write binary files in binary mode on Windows.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- tools/bin2res.c
+++ tools/bin2res.c
@@ -164,7 +164,7 @@ int process_resources(const char* input_
 	    if (inserting) fputc(c, ftmp);
 	if (c == EOF) break;
 
-	if (!(fres = fopen(res_file_name, inserting ? "r" : "w"))) break;
+	if (!(fres = fopen(res_file_name, inserting ? "rb" : "wb"))) break;
 	if (inserting)
 	{
 	    if (!insert_hexdump(ftmp, fres)) break;


More information about the wine-patches mailing list