[ros-diffs] [tkreuzer] 56258: [CMD] Fix MSVC / 64 bit warnings

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Mar 28 09:50:05 UTC 2012


Author: tkreuzer
Date: Wed Mar 28 09:50:04 2012
New Revision: 56258

URL: http://svn.reactos.org/svn/reactos?rev=56258&view=rev
Log:
[CMD]
Fix MSVC / 64 bit warnings

Modified:
    trunk/reactos/base/shell/cmd/dir.c
    trunk/reactos/base/shell/cmd/filecomp.c
    trunk/reactos/base/shell/cmd/for.c
    trunk/reactos/base/shell/cmd/goto.c
    trunk/reactos/base/shell/cmd/internal.c
    trunk/reactos/base/shell/cmd/misc.c
    trunk/reactos/base/shell/cmd/mklink.c
    trunk/reactos/base/shell/cmd/move.c
    trunk/reactos/base/shell/cmd/parser.c
    trunk/reactos/base/shell/cmd/replace.c
    trunk/reactos/base/shell/cmd/set.c
    trunk/reactos/base/shell/cmd/ver.c

Modified: trunk/reactos/base/shell/cmd/dir.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -817,7 +817,7 @@
 static LPTSTR
 getName(const TCHAR* file, TCHAR * dest)
 {
-	int iLen;
+	INT_PTR iLen;
 	LPTSTR end;
 
 	/* Check for "." and ".." folders */
@@ -919,7 +919,7 @@
   SHORT iScreenWidth;
   USHORT iColumns;
   USHORT iLines;
-  UINT iLongestName;
+  UINT_PTR iLongestName;
   TCHAR szTempFname[MAX_PATH];
   DWORD i;
   DWORD j;
@@ -944,7 +944,7 @@
 
   /* Count the highest number of columns */
   GetScreenSize(&iScreenWidth, 0);
-  iColumns = iScreenWidth / iLongestName;
+  iColumns = (USHORT)(iScreenWidth / iLongestName);
 
   /* Check if there is enough space for spaces between names */
   if (((iLongestName * iColumns) + iColumns) >= (UINT)iScreenWidth)
@@ -1301,7 +1301,7 @@
 static INT
 DirList(LPTSTR szPath,			/* [IN] The path that dir starts */
 		LPDIRSWITCHFLAGS lpFlags)	/* [IN] The flags of the listing */
-{	
+{
 	BOOL fPoint;							/* If szPath is a file with extension fPoint will be True*/
 	HANDLE hSearch;							/* The handle of the search */
 	HANDLE hRecSearch;						/* The handle for searching recursivly */

Modified: trunk/reactos/base/shell/cmd/filecomp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/filecomp.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -509,7 +509,7 @@
 VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
 {
 	/* Length of string before we complete it */
-	INT StartLength;
+	INT_PTR StartLength;
 	/* Length of string after completed */
 	//INT EndLength;
 	/* The number of chars added too it */

Modified: trunk/reactos/base/shell/cmd/for.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/for.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/for.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/for.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -94,15 +94,15 @@
  * dynamically allocating enough space to hold it all */
 static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
 {
-	DWORD Len = 0;
-	DWORD AllocLen = 1000;
+	SIZE_T Len = 0;
+	SIZE_T AllocLen = 1000;
 	LPTSTR Contents = cmd_alloc(AllocLen * sizeof(TCHAR));
 	if (!Contents)
 		return NULL;
 
 	while (_fgetts(Buffer, CMDLINE_LENGTH, InputFile))
 	{
-		DWORD CharsRead = _tcslen(Buffer);
+		ULONG_PTR CharsRead = _tcslen(Buffer);
 		while (Len + CharsRead >= AllocLen)
 		{
 			Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR));

Modified: trunk/reactos/base/shell/cmd/goto.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/goto.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/goto.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/goto.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -80,7 +80,7 @@
 	while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0])))
 	{
 		int pos;
-		int size;
+		INT_PTR size;
 
 		/* Strip out any trailing spaces or control chars */
 		tmp = textline + _tcslen (textline) - 1;
@@ -93,7 +93,7 @@
 		tmp = textline;
 		while (_istspace (*tmp))
 			tmp++;
-		
+
 		/* All space after leading space terminate the string */
 		size = _tcslen(tmp) -1;
 		pos=0;

Modified: trunk/reactos/base/shell/cmd/internal.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/internal.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/internal.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/internal.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -281,7 +281,7 @@
 {
     TCHAR path[MAX_PATH];
     TCHAR *p = DirPath;
-    INT  n;
+    INT_PTR  n;
 
     if (CreateDirectory(DirPath, NULL))
         return TRUE;

Modified: trunk/reactos/base/shell/cmd/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/misc.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/misc.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/misc.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -281,7 +281,7 @@
 	LPTSTR start;
 	LPTSTR q;
 	INT  ac;
-	INT  len;
+	INT_PTR  len;
 
 	arg = cmd_alloc (sizeof (LPTSTR));
 	if (!arg)
@@ -360,7 +360,7 @@
 	LPTSTR start;
 	LPTSTR q;
 	INT  ac;
-	INT  len;
+	INT_PTR  len;
 
 	arg = cmd_alloc (sizeof (LPTSTR));
 	if (!arg)
@@ -505,7 +505,7 @@
 		len = dwRead;
 		if (end)
 		{
-			len = (end - lpString) + 1;
+			len = (INT)(end - lpString) + 1;
 			SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT);
 		}
 	}

Modified: trunk/reactos/base/shell/cmd/mklink.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/mklink.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/mklink.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/mklink.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -81,22 +81,22 @@
 	if (hJunction != INVALID_HANDLE_VALUE)
 	{
 		/* Allocate a buffer large enough to hold both strings, including trailing NULs */
-		DWORD TargetLen = wcslen(TargetFullPathW) * sizeof(WCHAR);
-		DWORD DataSize = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer)
-		                 + TargetNTPath.Length + sizeof(WCHAR)
-		                 + TargetLen           + sizeof(WCHAR);
+		SIZE_T TargetLen = wcslen(TargetFullPathW) * sizeof(WCHAR);
+		DWORD DataSize = (DWORD)(FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer)
+		                  + TargetNTPath.Length + sizeof(WCHAR)
+		                  + TargetLen           + sizeof(WCHAR));
 		PREPARSE_DATA_BUFFER Data = _alloca(DataSize);
 
 		/* Fill it out and use it to turn the directory into a reparse 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->MountPointReparseBuffer.SubstituteNameOffset = 0;
 		Data->MountPointReparseBuffer.SubstituteNameLength = TargetNTPath.Length;
 		wcscpy(Data->MountPointReparseBuffer.PathBuffer,
 		       TargetNTPath.Buffer);
 		Data->MountPointReparseBuffer.PrintNameOffset = TargetNTPath.Length + sizeof(WCHAR);
-		Data->MountPointReparseBuffer.PrintNameLength = TargetLen;
+		Data->MountPointReparseBuffer.PrintNameLength = (USHORT)TargetLen;
 		wcscpy((WCHAR *)((BYTE *)Data->MountPointReparseBuffer.PathBuffer
 		                 + Data->MountPointReparseBuffer.PrintNameOffset),
 		       TargetFullPathW);

Modified: trunk/reactos/base/shell/cmd/move.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/move.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/move.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/move.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -435,7 +435,7 @@
 							if (nDirLevel > 0)
 							{
 								TCHAR szTempPath[MAX_PATH];
-								INT nDiff;
+								INT_PTR nDiff;
 
 								FoundFile = TRUE; /* we need to continue our seek for files */
 								nDirLevel--;

