Include protection for <unistd.h>, <sys/types.h> and <sys/stat.h>.
diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c
index c0a855e..79d9dbe 100644
--- a/tools/fnt2bdf.c
+++ b/tools/fnt2bdf.c
@@ -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 --git a/tools/makedep.c b/tools/makedep.c
index 2a2174a..bf51ba0 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -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 --git a/tools/widl/header.c b/tools/widl/header.c
index 16be1f9..c910a9a 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -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 --git a/tools/widl/parser.l b/tools/widl/parser.l
index d89e479..2f3e602 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -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 --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index a0677bd..2cf3ff1 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -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 --git a/tools/widl/widl.c b/tools/widl/widl.c
index 8dfbcd5..9c26b82 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -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 --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 054e885..7a4c2a4 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -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 --git a/tools/winebuild/res16.c b/tools/winebuild/res16.c
index b91ffa3..3694bef 100644
--- a/tools/winebuild/res16.c
+++ b/tools/winebuild/res16.c
@@ -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 --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index ed4a38a..8eaeca4 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -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 --git a/tools/winedump/debug.c b/tools/winedump/debug.c
index 5fa3a41..bd9164e 100644
--- a/tools/winedump/debug.c
+++ b/tools/winedump/debug.c
@@ -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
@@ -480,4 +486,3 @@
{
dump_codeview_headers(base, len);
}
-
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 943fbdf..a5832a0 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -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 --git a/tools/wpp/preproc.c b/tools/wpp/preproc.c
index 8978c25..868a2b0b 100644
--- a/tools/wpp/preproc.c
+++ b/tools/wpp/preproc.c
@@ -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 --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c
index 463b38c..de3a0cc 100644
--- a/tools/wrc/wrc.c
+++ b/tools/wrc/wrc.c
@@ -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>