summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compat.c44
-rw-r--r--src/compat.h37
-rw-r--r--src/drive.h8
-rw-r--r--src/ntfs.h6
-rw-r--r--src/ntfsx.c2
-rw-r--r--src/scrounge.c2
-rw-r--r--src/usuals.h6
7 files changed, 29 insertions, 76 deletions
diff --git a/src/compat.c b/src/compat.c
index 171f551..013675f 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -87,20 +87,7 @@ int getopt(int nargc, char* const* nargv, const char* ostr)
return (-1);
}
- if (place[1] && *++place == '-') #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }/* found "--" */
+ if (place[1] && *++place == '-') /* found "--" */
{
++optind;
place = EMSG;
@@ -151,20 +138,6 @@ int getopt(int nargc, char* const* nargv, const char* ostr)
return (optopt); /* dump back option letter */
}
#endif
- #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }
#ifndef HAVE_ERR_H
@@ -413,18 +386,3 @@ char* itoa(int val, char* out, int radix)
return out;
}
#endif
-
-#if HAVE_MALLOC == 0
-#undef malloc
-
-/* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
-void* rpl_malloc (size_t n)
-{
- if (n == 0)
- n = 1;
- return malloc (n);
-}
-
-#endif
diff --git a/src/compat.h b/src/compat.h
index 0047991..a73637f 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -22,25 +22,25 @@
/* Force use of win32 configuration if compiling there */
#ifdef _WIN32
-#include "../config.win32.h"
+#include "config.win32.h"
#else
#ifdef HAVE_CONFIG_H
-#include "../config.h"
+#include "config.h"
#endif
#endif
#include <sys/types.h>
#ifndef MAX_PATH
- #ifdef _MAX_PATH
- #define MAX_PATH _MAX_PATH
- #else
- #define MAX_PATH 256
- #endif
+#ifdef _MAX_PATH
+#define MAX_PATH _MAX_PATH
+#else
+#define MAX_PATH 256
+#endif
#endif
#ifndef HAVE_STDARG_H
-#error ERROR: Must have a working <stdarg.h> header
+#error ERROR: Must have a working stdarg.h header
#else
#include <stdarg.h>
#endif
@@ -83,7 +83,9 @@ typedef unsigned char byte;
typedef unsigned int uint;
#endif
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#endif
#ifndef HAVE_UINT64
#ifdef HAVE_UINT64_T
@@ -174,20 +176,7 @@ void err_set_file(void *fp);
void err_set_exit(void (*ef)(int));
void err(int eval, const char *fmt, ...);
void verr(int eval, const char *fmt, va_list ap);
-void errc(int eval, int c #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }ode, const char *fmt, ...);
+void errc(int eval, int code, const char *fmt, ...);
void verrc(int eval, int code, const char *fmt, va_list ap);
void errx(int eval, const char *fmt, ...);
void verrx(int eval, const char *fmt, va_list ap);
@@ -200,7 +189,7 @@ void vwarnx(const char *fmt, va_list ap);
#endif
#ifndef HAVE_REALLOCF
-void* reallocf(void* ptr, size_t size);
+void* reallocf(void* p, size_t sz);
#endif
/* Some number conversion stuff */
@@ -326,7 +315,7 @@ void* reallocf(void* ptr, size_t size);
#ifdef _WIN32
#define lseek64 _lseeki64
#else
- #if ( SIZEOF_OFF_T == 8 )
+ #if SIZEOF_OFF_T == 8
#define lseek64 lseek
#else
#error ERROR: Must have a working 64 bit seek function
diff --git a/src/drive.h b/src/drive.h
index 9d8e58c..fc05567 100644
--- a/src/drive.h
+++ b/src/drive.h
@@ -23,7 +23,13 @@
#include "usuals.h"
#define kSectorSize 0x200
-#define kInvalidSector UL(0xFFFFFFFFFFFFFFFF)
+
+#ifdef _WIN32
+ #define kInvalidSector 0xFFFFFFFFFFFFFFFF
+#else
+ #define kInvalidSector 0xFFFFFFFFFFFFFFFFLL
+#endif
+
struct _ntfsx_mftmap;
struct _drivelocks;
diff --git a/src/ntfs.h b/src/ntfs.h
index 06ca6bb..f35fac0 100644
--- a/src/ntfs.h
+++ b/src/ntfs.h
@@ -60,6 +60,12 @@ ntfs_bootsector;
#define kNTFS_RecFlagUse 0x01
#define kNTFS_RecFlagDir 0x02
+#ifdef _WIN32
+ #define kNTFS_RefMask 0xFFFFFFFFFFFF
+#else
+ #define kNTFS_RefMask 0xFFFFFFFFFFFFLL
+#endif
+
typedef struct _ntfs_recordheader
{
uint32 magic; /* Magic number 'FILE' */
diff --git a/src/ntfsx.c b/src/ntfsx.c
index 4d6546b..6c4dd45 100644
--- a/src/ntfsx.c
+++ b/src/ntfsx.c
@@ -316,7 +316,7 @@ ntfsx_attribute* ntfsx_record_findattribute(ntfsx_record* record, uint32 attrTyp
if(atlr->type == attrType)
{
/* Read in appropriate cluster */
- mftRecord = ntfsx_mftmap_sectorforindex(record->info->mftmap, atlr->refAttrib & UL(0xFFFFFFFFFFFF));
+ mftRecord = ntfsx_mftmap_sectorforindex(record->info->mftmap, atlr->refAttrib & kNTFS_RefMask);
r2 = ntfsx_record_alloc(record->info);
if(!r2)
diff --git a/src/scrounge.c b/src/scrounge.c
index 075f329..4350e5e 100644
--- a/src/scrounge.c
+++ b/src/scrounge.c
@@ -109,7 +109,7 @@ void processRecordFileBasics(partitioninfo* pi, ntfsx_record* record, filebasics
/* Parent Directory */
- basics->parent = filename->refParent & UL(0xFFFFFFFFFFFF);
+ basics->parent = filename->refParent & kNTFS_RefMask;
/* Namespace */
diff --git a/src/usuals.h b/src/usuals.h
index f429d5b..01f39a0 100644
--- a/src/usuals.h
+++ b/src/usuals.h
@@ -72,10 +72,4 @@
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
-#ifdef _WIN32
- #define UL(x) x
-#else
- #define UL(x) x#LL
-#endif
-
#endif /* __USUALS_H__ */