[gs-cvs] rev 7675 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Sun Feb 4 08:19:41 PST 2007


Author: leonardo
Date: 2007-02-04 08:19:41 -0800 (Sun, 04 Feb 2007)
New Revision: 7675

Modified:
   trunk/gs/src/gp_mswin.c
Log:
Fix : MSVC doesn't implement snscanf (continued).

DETAILS :

The last revision doesn't compile with MSVC6,7, 
so this is a better one.
Patch from SaGS.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gp_mswin.c
===================================================================
--- trunk/gs/src/gp_mswin.c	2007-02-03 13:30:24 UTC (rev 7674)
+++ trunk/gs/src/gp_mswin.c	2007-02-04 16:19:41 UTC (rev 7675)
@@ -725,8 +725,15 @@
 
 int snprintf(char *buffer, size_t count, const char *format, ...)
 {
-    va_list args;
-    va_start(args, format);
+    if (count > 0) {
+	va_list args;
+	int n; 
 
-    return vsnprintf_s(buffer, count, count - 1, format, args);
+	va_start(args, format);
+	n = _vsnprintf(buffer, count, format, args);
+	buffer[count - 1] = 0;
+	va_end(args);
+	return n;
+    } else
+	return 0;
 }
\ No newline at end of file



More information about the gs-cvs mailing list