Fix MSVC / 64 bit warnings

svn path=/trunk/; revision=56258
This commit is contained in:
Timo Kreuzer 2012-03-28 09:50:04 +00:00
parent 82c185ae72
commit 00b699d98b
12 changed files with 30 additions and 28 deletions

View file

@ -817,7 +817,7 @@ TCHAR* getExt(const TCHAR* file)
static LPTSTR static LPTSTR
getName(const TCHAR* file, TCHAR * dest) getName(const TCHAR* file, TCHAR * dest)
{ {
int iLen; INT_PTR iLen;
LPTSTR end; LPTSTR end;
/* Check for "." and ".." folders */ /* Check for "." and ".." folders */
@ -919,7 +919,7 @@ DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
SHORT iScreenWidth; SHORT iScreenWidth;
USHORT iColumns; USHORT iColumns;
USHORT iLines; USHORT iLines;
UINT iLongestName; UINT_PTR iLongestName;
TCHAR szTempFname[MAX_PATH]; TCHAR szTempFname[MAX_PATH];
DWORD i; DWORD i;
DWORD j; DWORD j;
@ -944,7 +944,7 @@ DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
/* Count the highest number of columns */ /* Count the highest number of columns */
GetScreenSize(&iScreenWidth, 0); GetScreenSize(&iScreenWidth, 0);
iColumns = iScreenWidth / iLongestName; iColumns = (USHORT)(iScreenWidth / iLongestName);
/* Check if there is enough space for spaces between names */ /* Check if there is enough space for spaces between names */
if (((iLongestName * iColumns) + iColumns) >= (UINT)iScreenWidth) if (((iLongestName * iColumns) + iColumns) >= (UINT)iScreenWidth)
@ -1301,7 +1301,7 @@ QsortFiles(LPWIN32_FIND_DATA ptrArray[], /* [IN/OUT] The array with file info po
static INT static INT
DirList(LPTSTR szPath, /* [IN] The path that dir starts */ DirList(LPTSTR szPath, /* [IN] The path that dir starts */
LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */
{ {
BOOL fPoint; /* If szPath is a file with extension fPoint will be True*/ BOOL fPoint; /* If szPath is a file with extension fPoint will be True*/
HANDLE hSearch; /* The handle of the search */ HANDLE hSearch; /* The handle of the search */
HANDLE hRecSearch; /* The handle for searching recursivly */ HANDLE hRecSearch; /* The handle for searching recursivly */

View file

@ -509,7 +509,7 @@ int __cdecl compare(const void *arg1,const void *arg2)
VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor) VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
{ {
/* Length of string before we complete it */ /* Length of string before we complete it */
INT StartLength; INT_PTR StartLength;
/* Length of string after completed */ /* Length of string after completed */
//INT EndLength; //INT EndLength;
/* The number of chars added too it */ /* The number of chars added too it */

View file

@ -94,15 +94,15 @@ static BOOL Exiting(PARSED_COMMAND *Cmd)
* dynamically allocating enough space to hold it all */ * dynamically allocating enough space to hold it all */
static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer) static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
{ {
DWORD Len = 0; SIZE_T Len = 0;
DWORD AllocLen = 1000; SIZE_T AllocLen = 1000;
LPTSTR Contents = cmd_alloc(AllocLen * sizeof(TCHAR)); LPTSTR Contents = cmd_alloc(AllocLen * sizeof(TCHAR));
if (!Contents) if (!Contents)
return NULL; return NULL;
while (_fgetts(Buffer, CMDLINE_LENGTH, InputFile)) while (_fgetts(Buffer, CMDLINE_LENGTH, InputFile))
{ {
DWORD CharsRead = _tcslen(Buffer); ULONG_PTR CharsRead = _tcslen(Buffer);
while (Len + CharsRead >= AllocLen) while (Len + CharsRead >= AllocLen)
{ {
Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR)); Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR));

View file

@ -80,7 +80,7 @@ INT cmd_goto (LPTSTR param)
while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0]))) while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0])))
{ {
int pos; int pos;
int size; INT_PTR size;
/* Strip out any trailing spaces or control chars */ /* Strip out any trailing spaces or control chars */
tmp = textline + _tcslen (textline) - 1; tmp = textline + _tcslen (textline) - 1;
@ -93,7 +93,7 @@ INT cmd_goto (LPTSTR param)
tmp = textline; tmp = textline;
while (_istspace (*tmp)) while (_istspace (*tmp))
tmp++; tmp++;
/* All space after leading space terminate the string */ /* All space after leading space terminate the string */
size = _tcslen(tmp) -1; size = _tcslen(tmp) -1;
pos=0; pos=0;

View file

@ -281,7 +281,7 @@ MakeFullPath(TCHAR * DirPath)
{ {
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
TCHAR *p = DirPath; TCHAR *p = DirPath;
INT n; INT_PTR n;
if (CreateDirectory(DirPath, NULL)) if (CreateDirectory(DirPath, NULL))
return TRUE; return TRUE;

View file

@ -281,7 +281,7 @@ LPTSTR *split (LPTSTR s, LPINT args, BOOL expand_wildcards)
LPTSTR start; LPTSTR start;
LPTSTR q; LPTSTR q;
INT ac; INT ac;
INT len; INT_PTR len;
arg = cmd_alloc (sizeof (LPTSTR)); arg = cmd_alloc (sizeof (LPTSTR));
if (!arg) if (!arg)
@ -360,7 +360,7 @@ LPTSTR *splitspace (LPTSTR s, LPINT args)
LPTSTR start; LPTSTR start;
LPTSTR q; LPTSTR q;
INT ac; INT ac;
INT len; INT_PTR len;
arg = cmd_alloc (sizeof (LPTSTR)); arg = cmd_alloc (sizeof (LPTSTR));
if (!arg) if (!arg)
@ -505,7 +505,7 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
len = dwRead; len = dwRead;
if (end) if (end)
{ {
len = (end - lpString) + 1; len = (INT)(end - lpString) + 1;
SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT); SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT);
} }
} }

