cmd: Respect constant wide strings naming convention.

This commit is contained in:
Frédéric Delanoy 2012-02-11 18:24:56 +01:00 committed by Alexandre Julliard
parent 7cf307a7bd
commit 668e44ab26
5 changed files with 28 additions and 28 deletions

View file

@ -475,13 +475,13 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
int datelen; int datelen;
doneModifier = TRUE; doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
/* Format the time */ /* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime); FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime, GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH); NULL, thisoutput, MAX_PATH);
strcatW(thisoutput, space); strcatW(thisoutput, spaceW);
datelen = strlenW(thisoutput); datelen = strlenW(thisoutput);
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime, GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen); NULL, (thisoutput+datelen), MAX_PATH-datelen);
@ -497,14 +497,14 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
static const WCHAR fmt[] = {'%','u','\0'}; static const WCHAR fmt[] = {'%','u','\0'};
doneModifier = TRUE; doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
wsprintfW(thisoutput, fmt, fullsize); wsprintfW(thisoutput, fmt, fullsize);
strcatW(finaloutput, thisoutput); strcatW(finaloutput, thisoutput);
} }
/* 4. Handle 's' : Use short paths (File doesn't have to exist) */ /* 4. Handle 's' : Use short paths (File doesn't have to exist) */
if (memchrW(firstModifier, 's', modifierLen) != NULL) { if (memchrW(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
/* Don't flag as doneModifier - %~s on its own is processed later */ /* Don't flag as doneModifier - %~s on its own is processed later */
GetShortPathNameW(outputparam, outputparam, sizeof(outputparam)/sizeof(outputparam[0])); GetShortPathNameW(outputparam, outputparam, sizeof(outputparam)/sizeof(outputparam[0]));
} }
@ -513,7 +513,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
/* Note this overrides d,p,n,x */ /* Note this overrides d,p,n,x */
if (memchrW(firstModifier, 'f', modifierLen) != NULL) { if (memchrW(firstModifier, 'f', modifierLen) != NULL) {
doneModifier = TRUE; doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
strcatW(finaloutput, fullfilename); strcatW(finaloutput, fullfilename);
} else { } else {
@ -523,7 +523,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
WCHAR ext[MAX_PATH]; WCHAR ext[MAX_PATH];
BOOL doneFileModifier = FALSE; BOOL doneFileModifier = FALSE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
/* Split into components */ /* Split into components */
WCMD_splitpath(fullfilename, drive, dir, fname, ext); WCMD_splitpath(fullfilename, drive, dir, fname, ext);
@ -560,7 +560,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
if (!doneFileModifier && if (!doneFileModifier &&
memchrW(firstModifier, 's', modifierLen) != NULL) { memchrW(firstModifier, 's', modifierLen) != NULL) {
doneModifier = TRUE; doneModifier = TRUE;
if (finaloutput[0] != 0x00) strcatW(finaloutput, space); if (finaloutput[0] != 0x00) strcatW(finaloutput, spaceW);
strcatW(finaloutput, outputparam); strcatW(finaloutput, outputparam);
} }
} }

View file

@ -349,7 +349,7 @@ void WCMD_choice (const WCHAR * command) {
ptr = strchrW(opt_c, answer[0]); ptr = strchrW(opt_c, answer[0]);
if (ptr) { if (ptr) {
WCMD_output_asis(answer); WCMD_output_asis(answer);
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
if (have_console) if (have_console)
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), oldmode); SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), oldmode);
@ -954,7 +954,7 @@ void WCMD_echo (const WCHAR *command)
echo_mode = FALSE; echo_mode = FALSE;
else { else {
WCMD_output_asis (command); WCMD_output_asis (command);
WCMD_output_asis (newline); WCMD_output_asis (newlineW);
} }
HeapFree(GetProcessHeap(), 0, trimmed); HeapFree(GetProcessHeap(), 0, trimmed);
} }
@ -2101,7 +2101,7 @@ void WCMD_setshow_default (const WCHAR *command) {
GetCurrentDirectoryW(sizeof(cwd)/sizeof(WCHAR), cwd); GetCurrentDirectoryW(sizeof(cwd)/sizeof(WCHAR), cwd);
if (strlenW(command) == 0) { if (strlenW(command) == 0) {
strcatW (cwd, newline); strcatW (cwd, newlineW);
WCMD_output_asis (cwd); WCMD_output_asis (cwd);
} }
else { else {
@ -2264,7 +2264,7 @@ static int WCMD_setshow_sortenv(const WCHAR *s, const WCHAR *stub)
/* Don't display special internal variables */ /* Don't display special internal variables */
if (str[i][0] != '=') { if (str[i][0] != '=') {
WCMD_output_asis(str[i]); WCMD_output_asis(str[i]);
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
displayedcount++; displayedcount++;
} }
} }
@ -2368,7 +2368,7 @@ void WCMD_setshow_path (const WCHAR *command) {
if (status != 0) { if (status != 0) {
WCMD_output_asis ( pathEqW); WCMD_output_asis ( pathEqW);
WCMD_output_asis ( string); WCMD_output_asis ( string);
WCMD_output_asis ( newline); WCMD_output_asis ( newlineW);
} }
else { else {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOPATH)); WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOPATH));
@ -2488,7 +2488,7 @@ void WCMD_start(const WCHAR *command)
strcatW( file, exeW ); strcatW( file, exeW );
cmdline = HeapAlloc( GetProcessHeap(), 0, (strlenW(file) + strlenW(command) + 2) * sizeof(WCHAR) ); cmdline = HeapAlloc( GetProcessHeap(), 0, (strlenW(file) + strlenW(command) + 2) * sizeof(WCHAR) );
strcpyW( cmdline, file ); strcpyW( cmdline, file );
strcatW( cmdline, space ); strcatW( cmdline, spaceW );
strcatW( cmdline, command ); strcatW( cmdline, command );
memset( &st, 0, sizeof(STARTUPINFOW) ); memset( &st, 0, sizeof(STARTUPINFOW) );
@ -2879,7 +2879,7 @@ void WCMD_assoc (const WCHAR *command, BOOL assoc) {
if (rc == ERROR_SUCCESS) { if (rc == ERROR_SUCCESS) {
WCMD_output_asis(keyValue); WCMD_output_asis(keyValue);
} }
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
RegCloseKey(readKey); RegCloseKey(readKey);
} }
} }
@ -2909,7 +2909,7 @@ void WCMD_assoc (const WCHAR *command, BOOL assoc) {
WCMD_output_asis(equalW); WCMD_output_asis(equalW);
/* If no default value found, leave line empty after '=' */ /* If no default value found, leave line empty after '=' */
if (rc == ERROR_SUCCESS) WCMD_output_asis(keyValue); if (rc == ERROR_SUCCESS) WCMD_output_asis(keyValue);
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
RegCloseKey(readKey); RegCloseKey(readKey);
} else { } else {
@ -2982,7 +2982,7 @@ void WCMD_assoc (const WCHAR *command, BOOL assoc) {
WCMD_output_asis(command); WCMD_output_asis(command);
WCMD_output_asis(equalW); WCMD_output_asis(equalW);
WCMD_output_asis(newValue); WCMD_output_asis(newValue);
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
} }
} }
} }

