[pypy-commit] cffi default: Fix for Windows, which doesn't have a reasonable snprintf()

arigo noreply at buildbot.pypy.org
Sat Jul 5 19:41:46 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1544:079492211215
Date: 2014-07-05 19:41 +0200
http://bitbucket.org/cffi/cffi/changeset/079492211215/

Log:	Fix for Windows, which doesn't have a reasonable snprintf()

diff --git a/cffi/vengine_gen.py b/cffi/vengine_gen.py
--- a/cffi/vengine_gen.py
+++ b/cffi/vengine_gen.py
@@ -435,14 +435,14 @@
                     enumerator, enumerator, enumvalue))
             prnt('    char buf[64];')
             prnt('    if ((%s) < 0)' % enumerator)
-            prnt('        snprintf(buf, 63, "%%ld", (long)(%s));' % enumerator)
+            prnt('        sprintf(buf, "%%ld", (long)(%s));' % enumerator)
             prnt('    else')
-            prnt('        snprintf(buf, 63, "%%lu", (unsigned long)(%s));' %
+            prnt('        sprintf(buf, "%%lu", (unsigned long)(%s));' %
                  enumerator)
-            prnt('    snprintf(out_error, 255,'
+            prnt('    sprintf(out_error,'
                              ' "%s has the real value %s, not %s",')
             prnt('            "%s", buf, "%d");' % (
-                enumerator, enumvalue))
+                enumerator[:100], enumvalue))
             prnt('    return -1;')
             prnt('  }')
         prnt('  return 0;')


More information about the pypy-commit mailing list