ScoTTie <scott@wizzer-it.com>/erie-- <seditaniedi@gmail.com>

Build fixes for FreeBSD

svn path=/trunk/; revision=18952
This commit is contained in:
Gé van Geldorp 2005-11-02 16:13:00 +00:00
parent eb90b6c916
commit 02d236693b
15 changed files with 114 additions and 51 deletions

View 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()

View 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

View file

@ -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"

View file

@ -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>

View 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 ****************************************************************/

View 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 */

View 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()

View file

@ -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

View 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;

View 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

View 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

View 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

View 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

View 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

View 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;