[libcxx-commits] [PATCH] D59727: [libc++] Fix return value of snprintf_l() on Windows when buffer is too small
Tom Anderson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 26 12:52:40 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357024: [libc++] Fix return value of snprintf_l() on Windows when buffer is too small (authored by thomasanderson, committed by ).
Herald added subscribers: llvm-commits, christof.
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D59727?vs=192329&id=192331#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59727/new/
https://reviews.llvm.org/D59727
Files:
libcxx/trunk/src/support/win32/locale_win32.cpp
Index: libcxx/trunk/src/support/win32/locale_win32.cpp
===================================================================
--- libcxx/trunk/src/support/win32/locale_win32.cpp
+++ libcxx/trunk/src/support/win32/locale_win32.cpp
@@ -87,14 +87,15 @@
int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...)
{
-#if !defined(_LIBCPP_MSVCRT)
- __libcpp_locale_guard __current(loc);
-#endif
va_list ap;
va_start( ap, format );
#if defined(_LIBCPP_MSVCRT)
- int result = _vsnprintf_l( ret, n, format, loc, ap );
+ // FIXME: Remove usage of internal CRT function and globals.
+ int result = __stdio_common_vsprintf(
+ _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
+ ret, n, format, loc, ap);
#else
+ __libcpp_locale_guard __current(loc);
int result = vsnprintf( ret, n, format, ap );
#endif
va_end(ap);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59727.192331.patch
Type: text/x-patch
Size: 908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190326/63ecb196/attachment.bin>
More information about the libcxx-commits
mailing list