Date: Sat, 26 Sep 2009 10:27:14 -0400
From: ionucu(a)videotron.ca
To: ros-dev(a)reactos.org
CC: ros-diffs(a)reactos.org
Subject: Re: [ros-dev] [ros-diffs] [sginsberg] 43167: - HAL: Make /W3
friendly - Everywhere else: Use casts instead of -1U to fix C4146 (this
is
compatible with both compilers)
No.
0xFFFFFFFF.
Best regards,
Alex Ionescu
On Sat, Sep 26, 2009 at 9:41 AM, <sginsberg(a)svn.reactos.org> wrote:
> Author: sginsberg
> Date: Sat Sep 26 15:41:57 2009
> New Revision: 43167
>
> URL:
http://svn.reactos.org/svn/reactos?rev=43167&view=rev
> Log:
> - HAL: Make /W3 friendly
> - Everywhere else: Use casts instead of -1U to fix C4146 (this is
> compatible with both compilers)
>
> Modified:
> trunk/reactos/boot/freeldr/freeldr/debug.c
> trunk/reactos/dll/cpl/console/colors.c
> trunk/reactos/dll/cpl/console/layout.c
> trunk/reactos/dll/cpl/main/mouse.c
> trunk/reactos/dll/win32/kernel32/debug/debugger.c
> trunk/reactos/dll/win32/kernel32/file/file.c
> trunk/reactos/dll/win32/opengl32/opengl32.c
> trunk/reactos/hal/halx86/generic/dma.c
> trunk/reactos/hal/halx86/generic/pci.c
> trunk/reactos/hal/halx86/include/ioapic.h
> trunk/reactos/hal/halx86/mp/apic.c
> trunk/reactos/hal/halx86/mp/ioapic.c
> trunk/reactos/hal/halx86/mp/mpconfig.c
> trunk/reactos/lib/cmlib/hivedata.h
> trunk/reactos/lib/rtl/debug.c
> trunk/reactos/ntoskrnl/ex/init.c
> trunk/reactos/ntoskrnl/ps/psmgr.c
>
> Modified: trunk/reactos/boot/freeldr/freeldr/debug.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/debug…
>
>
> ==============================================================================
> --- trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1]
> (original)
> +++ trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] Sat Sep
> 26
> 15:41:57 2009
> @@ -311,7 +311,7 @@
> Length = _vsnprintf(Buffer, 512, Format, ap);
>
> /* Check if we went past the buffer */
> - if (Length == -1U)
> + if (Length == (ULONG)-1)
> {
> /* Terminate it if we went over-board */
> Buffer[sizeof(Buffer) - 1] = '\n';
>
> Modified: trunk/reactos/dll/cpl/console/colors.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/colors.c?r…
>
>
> ==============================================================================
> --- trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] (original)
> +++ trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -116,7 +116,7 @@
> break;
> }
>
> - if (red == -1U)
> + if (red == (DWORD)-1)
> {
> red = SendMessage(GetDlgItem(hwndDlg,
> IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
> if (HIWORD(red))
> @@ -127,7 +127,7 @@
> red = LOBYTE(red);
> }
>
> - if (green == -1U)
> + if (green == (DWORD)-1)
> {
> green =
> SendMessage(GetDlgItem(hwndDlg,
> IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0);
> if (HIWORD(green))
> @@ -138,7 +138,7 @@
> green = LOBYTE(green);
> }
>
> - if (blue == -1U)
> + if (blue == (DWORD)-1)
> {
> blue = SendMessage(GetDlgItem(hwndDlg,
> IDC_UPDOWN_COLOR_BLUE), UDM_GETPOS, 0, 0);
> if (HIWORD(blue))
>
> Modified: trunk/reactos/dll/cpl/console/layout.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/layout.c?r…
>
>
> ==============================================================================
> --- trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] (original)
> +++ trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -160,7 +160,7 @@
> 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));
>
> - 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_TOP, HIWORD(pConInfo->WindowPosition), FALSE);
>
> Modified: trunk/reactos/dll/cpl/main/mouse.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/mouse.c?rev=4…
>
>
> ==============================================================================
> --- trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] (original)
> +++ trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] Sat Sep 26
> 15:41:57
> 2009
> @@ -968,7 +968,7 @@
> GetSysColor(COLOR_WINDOWTEXT));
> }
>
> - if (lpdis->itemID != -1U)
> + if (lpdis->itemID != (UINT)-1)
> {
> CopyRect(&rc, &lpdis->rcItem);
> rc.left += 5;
>
> Modified: trunk/reactos/dll/win32/kernel32/debug/debugger.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/debug/d…
>
>
> ==============================================================================
> --- trunk/reactos/dll/win32/kernel32/debug/debugger.c [iso-8859-1]
> (original)
> +++ trunk/reactos/dll/win32/kernel32/debug/debugger.c [iso-8859-1]
> Sat
> Sep 26 15:41:57 2009
> @@ -232,7 +232,7 @@
> CLIENT_ID ClientId;
>
> /* 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 */
> ClientId.UniqueThread = NULL;
>
> Modified: trunk/reactos/dll/win32/kernel32/file/file.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/fi…
>
>
> ==============================================================================
> --- trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1]
> (original)
> +++ trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1] Sat Sep
> 26
> 15:41:57 2009
> @@ -534,7 +534,7 @@
> *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
> file position is greater than 4 GB. Since
> NtSetInformationFile
>
> Modified: trunk/reactos/dll/win32/opengl32/opengl32.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/opengl32/opengl3…
>
>
> ==============================================================================
> --- trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1]
> (original)
> +++ trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1] Sat Sep
> 26
> 15:41:57 2009
> @@ -21,7 +21,7 @@
>
> /* global vars */
> /* 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;
>
>
> @@ -103,7 +103,7 @@
> TRUE /* bInheritHandle */ };
>
> OPENGL32_tls = TlsAlloc();
> - if (-1U == OPENGL32_tls)
> + if ((DWORD)-1 == OPENGL32_tls)
> return FALSE;
>
> memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata)
> );
> @@ -179,7 +179,7 @@
> CloseHandle( OPENGL32_processdata.dcdata_mutex );
>
> /* free TLS */
> - if (OPENGL32_tls != -1U)
> + if (OPENGL32_tls != (DWORD)-1)
> TlsFree(OPENGL32_tls);
> }
>
>
> Modified: trunk/reactos/hal/halx86/generic/dma.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/dma.c?r…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -1991,7 +1991,7 @@
> 0);
>
> /* Check if nothing was found */
> - if (MapRegisterNumber == -1U)
> + if (MapRegisterNumber == (ULONG)-1)
> {
> /* No free registers found, so use the base registers */
> RtlSetBits(MasterAdapter->MapRegisters,
>
> Modified: trunk/reactos/hal/halx86/generic/pci.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/pci.c?r…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/generic/pci.c [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/generic/pci.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -572,7 +572,7 @@
> {
> 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 */
> WriteBuffer = 0xffffffff;
>
> Modified: trunk/reactos/hal/halx86/include/ioapic.h
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/ioapic.…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/include/ioapic.h [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/include/ioapic.h [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -15,7 +15,7 @@
> #define IOAPIC_REDTBL 0x0010 /* Redirection Table (0-23 64-bit
> registers) (R/W) */
>
> #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 IOAPIC_VER_MASK (0xFF)
> @@ -68,8 +68,8 @@
>
> typedef struct _IOAPIC_INFO
> {
> - ULONG ApicId; /* APIC ID */
> - ULONG ApicVersion; /* APIC version */
> + UCHAR ApicId; /* APIC ID */
> + UCHAR ApicVersion; /* APIC version */
> ULONG ApicAddress; /* APIC address */
> ULONG EntryCount; /* Number of redirection entries */
> } IOAPIC_INFO, *PIOAPIC_INFO;
>
> Modified: trunk/reactos/hal/halx86/mp/apic.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/apic.c?rev=4…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] Sat Sep 26
> 15:41:57
> 2009
> @@ -823,7 +823,7 @@
> if (TSCPresent)
> {
> 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",
> CPUMap[CPU].CoreSpeed/1000000,
> CPUMap[CPU].CoreSpeed%1000000);
> @@ -856,10 +856,10 @@
> Access.SegmentType = I386_INTERRUPT_GATE;
>
> idt = (KIDTENTRY*)((ULONG)KeGetPcr()->IDT + index *
> sizeof(KIDTENTRY));
> - idt->Offset = address & 0xffff;
> + idt->Offset = (USHORT)(address & 0xffff);
> idt->Selector = KGDT_R0_CODE;
> idt->Access = Access.Value;
> - idt->ExtendedOffset = address >> 16;
> + idt->ExtendedOffset = (USHORT)(address >> 16);
> }
>
> VOID HaliInitBSP(VOID)
>
> Modified: trunk/reactos/hal/halx86/mp/ioapic.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/ioapic.c?rev…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/mp/ioapic.c [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/mp/ioapic.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -661,7 +661,7 @@
>
> VOID Disable8259AIrq(ULONG irq)
> {
> - ULONG tmp;
> + UCHAR tmp;
>
> if (irq >= 8)
> {
>
> Modified: trunk/reactos/hal/halx86/mp/mpconfig.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/mpconfig.c?r…
>
>
> ==============================================================================
> --- trunk/reactos/hal/halx86/mp/mpconfig.c [iso-8859-1] (original)
> +++ trunk/reactos/hal/halx86/mp/mpconfig.c [iso-8859-1] Sat Sep 26
> 15:41:57 2009
> @@ -83,7 +83,7 @@
> static VOID
> HaliMPProcessorInfo(PMP_CONFIGURATION_PROCESSOR m)
> {
> - ULONG ver;
> + UCHAR ver;
>
> if (!(m->CpuFlags & CPU_FLAG_ENABLED))
> return;
> @@ -176,7 +176,7 @@
> static VOID
> HaliMPBusInfo(PMP_CONFIGURATION_BUS m)
> {
> - static ULONG CurrentPCIBusId = 0;
> + static UCHAR CurrentPCIBusId = 0;
>
> DPRINT("Bus #%d is %.*s\n", m->BusId, 6, m->BusType);
>
> @@ -357,7 +357,7 @@
> HaliConstructDefaultIOIrqMPTable(ULONG Type)
> {
> MP_CONFIGURATION_INTSRC intsrc;
> - ULONG i;
> + UCHAR i;
>
> intsrc.Type = MPCTE_INTSRC;
> intsrc.IrqFlag = 0; /* conforming */
> @@ -394,8 +394,8 @@
> MP_CONFIGURATION_BUS bus;
> MP_CONFIGURATION_IOAPIC ioapic;
> MP_CONFIGURATION_INTLOCAL lintsrc;
> - ULONG linttypes[2] = { INT_EXTINT, INT_NMI };
> - ULONG i;
> + UCHAR linttypes[2] = { INT_EXTINT, INT_NMI };
> + UCHAR i;
>
> /*
> * 2 CPUs, numbered 0 & 1.
>
> Modified: trunk/reactos/lib/cmlib/hivedata.h
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=4…
>
>
> ==============================================================================
> --- trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] (original)
> +++ trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] Sat Sep 26
> 15:41:57
> 2009
> @@ -80,7 +80,7 @@
> //
> // Cell Magic Values
> //
> -#define HCELL_NIL -1U
> +#define HCELL_NIL (ULONG)-1
> #define HCELL_CACHED 1
>
> #define HCELL_TYPE_MASK 0x80000000
>
> Modified: trunk/reactos/lib/rtl/debug.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/debug.c?rev=43167&…
>
>
> ==============================================================================
> --- trunk/reactos/lib/rtl/debug.c [iso-8859-1] (original)
> +++ trunk/reactos/lib/rtl/debug.c [iso-8859-1] Sat Sep 26 15:41:57
> 2009
> @@ -61,7 +61,7 @@
> EXCEPTION_RECORD ExceptionRecord;
>
> /* Check if we should print it or not */
> - if ((ComponentId != -1U) &&
> + if ((ComponentId != (ULONG)-1) &&
> !(NtQueryDebugFilterState(ComponentId, Level)))
> {
> /* This message is masked */
> @@ -96,7 +96,7 @@
> _SEH2_END;
>
> /* Check if we went past the buffer */
> - if (Length == -1U)
> + if (Length == (ULONG)-1)
> {
> /* Terminate it if we went over-board */
> Buffer[sizeof(Buffer) - 1] = '\n';
>
> Modified: trunk/reactos/ntoskrnl/ex/init.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=431…
>
>
> ==============================================================================
> --- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sat Sep 26 15:41:57
> 2009
> @@ -466,7 +466,7 @@
>
> /* Make sure the buffer is a valid string which within the given
> length */
> if ((NtInitialUserProcessBufferType != REG_SZ) ||
> - ((NtInitialUserProcessBufferLength != -1U) &&
> + ((NtInitialUserProcessBufferLength != (ULONG)-1) &&
> ((NtInitialUserProcessBufferLength < sizeof(WCHAR)) ||
> (NtInitialUserProcessBufferLength >
> sizeof(NtInitialUserProcessBuffer) - sizeof(WCHAR)))))
> @@ -1429,7 +1429,7 @@
> if (!ExpRealTimeIsUniversal)
> {
> /* Check if we don't have a valid bias */
> - if (ExpLastTimeZoneBias == -1U)
> + if (ExpLastTimeZoneBias == (ULONG)-1)
> {
> /* Reset */
> ResetBias = TRUE;
>
> Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
> URL:
>
>
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=43…
>
>
> ==============================================================================
> --- trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] Sat Sep 26
> 15:41:57
> 2009
> @@ -443,7 +443,7 @@
> /* Now multiply limits by 1MB */
> PspDefaultPagedLimit <<= 20;
> PspDefaultNonPagedLimit <<= 20;
> - if (PspDefaultPagefileLimit != -1U) PspDefaultPagefileLimit <<=
> 20;
> + if (PspDefaultPagefileLimit != (ULONG)-1)
> PspDefaultPagefileLimit
> <<= 20;
>
> /* Initialize the Active Process List */
> InitializeListHead(&PsActiveProcessHead);
>
>
>
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev
________________________________
Windows Live™: Keep your life in sync. Check it out!
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org