Fix incorrect check in WCMD_HandleTildaModifiers().

Gerald Pfeifer gerald at pfeifer.com
Wed Jun 10 08:27:06 CDT 2009


>= '0' || <= '9' always is true. :-)  This patch fixes it, and
avoids two just hand coded checks altogether.

Gerald

ChangeLog:
Fix incorrect check in WCMD_HandleTildaModifiers().
Use isdigit() instead of hand-coding this check.

diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index 0044f70..201500a 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -366,7 +366,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
     WINE_TRACE("Looking backwards for parameter id: %s / %s\n",
                wine_dbgstr_w(lastModifier), wine_dbgstr_w(forVariable));
 
-    if (!justFors && context && (*lastModifier >= '0' || *lastModifier <= '9')) {
+    if (!justFors && context && isdigit(*lastModifier)) {
       /* Its a valid parameter identifier - OK */
       break;
 
@@ -381,7 +381,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, WCHAR *forVariable, WCHAR *forValu
   if (lastModifier == firstModifier) return; /* Invalid syntax */
 
   /* Extract the parameter to play with */
-  if ((*lastModifier >= '0' && *lastModifier <= '9')) {
+  if (isdigit(*lastModifier)) {
     strcpyW(outputparam, WCMD_parameter (context -> command,
                  *lastModifier-'0' + context -> shift_count[*lastModifier-'0'], NULL));
   } else {



More information about the wine-patches mailing list