ScoTTie <scott@wizzer-it.com>/erie-- <seditaniedi@gmail.com>
Build fixes for FreeBSD
Modified: trunk/reactos/tools/buildno/XML.cpp
Modified: trunk/reactos/tools/buildno/ssprintf.cpp
Modified: trunk/reactos/tools/cabman/cabinet.cxx
Modified: trunk/reactos/tools/cdmake/cdmake.c
Modified: trunk/reactos/tools/nci/ncitool.c
Modified: trunk/reactos/tools/pefixup.c
Modified: trunk/reactos/tools/rbuild/XML.cpp
Modified: trunk/reactos/tools/rbuild/ssprintf.cpp
Modified: trunk/reactos/tools/rsym.h
Modified: trunk/reactos/w32api/include/poppack.h
Modified: trunk/reactos/w32api/include/pshpack1.h
Modified: trunk/reactos/w32api/include/pshpack2.h
Modified: trunk/reactos/w32api/include/pshpack4.h
Modified: trunk/reactos/w32api/include/pshpack8.h
Modified: trunk/reactos/w32api/include/wingdi.h

Modified: trunk/reactos/tools/buildno/XML.cpp
--- trunk/reactos/tools/buildno/XML.cpp	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/buildno/XML.cpp	2005-11-02 16:13:00 UTC (rev 18952)
@@ -71,13 +71,19 @@
 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()

Modified: trunk/reactos/tools/buildno/ssprintf.cpp
--- trunk/reactos/tools/buildno/ssprintf.cpp	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/buildno/ssprintf.cpp	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/tools/cabman/cabinet.cxx
--- trunk/reactos/tools/cabman/cabinet.cxx	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/cabman/cabinet.cxx	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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"

Modified: trunk/reactos/tools/cdmake/cdmake.c
--- trunk/reactos/tools/cdmake/cdmake.c	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/cdmake/cdmake.c	2005-11-02 16:13:00 UTC (rev 18952)
@@ -35,15 +35,19 @@
 #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>

Modified: trunk/reactos/tools/nci/ncitool.c
--- trunk/reactos/tools/nci/ncitool.c	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/nci/ncitool.c	2005-11-02 16:13:00 UTC (rev 18952)
@@ -14,7 +14,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <malloc.h>
+#ifndef __FreeBSD__
+# include <malloc.h>
+#endif // __FreeBSD__
 
 /* DEFINES  ****************************************************************/
 

Modified: trunk/reactos/tools/pefixup.c
--- trunk/reactos/tools/pefixup.c	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/pefixup.c	2005-11-02 16:13:00 UTC (rev 18952)
@@ -47,7 +47,7 @@
 #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 @@
 	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 @@
 	WORD NumberOfLinenumbers;
 	DWORD Characteristics;
 } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
-#pragma pack(pop)
+#pragma pack(4)
 
 /* End of ripped definitions */
 

Modified: trunk/reactos/tools/rbuild/XML.cpp
--- trunk/reactos/tools/rbuild/XML.cpp	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/rbuild/XML.cpp	2005-11-02 16:13:00 UTC (rev 18952)
@@ -70,13 +70,19 @@
 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()

Modified: trunk/reactos/tools/rbuild/ssprintf.cpp
--- trunk/reactos/tools/rbuild/ssprintf.cpp	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/rbuild/ssprintf.cpp	2005-11-02 16:13:00 UTC (rev 18952)
@@ -15,12 +15,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

Modified: trunk/reactos/tools/rsym.h
--- trunk/reactos/tools/rsym.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/tools/rsym.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -33,7 +33,7 @@
 #endif
 #endif
 
-#pragma pack(push,2)
+#pragma pack(2)
 typedef struct _IMAGE_DOS_HEADER {
   WORD e_magic;
   WORD e_cblp;
@@ -55,13 +55,13 @@
   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 @@
   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 @@
 #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 @@
   UCHAR e_sclass;
   UCHAR e_numaux;
 } COFF_SYMENT, *PCOFF_SYMENT;
-#pragma pack(pop)
+#pragma pack(4)
 
 typedef struct _ROSSYM_ENTRY {
   ULONG_PTR Address;

Modified: trunk/reactos/w32api/include/poppack.h
--- trunk/reactos/w32api/include/poppack.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/poppack.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/w32api/include/pshpack1.h
--- trunk/reactos/w32api/include/pshpack1.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/pshpack1.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/w32api/include/pshpack2.h
--- trunk/reactos/w32api/include/pshpack2.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/pshpack2.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/w32api/include/pshpack4.h
--- trunk/reactos/w32api/include/pshpack4.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/pshpack4.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/w32api/include/pshpack8.h
--- trunk/reactos/w32api/include/pshpack8.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/pshpack8.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -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

Modified: trunk/reactos/w32api/include/wingdi.h
--- trunk/reactos/w32api/include/wingdi.h	2005-11-02 15:32:05 UTC (rev 18951)
+++ trunk/reactos/w32api/include/wingdi.h	2005-11-02 16:13:00 UTC (rev 18952)
@@ -1225,14 +1225,14 @@
 	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 @@
 	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 @@
 	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 @@
 	DWORD mtMaxRecord;
 	WORD mtNoParameters;
 } METAHEADER,*PMETAHEADER,*LPMETAHEADER;
-#pragma pack(pop)
+#include "poppack.h"
 typedef struct tagENHMETAHEADER {
 	DWORD iType;
 	DWORD nSize;
@@ -2320,7 +2320,7 @@
 	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 @@
 	UINT ntmCellHeight;
 	UINT ntmAvgWidth;
 } NEWTEXTMETRICW,*PNEWTEXTMETRICW,*LPNEWTEXTMETRICW;
-#pragma pack(pop)
+#include "poppack.h"
 typedef struct tagNEWTEXTMETRICEXA {
 	NEWTEXTMETRICA ntmTm;
 	FONTSIGNATURE ntmFontSig;