Added libgmp.
[fedora-mingw.git] / gmp / mingw32-gmp-4.2.4-sscanf-test.patch
diff --git a/gmp/mingw32-gmp-4.2.4-sscanf-test.patch b/gmp/mingw32-gmp-4.2.4-sscanf-test.patch
new file mode 100644 (file)
index 0000000..e2f34c4
--- /dev/null
@@ -0,0 +1,35 @@
+--- gmp-4.2.4.orig/tests/misc/t-scanf.c        2008-08-02 21:11:59.000000000 +0100
++++ gmp-4.2.4.sscanf/tests/misc/t-scanf.c      2009-01-28 16:42:26.000000000 +0000
+@@ -93,6 +93,24 @@
+   return result;
+ }
++/* This is a problem found on i686-pc-mingw32, running binaries under
++   Wine.  Windows scanf functions don't skip whitespace before %-specifiers
++   [http://msdn.microsoft.com/en-us/library/kwwtf9ch(VS.71).aspx] */
++int
++test_sscanf_s_skips_whitespace (void)
++{
++  char str[16];
++
++  if (sscanf (" ", "%s", str) == EOF)
++    return 1;
++  else
++    {
++      printf ("Warning, sscanf (\" \", \"%s\", str) != EOF.\n");
++      printf ("This affects gmp_sscanf, some tests will be suppressed.\n");
++      return 0;
++    }
++}
++
+ /* Convert fmt from a GMP scanf format string to an equivalent for a plain
+    libc scanf, for example "%Zd" becomes "%ld".  Return 1 if this succeeds,
+@@ -1489,6 +1507,7 @@
+   }
+   /* EOF for no matching */
++  if (test_sscanf_s_skips_whitespace ())
+   {
+     char buf[128];
+     ret = gmp_sscanf ("   ", "%s", buf);