[libcxx-commits] [PATCH] D118187: [libcxx] [Windows] Use the standard vsnprintf instead of _vsnprintf

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 31 12:29:55 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a5388ca67b0: [libcxx] [Windows] Use the standard vsnprintf instead of _vsnprintf (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D118187?vs=403029&id=404670#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118187/new/

https://reviews.llvm.org/D118187

Files:
  libcxx/src/support/win32/support.cpp
  libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp


Index: libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.pass.cpp
@@ -12,7 +12,10 @@
 
 // iter_type put(iter_type s, ios_base& iob, char_type fill, double v) const;
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
+// FIXME: The printf functions in Microsoft's CRT have a couple quirks in
+// corner cases, failing this test.
+// XFAIL: msvc
+
 // XFAIL: LIBCXX-AIX-FIXME
 
 #include <locale>
Index: libcxx/src/support/win32/support.cpp
===================================================================
--- libcxx/src/support/win32/support.cpp
+++ libcxx/src/support/win32/support.cpp
@@ -23,7 +23,7 @@
     // Query the count required.
     va_list ap_copy;
     va_copy(ap_copy, ap);
-    int count = _vsnprintf( NULL, 0, format, ap_copy );
+    int count = vsnprintf( NULL, 0, format, ap_copy );
     va_end(ap_copy);
     if (count < 0)
         return count;
@@ -33,7 +33,7 @@
         return -1;
     // If we haven't used exactly what was required, something is wrong.
     // Maybe bug in vsnprintf. Report the error and return.
-    if (_vsnprintf(p, buffer_size, format, ap) != count) {
+    if (vsnprintf(p, buffer_size, format, ap) != count) {
         free(p);
         return -1;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118187.404670.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220131/8bb4b009/attachment.bin>


More information about the libcxx-commits mailing list