Modified: trunk/reactos/base/shell/cmd/parser.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/parser.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/parser.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -411,7 +411,7 @@
 	return Cmd;
 }
 
-/* Parse a FOR command. 
+/* Parse a FOR command.
  * Syntax is: FOR [options] %var IN (list) DO command */
 static PARSED_COMMAND *ParseFor(void)
 {
@@ -536,7 +536,7 @@
 	PARSED_COMMAND *(*Func)(void);
 
 	TCHAR *Pos = _stpcpy(ParsedLine, CurrentToken) + 1;
-	DWORD TailOffset = Pos - ParsedLine;
+	DWORD_PTR TailOffset = Pos - ParsedLine;
 
 	/* Check for special forms */
 	if ((Func = ParseFor, _tcsicmp(ParsedLine, _T("for")) == 0) ||

Modified: trunk/reactos/base/shell/cmd/replace.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/replace.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/replace.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/replace.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -203,7 +203,8 @@
 INT recReplace(DWORD dwFlags, TCHAR szSrcPath[MAX_PATH], TCHAR szDestPath[MAX_PATH], BOOL *doMore)
 {
 	TCHAR tmpDestPath[MAX_PATH], tmpSrcPath[MAX_PATH];
-	INT filesReplaced=0, i;
+	INT filesReplaced=0;
+	INT_PTR i;
 	DWORD dwAttrib = 0;
 	HANDLE hFile;
 	WIN32_FIND_DATA findBuffer;
@@ -298,7 +299,8 @@
 	HANDLE hFile;
 	WIN32_FIND_DATA findBuffer;
 	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
 	   over all the files and directorys in the dest directory */

Modified: trunk/reactos/base/shell/cmd/set.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/set.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/set.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/set.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -212,7 +212,7 @@
 		while ( __iscsym(*p2) )
 			++p2;
 	}
-	return p2-p;
+	return (INT)(p2-p);
 }
 
 #define PARSE_IDENT(ident,identlen,p) \

Modified: trunk/reactos/base/shell/cmd/ver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/ver.c?rev=56258&r1=56257&r2=56258&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/ver.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/ver.c [iso-8859-1] Wed Mar 28 09:50:04 2012
@@ -36,7 +36,7 @@
 	if (GetVersionEx(&VersionInfo))
 	{
 		LPTSTR RosVersion;
-		unsigned RosVersionLen;
+		SIZE_T RosVersionLen;
 
 		RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1;
 		RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) -
@@ -76,7 +76,7 @@
 	{
 
 		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++)
 		{




More information about the Ros-diffs mailing list