[ros-diffs] [sginsberg] 43192: - Use MAXUINT, MAXULONG, MAXDWORD, MAXULONGLONG and MAXULONGLONG instead of ~0 or casting -1 to unsigned. - bintype.c: Use INVALID_SET_FILE_POINTER instead of (DWORD)-1. - irp.c: KsGetNodeIdFromIrp returns KSFILTER_NODE (which is -1). - basetsd.h: Add missing MAXUINT and MAXULONGLONG. - typedefs.h: Add MAXULONG for mkhive. - elf.inc.h and pe.c: Remove incorrect and unneeded MAXULONG define.

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Sun Sep 27 22:07:43 CEST 2009


Author: sginsberg
Date: Sun Sep 27 22:07:43 2009
New Revision: 43192

URL: http://svn.reactos.org/svn/reactos?rev=43192&view=rev
Log:
- Use MAXUINT, MAXULONG, MAXDWORD, MAXULONGLONG and MAXULONGLONG instead of ~0 or casting -1 to unsigned.
- bintype.c: Use INVALID_SET_FILE_POINTER instead of (DWORD)-1.
- irp.c: KsGetNodeIdFromIrp returns KSFILTER_NODE (which is -1).
- basetsd.h: Add missing MAXUINT and MAXULONGLONG.
- typedefs.h: Add MAXULONG for mkhive.
- elf.inc.h and pe.c: Remove incorrect and unneeded MAXULONG define.

Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
    trunk/reactos/boot/freeldr/freeldr/debug.c
    trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c
    trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.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/bintype.c
    trunk/reactos/dll/win32/kernel32/file/file.c
    trunk/reactos/dll/win32/kernel32/misc/error.c
    trunk/reactos/dll/win32/opengl32/opengl32.c
    trunk/reactos/drivers/bus/pci/pdo.c
    trunk/reactos/drivers/filesystems/msfs/finfo.c
    trunk/reactos/drivers/ksfilter/ks/allocators.c
    trunk/reactos/drivers/ksfilter/ks/irp.c
    trunk/reactos/drivers/ksfilter/ks/topology.c
    trunk/reactos/drivers/serial/serial/serial.h
    trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp
    trunk/reactos/drivers/wdm/audio/filters/splitter/splitter.c
    trunk/reactos/drivers/wdm/audio/legacy/stream/pnp.c
    trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
    trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c
    trunk/reactos/hal/halppc/generic/dma.c
    trunk/reactos/hal/halx86/generic/dma.c
    trunk/reactos/include/host/typedefs.h
    trunk/reactos/include/psdk/basetsd.h
    trunk/reactos/lib/cmlib/hivedata.h
    trunk/reactos/lib/rtl/bitmap.c
    trunk/reactos/lib/rtl/debug.c
    trunk/reactos/lib/rtl/heap.c
    trunk/reactos/lib/rtl/rangelist.c
    trunk/reactos/lib/rtl/registry.c
    trunk/reactos/lib/rtl/unicode.c
    trunk/reactos/ntoskrnl/ex/init.c
    trunk/reactos/ntoskrnl/fstub/disksup.c
    trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
    trunk/reactos/ntoskrnl/kdbg/kdb.c
    trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
    trunk/reactos/ntoskrnl/ke/i386/irqobj.c
    trunk/reactos/ntoskrnl/mm/elf.inc.h
    trunk/reactos/ntoskrnl/mm/i386/pagepae.c
    trunk/reactos/ntoskrnl/mm/pe.c
    trunk/reactos/ntoskrnl/po/power.c
    trunk/reactos/ntoskrnl/ps/psmgr.c
    trunk/reactos/ntoskrnl/ps/query.c

Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -815,7 +815,7 @@
     if (ModuleData) {
 
         /* Make sure this is the right module and that it hasn't been closed */
-        if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == (ULONG_PTR)-1)) {
+        if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == MAXULONG_PTR)) {
 
             /* Close the Module */
             ModuleData->ModEnd = ModuleData->ModStart + ModuleSize;

Modified: trunk/reactos/boot/freeldr/freeldr/debug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/debug.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -311,7 +311,7 @@
 	Length = _vsnprintf(Buffer, 512, Format, ap);
 
 	/* Check if we went past the buffer */
-	if (Length == (ULONG)-1)
+	if (Length == MAXULONG)
 	{
 		/* Terminate it if we went over-board */
 		Buffer[sizeof(Buffer) - 1] = '\n';

Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -292,7 +292,7 @@
         {
             CurrentOffset += DataRunLength * Volume->ClusterSize;
             DataRun = NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
-            if (DataRunLength != (ULONGLONG)-1)
+            if (DataRunLength != MAXULONGLONG)
             {
                 DataRunStartLCN = LastLCN + DataRunOffset;
                 LastLCN = DataRunStartLCN;

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -177,7 +177,7 @@
     if (ModuleData) {
         
         /* Make sure this is the right module and that it hasn't been closed */
-        if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == (ULONG_PTR)-1)) {
+        if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == MAXULONG_PTR)) {
             
             /* Close the Module */
             ModuleData->ModEnd = ModuleData->ModStart + ModuleSize;

Modified: trunk/reactos/dll/cpl/console/colors.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/colors.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/colors.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -44,9 +44,9 @@
 	LPNMUPDOWN lpnmud;
     LPPSHNOTIFY lppsn;
 	LPDRAWITEMSTRUCT drawItem;
-	DWORD red = -1;
-	DWORD green = -1;
-	DWORD blue = -1;
+	DWORD red = MAXDWORD;
+	DWORD green = MAXDWORD;
+	DWORD blue = MAXDWORD;
 
 	pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER);
 
@@ -116,7 +116,7 @@
 				break;
 			}
 
-			if (red == (DWORD)-1)
+			if (red == MAXDWORD)
 			{
 				red = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_RED), UDM_GETPOS, 0, 0);
 				if (HIWORD(red))
