ScoTTie <scott@wizzer-it.com>/erie-- <seditaniedi@gmail.com>
authorGé van Geldorp <ge@gse.nl>
Wed, 2 Nov 2005 16:13:00 +0000 (16:13 +0000)
committerGé van Geldorp <ge@gse.nl>
Wed, 2 Nov 2005 16:13:00 +0000 (16:13 +0000)
Build fixes for FreeBSD

svn path=/trunk/; revision=18952

15 files changed:
reactos/tools/buildno/XML.cpp
reactos/tools/buildno/ssprintf.cpp
reactos/tools/cabman/cabinet.cxx
reactos/tools/cdmake/cdmake.c
reactos/tools/nci/ncitool.c
reactos/tools/pefixup.c
reactos/tools/rbuild/XML.cpp
reactos/tools/rbuild/ssprintf.cpp
reactos/tools/rsym.h
reactos/w32api/include/poppack.h
reactos/w32api/include/pshpack1.h
reactos/w32api/include/pshpack2.h
reactos/w32api/include/pshpack4.h
reactos/w32api/include/pshpack8.h
reactos/w32api/include/wingdi.h

index 741c41b..160b425 100644 (file)
@@ -71,13 +71,19 @@ unsigned long long
 filelen ( FILE* f )
 {
 #ifdef WIN32
-       return _filelengthi64 ( _fileno(f) );
+        return _filelengthi64 ( _fileno(f) );
 #else
-       struct stat64 file_stat;
-       if ( fstat64(fileno(f), &file_stat) != 0 )
-               return 0;
-       return file_stat.st_size;
-#endif
+# ifdef __FreeBSD__
+        struct stat file_stat;
+        if ( fstat(fileno(f), &file_stat) != 0 )
+# else
+        struct stat64 file_stat;
+        if ( fstat64(fileno(f), &file_stat) != 0 )
+# endif // __FreeBSD__
+                return 0;
+        return file_stat.st_size;
+
+#endif // WIN32
 }
 
 Path::Path()
index 0edf91b..3b2bfbf 100644 (file)
@@ -2,12 +2,23 @@
 
 #include "pch.h"
 
-#include <malloc.h>
+#ifdef __FreeBSD__
+# include <stdlib.h>
+#else
+# include <malloc.h>
+#endif // __FreeBSD__
 #include <math.h>
 #include <float.h>
 #include <assert.h>
 #include "ssprintf.h"
 
+#ifdef __FreeBSD__
+# define __isnan isnan
+# define __finite finite
+# define powl __builtin_powl
+# define modfl __builtin_modfl
+#endif // _FreeBSD__
+
 #ifdef _MSC_VER
 #define alloca _alloca
 #endif//_MSC_VER
index 63e658a..ae5c6e9 100755 (executable)
@@ -16,6 +16,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __FreeBSD__
+# include <sys/stat.h>
+#endif // __FreeBSD__
 #include "cabinet.h"
 #include "raw.h"
 #include "mszip.h"
index 5ed51d6..f01ac6a 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #ifdef WIN32
-#include <io.h>
-#include <dos.h>
+# include <io.h>
+# include <dos.h>
 #else
-#include <sys/io.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#endif
+# ifdef __FreeBSD__
+#  include <sys/uio.h>
+# else
+#  include <sys/io.h>
+# endif // __FreeBSD__
+# include <errno.h>
+# include <sys/types.h>
+# include <dirent.h>
+# include <unistd.h>
+#endif // WIN32
 #include <ctype.h>
 #include <setjmp.h>
 #include <time.h>
index a176ad8..0b62a10 100644 (file)
@@ -14,7 +14,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <malloc.h>
+#ifndef __FreeBSD__
+# include <malloc.h>
+#endif // __FreeBSD__
 
 /* DEFINES  ****************************************************************/
 
