3 #include "WinPortHandle.h"
4 #include "PathHelpers.h"
6 SHAREDSYMBOL
int vswprintf_ws2ls(wchar_t * ws
, size_t len
, const wchar_t * format
, va_list arg
)
8 std::wstring converted_format
;
9 for (bool percent
= false; *format
; ++format
) {
12 if (!converted_format
.empty()) {
13 if (converted_format
.back() == L
'w')
14 converted_format
.back() = L
'l';
15 else if (converted_format
.back() == L
'h')
16 converted_format
.pop_back();
18 converted_format
+= L
'l';
20 converted_format
+= L
'l';
22 if (wcschr(L
"diouxXeEfFgGcCsSpnm%", *format
)) {
25 } else if (*format
==L
'%') {
28 converted_format
+= *format
;
31 return vswprintf(ws
, len
, converted_format
.c_str(), arg
);
35 SHAREDSYMBOL
int swprintf_ws2ls (wchar_t* ws
, size_t len
, const wchar_t* format
, ...)
39 int r
= vswprintf_ws2ls(ws
, len
, format
, arg
);