*improved locale processing.
This commit is contained in:
parent
0ccc23891a
commit
d80578329c
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
||||
Aug. 4 2016
|
||||
Improved locale processing
|
||||
|
||||
Jul. 26 2016
|
||||
Fixed a multiple disposing bug with class member
|
||||
|
||||
|
@ -15971,16 +15971,17 @@ _print:
|
||||
_get_printer(s)(MB_REAL_FMT, val_ptr->data.float_point);
|
||||
} else if(val_ptr->type == _DT_STRING) {
|
||||
#if defined MB_CP_VC && defined MB_ENABLE_UNICODE
|
||||
char* loc = setlocale(LC_ALL, "");
|
||||
char* str = val_ptr->data.string ? val_ptr->data.string : MB_NULL_STRING;
|
||||
_dynamic_buffer_t buf;
|
||||
size_t lbuf = 0;
|
||||
_INIT_BUF(buf);
|
||||
setlocale(LC_ALL, "");
|
||||
while((lbuf = (size_t)mb_bytes_to_wchar(str, &_WCHAR_BUF_PTR(buf), _WCHARS_OF_BUF(buf))) > _WCHARS_OF_BUF(buf)) {
|
||||
_RESIZE_WCHAR_BUF(buf, lbuf);
|
||||
}
|
||||
_get_printer(s)("%ls", _WCHAR_BUF_PTR(buf));
|
||||
_DISPOSE_BUF(buf);
|
||||
setlocale(LC_ALL, loc);
|
||||
#else /* MB_CP_VC && MB_ENABLE_UNICODE */
|
||||
_get_printer(s)(val_ptr->data.string ? val_ptr->data.string : MB_NULL_STRING);
|
||||
#endif /* MB_CP_VC && MB_ENABLE_UNICODE */
|
||||
|
@ -757,11 +757,12 @@ static void _list_one_line(bool_t nl, long l, const char* ln) {
|
||||
#if defined MB_CP_VC && defined MB_ENABLE_UNICODE
|
||||
wchar_t wstr[16];
|
||||
wchar_t* wstrp = wstr;
|
||||
setlocale(LC_ALL, "");
|
||||
char* loc = setlocale(LC_ALL, "");
|
||||
_bytes_to_wchar(ln, &wstrp, countof(wstr));
|
||||
_printf(nl ? "%ld]%ls\n" : "%ld]%ls", l, wstrp);
|
||||
if(wstrp != wstr)
|
||||
free(wstrp);
|
||||
setlocale(LC_ALL, loc);
|
||||
#else /* MB_CP_VC && MB_ENABLE_UNICODE */
|
||||
_printf(nl ? "%ld]%s\n" : "%ld]%s", l, ln);
|
||||
#endif /* MB_CP_VC && MB_ENABLE_UNICODE */
|
||||
|
Loading…
x
Reference in New Issue
Block a user