index e7055b8..69964b1 100644 (file)
@@ -47,7 +47,7 @@ typedef int LONG;
 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((unsigned long)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
 
-#pragma pack(push,2)
+#pragma pack(2)
 typedef struct _IMAGE_DOS_HEADER {
        WORD e_magic;
        WORD e_cblp;
@@ -69,8 +69,8 @@ typedef struct _IMAGE_DOS_HEADER {
        WORD e_res2[10];
        LONG e_lfanew;
 } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
-#pragma pack(pop)
-#pragma pack(push,4)
+#pragma pack(4)
+#pragma pack(4)
 typedef struct _IMAGE_EXPORT_DIRECTORY {
        DWORD Characteristics;
        DWORD TimeDateStamp;
@@ -150,7 +150,7 @@ typedef struct _IMAGE_SECTION_HEADER {
        WORD NumberOfLinenumbers;
        DWORD Characteristics;
 } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
-#pragma pack(pop)
+#pragma pack(4)
 
 /* End of ripped definitions */
 
index 074af9e..306dbe2 100644 (file)
@@ -70,13 +70,19 @@ unsigned long long
 filelen ( FILE* f )
 {
 #ifdef WIN32
-       return _filelengthi64 ( _fileno(f) );
+        return _filelengthi64 ( _fileno(f) );
 #else
-       struct stat64 file_stat;
-       if ( fstat64(fileno(f), &file_stat) != 0 )
-               return 0;
-       return file_stat.st_size;
-#endif
+# ifdef __FreeBSD__
+        struct stat file_stat;
+        if ( fstat(fileno(f), &file_stat) != 0 )
+# else
+        struct stat64 file_stat;
+        if ( fstat64(fileno(f), &file_stat) != 0 )
+# endif // __FreeBSD__
+                return 0;
+        return file_stat.st_size;
+
+#endif // WIN32
 }
 
 Path::Path()
index 36a190c..541ab37 100644 (file)
  */
 #include "pch.h"
 
-#include <malloc.h>
+#ifdef __FreeBSD__
+# include <stdlib.h>
+#else
+# include <malloc.h>
+#endif // __FreeBSD__
 #include <math.h>
 #include <float.h>
 #include <assert.h>
 #include "ssprintf.h"
 
+#ifdef __FreeBSD__
+# define __isnan isnan
+# define __finite finite
+# define powl __builtin_powl
+# define modfl __builtin_modfl
+#endif // _FreeBSD__
+
 #ifdef _MSC_VER
 #define alloca _alloca
 #endif//_MSC_VER
index 64dcd37..77e406b 100644 (file)
@@ -33,7 +33,7 @@ typedef  unsigned long ULONG_PTR;
 #endif
 #endif
 
-#pragma pack(push,2)
+#pragma pack(2)
 typedef struct _IMAGE_DOS_HEADER {
   WORD e_magic;
   WORD e_cblp;
@@ -55,13 +55,13 @@ typedef struct _IMAGE_DOS_HEADER {
   WORD e_res2[10];
   LONG e_lfanew;
 } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
-#pragma pack(pop)
+#pragma pack(4)
 
 #define IMAGE_FILE_LINE_NUMS_STRIPPED  4
 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
 #define IMAGE_FILE_DEBUG_STRIPPED      512
 
-#pragma pack(push,4)
+#pragma pack(4)
 typedef struct _IMAGE_FILE_HEADER {
   WORD Machine;
   WORD NumberOfSections;
@@ -162,7 +162,7 @@ typedef struct {
   USHORT s_nlnno;    /* number of line number entries    */
   ULONG  s_flags;    /* flags                            */
 } SCNHDR;
-#pragma pack(pop)
+#pragma pack(4)
 
 typedef struct _SYMBOLFILE_HEADER {
   ULONG SymbolsOffset;
@@ -238,7 +238,7 @@ typedef struct _STAB_ENTRY {
 #define C_ALIAS                105     /* duplicate tag                */
 #define C_HIDDEN       106     /* ext symbol in dmert public lib */
 
-#pragma pack(push,1)
+#pragma pack(1)
 typedef struct _COFF_SYMENT
 {
   union
@@ -258,7 +258,7 @@ typedef struct _COFF_SYMENT
   UCHAR e_sclass;
   UCHAR e_numaux;
 } COFF_SYMENT, *PCOFF_SYMENT;
-#pragma pack(pop)
+#pragma pack(4)
 
 typedef struct _ROSSYM_ENTRY {
   ULONG_PTR Address;
index bb04d45..438dc73 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef RC_INVOKED
-#pragma pack(pop)
-#endif
+# if ( __FreeBSD__ == 5 )
+#  pragma pack(4)
+# else
+#  pragma pack(pop)
+# endif // __FreeBSD__
+#endif // RC_INVOKED
index 3cbcf23..cd41edf 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef RC_INVOKED
-#pragma pack(push,1)
-#endif
+# if ( __FreeBSD__ == 5 )
+#  pragma pack(1)
+# else
+#  pragma pack(push,1)
+# endif // __FreeBSD__
+#endif // RC_INVOKED
index 4d88e00..401eacd 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef RC_INVOKED
-#pragma pack(push,2)
-#endif
+# if ( __FreeBSD__ == 5 )
+#  pragma pack(2)
+# else
+#  pragma pack(push,2)
+# endif // __FreeBSD__
+#endif // RC_INVOKED
index c1c3cf9..df14925 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef RC_INVOKED
-#pragma pack(push,4)
-#endif
+# if ( __FreeBSD__ == 5 )
+#  pragma pack(4)
+# else
+#  pragma pack(push,4)
+# endif // __FreeBSD__
+#endif // RC_INVOKED
index f0c4539..354b3eb 100644 (file)
@@ -1,3 +1,7 @@
 #ifndef RC_INVOKED
-#pragma pack(push,8)
-#endif
+# if ( __FreeBSD__ == 5 )
+#  pragma pack(8)
+# else
+#  pragma pack(push,8)
+# endif // __FreeBSD__
+#endif // RC_INVOKED
index e8f1f26..c07c17b 100644 (file)
@@ -1225,14 +1225,14 @@ typedef struct tagBITMAPCOREHEADER {
        WORD    bcPlanes;
        WORD    bcBitCount;
 } BITMAPCOREHEADER,*LPBITMAPCOREHEADER,*PBITMAPCOREHEADER;
-#pragma pack(push,1)
+#include "pshpack1.h"
 typedef struct tagRGBTRIPLE {
        BYTE rgbtBlue;
        BYTE rgbtGreen;
        BYTE rgbtRed;
 } RGBTRIPLE,*LPRGBTRIPLE;
-#pragma pack(pop)
-#pragma pack(push,2)
+#include "poppack.h"
+#include "pshpack2.h"
 typedef struct tagBITMAPFILEHEADER {
        WORD    bfType;
        DWORD   bfSize;
@@ -1240,7 +1240,7 @@ typedef struct tagBITMAPFILEHEADER {
        WORD    bfReserved2;
        DWORD   bfOffBits;
 } BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER;
-#pragma pack(pop)
+#include "poppack.h"
 typedef struct _BITMAPCOREINFO {
        BITMAPCOREHEADER        bmciHeader;
        RGBTRIPLE       bmciColors[1];
@@ -2024,7 +2024,7 @@ typedef struct tagEMRSELECTCLIPPATH {
        EMR emr;
        DWORD iMode;
 } EMRSELECTCLIPPATH,*PEMRSELECTCLIPPATH,EMRSETBKMODE,*PEMRSETBKMODE,EMRSETMAPMODE,*PEMRSETMAPMODE,EMRSETPOLYFILLMODE,*PEMRSETPOLYFILLMODE,EMRSETROP2,*PEMRSETROP2,EMRSETSTRETCHBLTMODE,*PEMRSETSTRETCHBLTMODE,EMRSETTEXTALIGN,*PEMRSETTEXTALIGN,EMRENABLEICM,*PEMRENABLEICM;
-#pragma pack(push,2)
+#include "pshpack2.h"
 typedef struct tagMETAHEADER {
        WORD mtType;
        WORD mtHeaderSize;
@@ -2034,7 +2034,7 @@ typedef struct tagMETAHEADER {
        DWORD mtMaxRecord;
        WORD mtNoParameters;
 } METAHEADER,*PMETAHEADER,*LPMETAHEADER;
-#pragma pack(pop)
+#include "poppack.h"
 typedef struct tagENHMETAHEADER {
        DWORD iType;
        DWORD nSize;
@@ -2320,7 +2320,7 @@ typedef struct tagLOCALESIGNATURE {
        DWORD lsCsbSupported[2];
 } LOCALESIGNATURE,*PLOCALESIGNATURE,*LPLOCALESIGNATURE;
 typedef LONG LCSTYPE;
-#pragma pack(push,4)
+#include "pshpack4.h"
 typedef struct tagNEWTEXTMETRICA {
        LONG tmHeight;
        LONG tmAscent;
@@ -2373,7 +2373,7 @@ typedef struct tagNEWTEXTMETRICW {
        UINT ntmCellHeight;
        UINT ntmAvgWidth;
 } NEWTEXTMETRICW,*PNEWTEXTMETRICW,*LPNEWTEXTMETRICW;
-#pragma pack(pop)
+#include "poppack.h"
 typedef struct tagNEWTEXTMETRICEXA {
        NEWTEXTMETRICA ntmTm;
        FONTSIGNATURE ntmFontSig;