View file

@ -316,7 +316,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Output the results */ /* Output the results */
if (!bare) { if (!bare) {
if (level != 0 && (entry_count > 0)) WCMD_output_asis (newline); if (level != 0 && (entry_count > 0)) WCMD_output_asis (newlineW);
if (!recurse || ((entry_count > 0) && done_header==FALSE)) { if (!recurse || ((entry_count > 0) && done_header==FALSE)) {
static const WCHAR headerW[] = {'D','i','r','e','c','t','o','r','y',' ','o','f', static const WCHAR headerW[] = {'D','i','r','e','c','t','o','r','y',' ','o','f',
' ','%','1','\n','\n','\0'}; ' ','%','1','\n','\n','\0'};
@ -446,7 +446,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
} }
} }
} }
if (addNewLine) WCMD_output_asis (newline); if (addNewLine) WCMD_output_asis (newlineW);
cur_width = 0; cur_width = 0;
} }

View file

@ -231,8 +231,8 @@ extern BATCH_CONTEXT *context;
#define WCMD_EXIT 45 #define WCMD_EXIT 45
/* Some standard messages */ /* Some standard messages */
extern const WCHAR newline[]; extern const WCHAR newlineW[];
extern const WCHAR space[]; extern const WCHAR spaceW[];
extern const WCHAR nullW[]; extern const WCHAR nullW[];
extern const WCHAR dotW[]; extern const WCHAR dotW[];
extern const WCHAR dotdotW[]; extern const WCHAR dotdotW[];

