Include protection for <unistd.h>, <sys/types.h> and <sys/stat.h>.

This commit is contained in:
Dmitry Timoshkov 2002-08-17 18:28:43 +00:00 committed by Alexandre Julliard
parent e75542ae24
commit c63d98038a
13 changed files with 76 additions and 23 deletions

View File

@ -30,8 +30,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
#include "fnt2bdf.h" #include "fnt2bdf.h"
#include "module.h" #include "module.h"
@ -146,6 +155,13 @@ int parse_fnt_data(unsigned char* file_buffer, int length)
t = return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion); t = return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion);
if( t != 0x300 && t != 0x200) return ERROR_VERSION; 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); t = return_data_value(dfLong, &cpe_font_struct.hdr.dfSize);
if( t > length ) return ERROR_SIZE; if( t > length ) return ERROR_SIZE;
else else
@ -176,7 +192,7 @@ int parse_fnt_data(unsigned char* file_buffer, int length)
if( return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion) == 0x200) { if( return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion) == 0x200) {
cpe_font_struct.dfCharTable[ic].charOffset = cpe_font_struct.dfCharTable[ic].charOffset =
return_data_value(dfShort, &file_buffer[l_ptr]); 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 */ else { /* Windows Version 3.0 type font */
cpe_font_struct.dfCharTable[ic].charOffset = cpe_font_struct.dfCharTable[ic].charOffset =
@ -540,7 +556,7 @@ int main(int argc, char **argv)
parse_options( argc, argv); parse_options( argc, argv);
if( (fd = open( g_lpstrInputFile, O_RDONLY)) ) if( (fd = open( g_lpstrInputFile, O_RDONLY | O_BINARY)) )
{ {
int i; int i;
struct stat file_stat; struct stat file_stat;
@ -574,7 +590,7 @@ int main(int argc, char **argv)
unsigned short size_shift = return_data_value(dfShort, lpdata); unsigned short size_shift = return_data_value(dfShort, lpdata);
unsigned char* lpfont = NULL; unsigned char* lpfont = NULL;
unsigned offset; unsigned offset;
unsigned length; int length;
for( j = 0; j < count; j++, pFontStorage++ ) for( j = 0; j < count; j++, pFontStorage++ )
{ {

View File

@ -25,7 +25,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* Max first-level includes per file */ /* Max first-level includes per file */
#define MAX_INCLUDES 200 #define MAX_INCLUDES 200

View File

@ -22,7 +22,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>

View File

@ -33,12 +33,16 @@ uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12}
%{ %{
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "widl.h" #include "widl.h"
#include "utils.h" #include "utils.h"

View File

@ -22,7 +22,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>

View File

@ -23,7 +23,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>

View File

@ -26,7 +26,9 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "build.h" #include "build.h"

View File

@ -25,9 +25,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif

View File

@ -25,9 +25,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif

View File

@ -25,10 +25,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <time.h> #include <time.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
#include <sys/stat.h> # include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
@ -480,4 +486,3 @@ void dump_codeview(unsigned long base, unsigned long len)
{ {
dump_codeview_headers(base, len); dump_codeview_headers(base, len);
} }

View File

@ -23,10 +23,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <time.h> #include <time.h>
#include <sys/types.h> #ifdef HAVE_SYS_TYPES_H
#include <sys/stat.h> # include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif

View File

@ -24,7 +24,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "wpp_private.h" #include "wpp_private.h"

View File

@ -52,7 +52,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>