kdesupport/kdewin32

Jaroslaw Staniek js at iidea.pl
Wed Jun 4 13:15:18 CEST 2008


SVN commit 816616 by staniek:

msvc:
Replace _snprintf() because we want to behave like on UNIX:
 terminate with \0 if the buffer is too small, and return value that
 is greater than or equal to the size argument if the string was
 too short and some of the printed characters were discarded.

Perhaps we shall define KDE_snprintf() at kdelibs level as there are many uses of snprintf() in KDE?

CCMAIL:kde-windows at kde.org



 M  +1 -0      CMakeLists.txt  
 M  +17 -1     include/msvc/stdio.h  
 A             src/stdio.c   [License: LGPL (v2+)]


--- trunk/kdesupport/kdewin32/CMakeLists.txt #816615:816616
@@ -90,6 +90,7 @@
    )
 if(MSVC)
   set(win_LIB_SRCS ${win_LIB_SRCS}
+      src/stdio.c
       src/math/tgamma.c
       src/math/tgammaf.c
       src/math/lgamma.c
--- trunk/kdesupport/kdewin32/include/msvc/stdio.h #816615:816616
@@ -1,6 +1,7 @@
 /*
    This file is part of the KDE libraries
    Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher at gmx.de>
+   Copyright (C) 2008 Jaroslaw Staniek <js at iidea.pl>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -26,7 +27,22 @@
 /* regular header from msvc includes */
 # include <../include/stdio.h>
 
-#define snprintf _snprintf
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Replaces _snprintf() because we want to behave like on UNIX: 
+  * terminate with \0 if the buffer is too small, and return value that 
+  * is greater than or equal to the size argument if the string was 
+  * too short and some of the printed characters were discarded. */
+KDEWIN32_EXPORT int kdewin32_snprintf(char *buffer, size_t count, const char *fmt, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define snprintf kdewin32_snprintf
 #define vsnprintf _vsnprintf
 #define popen _popen
 #define pclose _pclose


More information about the Kde-windows mailing list