Remove some explicit comparisons with TRUE and make desired explicit comparison more obvious.
Patch by Love Nystrom, modified by me. Fixes a bug in RtlUpcaseUnicodeString. Not committed: modifications to freetype, since this is 3rd party code.
CORE-8799


svn path=/trunk/; revision=65419
This commit is contained in:
Timo Kreuzer 2014-11-16 14:07:37 +00:00
parent 71b471e27e
commit 6e7c087233
13 changed files with 26 additions and 25 deletions

View file

@ -44,7 +44,7 @@ CmComparePackedNames(
{ {
ULONG i; ULONG i;
if (NamePacked == TRUE) if (NamePacked)
{ {
PUCHAR PackedName = (PUCHAR)Name; PUCHAR PackedName = (PUCHAR)Name;
@ -153,7 +153,7 @@ CmCopyPackedName(
ASSERT(Name != 0); ASSERT(Name != 0);
ASSERT(NameLength != 0); ASSERT(NameLength != 0);
if (NamePacked == TRUE) if (NamePacked)
{ {
NameLength *= sizeof(WCHAR); NameLength *= sizeof(WCHAR);
CharCount = min(BufferLength, NameLength) / sizeof(WCHAR); CharCount = min(BufferLength, NameLength) / sizeof(WCHAR);

View file

@ -184,7 +184,7 @@ HidParser_GetReportItemTypeCountFromReportType(
// //
// check item type // check item type
// //
if (Report->Items[Index].HasData && bData == TRUE) if (Report->Items[Index].HasData && bData)
{ {
// //
// found data item // found data item

View file

@ -139,9 +139,9 @@ HidParser_GetCollectionDescription(
DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE); DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE);
DeviceDescription->ReportIDs[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) == TRUE ? 1 : 0); DeviceDescription->ReportIDs[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) ? 1 : 0);
DeviceDescription->ReportIDs[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) == TRUE ? 1 : 0); DeviceDescription->ReportIDs[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) ? 1 : 0);
DeviceDescription->ReportIDs[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) == TRUE ? 1 : 0); DeviceDescription->ReportIDs[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) ? 1 : 0);
// //

View file

@ -570,7 +570,7 @@ HidParser_InitReportItem(
ReportItem->BitCount = GlobalItemState->ReportSize; ReportItem->BitCount = GlobalItemState->ReportSize;
ReportItem->HasData = (ItemData->DataConstant == FALSE); ReportItem->HasData = (ItemData->DataConstant == FALSE);
ReportItem->Array = (ItemData->ArrayVariable == 0); ReportItem->Array = (ItemData->ArrayVariable == 0);
ReportItem->Relative = (ItemData->Relative == TRUE); ReportItem->Relative = (ItemData->Relative != FALSE);
ReportItem->Minimum = LogicalMinimum; ReportItem->Minimum = LogicalMinimum;
ReportItem->Maximum = LogicalMaximum; ReportItem->Maximum = LogicalMaximum;
ReportItem->UsageMinimum = UsageMinimum; ReportItem->UsageMinimum = UsageMinimum;

View file

@ -63,8 +63,9 @@ VOID DisplayIPPacket(
UINT Length; UINT Length;
PCHAR CharBuffer; PCHAR CharBuffer;
if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE) || /* DbgQueryDebugFilterState returns (NTSTATUS)TRUE, (NTSTATUS)FALSE or a failure status code */
(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK) != TRUE)) { if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != (NTSTATUS)TRUE) ||
(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK) != (NTSTATUS)TRUE)) {
return; return;
} }

View file