View file

@ -44,8 +44,8 @@ int defaultColor = 7;
BOOL echo_mode = TRUE; BOOL echo_mode = TRUE;
WCHAR anykey[100], version_string[100]; WCHAR anykey[100], version_string[100];
const WCHAR newline[] = {'\r','\n','\0'}; const WCHAR newlineW[] = {'\r','\n','\0'};
const WCHAR space[] = {' ','\0'}; const WCHAR spaceW[] = {' ','\0'};
static BOOL opt_c, opt_k, opt_s, unicodeOutput = FALSE; static BOOL opt_c, opt_k, opt_s, unicodeOutput = FALSE;
@ -318,7 +318,7 @@ void WCMD_print_error (void) {
WCMD_output_asis_len(lpMsgBuf, lstrlenW(lpMsgBuf), WCMD_output_asis_len(lpMsgBuf, lstrlenW(lpMsgBuf),
GetStdHandle(STD_ERROR_HANDLE)); GetStdHandle(STD_ERROR_HANDLE));
LocalFree (lpMsgBuf); LocalFree (lpMsgBuf);
WCMD_output_asis_len (newline, lstrlenW(newline), WCMD_output_asis_len (newlineW, lstrlenW(newlineW),
GetStdHandle(STD_ERROR_HANDLE)); GetStdHandle(STD_ERROR_HANDLE));
return; return;
} }
@ -1550,7 +1550,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WCMD_type (p); WCMD_type (p);
break; break;
case WCMD_VER: case WCMD_VER:
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
WCMD_version (); WCMD_version ();
break; break;
case WCMD_VERIFY: case WCMD_VERIFY:
@ -1813,7 +1813,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if (strlenW(extraSpace) == MAXSTRING -1) { if (strlenW(extraSpace) == MAXSTRING -1) {
WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_TRUNCATEDLINE)); WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_TRUNCATEDLINE));
WCMD_output_asis_stderr(extraSpace); WCMD_output_asis_stderr(extraSpace);
WCMD_output_asis_stderr(newline); WCMD_output_asis_stderr(newlineW);
} }
/* Replace env vars if in a batch context */ /* Replace env vars if in a batch context */
@ -1834,9 +1834,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, && CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
extraSpace, min_len, echoCol, len) != CSTR_EQUAL) extraSpace, min_len, echoCol, len) != CSTR_EQUAL)
{ {
WCMD_output_asis(space); WCMD_output_asis(spaceW);
} }
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
} }
/* Start with an empty string, copying to the command string */ /* Start with an empty string, copying to the command string */
@ -2172,7 +2172,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* Continue to echo commands IF echo is on and in batch program */ /* Continue to echo commands IF echo is on and in batch program */
if (context && echo_mode && extraSpace[0] && (extraSpace[0] != '@')) { if (context && echo_mode && extraSpace[0] && (extraSpace[0] != '@')) {
WCMD_output_asis(extraSpace); WCMD_output_asis(extraSpace);
WCMD_output_asis(newline); WCMD_output_asis(newlineW);
} }
} }
} }