View file

@ -81,22 +81,22 @@ static BOOL CreateJunction(LPCTSTR LinkName, LPCTSTR TargetName)
if (hJunction != INVALID_HANDLE_VALUE) if (hJunction != INVALID_HANDLE_VALUE)
{ {
/* Allocate a buffer large enough to hold both strings, including trailing NULs */ /* Allocate a buffer large enough to hold both strings, including trailing NULs */
DWORD TargetLen = wcslen(TargetFullPathW) * sizeof(WCHAR); SIZE_T TargetLen = wcslen(TargetFullPathW) * sizeof(WCHAR);
DWORD DataSize = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) DWORD DataSize = (DWORD)(FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer)
+ TargetNTPath.Length + sizeof(WCHAR) + TargetNTPath.Length + sizeof(WCHAR)
+ TargetLen + sizeof(WCHAR); + TargetLen + sizeof(WCHAR));
PREPARSE_DATA_BUFFER Data = _alloca(DataSize); PREPARSE_DATA_BUFFER Data = _alloca(DataSize);
/* Fill it out and use it to turn the directory into a reparse point */ /* Fill it out and use it to turn the directory into a reparse point */
Data->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; Data->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
Data->ReparseDataLength = DataSize - FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer); Data->ReparseDataLength = (WORD)(DataSize - FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer));
Data->Reserved = 0; Data->Reserved = 0;
Data->MountPointReparseBuffer.SubstituteNameOffset = 0; Data->MountPointReparseBuffer.SubstituteNameOffset = 0;
Data->MountPointReparseBuffer.SubstituteNameLength = TargetNTPath.Length; Data->MountPointReparseBuffer.SubstituteNameLength = TargetNTPath.Length;
wcscpy(Data->MountPointReparseBuffer.PathBuffer, wcscpy(Data->MountPointReparseBuffer.PathBuffer,
TargetNTPath.Buffer); TargetNTPath.Buffer);
Data->MountPointReparseBuffer.PrintNameOffset = TargetNTPath.Length + sizeof(WCHAR); Data->MountPointReparseBuffer.PrintNameOffset = TargetNTPath.Length + sizeof(WCHAR);
Data->MountPointReparseBuffer.PrintNameLength = TargetLen; Data->MountPointReparseBuffer.PrintNameLength = (USHORT)TargetLen;
wcscpy((WCHAR *)((BYTE *)Data->MountPointReparseBuffer.PathBuffer wcscpy((WCHAR *)((BYTE *)Data->MountPointReparseBuffer.PathBuffer
+ Data->MountPointReparseBuffer.PrintNameOffset), + Data->MountPointReparseBuffer.PrintNameOffset),
TargetFullPathW); TargetFullPathW);