@@ -127,7 +127,7 @@
 				red = LOBYTE(red);
 			}
 
-			if (green == (DWORD)-1)
+			if (green == MAXDWORD)
 			{
 				green = SendMessage(GetDlgItem(hwndDlg, IDC_UPDOWN_COLOR_GREEN), UDM_GETPOS, 0, 0);
 				if (HIWORD(green))
@@ -138,7 +138,7 @@
 				green = LOBYTE(green);
 			}
 
-			if (blue == (DWORD)-1)
+			if (blue == MAXDWORD)
 			{
 				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?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/layout.c [iso-8859-1] Sun Sep 27 22:07:43 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 != (DWORD)-1)
+			if (pConInfo->WindowPosition != MAXDWORD)
 			{
 				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=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/main/mouse.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -968,7 +968,7 @@
                    GetSysColor(COLOR_WINDOWTEXT));
     }
 
-    if (lpdis->itemID != (UINT)-1)
+    if (lpdis->itemID != MAXUINT)
     {
         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/debugger.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/debug/debugger.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/debug/debugger.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -232,7 +232,7 @@
     CLIENT_ID ClientId;
 
     /* If we don't have a PID, look it up */
-    if (dwProcessId == (DWORD)-1) dwProcessId = (DWORD)CsrGetProcessId();
+    if (dwProcessId == MAXDWORD) dwProcessId = (DWORD)CsrGetProcessId();
 
     /* Open a handle to the process */
     ClientId.UniqueThread = NULL;

Modified: trunk/reactos/dll/win32/kernel32/file/bintype.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/bintype.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/bintype.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/bintype.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -38,7 +38,7 @@
   CurPos = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
 
   /* read modref table */
-  if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_modtab, NULL, FILE_BEGIN) == (DWORD)-1) ||
+  if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_modtab, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) ||
      (!(modtab = HeapAlloc(GetProcessHeap(), 0, ne->ne_cmod * sizeof(WORD)))) ||
      (!(ReadFile(hFile, modtab, ne->ne_cmod * sizeof(WORD), &Read, NULL))) ||
      (Read != (DWORD)ne->ne_cmod * sizeof(WORD)))
@@ -47,7 +47,7 @@
   }
 
   /* read imported names table */
