* dtable.cc (handle_to_fn): Accomodate new argument order in call to
sys_wcstombs. * fhandler_disk_file.cc (fhandler_disk_file::readdir): Call sys_wcstombs instead of just wcstombs to accomodate OEM codepages. * miscfuncs.cc (sys_wcstombs): Split len argument in source and target length. Always 0-terminate result in target string. * security.cc (lsa2wchar): Remove unused function. (lsa2str): Ditto. (get_lsa_srv_inf): Ditto. (get_logon_server): Accomodate new argument order in call to sys_wcstombs. (get_user_groups): Ditto. (get_user_local_groups): Ditto. (get_priv_list): Call sys_wcstombs directly instead of lsa2str. * uinfo.cc (cygheap_user::ontherange): Accomodate new argument order in call to sys_wcstombs. * winsup.h (sys_wcstombs): Change prototype to match new argument order.
This commit is contained in:
@@ -210,10 +210,18 @@ get_cp ()
|
||||
return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
|
||||
}
|
||||
|
||||
/* tlen is always treated as the maximum buffer size, including the '\0'
|
||||
character. sys_wcstombs will always return a 0-terminated result, no
|
||||
matter what. */
|
||||
int __stdcall
|
||||
sys_wcstombs (char *tgt, const WCHAR *src, int len)
|
||||
sys_wcstombs (char *tgt, int tlen, const WCHAR *src, int slen)
|
||||
{
|
||||
return WideCharToMultiByte (get_cp (), 0, src, -1, tgt, len, NULL, NULL);
|
||||
int ret;
|
||||
|
||||
ret = WideCharToMultiByte (get_cp (), 0, src, slen, tgt, tlen, NULL, NULL);
|
||||
if (ret)
|
||||
tgt[ret < tlen ? ret : tlen - 1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __stdcall
|
||||
|
Reference in New Issue
Block a user