From 5ab0b5cf529c3f069264b469db4aacbcb95ce760 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 25 Feb 2008 18:32:23 +0000 Subject: * dcrt0.cc (initial_env): Only use local buffer "buf" if DEBUGGING is enabled. Replace calls to GetEnvironmentVariable by calls to GetEnvironmentVariableA for clarity. Call GetEnvironmentVariableA with NULL buffer. (cygbench): Ditto, drop local buffer. * environ.cc (getearly): Call GetEnvironmentVariableA. (environ_init): Retrieve unicode environment and convert to current codepage locally. (getwinenveq): Ditto. * exceptions.cc (try_to_debug): Accommodate new sys_mbstowcs calling convention. * fhandler_clipboard.cc (set_clipboard): Call sys_mbstowcs to retrieve required buffer length. * fork.cc (frok::child): Call GetEnvironmentVariableA. * miscfuncs.cc: Accommodate changed arguments in calls to sys_mbstowcs. * sec_auth.cc: Ditto. * strfuncs.cc (sys_wcstombs_alloc): Fix formatting. (sys_mbstowcs): Change arguments to allow specifying a source string length. (sys_mbstowcs_alloc): Ditto. * uinfo.cc (cygheap_user::ontherange): Accommodate changed arguments in calls to sys_mbstowcs. * winsup.h (sys_mbstowcs): Adjust declaration. (sys_mbstowcs_alloc): Ditto. --- winsup/cygwin/miscfuncs.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/miscfuncs.cc') diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 4f19b2f53..e92480f53 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -116,10 +116,10 @@ cygwin_strcasecmp (const char *cs, const char *ct) len = (strlen (cs) + 1) * sizeof (WCHAR); RtlInitEmptyUnicodeString (&us, (PWCHAR) alloca (len), len); - us.Length = sys_mbstowcs (us.Buffer, cs, us.MaximumLength) * sizeof (WCHAR); + us.Length = sys_mbstowcs (us.Buffer, us.MaximumLength, cs) * sizeof (WCHAR); len = (strlen (ct) + 1) * sizeof (WCHAR); RtlInitEmptyUnicodeString (&ut, (PWCHAR) alloca (len), len); - ut.Length = sys_mbstowcs (ut.Buffer, ct, ut.MaximumLength) * sizeof (WCHAR); + ut.Length = sys_mbstowcs (ut.Buffer, ut.MaximumLength, ct) * sizeof (WCHAR); return RtlCompareUnicodeString (&us, &ut, TRUE); } @@ -134,14 +134,14 @@ cygwin_strncasecmp (const char *cs, const char *ct, size_t n) ++ls; len = ls * sizeof (WCHAR); RtlInitEmptyUnicodeString (&us, (PWCHAR) alloca (len), len); - us.Length = MultiByteToWideChar (get_cp (), 0, cs, ls, us.Buffer, - us.MaximumLength) * sizeof (WCHAR); + us.Length = sys_mbstowcs (us.Buffer, us.MaximumLength / sizeof (WCHAR), + cs, ls) * sizeof (WCHAR); while (ct[lt] && lt < n) ++lt; len = lt * sizeof (WCHAR); RtlInitEmptyUnicodeString (&ut, (PWCHAR) alloca (len), len); - ut.Length = MultiByteToWideChar (get_cp (), 0, ct, lt, ut.Buffer, - ut.MaximumLength) * sizeof (WCHAR); + ut.Length = sys_mbstowcs (ut.Buffer, ut.MaximumLength / sizeof (WCHAR), + ct, lt) * sizeof (WCHAR); return RtlCompareUnicodeString (&us, &ut, TRUE); } @@ -172,7 +172,7 @@ cygwin_strlwr (char *string) size_t len = (strlen (string) + 1) * sizeof (WCHAR); us.MaximumLength = len; us.Buffer = (PWCHAR) alloca (len); - us.Length = sys_mbstowcs (us.Buffer, string, len) * sizeof (WCHAR) + us.Length = sys_mbstowcs (us.Buffer, len, string) * sizeof (WCHAR) - sizeof (WCHAR); RtlDowncaseUnicodeString (&us, &us, FALSE); sys_wcstombs (string, len / sizeof (WCHAR), us.Buffer); @@ -186,7 +186,7 @@ cygwin_strupr (char *string) size_t len = (strlen (string) + 1) * sizeof (WCHAR); us.MaximumLength = len; us.Buffer = (PWCHAR) alloca (len); - us.Length = sys_mbstowcs (us.Buffer, string, len) * sizeof (WCHAR) + us.Length = sys_mbstowcs (us.Buffer, len, string) * sizeof (WCHAR) - sizeof (WCHAR); RtlUpcaseUnicodeString (&us, &us, FALSE); sys_wcstombs (string, len / sizeof (WCHAR), us.Buffer); -- cgit v1.2.3