Include protection for unistd.h and sys/time.h

Dmitry Timoshkov dmitry at baikal.ru
Sat Aug 17 05:33:05 CDT 2002


Hello all.

This patch does the same as one from Patrik for directory
'tools' (<sys/types.h> and <sys/stat.h> are also protected).
As an additional bonus fnt2bdf now not only compiles, but also
actually works after compilation by MSVC.

Changelog:
Include protection for <unistd.h>, <sys/types.h> and <sys/stat.h>
in the tools directory.

-- 
Dmitry.
-------------- next part --------------
diff -u cvs/hq/wine/tools/fnt2bdf.c wine/tools/fnt2bdf.c
--- cvs/hq/wine/tools/fnt2bdf.c	Mon Jun  3 13:01:49 2002
+++ wine/tools/fnt2bdf.c	Sat Aug 17 18:47:31 2002
@@ -30,8 +30,17 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <fcntl.h>
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
 
 #include "fnt2bdf.h"
 #include "module.h"
@@ -146,6 +155,13 @@
   t = return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion);
   if( t != 0x300 && t != 0x200) return ERROR_VERSION;
 
+  t = return_data_value(dfShort, &cpe_font_struct.hdr.fi.dfType);
+  if (t & 1)
+  {
+    fprintf(stderr, "Vector fonts not supported\n");
+    return ERROR_DATA;
+  }
+
   t = return_data_value(dfLong, &cpe_font_struct.hdr.dfSize);
   if( t > length ) return ERROR_SIZE;
   else
@@ -176,7 +192,7 @@
 	if( return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion) == 0x200) {
 	    cpe_font_struct.dfCharTable[ic].charOffset =
 			return_data_value(dfShort, &file_buffer[l_ptr]);
-	    l_ptr += 2;	/* bump by sizeof(long) */
+	    l_ptr += 2;	/* bump by sizeof(short) */
 	    }
 	else { 	/*  Windows Version 3.0 type font */
 	    cpe_font_struct.dfCharTable[ic].charOffset =
@@ -540,7 +556,7 @@
 
   parse_options( argc, argv);
 
-  if( (fd = open( g_lpstrInputFile, O_RDONLY)) )
+  if( (fd = open( g_lpstrInputFile, O_RDONLY | O_BINARY)) )
   {
     int    i;
     struct stat file_stat;
@@ -574,7 +590,7 @@
 		 unsigned short		size_shift = return_data_value(dfShort, lpdata);
 		 unsigned char*		lpfont = NULL;
 		 unsigned		offset;
-		 unsigned		length;
+		 int			length;
 
 		 for( j = 0; j < count; j++, pFontStorage++ )
 		 {
diff -u cvs/hq/wine/tools/makedep.c wine/tools/makedep.c
--- cvs/hq/wine/tools/makedep.c	Thu May 16 12:06:10 2002
+++ wine/tools/makedep.c	Sat Aug 17 18:48:09 2002
@@ -25,7 +25,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 /* Max first-level includes per file */
 #define MAX_INCLUDES 200
diff -u cvs/hq/wine/tools/widl/header.c wine/tools/widl/header.c
--- cvs/hq/wine/tools/widl/header.c	Wed Aug 14 23:29:36 2002
+++ wine/tools/widl/header.c	Sat Aug 17 18:53:22 2002
@@ -22,7 +22,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff -u cvs/hq/wine/tools/widl/parser.l wine/tools/widl/parser.l
--- cvs/hq/wine/tools/widl/parser.l	Fri Jul 26 16:02:39 2002
+++ wine/tools/widl/parser.l	Sat Aug 17 19:07:47 2002
@@ -33,12 +33,16 @@
 
 %{
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <assert.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 #include "widl.h"
 #include "utils.h"
diff -u cvs/hq/wine/tools/widl/proxy.c wine/tools/widl/proxy.c
--- cvs/hq/wine/tools/widl/proxy.c	Wed Aug 14 23:29:36 2002
+++ wine/tools/widl/proxy.c	Sat Aug 17 19:08:22 2002
@@ -22,7 +22,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff -u cvs/hq/wine/tools/widl/widl.c wine/tools/widl/widl.c
--- cvs/hq/wine/tools/widl/widl.c	Tue Jul 23 13:37:42 2002
+++ wine/tools/widl/widl.c	Sat Aug 17 19:08:35 2002
@@ -23,7 +23,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff -u cvs/hq/wine/tools/winebuild/import.c wine/tools/winebuild/import.c
--- cvs/hq/wine/tools/winebuild/import.c	Fri Aug  2 17:42:49 2002
+++ wine/tools/winebuild/import.c	Sat Aug 17 19:08:57 2002
@@ -26,7 +26,9 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 #include "build.h"
 
diff -u cvs/hq/wine/tools/winebuild/res16.c wine/tools/winebuild/res16.c
--- cvs/hq/wine/tools/winebuild/res16.c	Mon Apr 29 14:49:15 2002
+++ wine/tools/winebuild/res16.c	Sat Aug 17 19:14:15 2002
@@ -25,9 +25,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <fcntl.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
diff -u cvs/hq/wine/tools/winebuild/res32.c wine/tools/winebuild/res32.c
--- cvs/hq/wine/tools/winebuild/res32.c	Mon Apr 29 14:49:15 2002
+++ wine/tools/winebuild/res32.c	Sat Aug 17 19:15:06 2002
@@ -25,9 +25,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #include <fcntl.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
diff -u cvs/hq/wine/tools/winedump/debug.c wine/tools/winedump/debug.c
--- cvs/hq/wine/tools/winedump/debug.c	Mon Jun  3 13:01:51 2002
+++ wine/tools/winedump/debug.c	Sat Aug 17 19:16:14 2002
@@ -25,10 +25,16 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
diff -u cvs/hq/wine/tools/winedump/pe.c wine/tools/winedump/pe.c
--- cvs/hq/wine/tools/winedump/pe.c	Thu Jul  4 21:43:22 2002
+++ wine/tools/winedump/pe.c	Sat Aug 17 19:16:40 2002
@@ -23,10 +23,16 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
diff -u cvs/hq/wine/tools/wpp/preproc.c wine/tools/wpp/preproc.c
--- cvs/hq/wine/tools/wpp/preproc.c	Tue Jul 16 11:33:11 2002
+++ wine/tools/wpp/preproc.c	Sat Aug 17 19:10:48 2002
@@ -24,7 +24,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 #include "wpp_private.h"
 
diff -u cvs/hq/wine/tools/wrc/wrc.c wine/tools/wrc/wrc.c
--- cvs/hq/wine/tools/wrc/wrc.c	Sat Aug 17 18:42:34 2002
+++ wine/tools/wrc/wrc.c	Sat Aug 17 19:11:01 2002
@@ -52,7 +52,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>


More information about the wine-patches mailing list