- Fix some warnings spotted by MSVC
authorColin Finck <colin@reactos.org>
Sat, 17 May 2008 08:49:39 +0000 (08:49 +0000)
committerColin Finck <colin@reactos.org>
Sat, 17 May 2008 08:49:39 +0000 (08:49 +0000)
- Define cmd_exit to ExitProcess if _DEBUG_MEM is not defined.
  Fixes compilation, when _DEBUG_MEM is turned off.

svn path=/trunk/; revision=33545

reactos/base/shell/cmd/cmddbg.h
reactos/base/shell/cmd/cmdinput.c
reactos/base/shell/cmd/dir.c
reactos/base/shell/cmd/filecomp.c
reactos/base/shell/cmd/internal.c

index 01f5177..8f94525 100644 (file)
@@ -31,5 +31,6 @@ cmd_exit(int code);
 #define cmd_free(ptr) free(ptr)
 #define cmd_dup(str) _tcsdup(str)
 #define cmd_checkbuffer(ptr)
+#define cmd_exit(code) ExitProcess(code)
 
 #endif
index d03c31d..fdba537 100644 (file)
@@ -518,7 +518,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
                                else
                                {
                                        LPCTSTR last = PeekHistory(-1);
-                                       if (last && charcount < _tcslen (last))
+                                       if (last && charcount < (INT)_tcslen (last))
                                        {
                                                PreviousChar = last[current];
                                                ConOutChar(PreviousChar);
index 6fd7419..52282ca 100644 (file)
@@ -1849,7 +1849,7 @@ CommandDir(LPTSTR first, LPTSTR rest)
 
        prev_volume[0] = _T('\0');
 
-       for(loop = 0; loop < entries; loop++)
+       for(loop = 0; loop < (UINT)entries; loop++)
        {
                if (CheckCtrlBreak(BREAK_INPUT))
                {
index 5e64e14..4ca8b83 100644 (file)
@@ -483,8 +483,9 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
        }
 
 }
- int __cdecl compare(const void *arg1,const void *arg2)
- {
+
+int __cdecl compare(const void *arg1,const void *arg2)
+{
        FileName * File1;
        FileName * File2;
        INT ret;
@@ -503,7 +504,7 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
        cmd_free(File1);
        cmd_free(File2);
        return ret;
- }
+}
 
 VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
 {
index a04d9a6..b36ba2e 100644 (file)
@@ -591,7 +591,7 @@ BOOL DeleteFolder(LPTSTR FileName)
 INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
 {
        TCHAR dir[MAX_PATH];            /* pointer to the directory to change to */
-       char ch;
+       TCHAR ch;
        INT args;
        LPTSTR *arg = NULL;
        INT i;
@@ -622,20 +622,22 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
        }
 
        dir[0] = 0;
+
        /* check for options anywhere in command line */
        for (i = 0; i < args; i++)
        {
-               if (*arg[i] == _T('/'))
+               if (*arg[i] == '/')
                {
                        /*found a command, but check to make sure it has something after it*/
                        if (_tcslen (arg[i]) == 2)
                        {
                                ch = _totupper (arg[i][1]);
-                               if (ch == _T('S'))
+
+                               if (ch == 'S')
                                {
                                        RD_SUB = TRUE;
                                }
-                               else if (ch == _T('Q'))
+                               else if (ch == 'Q')
                                {
                                        RD_QUIET = TRUE;
                                }
@@ -648,7 +650,7 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
                }
        }
 
-       if (dir[0] == _T('\0'))
+       if (dir[0] == '\0')
        {
                /* No folder to remove */
                ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
@@ -657,9 +659,10 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
        }
 
        GetFullPathName(dir,MAX_PATH,szFullPath,NULL);
+
        /* remove trailing \ if any, but ONLY if dir is not the root dir */
-       if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == _T('\\'))
-               szFullPath[_tcslen(szFullPath) - 1] = _T('\0');
+       if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == '\\')
+               szFullPath[_tcslen(szFullPath) - 1] = '\0';
 
        if(RD_SUB)
        {
@@ -695,11 +698,11 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
                                FindClose (hFile);
                                nErrorLevel = 1;
                                return 1;
-                       }while (FindNextFile (hFile, &f));
+                       } while (FindNextFile (hFile, &f));
                        FindClose (hFile);
                }
                /* reovme the \\* */
-               szFullPath[_tcslen(szFullPath) - 2] = _T('\0');
+               szFullPath[_tcslen(szFullPath) - 2] = '\0';
        }
 
        if (!DeleteFolder(szFullPath))