[CMD] Use pointers to const strings in error functions, where applicable.

This commit is contained in:
Hermès Bélusca-Maïto 2020-09-12 20:29:54 +02:00
parent 3f8f3a2bba
commit 00ce3c48fe
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 20 additions and 20 deletions

View file

@ -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];