- Fix some warnings spotted by MSVC

- Define cmd_exit to ExitProcess if _DEBUG_MEM is not defined.
  Fixes compilation, when _DEBUG_MEM is turned off.

svn path=/trunk/; revision=33545
This commit is contained in:
Colin Finck 2008-05-17 08:49:39 +00:00
parent 982ea317be
commit 3b1370bd40
5 changed files with 19 additions and 14 deletions

View file

@ -31,5 +31,6 @@ cmd_exit(int code);
#define cmd_free(ptr) free(ptr) #define cmd_free(ptr) free(ptr)
#define cmd_dup(str) _tcsdup(str) #define cmd_dup(str) _tcsdup(str)
#define cmd_checkbuffer(ptr) #define cmd_checkbuffer(ptr)
#define cmd_exit(code) ExitProcess(code)
#endif #endif

View file

@ -518,7 +518,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
else else
{ {
LPCTSTR last = PeekHistory(-1); LPCTSTR last = PeekHistory(-1);
if (last && charcount < _tcslen (last)) if (last && charcount < (INT)_tcslen (last))
{ {
PreviousChar = last[current]; PreviousChar = last[current];
ConOutChar(PreviousChar); ConOutChar(PreviousChar);

View file

@ -1849,7 +1849,7 @@ CommandDir(LPTSTR first, LPTSTR rest)
prev_volume[0] = _T('\0'); prev_volume[0] = _T('\0');
for(loop = 0; loop < entries; loop++) for(loop = 0; loop < (UINT)entries; loop++)
{ {
if (CheckCtrlBreak(BREAK_INPUT)) if (CheckCtrlBreak(BREAK_INPUT))
{ {

View 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 * File1;
FileName * File2; FileName * File2;
INT ret; INT ret;
@ -503,7 +504,7 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
cmd_free(File1); cmd_free(File1);
cmd_free(File2); cmd_free(File2);
return ret; return ret;
} }
VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor) VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
{ {

View file

@ -591,7 +591,7 @@ BOOL DeleteFolder(LPTSTR FileName)
INT cmd_rmdir (LPTSTR cmd, LPTSTR param) INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
{ {
TCHAR dir[MAX_PATH]; /* pointer to the directory to change to */ TCHAR dir[MAX_PATH]; /* pointer to the directory to change to */
char ch; TCHAR ch;
INT args; INT args;
LPTSTR *arg = NULL; LPTSTR *arg = NULL;
INT i; INT i;
@ -622,20 +622,22 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
} }
dir[0] = 0; dir[0] = 0;
/* check for options anywhere in command line */ /* check for options anywhere in command line */
for (i = 0; i < args; i++) 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*/ /*found a command, but check to make sure it has something after it*/
if (_tcslen (arg[i]) == 2) if (_tcslen (arg[i]) == 2)
{ {
ch = _totupper (arg[i][1]); ch = _totupper (arg[i][1]);
if (ch == _T('S'))
if (ch == 'S')
{ {
RD_SUB = TRUE; RD_SUB = TRUE;
} }
else if (ch == _T('Q')) else if (ch == 'Q')
{ {
RD_QUIET = TRUE; 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 */ /* No folder to remove */
ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING); ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
@ -657,9 +659,10 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
} }
GetFullPathName(dir,MAX_PATH,szFullPath,NULL); GetFullPathName(dir,MAX_PATH,szFullPath,NULL);
/* remove trailing \ if any, but ONLY if dir is not the root dir */ /* remove trailing \ if any, but ONLY if dir is not the root dir */
if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == _T('\\')) if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == '\\')
szFullPath[_tcslen(szFullPath) - 1] = _T('\0'); szFullPath[_tcslen(szFullPath) - 1] = '\0';
if(RD_SUB) if(RD_SUB)
{ {
@ -695,11 +698,11 @@ INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
FindClose (hFile); FindClose (hFile);
nErrorLevel = 1; nErrorLevel = 1;
return 1; return 1;
}while (FindNextFile (hFile, &f)); } while (FindNextFile (hFile, &f));
FindClose (hFile); FindClose (hFile);
} }
/* reovme the \\* */ /* reovme the \\* */
szFullPath[_tcslen(szFullPath) - 2] = _T('\0'); szFullPath[_tcslen(szFullPath) - 2] = '\0';
} }
if (!DeleteFolder(szFullPath)) if (!DeleteFolder(szFullPath))