[Groonga-commit] groonga/groonga at ee83eab [master] windows: -1 for size on Windows

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Apr 19 12:18:48 JST 2015


Kouhei Sutou	2015-04-19 12:18:48 +0900 (Sun, 19 Apr 2015)

  New Revision: ee83eabe30c620a6ae5b0ed91e2094b9fbc6635f
  https://github.com/groonga/groonga/commit/ee83eabe30c620a6ae5b0ed91e2094b9fbc6635f

  Message:
    windows: -1 for size on Windows
    
    Because `n` for `_snprintf_s()` does NOT include terminate
    `\0`. (snprintf() in POSIX includes terminate `\0'.)

  Modified files:
    include/groonga/portability.h

  Modified: include/groonga/portability.h (+1 -1)
===================================================================
--- include/groonga/portability.h    2015-04-19 10:19:44 +0900 (c9a095a)
+++ include/groonga/portability.h    2015-04-19 12:18:48 +0900 (735d30f)
@@ -119,7 +119,7 @@
 
 #ifdef WIN32
 # define grn_snprintf(dest, dest_size, n, format, ...)          \
-  _snprintf_s((dest), (dest_size), (n), (format), __VA_ARGS__)
+  _snprintf_s((dest), (dest_size), (n) - 1, (format), __VA_ARGS__)
 #else /* WIN32 */
 # define grn_snprintf(dest, dest_size, n, format, ...)          \
   snprintf((dest), (n), (format), __VA_ARGS__)
-------------- next part --------------
HTML����������������������������...
下载 



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