From cb1539b7df635a0add672d6b33b6a86f49b60cf2 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 10 Feb 2012 17:36:11 +0000 Subject: [PATCH] [RTL] Fix64 bit warnings svn path=/trunk/; revision=55527 --- reactos/include/ndk/rtlfuncs.h | 6 +++--- reactos/lib/rtl/atom.c | 2 +- reactos/lib/rtl/path.c | 34 +++++++++++++++++----------------- reactos/lib/rtl/res.c | 3 ++- reactos/lib/rtl/slist.c | 6 +++--- reactos/lib/rtl/time.c | 2 +- reactos/lib/rtl/unicode.c | 3 +-- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/reactos/include/ndk/rtlfuncs.h b/reactos/include/ndk/rtlfuncs.h index 4ec355f5a67..235c2d836e7 100644 --- a/reactos/include/ndk/rtlfuncs.h +++ b/reactos/include/ndk/rtlfuncs.h @@ -2533,8 +2533,8 @@ RtlDosSearchPath_Ustr( 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 @@ RtlGetFullPathName_UstrEx( IN PSIZE_T FilePartSize, OUT PBOOLEAN NameInvalid, OUT RTL_PATH_TYPE* PathType, - OUT PULONG LengthNeeded + OUT PSIZE_T LengthNeeded ); NTSYSAPI diff --git a/reactos/lib/rtl/atom.c b/reactos/lib/rtl/atom.c index dde6658346f..aa09ae71e90 100644 --- a/reactos/lib/rtl/atom.c +++ b/reactos/lib/rtl/atom.c @@ -349,7 +349,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable, simply add it to the list */ if (HashLink != NULL) { - ULONG AtomNameLen = wcslen(AtomName); + ULONG AtomNameLen = (ULONG)wcslen(AtomName); if (AtomNameLen > RTL_MAXIMUM_ATOM_LENGTH) { diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index 3fc824f6063..78b79a10aea 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -138,7 +138,7 @@ RtlIsDosDeviceName_Ustr(IN PCUNICODE_STRING PathString) ((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 @@ RtlIsDosDeviceName_Ustr(IN PCUNICODE_STRING PathString) 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 @@ RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative, 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 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path) 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, /* 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, } /* 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 @@ RtlGetFullPathName_UstrEx(IN PUNICODE_STRING FileName, /* 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 @@ RtlDosSearchPath_Ustr(IN ULONG Flags, 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 @@ RtlDosSearchPath_Ustr(IN ULONG Flags, /* 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 @@ RtlDosSearchPath_Ustr(IN ULONG Flags, *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); diff --git a/reactos/lib/rtl/res.c b/reactos/lib/rtl/res.c index 91ed90fab8c..4c296fe8171 100644 --- a/reactos/lib/rtl/res.c +++ b/reactos/lib/rtl/res.c @@ -133,7 +133,8 @@ IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( IMAGE_RESOURCE_DIRECTORY *dir, { 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); diff --git a/reactos/lib/rtl/slist.c b/reactos/lib/rtl/slist.c index 4d291abe70e..fe96ab6248d 100644 --- a/reactos/lib/rtl/slist.c +++ b/reactos/lib/rtl/slist.c @@ -58,13 +58,13 @@ RtlFirstEntrySList(IN const SLIST_HEADER *ListHead) #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 diff --git a/reactos/lib/rtl/time.c b/reactos/lib/rtl/time.c index 0a6f68505a7..5433c3a15fe 100644 --- a/reactos/lib/rtl/time.c +++ b/reactos/lib/rtl/time.c @@ -37,7 +37,7 @@ #endif -static const int YearLengths[2] = +static const unsigned int YearLengths[2] = { DAYSPERNORMALYEAR, DAYSPERLEAPYEAR }; diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index c91d04cbd81..16eb6112791 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -2525,8 +2525,7 @@ RtlFindCharInUnicodeString( 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);