Windows compatibility fixes for widl:=0A=

Colin Finck mail at colinfinck.de
Thu Feb 7 16:15:22 CST 2008


- Support Windows-style pathes in dup_basename and make_token=0A=
- Write the TLB file in binary mode, so the line endings won't be changed=0A=
---=0A=
 tools/widl/utils.c      |    3 +++=0A=
 tools/widl/widl.c       |    3 +++=0A=
 tools/widl/widltypes.h  |    5 +++++=0A=
 tools/widl/write_msft.c |    2 +-=0A=
 4 files changed, 12 insertions(+), 1 deletions(-)=0A=
=0A=
diff --git a/tools/widl/utils.c b/tools/widl/utils.c=0A=
index e77361c..ed950f6 100644=0A=
--- a/tools/widl/utils.c=0A=
+++ b/tools/widl/utils.c=0A=
@@ -136,6 +136,9 @@ char *dup_basename(const char *name, const char *ext)=0A=
 		name =3D "widl.tab";=0A=
 =0A=
 	slash =3D strrchr(name, '/');=0A=
+	if (!slash)=0A=
+		slash =3D strrchr(name, '\\');=0A=
+=0A=
 	if (slash)=0A=
 		name =3D slash + 1;=0A=
 =0A=
diff --git a/tools/widl/widl.c b/tools/widl/widl.c=0A=
index 7945694..07f024c 100644=0A=
--- a/tools/widl/widl.c=0A=
+++ b/tools/widl/widl.c=0A=
@@ -166,6 +166,9 @@ static char *make_token(const char *name)=0A=
   int i;=0A=
 =0A=
   slash =3D strrchr(name, '/');=0A=
+  if(!slash)=0A=
+    slash =3D strrchr(name, '\\');=0A=
+=0A=
   if (slash) name =3D slash + 1;=0A=
 =0A=
   token =3D xstrdup(name);=0A=
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h=0A=
index acdc3f1..5740b3e 100644=0A=
--- a/tools/widl/widltypes.h=0A=
+++ b/tools/widl/widltypes.h=0A=
@@ -34,6 +34,11 @@ typedef GUID UUID;=0A=
 #define TRUE 1=0A=
 #define FALSE 0=0A=
 =0A=
+// All hosts, which don't define O_BINARY, don't need it :-)=0A=
+#ifndef O_BINARY=0A=
+#define O_BINARY 0=0A=
+#endif=0A=
+=0A=
 typedef struct _attr_t attr_t;=0A=
 typedef struct _expr_t expr_t;=0A=
 typedef struct _type_t type_t;=0A=
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c=0A=
index 51227bf..4e7edf3 100644=0A=
--- a/tools/widl/write_msft.c=0A=
+++ b/tools/widl/write_msft.c=0A=
@@ -2418,7 +2418,7 @@ static int save_all_changes(msft_typelib_t =
*typelib)=0A=
 =0A=
     retval =3D TYPE_E_IOERROR;=0A=
 =0A=
-    fd =3D creat(typelib->typelib->filename, 0666);=0A=
+    fd =3D open(typelib->typelib->filename, O_CREAT | O_WRONLY | =
O_TRUNC | O_BINARY, 0666);=0A=
     if (fd =3D=3D -1) return retval;=0A=
 =0A=
     filepos =3D sizeof(MSFT_Header) + sizeof(MSFT_SegDir);=0A=
-- =0A=
1.4.4.2=0A=
=0A=

------=_NextPart_000_0019_01C869A8.5E9A4590--




More information about the wine-patches mailing list