View file

@ -435,7 +435,7 @@ INT cmd_move (LPTSTR param)
if (nDirLevel > 0) if (nDirLevel > 0)
{ {
TCHAR szTempPath[MAX_PATH]; TCHAR szTempPath[MAX_PATH];
INT nDiff; INT_PTR nDiff;
FoundFile = TRUE; /* we need to continue our seek for files */ FoundFile = TRUE; /* we need to continue our seek for files */
nDirLevel--; nDirLevel--;

View file

@ -411,7 +411,7 @@ condition_done:
return Cmd; return Cmd;
} }
/* Parse a FOR command. /* Parse a FOR command.
* Syntax is: FOR [options] %var IN (list) DO command */ * Syntax is: FOR [options] %var IN (list) DO command */
static PARSED_COMMAND *ParseFor(void) static PARSED_COMMAND *ParseFor(void)
{ {
@ -536,7 +536,7 @@ static DECLSPEC_NOINLINE PARSED_COMMAND *ParseCommandPart(REDIRECTION *RedirList
PARSED_COMMAND *(*Func)(void); PARSED_COMMAND *(*Func)(void);
TCHAR *Pos = _stpcpy(ParsedLine, CurrentToken) + 1; TCHAR *Pos = _stpcpy(ParsedLine, CurrentToken) + 1;
DWORD TailOffset = Pos - ParsedLine; DWORD_PTR TailOffset = Pos - ParsedLine;
/* Check for special forms */ /* Check for special forms */
if ((Func = ParseFor, _tcsicmp(ParsedLine, _T("for")) == 0) || if ((Func = ParseFor, _tcsicmp(ParsedLine, _T("for")) == 0) ||

View file

@ -203,7 +203,8 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
INT recReplace(DWORD dwFlags, TCHAR szSrcPath[MAX_PATH], TCHAR szDestPath[MAX_PATH], BOOL *doMore) INT recReplace(DWORD dwFlags, TCHAR szSrcPath[MAX_PATH], TCHAR szDestPath[MAX_PATH], BOOL *doMore)
{ {
TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH]; TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH];
INT filesReplaced=0, i; INT filesReplaced=0;
INT_PTR i;
DWORD dwAttrib = 0; DWORD dwAttrib = 0;
HANDLE hFile; HANDLE hFile;
WIN32_FIND_DATA findBuffer; WIN32_FIND_DATA findBuffer;
@ -298,7 +299,8 @@ INT recFindSubDirs(DWORD dwFlags,
HANDLE hFile; HANDLE hFile;
WIN32_FIND_DATA findBuffer; WIN32_FIND_DATA findBuffer;
TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH]; TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH];
INT filesReplaced = 0, i; INT filesReplaced = 0;
INT_PTR i;
/* Add a wildcard to dest end so the it will be easy to itterate /* Add a wildcard to dest end so the it will be easy to itterate
over all the files and directorys in the dest directory */ over all the files and directorys in the dest directory */

View file

@ -212,7 +212,7 @@ ident_len ( LPCTSTR p )
while ( __iscsym(*p2) ) while ( __iscsym(*p2) )
++p2; ++p2;
} }
return p2-p; return (INT)(p2-p);
} }
#define PARSE_IDENT(ident,identlen,p) \ #define PARSE_IDENT(ident,identlen,p) \

View file

@ -36,7 +36,7 @@ VOID ShortVersion (VOID)
if (GetVersionEx(&VersionInfo)) if (GetVersionEx(&VersionInfo))
{ {
LPTSTR RosVersion; LPTSTR RosVersion;
unsigned RosVersionLen; SIZE_T RosVersionLen;
RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1; RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1;
RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) - RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) -
@ -76,7 +76,7 @@ INT cmd_ver (LPTSTR param)
{ {
ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others.")); ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others."));
ConOutPuts (_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team")); ConOutPuts (_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team"));
for (i = 0; param[i]; i++) for (i = 0; param[i]; i++)
{ {