diff options
author | LRN <lrn1986@gmail.com> | 2013-10-08 09:30:27 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-10-08 09:30:27 +0000 |
commit | 3e996078dc075428545ac4646937f437a02802cb (patch) | |
tree | 50a5a9ccb3b9c738deffdadea08dea691ad1def8 | |
parent | fecec16a940ab10dd028385d09bf3c31c5f85739 (diff) |
Replace OFF_T with off_t
-rw-r--r-- | src/include/gnunet_disk_lib.h | 20 | ||||
-rw-r--r-- | src/regex/regex_test_lib.c | 2 | ||||
-rw-r--r-- | src/util/container_bloomfilter.c | 8 | ||||
-rw-r--r-- | src/util/disk.c | 22 |
4 files changed, 23 insertions, 29 deletions
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 369f09492a..bf49b71f89 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h @@ -25,12 +25,6 @@ #ifndef GNUNET_DISK_LIB_H #define GNUNET_DISK_LIB_H -#if WINDOWS -#define OFF_T uint64_t -#else -#define OFF_T off_t -#endif - /** * Handle used to manage a pipe. */ @@ -307,8 +301,8 @@ GNUNET_DISK_file_backup (const char *fil); * @param whence specification to which position the offset parameter relates to * @return the new position on success, GNUNET_SYSERR otherwise */ -OFF_T -GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset, +off_t +GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence); @@ -408,7 +402,7 @@ GNUNET_DISK_file_open (const char *fn, */ int GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, - OFF_T *size); + off_t *size); /** @@ -767,8 +761,8 @@ GNUNET_DISK_directory_create (const char *dir); */ int GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, - OFF_T lock_start, - OFF_T lock_end, int excl); + off_t lock_start, + off_t lock_end, int excl); /** @@ -781,8 +775,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, */ int GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, - OFF_T unlock_start, - OFF_T unlock_end); + off_t unlock_start, + off_t unlock_end); /** diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index b871ea8728..09d608e659 100644 --- a/src/regex/regex_test_lib.c +++ b/src/regex/regex_test_lib.c @@ -346,7 +346,7 @@ REGEX_TEST_read_from_file (const char *filename) struct GNUNET_DISK_FileHandle *f; unsigned int nr; unsigned int offset; - OFF_T size; + off_t size; size_t len; char *buffer; char *regex; diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 08a083df40..579c1261db 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c @@ -181,7 +181,7 @@ static void incrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh) { - OFF_T fileSlot; + off_t fileSlot; unsigned char value; unsigned int high; unsigned int low; @@ -229,7 +229,7 @@ static void decrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh) { - OFF_T fileslot; + off_t fileslot; unsigned char value; unsigned int high; unsigned int low; @@ -462,10 +462,10 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, { struct GNUNET_CONTAINER_BloomFilter *bf; char *rbuff; - OFF_T pos; + off_t pos; int i; size_t ui; - OFF_T fsize; + off_t fsize; int must_read; GNUNET_assert (NULL != filename); diff --git a/src/util/disk.c b/src/util/disk.c index 652a45ed00..8dc1e35bf5 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -208,7 +208,7 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h) */ int GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, - OFF_T *size) + off_t *size) { #if WINDOWS BOOL b; @@ -219,7 +219,7 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, SetErrnoFromWinError (GetLastError ()); return GNUNET_SYSERR; } - *size = (OFF_T) li.QuadPart; + *size = (off_t) li.QuadPart; #else struct stat sbuf; @@ -239,8 +239,8 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, * @param whence specification to which position the offset parameter relates to * @return the new position on success, GNUNET_SYSERR otherwise */ -OFF_T -GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset, +off_t +GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, off_t offset, enum GNUNET_DISK_Seek whence) { if (h == NULL) @@ -263,7 +263,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset, SetErrnoFromWinError (GetLastError ()); return GNUNET_SYSERR; } - return (OFF_T) new_pos.QuadPart; + return (off_t) new_pos.QuadPart; #else static int t[] = { SEEK_SET, SEEK_CUR, SEEK_END }; @@ -1529,8 +1529,8 @@ GNUNET_DISK_file_change_owner (const char *filename, const char *user) * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int -GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, - OFF_T lock_end, int excl) +GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lock_start, + off_t lock_end, int excl) { if (fh == NULL) { @@ -1550,7 +1550,7 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; #else OVERLAPPED o; - OFF_T diff = lock_end - lock_start; + off_t diff = lock_end - lock_start; DWORD diff_low, diff_high; diff_low = (DWORD) (diff & 0xFFFFFFFF); diff_high = (DWORD) ((diff >> (sizeof (DWORD) * 8)) & 0xFFFFFFFF); @@ -1580,8 +1580,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int -GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlock_start, - OFF_T unlock_end) +GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, off_t unlock_start, + off_t unlock_end) { if (fh == NULL) { @@ -1601,7 +1601,7 @@ GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlock_start, return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; #else OVERLAPPED o; - OFF_T diff = unlock_end - unlock_start; + off_t diff = unlock_end - unlock_start; DWORD diff_low, diff_high; diff_low = (DWORD) (diff & 0xFFFFFFFF); diff_high = (DWORD) ((diff >> (sizeof (DWORD) * 8)) & 0xFFFFFFFF); |