comparison src/define.h @ 75:987aa872294e stable-0-6-11

Use ftello/fseeko to properly handle large files. Document and properly use datasize field in b5 blocks. Fix some MSVC compile issues and collect MSVC dependencies into one place.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Jun 2008 12:00:58 -0700
parents 3cb02cb1e6cd
children 0f1492b7fe8b
comparison
equal deleted inserted replaced
74:6f82d13e9300 75:987aa872294e
5 * dave.s@earthcorp.com 5 * dave.s@earthcorp.com
6 */ 6 */
7 7
8 #ifdef HAVE_CONFIG_H 8 #ifdef HAVE_CONFIG_H
9 #include "config.h" 9 #include "config.h"
10 #else
11 #ifdef _MSC_VER
12 #undef HAVE_UNISTD_H
13 #define HAVE_DIRECT_H
14 #define HAVE_WINDOWS_H
15 #endif
10 #endif 16 #endif
11 #include "version.h" 17 #include "version.h"
12 18
13 #ifndef DEFINEH_H 19 #ifndef DEFINEH_H
14 #define DEFINEH_H 20 #define DEFINEH_H
49 #include <limits.h> 55 #include <limits.h>
50 #include <wchar.h> 56 #include <wchar.h>
51 #include <signal.h> 57 #include <signal.h>
52 #include <errno.h> 58 #include <errno.h>
53 59
60 #define PERM_DIRS 0777
61
54 #ifdef HAVE_UNISTD_H 62 #ifdef HAVE_UNISTD_H
55 #include <unistd.h> 63 #include <unistd.h>
64 #define D_MKDIR(x) mkdir(x, PERM_DIRS)
56 #else 65 #else
57 #include "XGetopt.h" 66 #include "XGetopt.h"
58 #ifdef HAVE_DIRECT_H 67 #ifdef HAVE_DIRECT_H
59 #include <direct.h> // win32 68 #include <direct.h> // win32
60 #define chdir _chdir 69 #define D_MKDIR(x) mkdir(x)
61 #define int32_t __int32 70 #define chdir _chdir
62 #endif 71 #endif
63 72
64 #ifdef HAVE_WINDOWS_H 73 #ifdef HAVE_WINDOWS_H
65 #include <windows.h> // win32 74 #include <windows.h>
75 #endif
76
77 #ifdef _MSC_VER
78 #define vsnprintf _vsnprintf
79 #define snprintf _snprintf
80 #define ftello _ftelli64
81 #define fseeko _fseeki64
82 #define strcasecmp _stricmp
83 #define off_t __int64
84 #define size_t __int64
85 #define int64_t __int64
86 #define uint64_t unsigned __int64
87 #define int32_t __int32
88 #define uint32_t unsigned int
89 #define int16_t short int
90 #define uint16_t unsigned short int
91 #define int8_t signed char
92 #define uint8_t unsigned char
93 #define UINT64_MAX ((uint64_t)0xffffffffffffffff)
94 int __cdecl _fseeki64(FILE *, __int64, int);
95 __int64 __cdecl _ftelli64(FILE *);
66 #endif 96 #endif
67 #endif 97 #endif
68 98
69 #ifdef HAVE_SYS_STAT_H 99 #ifdef HAVE_SYS_STAT_H
70 # include <sys/stat.h> //mkdir 100 #include <sys/stat.h>
71 #endif 101 #endif
72 102
73 // for reading of directory and clearing in function mk_seperate_dir
74 #ifdef HAVE_SYS_TYPES_H 103 #ifdef HAVE_SYS_TYPES_H
75 # include <sys/types.h> 104 #include <sys/types.h>
76 #endif 105 #endif
77 106
78 #ifdef HAVE_DIRENT_H 107 #ifdef HAVE_DIRENT_H
79 # include <dirent.h> 108 #include <dirent.h>
80 #endif 109 #endif
81 110
82 111
83 void pst_debug(const char *fmt, ...); 112 void pst_debug(const char *fmt, ...);
84 void pst_debug_hexdumper(FILE* out, char* buf, size_t size, int col, int delta); 113 void pst_debug_hexdumper(FILE* out, char* buf, size_t size, int col, int delta);