-  if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_imptab, NULL, FILE_BEGIN) == (DWORD)-1) ||
+  if((SetFilePointer(hFile, mz->e_lfanew + ne->ne_imptab, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) ||
      (!(nametab = HeapAlloc(GetProcessHeap(), 0, ne->ne_enttab - ne->ne_imptab))) ||
      (!(ReadFile(hFile, nametab, ne->ne_enttab - ne->ne_imptab, &Read, NULL))) ||
      (Read != (DWORD)ne->ne_enttab - ne->ne_imptab))
@@ -100,7 +100,7 @@
   char magic[4];
   DWORD Read;
 
-  if((SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == (DWORD)-1) ||
+  if((SetFilePointer(hFile, 0, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) ||
      (!ReadFile(hFile, &Header, sizeof(Header), &Read, NULL) ||
       (Read != sizeof(Header))))
   {
@@ -143,7 +143,7 @@
      * This will tell us if there is more header information
      * to read or not.
      */
-    if((SetFilePointer(hFile, Header.mz.e_lfanew, NULL, FILE_BEGIN) == (DWORD)-1) ||
+    if((SetFilePointer(hFile, Header.mz.e_lfanew, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) ||
        (!ReadFile(hFile, magic, sizeof(magic), &Read, NULL) ||
         (Read != sizeof(magic))))
     {

Modified: trunk/reactos/dll/win32/kernel32/file/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/file.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/file.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -534,7 +534,7 @@
         *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
      }
 
-   if (FilePosition.CurrentByteOffset.u.LowPart == (DWORD)-1)
+   if (FilePosition.CurrentByteOffset.u.LowPart == MAXDWORD)
      {
        /* 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/kernel32/misc/error.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/error.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/error.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/error.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -75,7 +75,7 @@
 
             /* do an alertable wait if necessary */
             if (NT_SUCCESS(Status) &&
-                (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != (DWORD)-1)
+                (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != MAXDWORD)
             {
                 SleepEx(dwDuration,
                         TRUE);

Modified: trunk/reactos/dll/win32/opengl32/opengl32.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/opengl32/opengl32.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/opengl32/opengl32.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -20,8 +20,8 @@
 
 
 /* global vars */
-/* Do not assume it have the free value -1 set, any value can be in here */
-DWORD OPENGL32_tls = -1;
+/* Do not assume it have the free value MAXDWORD set, any value can be in here */
+DWORD OPENGL32_tls = MAXDWORD;
 GLPROCESSDATA OPENGL32_processdata;
 
 
@@ -103,7 +103,7 @@
                                    TRUE /* bInheritHandle */ };
 
     OPENGL32_tls = TlsAlloc();
-    if ((DWORD)-1 == OPENGL32_tls)
+    if (OPENGL32_tls == MAXDWORD)
         return FALSE;
 
     memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
@@ -179,7 +179,7 @@
         CloseHandle( OPENGL32_processdata.dcdata_mutex );
 
     /* free TLS */
-    if (OPENGL32_tls != (DWORD)-1)
+    if (OPENGL32_tls != MAXDWORD)
         TlsFree(OPENGL32_tls);
 }
 

Modified: trunk/reactos/drivers/bus/pci/pdo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -176,7 +176,7 @@
 
   DeviceCapabilities->UniqueID = FALSE;
   DeviceCapabilities->Address = ((DeviceNumber << 16) & 0xFFFF0000) + (FunctionNumber & 0xFFFF);
-  DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */
+  DeviceCapabilities->UINumber = MAXULONG; /* FIXME */
 
   return STATUS_SUCCESS;
 }
@@ -213,7 +213,7 @@
   *Base = BaseValue;
 
   /* Set magic value */
-  NewValue = (ULONG)-1;
+  NewValue = MAXULONG;
   Size= HalSetBusDataByOffset(PCIConfiguration,
                               DeviceExtension->PciDevice->BusNumber,
                               DeviceExtension->PciDevice->SlotNumber.u.AsULONG,

Modified: trunk/reactos/drivers/filesystems/msfs/finfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/finfo.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/finfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/finfo.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -16,8 +16,8 @@
 
 #undef MAILSLOT_NO_MESSAGE
 #undef MAILSLOT_WAIT_FOREVER
-#define MAILSLOT_NO_MESSAGE	((ULONG)-1)
-#define MAILSLOT_WAIT_FOREVER	((ULONG)-1)
+#define MAILSLOT_NO_MESSAGE   MAXULONG
+#define MAILSLOT_WAIT_FOREVER MAXULONG
 
 
 /* FUNCTIONS *****************************************************************/

Modified: trunk/reactos/drivers/ksfilter/ks/allocators.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/allocators.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -668,7 +668,7 @@
 
     /* verify framing */
     if ((Framing->FramingItem[0].Flags & KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT) &&
-         Framing->OutputCompression.RatioNumerator != (ULONG)-1 &&
+         Framing->OutputCompression.RatioNumerator != MAXULONG &&
          Framing->OutputCompression.RatioDenominator != 0 &&
          Framing->OutputCompression.RatioDenominator < Framing->OutputCompression.RatioNumerator)
     {

Modified: trunk/reactos/drivers/ksfilter/ks/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -2078,6 +2078,6 @@
     IN PIRP Irp)
 {
     UNIMPLEMENTED
-    return (ULONG)-1;
-}
-
+    return KSFILTER_NODE;
+}
+

Modified: trunk/reactos/drivers/ksfilter/ks/topology.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topology.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -122,7 +122,7 @@
     if (!NT_SUCCESS(Status))
         return Status;
 
-    if (NodeCreate->CreateFlags != 0 || (NodeCreate->Node >= Topology->TopologyNodesCount && NodeCreate->Node != (ULONG)-1))
+    if (NodeCreate->CreateFlags != 0 || (NodeCreate->Node >= Topology->TopologyNodesCount && NodeCreate->Node != MAXULONG))
     {
         /* invalid node create */
         FreeItem(NodeCreate);

Modified: trunk/reactos/drivers/serial/serial/serial.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/serial/serial/serial.h?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/serial/serial/serial.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/serial/serial/serial.h [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -108,7 +108,7 @@
 
 #define SERIAL_TAG 'lreS'
 
-#define INFINITE ((ULONG)-1)
+#define INFINITE MAXULONG
 
 /* Baud master clock */
 #define BAUD_CLOCK      1843200

Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -1226,7 +1226,7 @@
 
 	NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
 
-	if (PropertyRequest->Node == (ULONG)-1) {
+	if (PropertyRequest->Node == MAXULONG) {
 		return ntStatus;
 	}
 	if (PropertyRequest->Node >= KSNODE_TOPO_INVALID) {

Modified: trunk/reactos/drivers/wdm/audio/filters/splitter/splitter.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/filters/splitter/splitter.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/filters/splitter/splitter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/filters/splitter/splitter.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -133,7 +133,7 @@
         0,
         {
             0,
-            (ULONG)-1,
+            MAXULONG,
             1
         },
         {
@@ -173,7 +173,7 @@
         },
         KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING | KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL |
         KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING | KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE,
-        (ULONG)-1,
+        MAXULONG,
         1,
         NULL, //&AllocatorFraming,
         PinIntersectHandler

Modified: trunk/reactos/drivers/wdm/audio/legacy/stream/pnp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/stream/pnp.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/stream/pnp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/stream/pnp.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -315,7 +315,7 @@
         DeviceDesc.InterfaceType = Config->AdapterInterfaceType;
         DeviceDesc.DmaWidth = Width32Bits;
         DeviceDesc.DmaSpeed = Compatible;
-        DeviceDesc.MaximumLength = (ULONG)-1;
+        DeviceDesc.MaximumLength = MAXULONG;
         DeviceDesc.Dma32BitAddresses = DriverObjectExtension->Data.Dma24BitAddresses;
 
         Adapter = IoGetDmaAdapter(DeviceExtension->PhysicalDeviceObject, &DeviceDesc, &MapRegisters);

Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -173,7 +173,7 @@
     }
 
     /* close pin handle which uses same virtual audio device id and pin id */
-    FreeIndex = (ULONG)-1;
+    FreeIndex = MAXULONG;
     for(Index = 0; Index < ClientInfo->NumPins; Index++)
     {
         if (ClientInfo->hPins[Index].FilterId == FilterId && ClientInfo->hPins[Index].PinId == PinId && ClientInfo->hPins[Index].Handle && ClientInfo->hPins[Index].Type == DeviceInfo->DeviceType)
@@ -266,7 +266,7 @@
     {
         PWDMAUD_HANDLE Handels;
 
-        if (FreeIndex != (ULONG)-1)
+        if (FreeIndex != MAXULONG)
         {
             /* re-use a free index */
             ClientInfo->hPins[Index].Handle = PinHandle;

Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -210,7 +210,7 @@
         }
         Guid++;
     }
-    return (ULONG)-1;
+    return MAXULONG;
 }
 
 ULONG

Modified: trunk/reactos/hal/halppc/generic/dma.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halppc/generic/dma.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/hal/halppc/generic/dma.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halppc/generic/dma.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -1073,7 +1073,7 @@
 {
    PADAPTER_OBJECT MasterAdapter;
    PGROW_WORK_ITEM WorkItem;
-   ULONG Index = ~0;
+   ULONG Index = MAXULONG;
    ULONG Result;
    KIRQL OldIrql;
 
@@ -1129,7 +1129,7 @@
       {
          Index = RtlFindClearBitsAndSet(
             MasterAdapter->MapRegisters, NumberOfMapRegisters, 0);
-         if (Index != ~0)
+         if (Index != MAXULONG)
          {
             AdapterObject->MapRegisterBase =
                MasterAdapter->MapRegisterBase + Index;
@@ -1143,7 +1143,7 @@
          }
       }
 
-      if (Index == ~0)
+      if (Index == MAXULONG)
       {
          WorkItem = ExAllocatePoolWithTag(
             NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA);
@@ -1242,7 +1242,7 @@
    PADAPTER_OBJECT MasterAdapter;
    PKDEVICE_QUEUE_ENTRY DeviceQueueEntry;
    PWAIT_CONTEXT_BLOCK WaitContextBlock;
-   ULONG Index = ~0;
+   ULONG Index = MAXULONG;
    ULONG Result;
    KIRQL OldIrql;
 
@@ -1287,7 +1287,7 @@
             Index = RtlFindClearBitsAndSet(
                MasterAdapter->MapRegisters,
                WaitContextBlock->NumberOfMapRegisters, 0);
-            if (Index != ~0)
+            if (Index != MAXULONG)
             {
                AdapterObject->MapRegisterBase =
                   MasterAdapter->MapRegisterBase + Index;
@@ -1301,7 +1301,7 @@
             }
          }
 
-         if (Index == ~0)
+         if (Index == MAXULONG)
          {
             InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
             KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
@@ -1404,7 +1404,7 @@
          MasterAdapter->MapRegisters,
          AdapterObject->NumberOfMapRegisters,
          MasterAdapter->NumberOfMapRegisters);
-      if (Index == ~0)
+      if (Index == MAXULONG)
       {
          InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry);
          break;
@@ -1600,7 +1600,7 @@
    {
       if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
       {
-         if (RealMapRegisterBase->Counter != ~0)
+         if (RealMapRegisterBase->Counter != MAXULONG)
          {
             if (SlaveDma && !AdapterObject->IgnoreCount)
                Length -= HalReadDmaCounter(AdapterObject);
@@ -1779,7 +1779,7 @@
       PhysicalAddress = RealMapRegisterBase->PhysicalAddress;
       PhysicalAddress.QuadPart += ByteOffset;
       TransferLength = *Length;
-      RealMapRegisterBase->Counter = ~0;
+      RealMapRegisterBase->Counter = MAXULONG;
       Counter = 0;
    }
    else
@@ -1809,7 +1809,7 @@
          PhysicalAddress.QuadPart += ByteOffset;
          if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
          {
-            RealMapRegisterBase->Counter = ~0;
+            RealMapRegisterBase->Counter = MAXULONG;
             Counter = 0;
          }
       }
@@ -1982,13 +1982,13 @@
         }
 
         /* Try to find free map registers */
-        MapRegisterNumber = -1;
+        MapRegisterNumber = MAXULONG;
         MapRegisterNumber = RtlFindClearBitsAndSet(MasterAdapter->MapRegisters,
                                                    *NumberOfMapRegisters,
                                                    0);
 
         /* Check if nothing was found */
-        if (MapRegisterNumber == -1)
+        if (MapRegisterNumber == MAXULONG)
         {
             /* No free registers found, so use the base registers */
             RtlSetBits(MasterAdapter->MapRegisters,

Modified: trunk/reactos/hal/halx86/generic/dma.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/dma.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/dma.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -1075,7 +1075,7 @@
 {
    PADAPTER_OBJECT MasterAdapter;
    PGROW_WORK_ITEM WorkItem;
-   ULONG Index = ~0U;
+   ULONG Index = MAXULONG;
    ULONG Result;
    KIRQL OldIrql;
 
@@ -1131,7 +1131,7 @@
       {
          Index = RtlFindClearBitsAndSet(
             MasterAdapter->MapRegisters, NumberOfMapRegisters, 0);
-         if (Index != ~0U)
+         if (Index != MAXULONG)
          {
             AdapterObject->MapRegisterBase =
                MasterAdapter->MapRegisterBase + Index;
@@ -1145,7 +1145,7 @@
          }
       }
 
-      if (Index == ~0U)
+      if (Index == MAXULONG)
       {
          WorkItem = ExAllocatePoolWithTag(
             NonPagedPool, sizeof(GROW_WORK_ITEM), TAG_DMA);
@@ -1244,7 +1244,7 @@
    PADAPTER_OBJECT MasterAdapter;
    PKDEVICE_QUEUE_ENTRY DeviceQueueEntry;
    PWAIT_CONTEXT_BLOCK WaitContextBlock;
-   ULONG Index = ~0;
+   ULONG Index = MAXULONG;
    ULONG Result;
    KIRQL OldIrql;
 
@@ -1289,7 +1289,7 @@
             Index = RtlFindClearBitsAndSet(
                MasterAdapter->MapRegisters,
                WaitContextBlock->NumberOfMapRegisters, 0);
-            if (Index != ~0U)
+            if (Index != MAXULONG)
             {
                AdapterObject->MapRegisterBase =
                   MasterAdapter->MapRegisterBase + Index;
@@ -1303,7 +1303,7 @@
             }
          }
 
-         if (Index == ~0U)
+         if (Index == MAXULONG)
          {
             InsertTailList(&MasterAdapter->AdapterQueue, &AdapterObject->AdapterQueue);
             KfReleaseSpinLock(&MasterAdapter->SpinLock, OldIrql);
@@ -1406,7 +1406,7 @@
          MasterAdapter->MapRegisters,
          AdapterObject->NumberOfMapRegisters,
          MasterAdapter->NumberOfMapRegisters);
-      if (Index == ~0U)
+      if (Index == MAXULONG)
       {
          InsertHeadList(&MasterAdapter->AdapterQueue, ListEntry);
          break;
@@ -1604,7 +1604,7 @@
    {
       if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
       {
-         if (RealMapRegisterBase->Counter != ~0U)
+         if (RealMapRegisterBase->Counter != MAXULONG)
          {
             if (SlaveDma && !AdapterObject->IgnoreCount)
                Length -= HalReadDmaCounter(AdapterObject);
@@ -1783,7 +1783,7 @@
       PhysicalAddress = RealMapRegisterBase->PhysicalAddress;
       PhysicalAddress.QuadPart += ByteOffset;
       TransferLength = *Length;
-      RealMapRegisterBase->Counter = ~0;
+      RealMapRegisterBase->Counter = MAXULONG;
       Counter = 0;
    }
    else
@@ -1813,7 +1813,7 @@
          PhysicalAddress.QuadPart += ByteOffset;
          if ((ULONG_PTR)MapRegisterBase & MAP_BASE_SW_SG)
          {
-            RealMapRegisterBase->Counter = ~0;
+            RealMapRegisterBase->Counter = MAXULONG;
             Counter = 0;
          }
       }
@@ -1991,7 +1991,7 @@
                                                    0);
 
         /* Check if nothing was found */
-        if (MapRegisterNumber == (ULONG)-1)
+        if (MapRegisterNumber == MAXULONG)
         {
             /* No free registers found, so use the base registers */
             RtlSetBits(MasterAdapter->MapRegisters,

Modified: trunk/reactos/include/host/typedefs.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/host/typedefs.h?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/include/host/typedefs.h [iso-8859-1] (original)
+++ trunk/reactos/include/host/typedefs.h [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -217,6 +217,8 @@
 #define MAKEWORD(a,b)           ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
 #define MAKELONG(a,b)           ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
 
+#define MAXULONG 0xFFFFFFFF
+
 #define NT_SUCCESS(x)           ((x)>=0)
 #if !defined(__GNUC__)
 #define FIELD_OFFSET(t,f)       ((LONG)(LONG_PTR)&(((t*) 0)->f))

Modified: trunk/reactos/include/psdk/basetsd.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/basetsd.h?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/include/psdk/basetsd.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/basetsd.h [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -47,6 +47,10 @@
 #define MAXUHALF_PTR ((UHALF_PTR)~0)
 #define MAXHALF_PTR  ((HALF_PTR)(MAXUHALF_PTR >> 1))
 #define MINHALF_PTR  (~MAXHALF_PTR)
+
+#define MAXUINT      ((UINT)~((UINT)0))
+
+#define MAXULONGLONG ((ULONGLONG)~((ULONGLONG)0))
 
 #ifndef RC_INVOKED
 #ifdef __cplusplus

Modified: trunk/reactos/lib/cmlib/hivedata.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -80,7 +80,7 @@
 //
 // Cell Magic Values
 //
-#define HCELL_NIL                                       (ULONG)-1
+#define HCELL_NIL                                       MAXULONG
 #define HCELL_CACHED                                    1
 
 #define HCELL_TYPE_MASK                0x80000000

Modified: trunk/reactos/lib/rtl/bitmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -58,14 +58,14 @@
   ULONG ulPos = 0, ulRuns = 0;
 
   if (!ulCount)
-    return ~0U;
+    return MAXULONG;
 
   while (ulPos < lpBits->SizeOfBitMap)
   {
     /* Find next set/clear run */
     ULONG ulSize, ulNextPos = fn(lpBits, ulPos, &ulSize);
 
-    if (ulNextPos == ~0U)
+    if (ulNextPos == MAXULONG)
       break;
 
     if (bLongest && ulRuns == ulCount)
@@ -158,7 +158,7 @@
     ulStart = (ulStart & ~7u) + 8;
     lpOut++;
     if (ulStart >= lpBits->SizeOfBitMap)
-      return ~0U;
+      return MAXULONG;
   }
 
   /* Count blocks of 8 set bits */
@@ -248,7 +248,7 @@
     ulStart = (ulStart & ~7u) + 8;
     lpOut++;
     if (ulStart >= lpBits->SizeOfBitMap)
-      return ~0U;
+      return MAXULONG;
   }
 
   /* Count blocks of 8 clear bits */
@@ -513,7 +513,7 @@
   ULONG ulPos, ulEnd;
 
   if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap)
-    return ~0U;
+    return MAXULONG;
 
   ulEnd = BitMapHeader->SizeOfBitMap;
 
@@ -537,7 +537,7 @@
     else
       ulPos++;
   }
-  return ~0U;
+  return MAXULONG;
 }
 
 /*
@@ -596,7 +596,7 @@
   Size = BitMapHeader->SizeOfBitMap;
   if (*StartingIndex > Size)
   {
-    *StartingIndex = (ULONG)-1;
+    *StartingIndex = MAXULONG;
     return 0;
   }
 
@@ -619,7 +619,7 @@
   /* Return index of first set bit */
   if (Index >= Size)
   {
-    *StartingIndex = (ULONG)-1;
+    *StartingIndex = MAXULONG;
     return 0;
   }
   else
@@ -695,7 +695,7 @@
   ULONG ulPos, ulEnd;
 
   if (!BitMapHeader || !NumberToFind || NumberToFind > BitMapHeader->SizeOfBitMap)
-    return ~0U;
+    return MAXULONG;
 
   ulEnd = BitMapHeader->SizeOfBitMap;
 
@@ -719,7 +719,7 @@
     else
       ulPos++;
   }
-  return ~0U;
+  return MAXULONG;
 }
 
 
@@ -734,7 +734,7 @@
   ULONG ulPos;
 
   ulPos = RtlFindSetBits(BitMapHeader, NumberToFind, HintIndex);
-  if (ulPos != ~0U)
+  if (ulPos != MAXULONG)
     RtlClearBits(BitMapHeader, ulPos, NumberToFind);
   return ulPos;
 }
@@ -906,7 +906,7 @@
   ULONG ulPos;
 
   ulPos = RtlFindClearBits(BitMapHeader, NumberToFind, HintIndex);
-  if (ulPos != ~0U)
+  if (ulPos != MAXULONG)
     RtlSetBits(BitMapHeader, ulPos, NumberToFind);
   return ulPos;
 }

Modified: trunk/reactos/lib/rtl/debug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/debug.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/debug.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/debug.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -61,7 +61,7 @@
     EXCEPTION_RECORD ExceptionRecord;
 
     /* Check if we should print it or not */
-    if ((ComponentId != (ULONG)-1) &&
+    if ((ComponentId != MAXULONG) &&
         !(NtQueryDebugFilterState(ComponentId, Level)))
     {
         /* This message is masked */
@@ -96,7 +96,7 @@
     _SEH2_END;
 
     /* Check if we went past the buffer */
-    if (Length == (ULONG)-1)
+    if (Length == MAXULONG)
     {
         /* Terminate it if we went over-board */
         Buffer[sizeof(Buffer) - 1] = '\n';

Modified: trunk/reactos/lib/rtl/heap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/heap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heap.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -110,7 +110,7 @@
 /* Max size of the blocks on the free lists */
 static const DWORD HEAP_freeListSizes[HEAP_NB_FREE_LISTS] =
 {
-    0x10, 0x20, 0x80, 0x200, ~0UL
+    0x10, 0x20, 0x80, 0x200, MAXULONG
 };
 
 typedef struct
@@ -1612,7 +1612,7 @@
     if (!heapPtr)
     {
         RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE );
-        return ~0UL;
+        return MAXULONG;
     }
     flags &= HEAP_NO_SERIALIZE;
     flags |= heapPtr->flags;
@@ -1620,7 +1620,7 @@
     if (!HEAP_IsRealArena( heapPtr, HEAP_NO_SERIALIZE, ptr, QUIET ))
     {
         RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
-        ret = ~0UL;
+        ret = MAXULONG;
     }
     else
     {

Modified: trunk/reactos/lib/rtl/rangelist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rangelist.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/rangelist.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/rangelist.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -608,11 +608,11 @@
     }
 
   /* Add trailing range */
-  if (Previous->Range.End + 1 != (ULONGLONG)-1)
+  if (Previous->Range.End + 1 != MAXULONGLONG)
     {
       Status = RtlAddRange (InvertedRangeList,
 			    Previous->Range.End + 1,
-			    (ULONGLONG)-1,
+			    MAXULONGLONG,
 			    0,
 			    0,
 			    NULL,

Modified: trunk/reactos/lib/rtl/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/registry.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/registry.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/registry.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -131,7 +131,7 @@
     *InfoSize = 0;
 
     /* Check if there's no data */
-    if (KeyValueInfo->DataOffset == (ULONG)-1)
+    if (KeyValueInfo->DataOffset == MAXULONG)
     {
         /* Return proper status code */
         return (QueryTable->Flags & RTL_QUERY_REGISTRY_REQUIRED) ?

Modified: trunk/reactos/lib/rtl/unicode.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -1065,7 +1065,7 @@
     static const WCHAR byterev_control_chars[] = {0x0d00,0x0a00,0x0900,0x2000,0};
     const WCHAR *s = buf;
     int i;
-    unsigned int flags = ~0U, out_flags = 0;
+    unsigned int flags = MAXULONG, out_flags = 0;
 
     if (len < sizeof(WCHAR))
     {

Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -466,7 +466,7 @@
 
     /* Make sure the buffer is a valid string which within the given length */
     if ((NtInitialUserProcessBufferType != REG_SZ) ||
-        ((NtInitialUserProcessBufferLength != (ULONG)-1) &&
+        ((NtInitialUserProcessBufferLength != MAXULONG) &&
          ((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 == (ULONG)-1)
+            if (ExpLastTimeZoneBias == MAXULONG)
             {
                 /* Reset */
                 ResetBias = TRUE;

Modified: trunk/reactos/ntoskrnl/fstub/disksup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -20,7 +20,7 @@
 #if 1
 const WCHAR DiskMountString[] = L"\\DosDevices\\%C:";
 
-#define AUTO_DRIVE         ((ULONG)-1)
+#define AUTO_DRIVE         MAXULONG
 
 #define PARTITION_MAGIC    0xaa55
 
@@ -135,7 +135,7 @@
     if (RtlCompareUnicodeString(PartitionName, BootDevice, FALSE) == 0)
     {
         /* Set NtSystemPath to that partition's disk letter */
-        *NtSystemPath = 'A' + DriveNumber;
+        *NtSystemPath = (UCHAR)('A' + DriveNumber);
     }
 
     return TRUE;

Modified: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -152,7 +152,7 @@
   RTL_QUERY_REGISTRY_TABLE QueryTable[7];
   PSERVICE Service;
   NTSTATUS Status;
-  ULONG DefaultTag = ~0;
+  ULONG DefaultTag = MAXULONG;
 
   DPRINT("ServiceName: '%wZ'\n", ServiceName);
 

Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -1008,7 +1008,7 @@
             }
         }
 
-        if (i != (ULONG)-1) /* not found */
+        if (i != MAXULONG) /* not found */
             ASSERT(0);
     }
     else
@@ -1033,7 +1033,7 @@
             }
         }
 
-        if (i != (ULONG)-1) /* not found */
+        if (i != MAXULONG) /* not found */
             ASSERT(0);
     }
 

Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -447,9 +447,9 @@
         else
         {
             if (*p == '-')
-                clear = ~0;
+                clear = MAXULONG;
             else
-                set = ~0;
+                set = MAXULONG;
         }
         if (*p == '+' || *p == '-')
             p++;

Modified: trunk/reactos/ntoskrnl/ke/i386/irqobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/irqobj.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/irqobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/irqobj.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -194,8 +194,8 @@
     Interrupt->ShareVector = ShareVector;
     Interrupt->Number = ProcessorNumber;
     Interrupt->FloatingSave = FloatingSave;
-    Interrupt->TickCount = (ULONG)-1;
-    Interrupt->DispatchCount = (ULONG)-1;
+    Interrupt->TickCount = MAXULONG;
+    Interrupt->DispatchCount = MAXULONG;
 
     /* Loop the template in memory */
     for (i = 0; i < KINTERRUPT_DISPATCH_CODES; i++)

Modified: trunk/reactos/ntoskrnl/mm/elf.inc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/elf.inc.h?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/elf.inc.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/elf.inc.h [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -5,10 +5,6 @@
 
 #ifndef __ELF_WORD_SIZE
 #error __ELF_WORD_SIZE must be defined
-#endif
-
-#ifndef MAXULONG
-#define MAXULONG ((ULONG)(~1))
 #endif
 
 #include <elf/elf.h>
@@ -205,7 +201,7 @@
  }
 
  ASSERT(FALSE);
- return (ULONG)-1;
+ return MAXULONG;
 }
 
 static __inline USHORT ElfFmtpReadUShort
@@ -282,7 +278,7 @@
  }
 
  ASSERT(FALSE);
- return (ULONG)-1;
+ return MAXULONG;
 }
 
 static __inline BOOLEAN ElfFmtpIsPowerOf2(IN Elf_Addr Number)

Modified: trunk/reactos/ntoskrnl/mm/i386/pagepae.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/pagepae.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/pagepae.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/pagepae.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -78,11 +78,11 @@
 NTAPI
 MiFlushTlbIpiRoutine(ULONG_PTR Address)
 {
-   if (Address == (ULONG_PTR)-1)
+   if (Address == MAXULONGLONG)
    {
       KeFlushCurrentTb();
    }
-   else if (Address == (ULONG_PTR)-2)
+   else if (Address == MAXULONGLONG-1)
    {
       KeFlushCurrentTb();
    }

Modified: trunk/reactos/ntoskrnl/mm/pe.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pe.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pe.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pe.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -15,10 +15,6 @@
 #include <debug.h>
 
 #include <reactos/exeformat.h>
-
-#ifndef MAXULONG
-#define MAXULONG ((ULONG)(~1))
-#endif
 
 static ULONG SectionCharacteristicsToProtect[16] =
 {
@@ -453,7 +449,7 @@
 		if(pioh64OptHeader->ImageBase > MAXULONG_PTR)
 		    DIE(("ImageBase exceeds the address space\n"));
 
-		ImageSectionObject->ImageBase = pioh64OptHeader->ImageBase;
+		ImageSectionObject->ImageBase = (ULONG_PTR)pioh64OptHeader->ImageBase;
 	    }
 
 	    if(RTL_CONTAINS_FIELD(pioh64OptHeader, cbOptHeaderSize, SizeOfImage))

Modified: trunk/reactos/ntoskrnl/po/power.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -526,7 +526,7 @@
 
             /* Just zero the struct (and thus set BatteryState->BatteryPresent = FALSE) */
             RtlZeroMemory(BatteryState, sizeof(SYSTEM_BATTERY_STATE));
-            BatteryState->EstimatedTime = (ULONG)-1;
+            BatteryState->EstimatedTime = MAXULONG;
 
             Status = STATUS_SUCCESS;
             break;

Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -443,7 +443,7 @@
     /* Now multiply limits by 1MB */
     PspDefaultPagedLimit <<= 20;
     PspDefaultNonPagedLimit <<= 20;
-    if (PspDefaultPagefileLimit != (ULONG)-1) PspDefaultPagefileLimit <<= 20;
+    if (PspDefaultPagefileLimit != MAXULONG) PspDefaultPagefileLimit <<= 20;
 
     /* Initialize the Active Process List */
     InitializeListHead(&PsActiveProcessHead);

Modified: trunk/reactos/ntoskrnl/ps/query.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=43192&r1=43191&r2=43192&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Sun Sep 27 22:07:43 2009
@@ -193,8 +193,8 @@
                         Process->Vm.MinimumWorkingSetSize << PAGE_SHIFT;
 
                 /* Set default time limits */
-                QuotaLimits->TimeLimit.LowPart = (ULONG)-1;
-                QuotaLimits->TimeLimit.HighPart = (ULONG)-1;
+                QuotaLimits->TimeLimit.LowPart = MAXULONG;
+                QuotaLimits->TimeLimit.HighPart = MAXULONG;
 
                 /* Is quota block a default one? */
                 if (Process->QuotaBlock == &PspDefaultQuotaBlock)




More information about the Ros-diffs mailing list