mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 07:41:51 +00:00
- HAL: Make /W3 friendly
- Everywhere else: Use casts instead of -1U to fix C4146 (this is compatible with both compilers) svn path=/trunk/; revision=43167
This commit is contained in:
parent
53240a7115
commit
7e11f6d4bc
17 changed files with 31 additions and 31 deletions
|
@ -311,7 +311,7 @@ MsgBoxPrint(const char *Format, ...)
|
||||||
Length = _vsnprintf(Buffer, 512, Format, ap);
|
Length = _vsnprintf(Buffer, 512, Format, ap);
|
||||||
|
|
||||||
/* Check if we went past the buffer */
|
/* Check if we went past the buffer */
|
||||||
if (Length == -1U)
|
if (Length == (ULONG)-1)
|
||||||
{
|
{
|
||||||
/* Terminate it if we went over-board */
|
/* Terminate it if we went over-board */
|
||||||
Buffer[sizeof(Buffer) - 1] = '\n';
|
Buffer[sizeof(Buffer) - 1] = '\n';
|
||||||
|
|
|
@ -116,7 +116,7 @@ ColorsProc(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (red == -1U)
|
if (red == (DWORD)-1)
|
||||||
{
|
{
|
||||||
red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
|
red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
|
||||||
if (HIWORD(red))
|
if (HIWORD(red))
|
||||||
|
@ -127,7 +127,7 @@ ColorsProc(
|
||||||
red = LOBYTE(red);
|
red = LOBYTE(red);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (green == -1U)
|
if (green == (DWORD)-1)
|
||||||
{
|
{
|
||||||
green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0);
|
green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0);
|
||||||
if (HIWORD(green))
|
if (HIWORD(green))
|
||||||
|
@ -138,7 +138,7 @@ ColorsProc(
|
||||||
green = LOBYTE(green);
|
green = LOBYTE(green);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blue == -1U)
|
if (blue == (DWORD)-1)
|
||||||
{
|
{
|
||||||
blue = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0);
|
blue = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0);
|
||||||
if (HIWORD(blue))
|
if (HIWORD(blue))
|
||||||
|
|
|
@ -160,7 +160,7 @@ LayoutProc(
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0));
|
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_LEFT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(xres, 0));
|
||||||
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0));
|
SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_WINDOW_POS_TOP), UDM_SETRANGE, 0, (LPARAM)MAKELONG(yres, 0));
|
||||||
|
|
||||||
if (pConInfo->WindowPosition != -1U)
|
if (pConInfo->WindowPosition != (DWORD)-1)
|
||||||
{
|
{
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, LOWORD(pConInfo->WindowPosition), FALSE);
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, LOWORD(pConInfo->WindowPosition), FALSE);
|
||||||
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, HIWORD(pConInfo->WindowPosition), FALSE);
|
SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, HIWORD(pConInfo->WindowPosition), FALSE);
|
||||||
|
|
|
@ -968,7 +968,7 @@ OnDrawItem(UINT idCtl,
|
||||||
GetSysColor(COLOR_WINDOWTEXT));
|
GetSysColor(COLOR_WINDOWTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpdis->itemID != -1U)
|
if (lpdis->itemID != (UINT)-1)
|
||||||
{
|
{
|
||||||
CopyRect(&rc, &lpdis->rcItem);
|
CopyRect(&rc, &lpdis->rcItem);
|
||||||
rc.left += 5;
|
rc.left += 5;
|
||||||
|
|
|
@ -232,7 +232,7 @@ ProcessIdToHandle(IN DWORD dwProcessId)
|
||||||
CLIENT_ID ClientId;
|
CLIENT_ID ClientId;
|
||||||
|
|
||||||
/* If we don't have a PID, look it up */
|
/* If we don't have a PID, look it up */
|
||||||
if (dwProcessId == -1U) dwProcessId = (DWORD)CsrGetProcessId();
|
if (dwProcessId == (DWORD)-1) dwProcessId = (DWORD)CsrGetProcessId();
|
||||||
|
|
||||||
/* Open a handle to the process */
|
/* Open a handle to the process */
|
||||||
ClientId.UniqueThread = NULL;
|
ClientId.UniqueThread = NULL;
|
||||||
|
|
|
@ -534,7 +534,7 @@ SetFilePointer(HANDLE hFile,
|
||||||
*lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
|
*lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FilePosition.CurrentByteOffset.u.LowPart == -1U)
|
if (FilePosition.CurrentByteOffset.u.LowPart == (DWORD)-1)
|
||||||
{
|
{
|
||||||
/* The value of -1 is valid here, especially when the new
|
/* The value of -1 is valid here, especially when the new
|
||||||
file position is greater than 4 GB. Since NtSetInformationFile
|
file position is greater than 4 GB. Since NtSetInformationFile
|
||||||
|
|
|
@ -21,7 +21,7 @@ static DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
|
||||||
|
|
||||||
/* global vars */
|
/* global vars */
|
||||||
/* Do not assume it have the free value -1 set, any value can be in here */
|
/* Do not assume it have the free value -1 set, any value can be in here */
|
||||||
DWORD OPENGL32_tls = -1U;
|
DWORD OPENGL32_tls = -1;
|
||||||
GLPROCESSDATA OPENGL32_processdata;
|
GLPROCESSDATA OPENGL32_processdata;
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ OPENGL32_ProcessAttach( void )
|
||||||
TRUE /* bInheritHandle */ };
|
TRUE /* bInheritHandle */ };
|
||||||
|
|
||||||
OPENGL32_tls = TlsAlloc();
|
OPENGL32_tls = TlsAlloc();
|
||||||
if (-1U == OPENGL32_tls)
|
if ((DWORD)-1 == OPENGL32_tls)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
|
memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
|
||||||
|
@ -179,7 +179,7 @@ OPENGL32_ProcessDetach( void )
|
||||||
CloseHandle( OPENGL32_processdata.dcdata_mutex );
|
CloseHandle( OPENGL32_processdata.dcdata_mutex );
|
||||||
|
|
||||||
/* free TLS */
|
/* free TLS */
|
||||||
if (OPENGL32_tls != -1U)
|
if (OPENGL32_tls != (DWORD)-1)
|
||||||
TlsFree(OPENGL32_tls);
|
TlsFree(OPENGL32_tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1991,7 +1991,7 @@ HalAllocateCrashDumpRegisters(IN PADAPTER_OBJECT AdapterObject,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Check if nothing was found */
|
/* Check if nothing was found */
|
||||||
if (MapRegisterNumber == -1U)
|
if (MapRegisterNumber == (ULONG)-1)
|
||||||
{
|
{
|
||||||
/* No free registers found, so use the base registers */
|
/* No free registers found, so use the base registers */
|
||||||
RtlSetBits(MasterAdapter->MapRegisters,
|
RtlSetBits(MasterAdapter->MapRegisters,
|
||||||
|
|
|
@ -572,7 +572,7 @@ HalpAssignPCISlotResources(IN PBUS_HANDLER BusHandler,
|
||||||
{
|
{
|
||||||
ResourceCount++;
|
ResourceCount++;
|
||||||
|
|
||||||
Offset = FIELD_OFFSET(PCI_COMMON_CONFIG, u.type0.BaseAddresses[Address]);
|
Offset = (UCHAR)FIELD_OFFSET(PCI_COMMON_CONFIG, u.type0.BaseAddresses[Address]);
|
||||||
|
|
||||||
/* Write 0xFFFFFFFF there */
|
/* Write 0xFFFFFFFF there */
|
||||||
WriteBuffer = 0xffffffff;
|
WriteBuffer = 0xffffffff;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#define IOAPIC_REDTBL 0x0010 /* Redirection Table (0-23 64-bit registers) (R/W) */
|
#define IOAPIC_REDTBL 0x0010 /* Redirection Table (0-23 64-bit registers) (R/W) */
|
||||||
|
|
||||||
#define IOAPIC_ID_MASK (0xF << 24)
|
#define IOAPIC_ID_MASK (0xF << 24)
|
||||||
#define GET_IOAPIC_ID(x) (((x) & IOAPIC_ID_MASK) >> 24)
|
#define GET_IOAPIC_ID(x) ((UCHAR)(((x) & IOAPIC_ID_MASK) >> 24))
|
||||||
#define SET_IOAPIC_ID(x) ((x) << 24)
|
#define SET_IOAPIC_ID(x) ((x) << 24)
|
||||||
|
|
||||||
#define IOAPIC_VER_MASK (0xFF)
|
#define IOAPIC_VER_MASK (0xFF)
|
||||||
|
@ -68,8 +68,8 @@ typedef struct _IOAPIC_ROUTE_ENTRY {
|
||||||
|
|
||||||
typedef struct _IOAPIC_INFO
|
typedef struct _IOAPIC_INFO
|
||||||
{
|
{
|
||||||
ULONG ApicId; /* APIC ID */
|
UCHAR ApicId; /* APIC ID */
|
||||||
ULONG ApicVersion; /* APIC version */
|
UCHAR ApicVersion; /* APIC version */
|
||||||
ULONG ApicAddress; /* APIC address */
|
ULONG ApicAddress; /* APIC address */
|
||||||
ULONG EntryCount; /* Number of redirection entries */
|
ULONG EntryCount; /* Number of redirection entries */
|
||||||
} IOAPIC_INFO, *PIOAPIC_INFO;
|
} IOAPIC_INFO, *PIOAPIC_INFO;
|
||||||
|
|
|
@ -823,7 +823,7 @@ APICCalibrateTimer(ULONG CPU)
|
||||||
if (TSCPresent)
|
if (TSCPresent)
|
||||||
{
|
{
|
||||||
t2.QuadPart = (LONGLONG)__rdtsc();
|
t2.QuadPart = (LONGLONG)__rdtsc();
|
||||||
CPUMap[CPU].CoreSpeed = (HZ * (t2.QuadPart - t1.QuadPart));
|
CPUMap[CPU].CoreSpeed = (HZ * (ULONG)(t2.QuadPart - t1.QuadPart));
|
||||||
DPRINT("CPU clock speed is %ld.%04ld MHz.\n",
|
DPRINT("CPU clock speed is %ld.%04ld MHz.\n",
|
||||||
CPUMap[CPU].CoreSpeed/1000000,
|
CPUMap[CPU].CoreSpeed/1000000,
|
||||||
CPUMap[CPU].CoreSpeed%1000000);
|
CPUMap[CPU].CoreSpeed%1000000);
|
||||||
|
@ -856,10 +856,10 @@ SetInterruptGate(ULONG index, ULONG address)
|
||||||
Access.SegmentType = I386_INTERRUPT_GATE;
|
Access.SegmentType = I386_INTERRUPT_GATE;
|
||||||
|
|
||||||
idt = (KIDTENTRY*)((ULONG)KeGetPcr()->IDT + index * sizeof(KIDTENTRY));
|
idt = (KIDTENTRY*)((ULONG)KeGetPcr()->IDT + index * sizeof(KIDTENTRY));
|
||||||
idt->Offset = address & 0xffff;
|
idt->Offset = (USHORT)(address & 0xffff);
|
||||||
idt->Selector = KGDT_R0_CODE;
|
idt->Selector = KGDT_R0_CODE;
|
||||||
idt->Access = Access.Value;
|
idt->Access = Access.Value;
|
||||||
idt->ExtendedOffset = address >> 16;
|
idt->ExtendedOffset = (USHORT)(address >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID HaliInitBSP(VOID)
|
VOID HaliInitBSP(VOID)
|
||||||
|
|
|
@ -661,7 +661,7 @@ HaliReconfigurePciInterrupts(VOID)
|
||||||
|
|
||||||
VOID Disable8259AIrq(ULONG irq)
|
VOID Disable8259AIrq(ULONG irq)
|
||||||
{
|
{
|
||||||
ULONG tmp;
|
UCHAR tmp;
|
||||||
|
|
||||||
if (irq >= 8)
|
if (irq >= 8)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ HaliMPFamily(ULONG Family,
|
||||||
static VOID
|
static VOID
|
||||||
HaliMPProcessorInfo(PMP_CONFIGURATION_PROCESSOR m)
|
HaliMPProcessorInfo(PMP_CONFIGURATION_PROCESSOR m)
|
||||||
{
|
{
|
||||||
ULONG ver;
|
UCHAR ver;
|
||||||
|
|
||||||
if (!(m->CpuFlags & CPU_FLAG_ENABLED))
|
if (!(m->CpuFlags & CPU_FLAG_ENABLED))
|
||||||
return;
|
return;
|
||||||
|
@ -176,7 +176,7 @@ HaliMPProcessorInfo(PMP_CONFIGURATION_PROCESSOR m)
|
||||||
static VOID
|
static VOID
|
||||||
HaliMPBusInfo(PMP_CONFIGURATION_BUS m)
|
HaliMPBusInfo(PMP_CONFIGURATION_BUS m)
|
||||||
{
|
{
|
||||||
static ULONG CurrentPCIBusId = 0;
|
static UCHAR CurrentPCIBusId = 0;
|
||||||
|
|
||||||
DPRINT("Bus #%d is %.*s\n", m->BusId, 6, m->BusType);
|
DPRINT("Bus #%d is %.*s\n", m->BusId, 6, m->BusType);
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ static VOID
|
||||||
HaliConstructDefaultIOIrqMPTable(ULONG Type)
|
HaliConstructDefaultIOIrqMPTable(ULONG Type)
|
||||||
{
|
{
|
||||||
MP_CONFIGURATION_INTSRC intsrc;
|
MP_CONFIGURATION_INTSRC intsrc;
|
||||||
ULONG i;
|
UCHAR i;
|
||||||
|
|
||||||
intsrc.Type = MPCTE_INTSRC;
|
intsrc.Type = MPCTE_INTSRC;
|
||||||
intsrc.IrqFlag = 0; /* conforming */
|
intsrc.IrqFlag = 0; /* conforming */
|
||||||
|
@ -394,8 +394,8 @@ HaliConstructDefaultISAMPTable(ULONG Type)
|
||||||
MP_CONFIGURATION_BUS bus;
|
MP_CONFIGURATION_BUS bus;
|
||||||
MP_CONFIGURATION_IOAPIC ioapic;
|
MP_CONFIGURATION_IOAPIC ioapic;
|
||||||
MP_CONFIGURATION_INTLOCAL lintsrc;
|
MP_CONFIGURATION_INTLOCAL lintsrc;
|
||||||
ULONG linttypes[2] = { INT_EXTINT, INT_NMI };
|
UCHAR linttypes[2] = { INT_EXTINT, INT_NMI };
|
||||||
ULONG i;
|
UCHAR i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2 CPUs, numbered 0 & 1.
|
* 2 CPUs, numbered 0 & 1.
|
||||||
|
|
|
@ -80,7 +80,7 @@ typedef ULONG HCELL_INDEX, *PHCELL_INDEX;
|
||||||
//
|
//
|
||||||
// Cell Magic Values
|
// Cell Magic Values
|
||||||
//
|
//
|
||||||
#define HCELL_NIL -1U
|
#define HCELL_NIL (ULONG)-1
|
||||||
#define HCELL_CACHED 1
|
#define HCELL_CACHED 1
|
||||||
|
|
||||||
#define HCELL_TYPE_MASK 0x80000000
|
#define HCELL_TYPE_MASK 0x80000000
|
||||||
|
|
|
@ -61,7 +61,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
|
||||||
EXCEPTION_RECORD ExceptionRecord;
|
EXCEPTION_RECORD ExceptionRecord;
|
||||||
|
|
||||||
/* Check if we should print it or not */
|
/* Check if we should print it or not */
|
||||||
if ((ComponentId != -1U) &&
|
if ((ComponentId != (ULONG)-1) &&
|
||||||
!(NtQueryDebugFilterState(ComponentId, Level)))
|
!(NtQueryDebugFilterState(ComponentId, Level)))
|
||||||
{
|
{
|
||||||
/* This message is masked */
|
/* This message is masked */
|
||||||
|
@ -96,7 +96,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
/* Check if we went past the buffer */
|
/* Check if we went past the buffer */
|
||||||
if (Length == -1U)
|
if (Length == (ULONG)-1)
|
||||||
{
|
{
|
||||||
/* Terminate it if we went over-board */
|
/* Terminate it if we went over-board */
|
||||||
Buffer[sizeof(Buffer) - 1] = '\n';
|
Buffer[sizeof(Buffer) - 1] = '\n';
|
||||||
|
|
|
@ -466,7 +466,7 @@ ExpLoadInitialProcess(IN PINIT_BUFFER InitBuffer,
|
||||||
|
|
||||||
/* Make sure the buffer is a valid string which within the given length */
|
/* Make sure the buffer is a valid string which within the given length */
|
||||||
if ((NtInitialUserProcessBufferType != REG_SZ) ||
|
if ((NtInitialUserProcessBufferType != REG_SZ) ||
|
||||||
((NtInitialUserProcessBufferLength != -1U) &&
|
((NtInitialUserProcessBufferLength != (ULONG)-1) &&
|
||||||
((NtInitialUserProcessBufferLength < sizeof(WCHAR)) ||
|
((NtInitialUserProcessBufferLength < sizeof(WCHAR)) ||
|
||||||
(NtInitialUserProcessBufferLength >
|
(NtInitialUserProcessBufferLength >
|
||||||
sizeof(NtInitialUserProcessBuffer) - sizeof(WCHAR)))))
|
sizeof(NtInitialUserProcessBuffer) - sizeof(WCHAR)))))
|
||||||
|
@ -1429,7 +1429,7 @@ Phase1InitializationDiscard(IN PVOID Context)
|
||||||
if (!ExpRealTimeIsUniversal)
|
if (!ExpRealTimeIsUniversal)
|
||||||
{
|
{
|
||||||
/* Check if we don't have a valid bias */
|
/* Check if we don't have a valid bias */
|
||||||
if (ExpLastTimeZoneBias == -1U)
|
if (ExpLastTimeZoneBias == (ULONG)-1)
|
||||||
{
|
{
|
||||||
/* Reset */
|
/* Reset */
|
||||||
ResetBias = TRUE;
|
ResetBias = TRUE;
|
||||||
|
|
|
@ -443,7 +443,7 @@ PspInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
/* Now multiply limits by 1MB */
|
/* Now multiply limits by 1MB */
|
||||||
PspDefaultPagedLimit <<= 20;
|
PspDefaultPagedLimit <<= 20;
|
||||||
PspDefaultNonPagedLimit <<= 20;
|
PspDefaultNonPagedLimit <<= 20;
|
||||||
if (PspDefaultPagefileLimit != -1U) PspDefaultPagefileLimit <<= 20;
|
if (PspDefaultPagefileLimit != (ULONG)-1) PspDefaultPagefileLimit <<= 20;
|
||||||
|
|
||||||
/* Initialize the Active Process List */
|
/* Initialize the Active Process List */
|
||||||
InitializeListHead(&PsActiveProcessHead);
|
InitializeListHead(&PsActiveProcessHead);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue