https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00ce3c48fe99cdc475166…
commit 00ce3c48fe99cdc475166e3078b9166a8b9fcf48
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Sep 12 20:29:54 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Sep 13 22:50:09 2020 +0200
[CMD] Use pointers to const strings in error functions, where applicable.
---
base/shell/cmd/cmd.h | 18 +++++++++---------
base/shell/cmd/error.c | 18 +++++++++---------
base/shell/cmd/parser.c | 4 ++--
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/base/shell/cmd/cmd.h b/base/shell/cmd/cmd.h
index 2d285c10790..b3c1c0f1d9d 100644
--- a/base/shell/cmd/cmd.h
+++ b/base/shell/cmd/cmd.h
@@ -179,22 +179,22 @@ INT CommandEchoserr (LPTSTR);
VOID
ErrorMessage(
IN DWORD dwErrorCode,
- IN LPTSTR szFormat OPTIONAL,
+ IN PCTSTR szFormat OPTIONAL,
...);
VOID error_no_pipe(VOID);
-VOID error_bad_command(LPTSTR);
+VOID error_bad_command(PCTSTR s);
VOID error_invalid_drive(VOID);
VOID error_req_param_missing(VOID);
-VOID error_sfile_not_found(LPTSTR);
+VOID error_sfile_not_found(PCTSTR s);
VOID error_file_not_found(VOID);
VOID error_path_not_found(VOID);
-VOID error_too_many_parameters(LPTSTR);
-VOID error_parameter_format(TCHAR);
-VOID error_invalid_switch(TCHAR);
-VOID error_invalid_parameter_format(LPTSTR);
+VOID error_too_many_parameters(PCTSTR s);
+VOID error_parameter_format(TCHAR ch);
+VOID error_invalid_switch(TCHAR ch);
+VOID error_invalid_parameter_format(PCTSTR s);
VOID error_out_of_memory(VOID);
-VOID error_syntax(LPTSTR);
+VOID error_syntax(PCTSTR s);
VOID msg_pause(VOID);
@@ -360,7 +360,7 @@ VOID EchoCommand(PARSED_COMMAND *Cmd);
TCHAR *Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd);
VOID FreeCommand(PARSED_COMMAND *Cmd);
-void ParseErrorEx(LPTSTR s);
+VOID ParseErrorEx(IN PCTSTR s);
extern BOOL bParseError;
extern TCHAR ParseLine[CMDLINE_LENGTH];
diff --git a/base/shell/cmd/error.c b/base/shell/cmd/error.c
index dd2ec7a6c3f..147b0f7acf9 100644
--- a/base/shell/cmd/error.c
+++ b/base/shell/cmd/error.c
@@ -25,11 +25,11 @@
VOID
ErrorMessage(
IN DWORD dwErrorCode,
- IN LPTSTR szFormat OPTIONAL,
+ IN PCTSTR szFormat OPTIONAL,
...)
{
va_list arg_ptr;
- LPTSTR szError;
+ PTSTR szError;
TCHAR szMsg[RC_STRING_MAX_SIZE];
TCHAR szMessage[1024];
@@ -46,7 +46,7 @@ ErrorMessage(
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&szError, 0, NULL))
+ (PTSTR)&szError, 0, NULL))
{
ConErrPrintf(_T("%s%s%s"), szError, szMessage, (*szMessage ?
_T("\n") : _T("")));
if (szError)
@@ -76,7 +76,7 @@ VOID error_invalid_switch(TCHAR ch)
}
-VOID error_too_many_parameters(LPTSTR s)
+VOID error_too_many_parameters(PCTSTR s)
{
ConErrResPrintf(STRING_ERROR_TOO_MANY_PARAMETERS, s);
nErrorLevel = 1;
@@ -97,12 +97,12 @@ VOID error_file_not_found(VOID)
}
-VOID error_sfile_not_found(LPTSTR f)
+VOID error_sfile_not_found(PCTSTR s)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, STRING_ERROR_FILE_NOT_FOUND, szMsg, ARRAYSIZE(szMsg));
- ConErrPrintf(_T("%s - %s\n"), szMsg, f);
+ ConErrPrintf(_T("%s - %s\n"), szMsg, s);
nErrorLevel = 1;
}
@@ -121,7 +121,7 @@ VOID error_invalid_drive(VOID)
}
-VOID error_bad_command(LPTSTR s)
+VOID error_bad_command(PCTSTR s)
{
ConErrResPrintf(STRING_ERROR_BADCOMMAND, s);
nErrorLevel = 9009;
@@ -142,14 +142,14 @@ VOID error_out_of_memory(VOID)
}
-VOID error_invalid_parameter_format(LPTSTR s)
+VOID error_invalid_parameter_format(PCTSTR s)
{
ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, s);
nErrorLevel = 1;
}
-VOID error_syntax(LPTSTR s)
+VOID error_syntax(PCTSTR s)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
diff --git a/base/shell/cmd/parser.c b/base/shell/cmd/parser.c
index 048c83e3f96..37bc548f2a1 100644
--- a/base/shell/cmd/parser.c
+++ b/base/shell/cmd/parser.c
@@ -112,7 +112,7 @@ restart:
return (CurChar = Char);
}
-void ParseErrorEx(LPTSTR s)
+VOID ParseErrorEx(IN PCTSTR s)
{
/* Only display the first error we encounter */
if (!bParseError)
@@ -120,7 +120,7 @@ void ParseErrorEx(LPTSTR s)
bParseError = TRUE;
}
-static void ParseError(void)
+static __inline VOID ParseError(VOID)
{
ParseErrorEx(CurrentTokenType != TOK_END ? CurrentToken : NULL);
}