Frédéric Delanoy : cmd: Use CSTR_* instead of hardcoded values as result of CompareStringW.

Alexandre Julliard julliard at winehq.org
Tue Aug 23 12:44:57 CDT 2011


Module: wine
Branch: master
Commit: d1731eb98a2d1143fe7b7b7d58abb2c3c57a1754
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d1731eb98a2d1143fe7b7b7d58abb2c3c57a1754

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Sat Aug 20 01:58:53 2011 +0200

cmd: Use CSTR_* instead of hardcoded values as result of CompareStringW.

---

 programs/cmd/builtins.c |   12 ++++++------
 programs/cmd/wcmdmain.c |   16 ++++++++--------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 09c166f..254b2c7 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1003,7 +1003,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
   WINE_TRACE("Looking for 'do' in %p\n", *cmdList);
   if ((*cmdList == NULL) ||
       (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-                            (*cmdList)->command, 3, doW, -1) != 2)) {
+                            (*cmdList)->command, 3, doW, -1) != CSTR_EQUAL)) {
       WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR));
       return;
   }
@@ -1277,7 +1277,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
       } else {
         if (isIF && CompareStringW(LOCALE_USER_DEFAULT,
                                    NORM_IGNORECASE | SORT_STRINGSORT,
-                           (*cmdList)->command, 5, ifElse, -1) == 2) {
+                           (*cmdList)->command, 5, ifElse, -1) == CSTR_EQUAL) {
 
           /* Swap between if and else processing */
           processThese = !processThese;
@@ -1320,7 +1320,7 @@ void WCMD_give_help (WCHAR *command) {
   else {
     for (i=0; i<=WCMD_EXIT; i++) {
       if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-	  command, -1, inbuilt[i], -1) == 2) {
+	  command, -1, inbuilt[i], -1) == CSTR_EQUAL) {
 	WCMD_output_asis (WCMD_LoadMessage(i));
 	return;
       }
@@ -2090,7 +2090,7 @@ void WCMD_setshow_default (WCHAR *command) {
   /* Skip /D and trailing whitespace if on the front of the command line */
   if (CompareStringW(LOCALE_USER_DEFAULT,
                      NORM_IGNORECASE | SORT_STRINGSORT,
-                     command, 2, parmD, -1) == 2) {
+                     command, 2, parmD, -1) == CSTR_EQUAL) {
     command += 2;
     while (*command && *command==' ') command++;
   }
@@ -2262,7 +2262,7 @@ static int WCMD_setshow_sortenv(const WCHAR *s, const WCHAR *stub)
   for( i=0; i<count; i++ ) {
     if (!stub || CompareStringW(LOCALE_USER_DEFAULT,
                                 NORM_IGNORECASE | SORT_STRINGSORT,
-                                str[i], stublen, stub, -1) == 2) {
+                                str[i], stublen, stub, -1) == CSTR_EQUAL) {
       /* Don't display special internal variables */
       if (str[i][0] != '=') {
         WCMD_output_asis(str[i]);
@@ -2298,7 +2298,7 @@ void WCMD_setshow_env (WCHAR *s) {
   /* See if /P supplied, and if so echo the prompt, and read in a reply */
   if (CompareStringW(LOCALE_USER_DEFAULT,
                      NORM_IGNORECASE | SORT_STRINGSORT,
-                     s, 2, parmP, -1) == 2) {
+                     s, 2, parmP, -1) == CSTR_EQUAL) {
     WCHAR string[MAXSTRING];
     DWORD count;
 
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 0111c15..0bab2d0 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -597,7 +597,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
                                SORT_STRINGSORT,
                                thisVar,
                                (colonpos - thisVar) - 1,
-                               forVar, -1) == 2)) {
+                               forVar, -1) == CSTR_EQUAL)) {
       strcpyW(thisVarContents, forVal);
       len = strlenW(thisVarContents);
 
@@ -817,7 +817,7 @@ static void handleExpansion(WCHAR *cmd, BOOL justFors, WCHAR *forVariable, WCHAR
                                SORT_STRINGSORT,
                                p,
                                strlenW(forVariable),
-                               forVariable, -1) == 2)) {
+                               forVariable, -1) == CSTR_EQUAL)) {
       WCMD_strsubstW(p, p + strlenW(forVariable), forValue, -1);
 
     } else if (!justFors) {
@@ -1828,12 +1828,12 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
 
         /* If command starts with 'rem', ignore any &&, ( etc */
         if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-          curPos, 4, remCmd, -1) == 2) {
+          curPos, 4, remCmd, -1) == CSTR_EQUAL) {
           inRem = TRUE;
 
         /* If command starts with 'for', handle ('s mid line after IN or DO */
         } else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-          curPos, 4, forCmd, -1) == 2) {
+          curPos, 4, forCmd, -1) == CSTR_EQUAL) {
           inFor = TRUE;
 
         /* If command starts with 'if' or 'else', handle ('s mid line. We should ensure this
@@ -1843,11 +1843,11 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
                                         echo they equal
                                       )" will be parsed wrong */
         } else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-          curPos, 3, ifCmd, -1) == 2) {
+          curPos, 3, ifCmd, -1) == CSTR_EQUAL) {
           inIf = TRUE;
 
         } else if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-          curPos, 5, ifElse, -1) == 2) {
+          curPos, 5, ifElse, -1) == CSTR_EQUAL) {
           inElse = TRUE;
           lastWasElse = TRUE;
           onlyWhiteSpace = TRUE;
@@ -1861,7 +1861,7 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
            is then 0, and all whitespace is skipped                                */
         } else if (inFor &&
                    (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-                    curPos, 3, forDO, -1) == 2)) {
+                    curPos, 3, forDO, -1) == CSTR_EQUAL)) {
           WINE_TRACE("Found DO\n");
           lastWasDo = TRUE;
           onlyWhiteSpace = TRUE;
@@ -1879,7 +1879,7 @@ WCHAR *WCMD_ReadAndParseLine(WCHAR *optionalcmd, CMD_LIST **output, HANDLE readF
           WINE_TRACE("Found 'FOR', comparing next parm: '%s'\n", wine_dbgstr_w(curPos));
 
           if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
-              curPos, 3, forIN, -1) == 2) {
+              curPos, 3, forIN, -1) == CSTR_EQUAL) {
             WINE_TRACE("Found IN\n");
             lastWasIn = TRUE;
             onlyWhiteSpace = TRUE;




More information about the wine-cvs mailing list