Kouhei Sutou
null+****@clear*****
Thu Apr 16 21:36:51 JST 2015
Kouhei Sutou 2015-04-16 21:36:51 +0900 (Thu, 16 Apr 2015) New Revision: e76d983390c1849da8a0fdfd158bcd77ebc1a8e5 https://github.com/groonga/groonga/commit/e76d983390c1849da8a0fdfd158bcd77ebc1a8e5 Message: windows: always use _read() on Windows Modified files: build/ac_macros/check_functions.m4 config.h.cmake include/groonga/portability.h lib/grn.h lib/ii.c lib/io.c lib/proc.c Modified: build/ac_macros/check_functions.m4 (+0 -1) =================================================================== --- build/ac_macros/check_functions.m4 2015-04-16 21:31:52 +0900 (1a6fac6) +++ build/ac_macros/check_functions.m4 2015-04-16 21:36:51 +0900 (746917f) @@ -10,7 +10,6 @@ AC_CHECK_FUNCS(gmtime_r) AC_CHECK_FUNCS(localtime_r) AC_CHECK_FUNCS(mkostemp) AC_CHECK_FUNCS(open) -AC_CHECK_FUNCS(read) AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strncasecmp) AC_CHECK_FUNCS(strtoull) Modified: config.h.cmake (+0 -1) =================================================================== --- config.h.cmake 2015-04-16 21:31:52 +0900 (c8a7897) +++ config.h.cmake 2015-04-16 21:36:51 +0900 (750e5b8) @@ -150,7 +150,6 @@ #cmakedefine HAVE_LOCALTIME_R #cmakedefine HAVE_MKOSTEMP #cmakedefine HAVE_OPEN -#cmakedefine HAVE_READ #cmakedefine HAVE_STRCASECMP #cmakedefine HAVE_STRNCASECMP #cmakedefine HAVE_STRTOULL Modified: include/groonga/portability.h (+6 -0) =================================================================== --- include/groonga/portability.h 2015-04-16 21:31:52 +0900 (274bbba) +++ include/groonga/portability.h 2015-04-16 21:36:51 +0900 (4b2470c) @@ -115,4 +115,10 @@ # define grn_write(fd, buf, count) write((fd), (buf), (count)) #endif /* WIN32 */ +#ifdef WIN32 +# define grn_read(fd, buf, count) _read((fd), (buf), (count)) +#else +# define grn_read(fd, buf, count) read((fd), (buf), (count)) +#endif /* WIN32 */ + #endif /* GROONGA_PORTABILITY_H */ Modified: lib/grn.h (+0 -12) =================================================================== --- lib/grn.h 2015-04-16 21:31:52 +0900 (d23450a) +++ lib/grn.h 2015-04-16 21:36:51 +0900 (4de7324) @@ -79,18 +79,6 @@ # define GRN_CLOSE(fd) _close(fd) #endif /* HAVE_CLOSE */ -#ifdef HAVE_READ -# define GRN_READ(fd, buf, count) read(fd, buf, count) -#else -# define GRN_READ(fd, buf, count) _read(fd, buf, count) -#endif /* HAVE_READ */ - -#ifdef HAVE_WRITE -# define GRN_WRITE(fd, buf, count) write(fd, buf, count) -#else -# define GRN_WRITE(fd, buf, count) _write(fd, buf, count) -#endif /* HAVE_WRITE */ - #ifdef WIN32 # if defined(__GNUC__) && !defined(WINVER) Modified: lib/ii.c (+1 -1) =================================================================== --- lib/ii.c 2015-04-16 21:31:52 +0900 (c36236e) +++ lib/ii.c 2015-04-16 21:36:51 +0900 (86ed65a) @@ -7405,7 +7405,7 @@ grn_ii_buffer_fetch(grn_ctx *ctx, grn_ii_buffer *ii_buffer, ERRNO_ERR("grn_lseek"); return; } - if (read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) { + if (grn_read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) { SERR("read"); return; } Modified: lib/io.c (+2 -2) =================================================================== --- lib/io.c 2015-04-16 21:31:52 +0900 (c67a143) +++ lib/io.c 2015-04-16 21:36:51 +0900 (3b4412c) @@ -481,7 +481,7 @@ grn_io_detect_type(grn_ctx *ctx, const char *path) if (fd != -1) { struct stat s; if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) { - if (read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) { + if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) { if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) { res = h.type; } else { @@ -515,7 +515,7 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode) int fd = GRN_OPEN(path, O_RDWR | O_BINARY); if (fd == -1) { SERR(path); return NULL; } if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) { - if (read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) { + if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) { if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) { header_size = h.header_size; segment_size = h.segment_size; Modified: lib/proc.c (+1 -1) =================================================================== --- lib/proc.c 2015-04-16 21:31:52 +0900 (d284d42) +++ lib/proc.c 2015-04-16 21:36:51 +0900 (4c37c0e) @@ -90,7 +90,7 @@ grn_bulk_put_from_file(grn_ctx *ctx, grn_obj *bulk, const char *path) if ((buf = GRN_MALLOC(rest))) { ssize_t ss; for (bp = buf; rest; rest -= ss, bp += ss) { - if ((ss = GRN_READ(fd, bp, rest)) == -1) { goto exit; } + if ((ss = grn_read(fd, bp, rest)) == -1) { goto exit; } } GRN_TEXT_PUT(ctx, bulk, buf, stat.st_size); ret = 1; -------------- next part -------------- HTML����������������������������... Descargar