Kouhei Sutou
null+****@clear*****
Thu Oct 30 19:23:12 JST 2014
Kouhei Sutou 2014-10-30 19:23:12 +0900 (Thu, 30 Oct 2014) New Revision: 92899532ae2aa9b64cf7d9a6c4cf172e36c97639 https://github.com/groonga/groonga/commit/92899532ae2aa9b64cf7d9a6c4cf172e36c97639 Message: Ensure to use 64bit for offset Modified files: lib/grn.h lib/ii.c Modified: lib/grn.h (+9 -1) =================================================================== --- lib/grn.h 2014-10-30 19:13:42 +0900 (46e04bd) +++ lib/grn.h 2014-10-30 19:23:12 +0900 (e588497) @@ -123,7 +123,6 @@ # define vsnprintf(str, size, format, ap) _vsnprintf(str, size, format, ap) # endif /* !defined(__GNUC__) && _MSC_VER < 1500 */ # define unlink(pathname) _unlink(pathname) -# define lseek(fd, offset, whence) _lseek(fd, offset, whence) # define getpid() _getpid() # if !defined(__GNUC__) && _MSC_VER < 1400 # define fstat(fd, buf) _fstat(fd, buf) @@ -147,6 +146,7 @@ typedef int64_t INT64 typedef uint64_t UINT64 typedef ssize_t SSIZE_T typedef pid_t int +typedef off64_t int64_t # endif # undef MSG_WAITALL @@ -227,6 +227,14 @@ typedef int grn_sock; # define INT64_MIN (-9223372036854775808) #endif /* INT64_MIN */ + +#ifdef WIN32 +# define grn_lseek(fd, offset, whence) _lseeki64(fd, offset, whence) +#else /* WIN32 */ +# define grn_lseek(fd, offset, whence) lseek(fd, offset, whence) +#endif /* WIN32 */ + + #ifdef HAVE_PTHREAD_H # include <pthread.h> typedef pthread_t grn_thread; Modified: lib/ii.c (+5 -5) =================================================================== --- lib/ii.c 2014-10-30 19:13:42 +0900 (92623a7) +++ lib/ii.c 2014-10-30 19:23:12 +0900 (3a4e576) @@ -6426,8 +6426,8 @@ typedef struct { } ii_buffer_counter; typedef struct { - off_t head; - off_t tail; + off64_t head; + off64_t tail; uint32_t nextsize; uint8_t *buffer; uint32_t buffersize; @@ -6450,7 +6450,7 @@ struct _grn_ii_buffer { char tmpfpath[PATH_MAX]; uint64_t update_buffer_size; // stuff for parsing - off_t filepos; + off64_t filepos; grn_id *block_buf; size_t block_buf_size; size_t block_pos; @@ -6857,8 +6857,8 @@ grn_ii_buffer_fetch(grn_ctx *ctx, grn_ii_buffer *ii_buffer, return; } } - if (lseek(ii_buffer->tmpfd, block->head, SEEK_SET) != block->head) { - SERR("lseek"); + if (grn_lseek(ii_buffer->tmpfd, block->head, SEEK_SET) != block->head) { + SERR("grn_lseek"); return; } if (read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) { -------------- next part -------------- HTML����������������������������...下載