- Fix some rtl warnings on /W3.

svn path=/trunk/; revision=25943
This commit is contained in:
Alex Ionescu 2007-03-02 07:21:33 +00:00
parent a0a19e46ae
commit ba689f332a
5 changed files with 20 additions and 41 deletions

View file

@ -366,7 +366,7 @@ RtlAddAtomToAtomTable(IN PRTL_ATOM_TABLE AtomTable,
Entry->ReferenceCount = 1; Entry->ReferenceCount = 1;
Entry->Flags = 0x0; Entry->Flags = 0x0;
Entry->NameLength = AtomNameLen; Entry->NameLength = (UCHAR)AtomNameLen;
RtlCopyMemory(Entry->Name, RtlCopyMemory(Entry->Name,
AtomName, AtomName,
(AtomNameLen + 1) * sizeof(WCHAR)); (AtomNameLen + 1) * sizeof(WCHAR));

View file

@ -65,9 +65,9 @@ RtlpCreateCriticalSectionSem(PRTL_CRITICAL_SECTION CriticalSection)
} }
DPRINT("Created Event: %p \n", hNewEvent); DPRINT("Created Event: %p \n", hNewEvent);
if ((hEvent = _InterlockedCompareExchangePointer((PVOID*)&CriticalSection->LockSemaphore, if ((hEvent = (HANDLE)_InterlockedCompareExchange((PLONG)&CriticalSection->LockSemaphore,
(PVOID)hNewEvent, (LONG)hNewEvent,
0))) { 0))) {
/* Some just created an event */ /* Some just created an event */
DPRINT("Closing already created event: %p\n", hNewEvent); DPRINT("Closing already created event: %p\n", hNewEvent);

View file

@ -111,7 +111,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
} }
/* Update length */ /* Update length */
DebugString.Length += Length; DebugString.Length += (USHORT)Length;
/* First, let the debugger know as well */ /* First, let the debugger know as well */
if (RtlpCheckForActiveDebugger(FALSE)) if (RtlpCheckForActiveDebugger(FALSE))
@ -270,11 +270,11 @@ DbgPrompt(IN PCCH Prompt,
STRING Input; STRING Input;
/* Setup the input string */ /* Setup the input string */
Input.MaximumLength = MaximumResponseLength; Input.MaximumLength = (USHORT)MaximumResponseLength;
Input.Buffer = Response; Input.Buffer = Response;
/* Setup the output string */ /* Setup the output string */
Output.Length = strlen (Prompt); Output.Length = strlen(Prompt);
Output.Buffer = Prompt; Output.Buffer = Prompt;
/* Call the system service */ /* Call the system service */
@ -284,7 +284,7 @@ DbgPrompt(IN PCCH Prompt,
/* /*
* @implemented * @implemented
*/ */
BOOLEAN NTSTATUS
NTAPI NTAPI
DbgQueryDebugFilterState(IN ULONG ComponentId, DbgQueryDebugFilterState(IN ULONG ComponentId,
IN ULONG Level) IN ULONG Level)

View file

@ -75,7 +75,7 @@ RtlEnlargedUnsignedDivide (
) )
{ {
if (Remainder) if (Remainder)
*Remainder = Dividend.QuadPart % Divisor; *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
return (ULONG)(Dividend.QuadPart / Divisor); return (ULONG)(Dividend.QuadPart / Divisor);
} }
@ -128,7 +128,7 @@ RtlExtendedLargeIntegerDivide (
LARGE_INTEGER RC; LARGE_INTEGER RC;
if (Remainder) if (Remainder)
*Remainder = Dividend.QuadPart % Divisor; *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
RC.QuadPart = Dividend.QuadPart / Divisor; RC.QuadPart = Dividend.QuadPart / Divisor;

View file

@ -25,7 +25,6 @@ typedef USHORT NODE_TYPE_CODE;
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
static
ULONG ULONG
NTAPI NTAPI
ComputeUnicodeNameLength(IN PUNICODE_STRING UnicodeName) ComputeUnicodeNameLength(IN PUNICODE_STRING UnicodeName)
@ -44,7 +43,6 @@ ComputeUnicodeNameLength(IN PUNICODE_STRING UnicodeName)
return NamesFound; return NamesFound;
} }
static
RTL_GENERIC_COMPARE_RESULTS RTL_GENERIC_COMPARE_RESULTS
NTAPI NTAPI
CompareUnicodeStrings(IN PUNICODE_STRING Prefix, CompareUnicodeStrings(IN PUNICODE_STRING Prefix,
@ -57,7 +55,6 @@ CompareUnicodeStrings(IN PUNICODE_STRING Prefix,
ULONG i; ULONG i;
WCHAR FoundPrefix, FoundString; WCHAR FoundPrefix, FoundString;
PWCHAR p, p1; PWCHAR p, p1;
DPRINT("CompareUnicodeStrings: %wZ %wZ\n", String, Prefix);
/* Handle case noticed in npfs when Prefix = '\' and name starts with '\' */ /* Handle case noticed in npfs when Prefix = '\' and name starts with '\' */
if ((PrefixLength == 1) && if ((PrefixLength == 1) &&
@ -157,7 +154,6 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
PUNICODE_PREFIX_TABLE_ENTRY CurrentEntry, PreviousEntry, Entry, NextEntry; PUNICODE_PREFIX_TABLE_ENTRY CurrentEntry, PreviousEntry, Entry, NextEntry;
PRTL_SPLAY_LINKS SplayLinks; PRTL_SPLAY_LINKS SplayLinks;
RTL_GENERIC_COMPARE_RESULTS Result; RTL_GENERIC_COMPARE_RESULTS Result;
DPRINT("RtlFindUnicodePrefix\n");
/* Find out how many names there are */ /* Find out how many names there are */
NameCount = ComputeUnicodeNameLength(FullName); NameCount = ComputeUnicodeNameLength(FullName);
@ -165,7 +161,7 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
/* Find the right spot where to start looking for this entry */ /* Find the right spot where to start looking for this entry */
PreviousEntry = (PUNICODE_PREFIX_TABLE_ENTRY)PrefixTable; PreviousEntry = (PUNICODE_PREFIX_TABLE_ENTRY)PrefixTable;
CurrentEntry = PreviousEntry->NextPrefixTree; CurrentEntry = PreviousEntry->NextPrefixTree;
while (CurrentEntry->NameLength > NameCount) while (CurrentEntry->NameLength > (CSHORT)NameCount)
{ {
/* Not a match, move to the next entry */ /* Not a match, move to the next entry */
PreviousEntry = CurrentEntry; PreviousEntry = CurrentEntry;
@ -175,21 +171,17 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
/* Loop every entry which has valid entries */ /* Loop every entry which has valid entries */
while (CurrentEntry->NameLength) while (CurrentEntry->NameLength)
{ {
DPRINT("CurrentEntry->NameLength 0x%x\n", CurrentEntry->NameLength);
/* Get the splay links and loop */ /* Get the splay links and loop */
SplayLinks = &CurrentEntry->Links; SplayLinks = &CurrentEntry->Links;
while (SplayLinks) while (SplayLinks)
{ {
/* Get the entry */ /* Get the entry */
DPRINT("SplayLinks %p\n", SplayLinks);
Entry = CONTAINING_RECORD(SplayLinks, Entry = CONTAINING_RECORD(SplayLinks,
UNICODE_PREFIX_TABLE_ENTRY, UNICODE_PREFIX_TABLE_ENTRY,
Links); Links);
/* Do the comparison */ /* Do the comparison */
Result = CompareUnicodeStrings(Entry->Prefix, FullName, 0); Result = CompareUnicodeStrings(Entry->Prefix, FullName, 0);
DPRINT("Result 0x%x\n", Result);
if (Result == GenericGreaterThan) if (Result == GenericGreaterThan)
{ {
/* Prefix is greater, so restart on the left child */ /* Prefix is greater, so restart on the left child */
@ -208,7 +200,6 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
* NOTE: An index of 0 means case-insensitive(ie, we'll be case * NOTE: An index of 0 means case-insensitive(ie, we'll be case
* insensitive since index 0, ie, all the time) * insensitive since index 0, ie, all the time)
*/ */
DPRINT("CaseInsensitiveIndex %lx\n", CaseInsensitiveIndex);
if (!CaseInsensitiveIndex) if (!CaseInsensitiveIndex)
{ {
/* /*
@ -242,7 +233,6 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
} }
/* Return the entry */ /* Return the entry */
DPRINT("RtlFindUnicodePrefix: %p\n", Entry);
return Entry; return Entry;
} }
@ -258,13 +248,11 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
(Result != GenericGreaterThan)) (Result != GenericGreaterThan))
{ {
/* This is a positive match, return it */ /* This is a positive match, return it */
DPRINT("RtlFindUnicodePrefix: %p\n", NextEntry);
return NextEntry; return NextEntry;
} }
/* No match yet, continue looping the circular list */ /* No match yet, continue looping the circular list */
NextEntry = NextEntry->CaseMatch; NextEntry = NextEntry->CaseMatch;
DPRINT("NextEntry %p\n", NextEntry);
} while (NextEntry != Entry); } while (NextEntry != Entry);
/* /*
@ -275,15 +263,13 @@ RtlFindUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
break; break;
} }
/* Splay links exausted, move to next entry */ /* Splay links exhausted, move to next entry */
PreviousEntry = CurrentEntry; PreviousEntry = CurrentEntry;
CurrentEntry = CurrentEntry->NextPrefixTree; CurrentEntry = CurrentEntry->NextPrefixTree;
DPRINT("CurrentEntry %p\n", CurrentEntry);
} }
/* If we got here, nothing was found */ /* If we got here, nothing was found */
DPRINT("RtlFindUnicodePrefix: %p\n", NULL); return NULL;
return NULL;
} }
/* /*
@ -293,7 +279,7 @@ VOID
NTAPI NTAPI
RtlInitializeUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable) RtlInitializeUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable)
{ {
/* Setup the table */ /* Setup the table */
PrefixTable->NameLength = 0; PrefixTable->NameLength = 0;
PrefixTable->LastNextEntry = NULL; PrefixTable->LastNextEntry = NULL;
PrefixTable->NodeTypeCode = PFX_NTC_TABLE; PrefixTable->NodeTypeCode = PFX_NTC_TABLE;
@ -313,20 +299,19 @@ RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
ULONG NameCount; ULONG NameCount;
RTL_GENERIC_COMPARE_RESULTS Result; RTL_GENERIC_COMPARE_RESULTS Result;
PRTL_SPLAY_LINKS SplayLinks; PRTL_SPLAY_LINKS SplayLinks;
DPRINT("RtlInsertUnicodePrefix\n");
/* Find out how many names there are */ /* Find out how many names there are */
NameCount = ComputeUnicodeNameLength(Prefix); NameCount = ComputeUnicodeNameLength(Prefix);
/* Set up the initial entry data */ /* Set up the initial entry data */
PrefixTableEntry->NameLength = NameCount; PrefixTableEntry->NameLength = (CSHORT)NameCount;
PrefixTableEntry->Prefix = Prefix; PrefixTableEntry->Prefix = Prefix;
RtlInitializeSplayLinks(&PrefixTableEntry->Links); RtlInitializeSplayLinks(&PrefixTableEntry->Links);
/* Find the right spot where to insert this entry */ /* Find the right spot where to insert this entry */
PreviousEntry = (PUNICODE_PREFIX_TABLE_ENTRY)PrefixTable; PreviousEntry = (PUNICODE_PREFIX_TABLE_ENTRY)PrefixTable;
CurrentEntry = PreviousEntry->NextPrefixTree; CurrentEntry = PreviousEntry->NextPrefixTree;
while (CurrentEntry->NameLength > NameCount) while (CurrentEntry->NameLength > (CSHORT)NameCount)
{ {
/* Not a match, move to the next entry */ /* Not a match, move to the next entry */
PreviousEntry = CurrentEntry; PreviousEntry = CurrentEntry;
@ -334,7 +319,7 @@ RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
} }
/* Check if we did find a tree by now */ /* Check if we did find a tree by now */
if (CurrentEntry->NameLength != NameCount) if (CurrentEntry->NameLength != (CSHORT)NameCount)
{ {
/* We didn't, so insert a new entry in the list */ /* We didn't, so insert a new entry in the list */
PreviousEntry->NextPrefixTree = PrefixTableEntry; PreviousEntry->NextPrefixTree = PrefixTableEntry;
@ -345,11 +330,10 @@ RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
PrefixTableEntry->CaseMatch = PrefixTableEntry; PrefixTableEntry->CaseMatch = PrefixTableEntry;
/* Quick return */ /* Quick return */
DPRINT("RtlInsertUnicodePrefix TRUE\n");
return TRUE; return TRUE;
} }
/* We found a tree, so star thte search loop */ /* We found a tree, so start the search loop */
Entry = CurrentEntry; Entry = CurrentEntry;
while (TRUE) while (TRUE)
{ {
@ -368,7 +352,6 @@ RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
(GenericEqual)) (GenericEqual))
{ {
/* We must fail the insert: it already exists */ /* We must fail the insert: it already exists */
DPRINT("RtlInsertUnicodePrefix FALSE\n");
return FALSE; return FALSE;
} }
@ -461,8 +444,7 @@ RtlInsertUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
Entry->NextPrefixTree = NextEntry; Entry->NextPrefixTree = NextEntry;
/* Return success */ /* Return success */
DPRINT("RtlInsertUnicodePrefix TRUE\n"); return TRUE;
return TRUE;
} }
/* /*
@ -475,7 +457,6 @@ RtlNextUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
{ {
PRTL_SPLAY_LINKS SplayLinks; PRTL_SPLAY_LINKS SplayLinks;
PUNICODE_PREFIX_TABLE_ENTRY Entry, CaseMatchEntry; PUNICODE_PREFIX_TABLE_ENTRY Entry, CaseMatchEntry;
DPRINT("RtlNextUnicodePrefix\n");
/* We might need this entry 2/3rd of the time, so cache it now */ /* We might need this entry 2/3rd of the time, so cache it now */
CaseMatchEntry = PrefixTable->LastNextEntry->CaseMatch; CaseMatchEntry = PrefixTable->LastNextEntry->CaseMatch;
@ -534,7 +515,6 @@ RtlNextUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
/* Save this entry as the last one returned, and return it */ /* Save this entry as the last one returned, and return it */
PrefixTable->LastNextEntry = Entry; PrefixTable->LastNextEntry = Entry;
DPRINT("RtlNextUnicodePrefix: %p\n", Entry);
return Entry; return Entry;
} }
@ -548,7 +528,6 @@ RtlRemoveUnicodePrefix(PUNICODE_PREFIX_TABLE PrefixTable,
{ {
PUNICODE_PREFIX_TABLE_ENTRY Entry, RefEntry, NewEntry; PUNICODE_PREFIX_TABLE_ENTRY Entry, RefEntry, NewEntry;
PRTL_SPLAY_LINKS SplayLinks; PRTL_SPLAY_LINKS SplayLinks;
DPRINT("RtlRemoveUnicodePrefix\n");
/* Erase the last entry */ /* Erase the last entry */
PrefixTable->LastNextEntry = NULL; PrefixTable->LastNextEntry = NULL;