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 /src | |
parent | fecec16a940ab10dd028385d09bf3c31c5f85739 (diff) | |
download | gnunet-3e996078dc075428545ac4646937f437a02802cb.tar.gz gnunet-3e996078dc075428545ac4646937f437a02802cb.zip |
Replace OFF_T with off_t
Diffstat (limited to 'src')
-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 369f09492..bf49b71f8 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -25,12 +25,6 @@ | |||
25 | #ifndef GNUNET_DISK_LIB_H | 25 | #ifndef GNUNET_DISK_LIB_H |
26 | #define GNUNET_DISK_LIB_H | 26 | #define GNUNET_DISK_LIB_H |
27 | 27 | ||
28 | #if WINDOWS | ||
29 | #define OFF_T uint64_t | ||
30 | #else | ||
31 | #define OFF_T off_t | ||
32 | #endif | ||
33 | |||
34 | /** | 28 | /** |
35 | * Handle used to manage a pipe. | 29 | * Handle used to manage a pipe. |
36 | */ | 30 | */ |
@@ -307,8 +301,8 @@ GNUNET_DISK_file_backup (const char *fil); | |||
307 | * @param whence specification to which position the offset parameter relates to | 301 | * @param whence specification to which position the offset parameter relates to |
308 | * @return the new position on success, GNUNET_SYSERR otherwise | 302 | * @return the new position on success, GNUNET_SYSERR otherwise |
309 | */ | 303 | */ |
310 | OFF_T | 304 | off_t |
311 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, OFF_T offset, | 305 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h, off_t offset, |
312 | enum GNUNET_DISK_Seek whence); | 306 | enum GNUNET_DISK_Seek whence); |
313 | 307 | ||
314 | 308 | ||
@@ -408,7 +402,7 @@ GNUNET_DISK_file_open (const char *fn, | |||
408 | */ | 402 | */ |
409 | int | 403 | int |
410 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | 404 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, |
411 | OFF_T *size); | 405 | off_t *size); |
412 | 406 | ||
413 | 407 | ||
414 | /** | 408 | /** |
@@ -767,8 +761,8 @@ GNUNET_DISK_directory_create (const char *dir); | |||
767 | */ | 761 | */ |
768 | int | 762 | int |
769 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, | 763 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, |
770 | OFF_T lock_start, | 764 | off_t lock_start, |
771 | OFF_T lock_end, int excl); | 765 | off_t lock_end, int excl); |
772 | 766 | ||
773 | 767 | ||
774 | /** | 768 | /** |
@@ -781,8 +775,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, | |||
781 | */ | 775 | */ |
782 | int | 776 | int |
783 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, | 777 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, |
784 | OFF_T unlock_start, | 778 | off_t unlock_start, |
785 | OFF_T unlock_end); | 779 | off_t unlock_end); |
786 | 780 | ||
787 | 781 | ||
788 | /** | 782 | /** |
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c index b871ea872..09d608e65 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) | |||
346 | struct GNUNET_DISK_FileHandle *f; | 346 | struct GNUNET_DISK_FileHandle *f; |
347 | unsigned int nr; | 347 | unsigned int nr; |
348 | unsigned int offset; | 348 | unsigned int offset; |
349 | OFF_T size; | 349 | off_t size; |
350 | size_t len; | 350 | size_t len; |
351 | char *buffer; | 351 | char *buffer; |
352 | char *regex; | 352 | char *regex; |
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 08a083df4..579c1261d 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c | |||
@@ -181,7 +181,7 @@ static void | |||
181 | incrementBit (char *bitArray, unsigned int bitIdx, | 181 | incrementBit (char *bitArray, unsigned int bitIdx, |
182 | const struct GNUNET_DISK_FileHandle *fh) | 182 | const struct GNUNET_DISK_FileHandle *fh) |
183 | { | 183 | { |
184 | OFF_T fileSlot; | 184 | off_t fileSlot; |
185 | unsigned char value; | 185 | unsigned char value; |
186 | unsigned int high; | 186 | unsigned int high; |
187 | unsigned int low; | 187 | unsigned int low; |
@@ -229,7 +229,7 @@ static void | |||
229 | decrementBit (char *bitArray, unsigned int bitIdx, | 229 | decrementBit (char *bitArray, unsigned int bitIdx, |
230 | const struct GNUNET_DISK_FileHandle *fh) | 230 | const struct GNUNET_DISK_FileHandle *fh) |
231 | { | 231 | { |
232 | OFF_T fileslot; | 232 | off_t fileslot; |
233 | unsigned char value; | 233 | unsigned char value; |
234 | unsigned int high; | 234 | unsigned int high; |
235 | unsigned int low; | 235 | unsigned int low; |
@@ -462,10 +462,10 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, | |||
462 | { | 462 | { |
463 | struct GNUNET_CONTAINER_BloomFilter *bf; | 463 | struct GNUNET_CONTAINER_BloomFilter *bf; |
464 | char *rbuff; | 464 | char *rbuff; |
465 | OFF_T pos; | 465 | off_t pos; |
466 | int i; | 466 | int i; |
467 | size_t ui; | 467 | size_t ui; |
468 | OFF_T fsize; | 468 | off_t fsize; |
469 | int must_read; | 469 | int must_read; |
470 | 470 | ||
471 | GNUNET_assert (NULL != filename); | 471 | GNUNET_assert (NULL != filename); |
diff --git a/src/util/disk.c b/src/util/disk.c index 652a45ed0..8dc1e35bf 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) | |||
208 | */ | 208 | */ |
209 | int | 209 | int |
210 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | 210 | GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, |
211 | OFF_T *size) | 211 | off_t *size) |
212 | { | 212 | { |
213 | #if WINDOWS | 213 | #if WINDOWS |
214 | BOOL b; | 214 | BOOL b; |
@@ -219,7 +219,7 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | |||
219 | SetErrnoFromWinError (GetLastError ()); | 219 | SetErrnoFromWinError (GetLastError ()); |
220 | return GNUNET_SYSERR; | 220 | return GNUNET_SYSERR; |
221 | } | 221 | } |
222 | *size = (OFF_T) li.QuadPart; | 222 | *size = (off_t) li.QuadPart; |
223 | #else | 223 | #else |
224 | struct stat sbuf; | 224 | struct stat sbuf; |
225 | 225 | ||
@@ -239,8 +239,8 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | |||
239 | * @param whence specification to which position the offset parameter relates to | 239 | * @param whence specification to which position the offset parameter relates to |
240 | * @return the new position on success, GNUNET_SYSERR otherwise | 240 | * @return the new position on success, GNUNET_SYSERR otherwise |
241 | */ | 241 | */ |
242 | OFF_T | 242 | off_t |
243 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset, | 243 | GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, off_t offset, |
244 | enum GNUNET_DISK_Seek whence) | 244 | enum GNUNET_DISK_Seek whence) |
245 | { | 245 | { |
246 | if (h == NULL) | 246 | if (h == NULL) |
@@ -263,7 +263,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset, | |||
263 | SetErrnoFromWinError (GetLastError ()); | 263 | SetErrnoFromWinError (GetLastError ()); |
264 | return GNUNET_SYSERR; | 264 | return GNUNET_SYSERR; |
265 | } | 265 | } |
266 | return (OFF_T) new_pos.QuadPart; | 266 | return (off_t) new_pos.QuadPart; |
267 | #else | 267 | #else |
268 | static int t[] = { SEEK_SET, SEEK_CUR, SEEK_END }; | 268 | static int t[] = { SEEK_SET, SEEK_CUR, SEEK_END }; |
269 | 269 | ||
@@ -1529,8 +1529,8 @@ GNUNET_DISK_file_change_owner (const char *filename, const char *user) | |||
1529 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 1529 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
1530 | */ | 1530 | */ |
1531 | int | 1531 | int |
1532 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, | 1532 | GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lock_start, |
1533 | OFF_T lock_end, int excl) | 1533 | off_t lock_end, int excl) |
1534 | { | 1534 | { |
1535 | if (fh == NULL) | 1535 | if (fh == NULL) |
1536 | { | 1536 | { |
@@ -1550,7 +1550,7 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, OFF_T lock_start, | |||
1550 | return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; | 1550 | return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; |
1551 | #else | 1551 | #else |
1552 | OVERLAPPED o; | 1552 | OVERLAPPED o; |
1553 | OFF_T diff = lock_end - lock_start; | 1553 | off_t diff = lock_end - lock_start; |
1554 | DWORD diff_low, diff_high; | 1554 | DWORD diff_low, diff_high; |
1555 | diff_low = (DWORD) (diff & 0xFFFFFFFF); | 1555 | diff_low = (DWORD) (diff & 0xFFFFFFFF); |
1556 | diff_high = (DWORD) ((diff >> (sizeof (DWORD) * 8)) & 0xFFFFFFFF); | 1556 | 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, | |||
1580 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 1580 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
1581 | */ | 1581 | */ |
1582 | int | 1582 | int |
1583 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlock_start, | 1583 | GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, off_t unlock_start, |
1584 | OFF_T unlock_end) | 1584 | off_t unlock_end) |
1585 | { | 1585 | { |
1586 | if (fh == NULL) | 1586 | if (fh == NULL) |
1587 | { | 1587 | { |
@@ -1601,7 +1601,7 @@ GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh, OFF_T unlock_start, | |||
1601 | return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; | 1601 | return fcntl (fh->fd, F_SETLK, &fl) != 0 ? GNUNET_SYSERR : GNUNET_OK; |
1602 | #else | 1602 | #else |
1603 | OVERLAPPED o; | 1603 | OVERLAPPED o; |
1604 | OFF_T diff = unlock_end - unlock_start; | 1604 | off_t diff = unlock_end - unlock_start; |
1605 | DWORD diff_low, diff_high; | 1605 | DWORD diff_low, diff_high; |
1606 | diff_low = (DWORD) (diff & 0xFFFFFFFF); | 1606 | diff_low = (DWORD) (diff & 0xFFFFFFFF); |
1607 | diff_high = (DWORD) ((diff >> (sizeof (DWORD) * 8)) & 0xFFFFFFFF); | 1607 | diff_high = (DWORD) ((diff >> (sizeof (DWORD) * 8)) & 0xFFFFFFFF); |