string: fix vsnprintf on macOS
vsnprintf_l and vswprintf_l mutate va_list parameter on some versions of macOS (11.7 Big Sur). This makes it impossible to call printf multiple times with a growing buffer. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
b5e35922f1
commit
5b80f24830
@ -2328,7 +2328,9 @@ namespace stdex
|
|||||||
#pragma warning(suppress: 4996)
|
#pragma warning(suppress: 4996)
|
||||||
return _vsnprintf_l(str, capacity, format, locale, arg);
|
return _vsnprintf_l(str, capacity, format, locale, arg);
|
||||||
#else
|
#else
|
||||||
return ::vsnprintf_l(str, capacity, locale, format, arg);
|
va_list arg_mutable;
|
||||||
|
va_copy(arg_mutable, arg);
|
||||||
|
return ::vsnprintf_l(str, capacity, locale, format, arg_mutable);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2338,7 +2340,9 @@ namespace stdex
|
|||||||
#pragma warning(suppress: 4996)
|
#pragma warning(suppress: 4996)
|
||||||
return _vsnwprintf_l(str, capacity, format, locale, arg);
|
return _vsnwprintf_l(str, capacity, format, locale, arg);
|
||||||
#else
|
#else
|
||||||
return ::vswprintf_l(str, capacity, locale, format, arg);
|
va_list arg_mutable;
|
||||||
|
va_copy(arg_mutable, arg);
|
||||||
|
return ::vswprintf_l(str, capacity, locale, format, arg_mutable);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
Loading…
x
Reference in New Issue
Block a user