@ -57,7 +57,7 @@ MmeSetState(
/* Store audio stream pause state */ /* Store audio stream pause state */
SoundDeviceInstance->bPaused = !bStart; SoundDeviceInstance->bPaused = !bStart;
if (SoundDeviceInstance->bPaused == FALSE && OldState == TRUE) if (SoundDeviceInstance->bPaused == FALSE && OldState)
{ {
InitiateSoundStreaming(SoundDeviceInstance); InitiateSoundStreaming(SoundDeviceInstance);
} }

View file

@ -1586,7 +1586,7 @@ MMixerHandleAlternativeMixers(
MMixerIsTopologyPinReserved(Topology, Index, &Reserved); MMixerIsTopologyPinReserved(Topology, Index, &Reserved);
/* check if it has already been reserved */ /* check if it has already been reserved */
if (Reserved == TRUE) if (Reserved)
{ {
/* pin has already been reserved */ /* pin has already been reserved */
continue; continue;

View file

@ -64,7 +64,7 @@ vDbgPrintExWithPrefixInternal(IN PCCH Prefix,
/* Check if we should print it or not */ /* Check if we should print it or not */
if ((ComponentId != MAXULONG) && if ((ComponentId != MAXULONG) &&
(NtQueryDebugFilterState(ComponentId, Level)) != TRUE) (NtQueryDebugFilterState(ComponentId, Level)) != (NTSTATUS)TRUE)
{ {
/* This message is masked */ /* This message is masked */
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -535,7 +535,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
} }
Value->Length = 0; Value->Length = 0;
if (SysEnvUsed == TRUE) if (SysEnvUsed)
RtlAcquirePebLock(); RtlAcquirePebLock();
wcs = Environment; wcs = Environment;
@ -573,7 +573,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
Status = STATUS_BUFFER_TOO_SMALL; Status = STATUS_BUFFER_TOO_SMALL;
} }
if (SysEnvUsed == TRUE) if (SysEnvUsed)
RtlReleasePebLock(); RtlReleasePebLock();
return(Status); return(Status);
@ -582,7 +582,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
wcs++; wcs++;
} }
if (SysEnvUsed == TRUE) if (SysEnvUsed)
RtlReleasePebLock(); RtlReleasePebLock();
DPRINT("Return STATUS_VARIABLE_NOT_FOUND: %wZ\n", Name); DPRINT("Return STATUS_VARIABLE_NOT_FOUND: %wZ\n", Name);

View file

@ -105,7 +105,7 @@ start:
goto done; goto done;
} }
wait: wait:
if (Wait == TRUE) if (Wait)
{ {
Resource->ExclusiveWaiters++; Resource->ExclusiveWaiters++;
@ -120,10 +120,10 @@ wait:
} }
else /* one or more shared locks are in progress */ else /* one or more shared locks are in progress */
{ {
if (Wait == TRUE) if (Wait)
goto wait; goto wait;
} }
if (retVal == TRUE) if (retVal)
Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread; Resource->OwningThread = NtCurrentTeb()->ClientId.UniqueThread;
done: done:
RtlLeaveCriticalSection(&Resource->Lock); RtlLeaveCriticalSection(&Resource->Lock);
@ -154,7 +154,7 @@ start:
goto done; goto done;
} }
if (Wait == TRUE) if (Wait)
{ {
Resource->SharedWaiters++; Resource->SharedWaiters++;
RtlLeaveCriticalSection(&Resource->Lock); RtlLeaveCriticalSection(&Resource->Lock);

View file

@ -106,7 +106,7 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
{ {
/* Compute the cutover time of the first day of the current month */ /* Compute the cutover time of the first day of the current month */
AdjustedTimeFields.Year = CurrentTimeFields.Year; AdjustedTimeFields.Year = CurrentTimeFields.Year;
if (NextYearsCutover == TRUE) if (NextYearsCutover)
AdjustedTimeFields.Year++; AdjustedTimeFields.Year++;
AdjustedTimeFields.Month = CutoverTimeFields->Month; AdjustedTimeFields.Month = CutoverTimeFields->Month;
@ -146,8 +146,8 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime)) if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
return FALSE; return FALSE;
if (ThisYearsCutoverOnly == TRUE || if (ThisYearsCutoverOnly ||
NextYearsCutover == TRUE || NextYearsCutover ||
CutoverSystemTime.QuadPart >= CurrentTime->QuadPart) CutoverSystemTime.QuadPart >= CurrentTime->QuadPart)
{ {
break; break;

View file

@ -1809,7 +1809,7 @@ RtlUpcaseUnicodeString(
PAGED_CODE_RTL(); PAGED_CODE_RTL();
if (AllocateDestinationString == TRUE) if (AllocateDestinationString)
{ {
UniDest->MaximumLength = UniSource->Length; UniDest->MaximumLength = UniSource->Length;
UniDest->Buffer = RtlpAllocateStringMemory(UniDest->MaximumLength, TAG_USTR); UniDest->Buffer = RtlpAllocateStringMemory(UniDest->MaximumLength, TAG_USTR);
@ -2620,7 +2620,7 @@ RtlDnsHostNameToComputerName(PUNICODE_STRING ComputerName, PUNICODE_STRING DnsHo
ComputerNameOem.Length = (USHORT)ComputerNameOemNLength; ComputerNameOem.Length = (USHORT)ComputerNameOemNLength;
ComputerNameOem.MaximumLength = (USHORT)(MAX_COMPUTERNAME_LENGTH + 1); ComputerNameOem.MaximumLength = (USHORT)(MAX_COMPUTERNAME_LENGTH + 1);
if (RtlpDidUnicodeToOemWork(DnsHostName, &ComputerNameOem) == TRUE) if (RtlpDidUnicodeToOemWork(DnsHostName, &ComputerNameOem))
{ {
/* no unmapped character so convert it back to an unicode string */ /* no unmapped character so convert it back to an unicode string */
Status = RtlOemStringToUnicodeString(ComputerName, Status = RtlOemStringToUnicodeString(ComputerName,

View file

@ -83,7 +83,7 @@ void msvcrt_free_mt_locks(void)
/* Uninitialize the table */ /* Uninitialize the table */
for( i=0; i < _TOTAL_LOCKS; i++ ) for( i=0; i < _TOTAL_LOCKS; i++ )
{ {
if( lock_table[ i ].bInit == TRUE ) if( lock_table[ i ].bInit )
{ {
msvcrt_uninitialize_mlock( i ); msvcrt_uninitialize_mlock( i );
} }