cmd: Use towlower()/towupper() for WCHARs.

Found with Coccinelle.
This commit is contained in:
Akihiro Sagawa 2023-08-18 12:51:54 +09:00 committed by Alexandre Julliard
parent 75488b303b
commit 91de94ab99
3 changed files with 6 additions and 10 deletions

View file

@ -3496,7 +3496,7 @@ void WCMD_setshow_default (const WCHAR *args) {
/* Restore old directory if drive letter would change, and
CD x:\directory /D (or pushd c:\directory) not supplied */
if ((wcsstr(quals, L"/D") == NULL) &&
(param1[1] == ':') && (toupper(param1[0]) != toupper(cwd[0]))) {
(param1[1] == ':') && (towupper(param1[0]) != towupper(cwd[0]))) {
SetCurrentDirectoryW(cwd);
}
}

View file

@ -328,10 +328,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
}
/* /L convers all names to lower case */
if (lower) {
WCHAR *p = fd[i].cFileName;
while ( (*p = tolower(*p)) ) ++p;
}
if (lower) wcslwr( fd[i].cFileName );
/* /Q gets file ownership information */
if (usernames) {
@ -558,8 +555,7 @@ void WCMD_directory (WCHAR *args)
/* Prefill quals with (uppercased) DIRCMD env var */
if (GetEnvironmentVariableW(L"DIRCMD", string, ARRAY_SIZE(string))) {
p = string;
while ( (*p = toupper(*p)) ) ++p;
wcsupr( string );
lstrcatW(string,quals);
lstrcpyW(quals, string);
}
@ -827,7 +823,7 @@ void WCMD_directory (WCHAR *args)
/* Output disk free (trailer) and volume information (header) if the drive
letter changes */
if (lastDrive != toupper(thisEntry->dirName[0])) {
if (lastDrive != towupper(thisEntry->dirName[0])) {
/* Trailer Information */
if (lastDrive != '?') {
@ -835,7 +831,7 @@ void WCMD_directory (WCHAR *args)
WCMD_dir_trailer(prevEntry->dirName[0]);
}
lastDrive = toupper(thisEntry->dirName[0]);
lastDrive = towupper(thisEntry->dirName[0]);
if (!bare) {
WCHAR drive[3];

View file

@ -347,7 +347,7 @@ static void WCMD_show_prompt (BOOL newLine) {
}
else {
p++;
switch (toupper(*p)) {
switch (towupper(*p)) {
case '$':
*q++ = '$';
break;