mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
dup_mb_to_wc, dup_wc_to_mb: remove the 'flags' parameter.
This parameter was undocumented, and Windows-specific: its semantics date from before PuTTY was cross-platform, and are "Pass this flags parameter straight through to the Win32 API's conversion functions". So in Windows platform code you can pass flags like MB_USEGLYPHCHARS, but in cross-platform code, you dare not pass anything nonzero at all because the Unix frontend won't recognise it (or, likely, even compile). I've kept the flag for now in the underlying mb_to_wc / wc_to_mb functions. Partly that's because there's one place in the Windows code where the parameter _is_ used; mostly, it's because I'm about to replace those functions anyway, so there's no point in editing all the call sites twice.
This commit is contained in:
@ -10,7 +10,7 @@ Filename *filename_from_str(const char *str)
|
||||
{
|
||||
Filename *fn = snew(Filename);
|
||||
fn->cpath = dupstr(str);
|
||||
fn->wpath = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, fn->cpath);
|
||||
fn->wpath = dup_mb_to_wc(DEFAULT_CODEPAGE, fn->cpath);
|
||||
fn->utf8path = encode_wide_string_as_utf8(fn->wpath);
|
||||
return fn;
|
||||
}
|
||||
@ -19,7 +19,7 @@ Filename *filename_from_wstr(const wchar_t *str)
|
||||
{
|
||||
Filename *fn = snew(Filename);
|
||||
fn->wpath = dupwcs(str);
|
||||
fn->cpath = dup_wc_to_mb(DEFAULT_CODEPAGE, 0, fn->wpath, "?");
|
||||
fn->cpath = dup_wc_to_mb(DEFAULT_CODEPAGE, fn->wpath, "?");
|
||||
fn->utf8path = encode_wide_string_as_utf8(fn->wpath);
|
||||
return fn;
|
||||
}
|
||||
@ -29,7 +29,7 @@ Filename *filename_from_utf8(const char *ustr)
|
||||
Filename *fn = snew(Filename);
|
||||
fn->utf8path = dupstr(ustr);
|
||||
fn->wpath = decode_utf8_to_wide_string(fn->utf8path);
|
||||
fn->cpath = dup_wc_to_mb(DEFAULT_CODEPAGE, 0, fn->wpath, "?");
|
||||
fn->cpath = dup_wc_to_mb(DEFAULT_CODEPAGE, fn->wpath, "?");
|
||||
return fn;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ char filename_char_sanitise(char c)
|
||||
|
||||
FILE *f_open(const Filename *fn, const char *mode, bool isprivate)
|
||||
{
|
||||
wchar_t *wmode = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, mode);
|
||||
wchar_t *wmode = dup_mb_to_wc(DEFAULT_CODEPAGE, mode);
|
||||
return _wfopen(fn->wpath, wmode);
|
||||
sfree(wmode);
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ int message_box(HWND owner, LPCTSTR text, LPCTSTR caption, DWORD style,
|
||||
wtext = decode_utf8_to_wide_string(text);
|
||||
wcaption = decode_utf8_to_wide_string(caption);
|
||||
} else {
|
||||
wtext = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, text);
|
||||
wcaption = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, caption);
|
||||
wtext = dup_mb_to_wc(DEFAULT_CODEPAGE, text);
|
||||
wcaption = dup_mb_to_wc(DEFAULT_CODEPAGE, caption);
|
||||
}
|
||||
mbox.lpszText = wtext;
|
||||
mbox.lpszCaption = wcaption;
|
||||
|
Reference in New Issue
Block a user