mirror of
https://github.com/reactos/wine.git
synced 2025-03-02 17:55:57 +00:00
xcopy: Avoid using isdigit() for WCHARs.
Found with Coccinelle. Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
505be073a1
commit
373604f253
@ -643,7 +643,7 @@ cleanup:
|
||||
/* =========================================================================
|
||||
XCOPY_ParseCommandLine - Parses the command line
|
||||
========================================================================= */
|
||||
static BOOL is_whitespace(WCHAR c)
|
||||
static inline BOOL is_whitespace(WCHAR c)
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
@ -654,6 +654,11 @@ static WCHAR *skip_whitespace(WCHAR *p)
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline BOOL is_digit(WCHAR c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
/* Windows XCOPY uses a simplified command line parsing algorithm
|
||||
that lacks the escaped-quote logic of build_argv(), because
|
||||
literal double quotes are illegal in any of its arguments.
|
||||
@ -770,7 +775,7 @@ static int XCOPY_ParseCommandLine(WCHAR *suppliedsource,
|
||||
break;
|
||||
|
||||
/* D can be /D or /D: */
|
||||
case 'D': if (word[2]==':' && isdigit(word[3])) {
|
||||
case 'D': if (word[2]==':' && is_digit(word[3])) {
|
||||
SYSTEMTIME st;
|
||||
WCHAR *pos = &word[3];
|
||||
BOOL isError = FALSE;
|
||||
@ -781,18 +786,18 @@ static int XCOPY_ParseCommandLine(WCHAR *suppliedsource,
|
||||
* It is hardcoded to month-day-year.
|
||||
*/
|
||||
st.wMonth = _wtol(pos);
|
||||
while (*pos && isdigit(*pos)) pos++;
|
||||
while (*pos && is_digit(*pos)) pos++;
|
||||
if (*pos++ != '-') isError = TRUE;
|
||||
|
||||
if (!isError) {
|
||||
st.wDay = _wtol(pos);
|
||||
while (*pos && isdigit(*pos)) pos++;
|
||||
while (*pos && is_digit(*pos)) pos++;
|
||||
if (*pos++ != '-') isError = TRUE;
|
||||
}
|
||||
|
||||
if (!isError) {
|
||||
st.wYear = _wtol(pos);
|
||||
while (*pos && isdigit(*pos)) pos++;
|
||||
while (*pos && is_digit(*pos)) pos++;
|
||||
if (st.wYear < 100) st.wYear+=2000;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user