[ros-diffs] [tkreuzer] 55527: [RTL] Fix64 bit warnings

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Feb 10 17:36:11 UTC 2012


Author: tkreuzer
Date: Fri Feb 10 17:36:11 2012
New Revision: 55527

URL: http://svn.reactos.org/svn/reactos?rev=55527&view=rev
Log:
[RTL]
Fix64 bit warnings

Modified:
    trunk/reactos/include/ndk/rtlfuncs.h
    trunk/reactos/lib/rtl/atom.c
    trunk/reactos/lib/rtl/path.c
    trunk/reactos/lib/rtl/res.c
    trunk/reactos/lib/rtl/slist.c
    trunk/reactos/lib/rtl/time.c
    trunk/reactos/lib/rtl/unicode.c

Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -2533,8 +2533,8 @@
     IN PUNICODE_STRING CallerBuffer,
     IN OUT PUNICODE_STRING DynamicString OPTIONAL,
     OUT PUNICODE_STRING* FullNameOut OPTIONAL,
-    OUT PULONG FilePartSize OPTIONAL,
-    OUT PULONG LengthNeeded OPTIONAL
+    OUT PSIZE_T FilePartSize OPTIONAL,
+    OUT PSIZE_T LengthNeeded OPTIONAL
 );
 
 NTSYSAPI
@@ -2608,7 +2608,7 @@
     IN PSIZE_T FilePartSize,
     OUT PBOOLEAN NameInvalid,
     OUT RTL_PATH_TYPE* PathType,
-    OUT PULONG LengthNeeded
+    OUT PSIZE_T LengthNeeded
 );
 
 NTSYSAPI

