[PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Steven Edwards
-- 
Steven Edwards

There is one thing stronger than all the armies in the world, and
that is an idea whose time has come. - Victor Hugo
From d7e5946566433ee18ffda721dd48bd026ec8ee71 Mon Sep 17 00:00:00 2001
From: Steven Edwards [EMAIL PROTECTED]
Date: Wed, 10 Sep 2008 09:18:14 -0400
Subject: [PATCH] Open file in binary mode to work around a windows bug

---
 tools/widl/typelib.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index b30b323..2706870 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -354,10 +354,10 @@ static void read_importlib(importlib_t *importlib)
 
 file_name = wpp_find_include(importlib-name, NULL);
 if(file_name) {
-fd = open(file_name, O_RDONLY);
+fd = open(file_name, O_RDONLY | O_BINARY );
 free(file_name);
 }else {
-fd = open(importlib-name, O_RDONLY);
+fd = open(importlib-name, O_RDONLY | O_BINARY );
 }
 
 if(fd  0)
-- 
1.5.4.3




Re: [PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Dmitry Timoshkov
Steven Edwards [EMAIL PROTECTED] wrote:

 [PATCH] Open file in binary mode to work around a windows bug

What bug is that? If that's a Windows bug why Wine needs to be patched?

-- 
Dmitry.




Re: [PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Rob Shearman
2008/9/9 Dmitry Timoshkov [EMAIL PROTECTED]:
 Steven Edwards [EMAIL PROTECTED] wrote:

 [PATCH] Open file in binary mode to work around a windows bug

 What bug is that? If that's a Windows bug why Wine needs to be patched?

It's not a bug. When opening a file in text mode on Windows, all LFs
will be converted to CRLFs. Typelib files are binary and therefore
random parts of the typelib data
will seemingly be corrupted when read.

The patch is correct, even if the description isn't.

-- 
Rob Shearman




Re: [PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Steven Edwards
On Tue, Sep 9, 2008 at 11:10 AM, Rob Shearman [EMAIL PROTECTED] wrote:
 2008/9/9 Dmitry Timoshkov [EMAIL PROTECTED]:
 Steven Edwards [EMAIL PROTECTED] wrote:

 [PATCH] Open file in binary mode to work around a windows bug

 What bug is that? If that's a Windows bug why Wine needs to be patched?

 It's not a bug. When opening a file in text mode on Windows, all LFs
 will be converted to CRLFs. Typelib files are binary and therefore
 random parts of the typelib data
 will seemingly be corrupted when read.

 The patch is correct, even if the description isn't.

Sorry I should have said Allow opening files in binary mode to avoid
corruption from text mode on Windows or some such. I know the line
LF/CRLF stuff is not really a bug as there is not a standard that says
All line endings should follow the Unix method I just view the
historic dos/windows usage as a bug.

If Alexandre does not apply it I will resend.

-- 
Steven Edwards

There is one thing stronger than all the armies in the world, and
that is an idea whose time has come. - Victor Hugo




Re: [PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Dmitry Timoshkov
Steven Edwards [EMAIL PROTECTED] wrote:

 If Alexandre does not apply it I will resend.

Usually he doesn't apply the patches sent to wine-devel, so
you have to resend.

-- 
Dmitry.




Re: [PATCH] Open file in binary mode to work around a windows bug

2008-09-09 Thread Steven Edwards
On Tue, Sep 9, 2008 at 12:03 PM, Dmitry Timoshkov
[EMAIL PROTECTED] wrote:
 Steven Edwards [EMAIL PROTECTED] wrote:

 If Alexandre does not apply it I will resend.

 Usually he doesn't apply the patches sent to wine-devel, so
 you have to resend.

Duh! I am being really careless today for some reason...

-- 
Steven Edwards

There is one thing stronger than all the armies in the world, and
that is an idea whose time has come. - Victor Hugo