summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2004-04-03 20:49:23 +0000
committerStef Walter <stef@thewalter.net>2004-04-03 20:49:23 +0000
commit3eca787a2b83ff8cf60d2be9e588d4a558b85a85 (patch)
tree407a084fba7f51cfccb1cf20e25d419f618057a5
parent94ba99e2ccdfaf862af6ce039ae447eb244c9283 (diff)
Sorted the headers properly.
-rw-r--r--src/compat.c9
-rw-r--r--src/compat.h97
-rw-r--r--src/list.c6
-rw-r--r--src/main.c8
-rw-r--r--src/misc.c5
-rw-r--r--src/ntfsx.c5
-rw-r--r--src/scrounge.c7
-rw-r--r--src/search.c2
-rw-r--r--src/unicode.c4
-rw-r--r--src/usuals.h34
10 files changed, 126 insertions, 51 deletions
diff --git a/src/compat.c b/src/compat.c
index b183a99..14b85e4 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -17,15 +17,8 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
#include "compat.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
+#include "usuals.h"
/*
* We need to get a better check for this one.
diff --git a/src/compat.h b/src/compat.h
index 373d359..8f75ef2 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -83,6 +83,103 @@ typedef unsigned int uint;
#define HAVE_UINT
#endif
+#ifndef HAVE_UINT64
+ #ifdef _WIN32
+ typedef unsigned __int64 uint64;
+ #else
+ #ifdef HAVE_64BITLONGLONG
+ typedef unsigned long long uint64;
+ #else
+ #ifdef HAVE_64BITLONG
+ typedef unsigned long uint64;
+ #else
+ #error ERROR: Must have a compiler that can handle 64 bit integers
+ #endif
+ #endif
+ #endif
+#endif
+
+#ifndef HAVE_UINT32
+ #ifdef _WIN32
+ typedef unsigned __int32 uint32;
+ #else
+ #ifdef HAVE_32BITLONG
+ typedef unsigned long uint32;
+ #else
+ #ifdef HAVE_32BITINT
+ typedef unsigned int uint32;
+ #else
+ #error ERROR: Couldn't find a 32 bit integer to use
+ #endif
+ #endif
+ #endif
+#endif
+
+#ifndef HAVE_UINT16
+ #ifdef _WIN32
+ typedef unsigned __int16 uint16;
+ #else
+ #ifdef HAVE_16BITSHORT
+ typedef unsigned short uint16;
+ #else
+ #ifdef HAVE_16BITINT
+ typedef unsigned int uint16;
+ #else
+ #error ERROR: Couldn't find a 16 bit integer to use
+ #endif
+ #endif
+ #endif
+#endif
+
+#ifndef HAVE_INT64
+ #ifdef _WIN32
+ typedef signed __int64 int64;
+ #else
+ #ifdef HAVE_64BITLONGLONG
+ typedef signed long long int64;
+ #else
+ #ifdef HAVE_64BITLONG
+ typedef signed long int64;
+ #else
+ #error ERROR: Must have a compiler that can handle 64 bit integers
+ #endif
+ #endif
+ #endif
+#endif
+
+#ifndef HAVE_INT32
+ #ifdef _WIN32
+ typedef signed __int32 int32;
+ #else
+ #ifdef HAVE_32BITLONG
+ typedef signed long int32;
+ #else
+ #ifdef HAVE_32BITINT
+ typedef signed int int32;
+ #else
+ #error ERROR: Couldn't find a 32 bit integer to use
+ #endif
+ #endif
+ #endif
+#endif
+
+#ifndef HAVE_INT16
+ #ifdef _WIN32
+ typedef signed __int16 int16;
+ #else
+ #ifdef HAVE_16BITSHORT
+ typedef signed short int16;
+ #else
+ #ifdef HAVE_16BITINT
+ typedef signed int int16;
+ #else
+ #error ERROR: Couldn't find a 16 bit integer to use
+ #endif
+ #endif
+ #endif
+#endif
+
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff --git a/src/list.c b/src/list.c
index f93f3c0..97ac912 100644
--- a/src/list.c
+++ b/src/list.c
@@ -17,12 +17,6 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-
#include "usuals.h"
#include "drive.h"
#include "ntfs.h"
diff --git a/src/main.c b/src/main.c
index 5cde040..b6156d0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,13 +17,7 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <io.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "usuals.h"
#include "scrounge.h"
#include "compat.h"
diff --git a/src/misc.c b/src/misc.c
index 0bb65ac..0778467 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -17,11 +17,6 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <malloc.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
#include "usuals.h"
#include "compat.h"
#include "memref.h"
diff --git a/src/ntfsx.c b/src/ntfsx.c
index a3209e1..5d9a526 100644
--- a/src/ntfsx.c
+++ b/src/ntfsx.c
@@ -17,11 +17,6 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <io.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <string.h>
-
#include "scrounge.h"
#include "memref.h"
#include "ntfs.h"
diff --git a/src/scrounge.c b/src/scrounge.c
index 66297a8..8baf688 100644
--- a/src/scrounge.c
+++ b/src/scrounge.c
@@ -17,12 +17,7 @@
* Send bug reports to: <nielsen@memberwebs.com>
*/
-#include <io.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "usuals.h"
#include "scrounge.h"
#include "ntfs.h"
#include "ntfsx.h"
diff --git a/src/search.c b/src/search.c
index 4ab9823..2d9ee35 100644
--- a/src/search.c
+++ b/src/search.c
@@ -18,7 +18,7 @@
*/
-#include <stdio.h>
+#include "usuals.h"
#include "drive.h"
void scroungeSearch(partitioninfo* pi)
diff --git a/src/unicode.c b/src/unicode.c
index a8fc612..ea64574 100644
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -1,9 +1,7 @@
+#include "usuals.h"
#include <wchar.h>
-#include <wchar.h>
-#include "sablo.h"
-
/*
* Transcode UCS2 to UTF8.
*
diff --git a/src/usuals.h b/src/usuals.h
index 0697956..699adb3 100644
--- a/src/usuals.h
+++ b/src/usuals.h
@@ -20,18 +20,33 @@
#ifndef __USUALS_H__
#define __USUALS_H__
-#include "debug.h"
-#include "compat.h"
+#include <sys/types.h>
+
+#ifdef _WIN32
+ #include <../config.win32.h>
+#else
+ #include <../config.h>
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
-typedef unsigned __int64 uint64;
-typedef unsigned long uint32;
-typedef unsigned short uint16;
-typedef unsigned char byte;
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef _WIN32
+#include <malloc.h>
+#endif
-typedef signed __int64 int64;
-typedef signed long int32;
-typedef signed short int16;
+#include "debug.h"
+#include "compat.h"
#ifndef NULL
#define NULL 0
@@ -46,7 +61,6 @@ typedef signed short int16;
#define HIGHDWORD(i64) (DWORD)((i64) >> 32)
#define LOWDWORD(i64) (DWORD)((i64) & 0xFFFFFFFF)
-
#define INTERSECTS(b1, e1, b2, e2) \
((b1) < (e2) && (e1) > (b2))