Modified: trunk/reactos/lib/rtl/atom.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/atom.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/atom.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/atom.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -349,7 +349,7 @@
            simply add it to the list */
         if (HashLink != NULL)
           {
-             ULONG AtomNameLen = wcslen(AtomName);
+             ULONG AtomNameLen = (ULONG)wcslen(AtomName);
 
              if (AtomNameLen > RTL_MAXIMUM_ATOM_LENGTH)
              {

Modified: trunk/reactos/lib/rtl/path.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -138,7 +138,7 @@
                     ((c == 'l') || (c == 'c') || (c == 'p') || (c == 'a') || (c == 'n')))
                 {
                     /* Calculate the offset */
-                    ReturnOffset = (PCHAR)End - (PCHAR)PathCopy.Buffer;
+                    ReturnOffset = (USHORT)((PCHAR)End - (PCHAR)PathCopy.Buffer);
 
                     /* Build the final string */
                     PathCopy.Length = OriginalLength - ReturnOffset - (ColonCount * sizeof(WCHAR));
@@ -179,7 +179,7 @@
     while ((Start > PathCopy.Buffer) && (Start[-1] == ' ')) --Start;
 
     /* Finally see how many characters are left, and that's our size */
-    PathChars = Start - PathCopy.Buffer;
+    PathChars = (USHORT)(Start - PathCopy.Buffer);
     PathCopy.Length = PathChars * sizeof(WCHAR);
 
     /* Check if this is a COM or LPT port, which has a digit after it */
@@ -641,13 +641,13 @@
                     RtlReleasePebLock();
                     return Status;
                 }
- 
+
                 /* File is in current directory */
                 if (RtlEqualUnicodeString(&FullPath, &CurrentDirectory->DosPath, TRUE))
                 {
                     /* Make relative name string */
                     RelativeName->RelativeName.Buffer = (PWSTR)((ULONG_PTR)NewBuffer + FullPath.Length - PrefixCut);
-                    RelativeName->RelativeName.Length = PathLength - FullPath.Length;
+                    RelativeName->RelativeName.Length = (USHORT)(PathLength - FullPath.Length);
                     /* If relative name starts with \, skip it */
                     if (RelativeName->RelativeName.Buffer[0] == L'\\')
                     {
@@ -1116,7 +1116,7 @@
         CurDirHandle = (HANDLE)((ULONG_PTR)CurDirHandle | RTL_CURDIR_IS_REMOVABLE);
     }
 
-    FullPath.Length = FullPathLength;
+    FullPath.Length = (USHORT)FullPathLength;
 
     /* If full path isn't \ terminated, do it */
     if (FullPath.Buffer[CharLength - 1] != L'\\')
@@ -1784,7 +1784,7 @@
                           IN PSIZE_T FilePartSize,
                           OUT PBOOLEAN NameInvalid,
                           OUT RTL_PATH_TYPE* PathType,
-                          OUT PULONG LengthNeeded)
+                          OUT PSIZE_T LengthNeeded)
 {
     NTSTATUS Status;
     PWCHAR StaticBuffer;
@@ -1846,7 +1846,7 @@
     if ((StaticString) && (Length < StaticLength))
     {
         /* Set the final length */
-        StaticString->Length = Length;
+        StaticString->Length = (USHORT)Length;
 
         /* Set the file part size */
         if (FilePartSize) *FilePartSize = ShortName ? (ShortName - StaticString->Buffer) : 0;
@@ -1878,7 +1878,7 @@
 
         /* Set the settings for the dynamic string the caller sent */
         DynamicString->MaximumLength = StaticLength;
-        DynamicString->Length = Length;
+        DynamicString->Length = (USHORT)Length;
         DynamicString->Buffer = StaticBuffer;
 
         /* Set the part size */
@@ -1914,7 +1914,7 @@
     if ((StaticString) && (Length < StaticLength))
     {
         /* Set the final length */
-        StaticString->Length = Length;
+        StaticString->Length = (USHORT)Length;
 
         /* Set the file part size */
         if (FilePartSize) *FilePartSize = ShortName ? (ShortName - StaticString->Buffer) : 0;
@@ -1946,7 +1946,7 @@
     }
 
     /* Add space for a NULL terminator, and now check the full path */
-    TempDynamicString.MaximumLength = Length + sizeof(UNICODE_NULL);
+    TempDynamicString.MaximumLength = (USHORT)Length + sizeof(UNICODE_NULL);
     Length = RtlGetFullPathName_Ustr(FileName,
                                      Length,
                                      TempDynamicString.Buffer,
@@ -1979,7 +1979,7 @@
 
     /* Finalize the string and return it to the user */
     DynamicString->Buffer = TempDynamicString.Buffer;
-    DynamicString->Length = Length;
+    DynamicString->Length = (USHORT)Length;
     DynamicString->MaximumLength = TempDynamicString.MaximumLength;
     if (StringUsed) *StringUsed = DynamicString;
 
@@ -2027,16 +2027,16 @@
                       IN PUNICODE_STRING CallerBuffer,
                       IN OUT PUNICODE_STRING DynamicString OPTIONAL,
                       OUT PUNICODE_STRING* FullNameOut OPTIONAL,
-                      OUT PULONG FilePartSize OPTIONAL,
-                      OUT PULONG LengthNeeded OPTIONAL)
+                      OUT PSIZE_T FilePartSize OPTIONAL,
+                      OUT PSIZE_T LengthNeeded OPTIONAL)
 {
     WCHAR StaticCandidateBuffer[MAX_PATH];
     UNICODE_STRING StaticCandidateString;
     NTSTATUS Status;
     RTL_PATH_TYPE PathType;
     PWCHAR p, End, CandidateEnd, SegmentEnd;
-    ULONG SegmentSize, NamePlusExtLength, PathSize, MaxPathSize = 0, WorstCaseLength, ByteCount;
-    USHORT ExtensionLength = 0;
+    SIZE_T SegmentSize, ByteCount, PathSize, MaxPathSize = 0;
+    USHORT NamePlusExtLength, WorstCaseLength, ExtensionLength = 0;
     PUNICODE_STRING FullIsolatedPath;
     DPRINT("DOS Path Search: %lx %wZ %wZ %wZ %wZ %wZ\n",
             Flags, PathString, FileNameString, ExtensionString, CallerBuffer, DynamicString);
@@ -2177,7 +2177,7 @@
         /* Use the extension, the file name, and the largest path as the size */
         WorstCaseLength = ExtensionLength +
                           FileNameString->Length +
-                          MaxPathSize +
+                          (USHORT)MaxPathSize +
                           sizeof(UNICODE_NULL);
         if (WorstCaseLength > UNICODE_STRING_MAX_BYTES)
         {
@@ -2292,7 +2292,7 @@
             *CandidateEnd = UNICODE_NULL;
 
             /* Now set the final length of the string so it becomes valid */
-            StaticCandidateString.Length = (CandidateEnd -
+            StaticCandidateString.Length = (USHORT)(CandidateEnd -
                                             StaticCandidateString.Buffer) *
                                            sizeof(WCHAR);
 

Modified: trunk/reactos/lib/rtl/res.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/res.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/res.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/res.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -133,7 +133,8 @@
 {
     const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
     const IMAGE_RESOURCE_DIR_STRING_U *str;
-    int min, max, res, pos, namelen;
+    int min, max, res, pos;
+    size_t namelen;
 
     if (!((ULONG_PTR)name & 0xFFFF0000)) return find_entry_by_id( dir, (ULONG_PTR)name & 0xFFFF, root, want_dir );
     entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);

Modified: trunk/reactos/lib/rtl/slist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/slist.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/slist.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/slist.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -58,13 +58,13 @@
 #endif
 }
 
-WORD  
+WORD
 NTAPI
 RtlQueryDepthSList(IN PSLIST_HEADER ListHead)
 {
 #ifdef _WIN64
-    return ListHead->Header8.HeaderType ? 
-        ListHead->Header16.Sequence : ListHead->Header8.Sequence;
+    return ListHead->Header8.HeaderType ?
+        (WORD)ListHead->Header16.Sequence : (WORD)ListHead->Header8.Sequence;
 #else
     return ListHead->Depth;
 #endif

Modified: trunk/reactos/lib/rtl/time.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/time.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/time.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/time.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -37,7 +37,7 @@
 #endif
 
 
-static const int YearLengths[2] =
+static const unsigned int YearLengths[2] =
 {
     DAYSPERNORMALYEAR, DAYSPERLEAPYEAR
 };

Modified: trunk/reactos/lib/rtl/unicode.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=55527&r1=55526&r2=55527&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Fri Feb 10 17:36:11 2012
@@ -2525,8 +2525,7 @@
     BOOLEAN Found;
     const BOOLEAN WantToFind = (Flags & RTL_FIND_CHAR_IN_UNICODE_STRING_COMPLEMENT_CHAR_SET) == 0;
     const BOOLEAN CaseInSensitive = (Flags & RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE) != 0;
-    INT Length;
-    INT i;
+    USHORT i, Length;
 
     DPRINT("RtlFindCharInUnicodeString(%u, '%wZ', '%wZ', %p)\n",
            Flags, SearchString, MatchString, Position);




More information about the Ros-diffs mailing list