[Groonga-commit] groonga/groonga at 99165e4 [master] windows: hide vsnprintf() spec difference

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 26 15:51:26 JST 2016


Kouhei Sutou	2016-04-26 15:51:26 +0900 (Tue, 26 Apr 2016)

  New Revision: 99165e472fa03b8ce7087e14949f19724facc9b0
  https://github.com/groonga/groonga/commit/99165e472fa03b8ce7087e14949f19724facc9b0

  Message:
    windows: hide vsnprintf() spec difference

  Modified files:
    include/groonga/portability.h
    lib/ctx.c

  Modified: include/groonga/portability.h (+8 -0)
===================================================================
--- include/groonga/portability.h    2016-04-26 14:54:11 +0900 (a25f87a)
+++ include/groonga/portability.h    2016-04-26 15:51:26 +0900 (5f56e39)
@@ -142,6 +142,14 @@
 #endif /* WIN32 */
 
 #ifdef WIN32
+# define grn_vsnprintf(dest, dest_size, format, args)           \
+  vsnprintf((dest), (dest_size) - 1, (format), (args))
+#else /* WIN32 */
+# define grn_vsnprintf(dest, dest_size, format, args)           \
+  vsnprintf((dest), (dest_size), (format), (args))
+#endif /* WIN32 */
+
+#ifdef WIN32
 # define grn_write(fd, buf, count) _write((fd), (buf), (count))
 #else /* WIN32 */
 # define grn_write(fd, buf, count) write((fd), (buf), (count))

  Modified: lib/ctx.c (+1 -1)
===================================================================
--- lib/ctx.c    2016-04-26 14:54:11 +0900 (7cd6431)
+++ lib/ctx.c    2016-04-26 15:51:26 +0900 (0b5bdb5)
@@ -1646,7 +1646,7 @@ grn_ctx_log(grn_ctx *ctx, const char *fmt, ...)
 {
   va_list argp;
   va_start(argp, fmt);
-  vsnprintf(ctx->errbuf, GRN_CTX_MSGSIZE, fmt, argp);
+  grn_vsnprintf(ctx->errbuf, GRN_CTX_MSGSIZE, fmt, argp);
   va_end(argp);
 }
 
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index