[gs-cvs] rev 7674 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Sat Feb 3 05:30:25 PST 2007
Author: leonardo
Date: 2007-02-03 05:30:24 -0800 (Sat, 03 Feb 2007)
New Revision: 7674
Modified:
trunk/gs/src/gp_mswin.c
trunk/gs/src/iscan.c
trunk/gs/src/stdio_.h
Log:
Fix : MSVC doesn't implement snscanf.
DETAILS :
The revision 7672 doesn't compile with Microsoft Visual C++ 2005,
because this compiler doesn't properly define snprintf.
The function snsprintf is a part of the C standard ISO/IEC 9899:1999 (E),
so we decided to define it in the Windows platform-dependent module.
Possibly we'll need a further improvement for other Windows compilers.
Minor change : fixed an MSVC cast warning in iscan.c,
which has been introduced in revision 7672.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gp_mswin.c
===================================================================
--- trunk/gs/src/gp_mswin.c 2007-02-03 06:27:14 UTC (rev 7673)
+++ trunk/gs/src/gp_mswin.c 2007-02-03 13:30:24 UTC (rev 7674)
@@ -46,6 +46,7 @@
#include "gsexit.h"
#include "windows_.h"
+#include <stdarg.h>
#include <shellapi.h>
#include <winspool.h>
#include "gp_mswin.h"
@@ -716,3 +717,16 @@
return _fseeki64(strm, offset, origin);
#endif
}
+
+/* ------------------------- _snprintf -----------------------------*/
+
+/* Microsoft Visual C++ 2005 doesn't properly define snprintf,
+ which is defined in the C standard ISO/IEC 9899:1999 (E) */
+
+int snprintf(char *buffer, size_t count, const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+
+ return vsnprintf_s(buffer, count, count - 1, format, args);
+}
\ No newline at end of file
Modified: trunk/gs/src/iscan.c
===================================================================
--- trunk/gs/src/iscan.c 2007-02-03 06:27:14 UTC (rev 7673)
+++ trunk/gs/src/iscan.c 2007-02-03 13:30:24 UTC (rev 7674)
@@ -258,7 +258,7 @@
int len = strlen(pstate->s_error.string);
if (pstate->s_error.is_name) {
- int code = name_ref(imemory, pstate->s_error.string, len, pseo, 1);
+ int code = name_ref(imemory, (const byte *)pstate->s_error.string, len, pseo, 1);
if (code < 0)
return code;
Modified: trunk/gs/src/stdio_.h
===================================================================
--- trunk/gs/src/stdio_.h 2007-02-03 06:27:14 UTC (rev 7673)
+++ trunk/gs/src/stdio_.h 2007-02-03 13:30:24 UTC (rev 7674)
@@ -68,6 +68,8 @@
#if defined(_MSC_VER)
# define fdopen(handle,mode) _fdopen(handle,mode)
# define fileno(file) _fileno(file)
+/* Microsoft Visual C++ 2005 doesn't properly define snprintf */
+int snprintf(char *buffer, size_t count, const char *format , ...);
#endif
#endif /* stdio__INCLUDED */
More information about the gs-cvs
mailing list