fix code that depends on GCC's void* pointer arithmetic extension
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c
Modified: trunk/reactos/boot/freeldr/freeldr/cache/cache.c
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c
Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c
Modified: trunk/reactos/boot/freeldr/freeldr/linuxboot.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.c

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -363,7 +363,7 @@
   FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition =
     CmResourceShareUndetermined;
 
-  Ptr = (char *)(((PVOID)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
+  Ptr = (char *)(((ULONG_PTR)&FullResourceDescriptor->PartialResourceList.PartialDescriptors[0]) +
 		 sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
 
   /* Set instalation check data */
@@ -460,7 +460,7 @@
     sizeof(CM_DISK_GEOMETRY_DEVICE_DATA);
 
   /* Get pointer to geometry data */
-  DiskGeometry = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+  DiskGeometry = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
 
   /* Get the disk geometry */
   ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
@@ -648,7 +648,7 @@
     sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount;
 
   /* Get harddisk Int13 geometry data */
-  Int13Drives = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+  Int13Drives = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
   for (i = 0; i < DiskCount; i++)
     {
       if (MachDiskGetDriveGeometry(0x80 + i, &Geometry))
@@ -744,7 +744,7 @@
   PUSHORT SegPtr = (PUSHORT)0x7A;
   PUSHORT OfsPtr = (PUSHORT)0x78;
 
-  return (PVOID)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr);
+  return (PVOID)((ULONG_PTR)(((ULONG)(*SegPtr)) << 4) + (ULONG)(*OfsPtr));
 }
 
 
@@ -814,7 +814,7 @@
     PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
     PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_FLOPPY_DEVICE_DATA);
 
-    FloppyData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+    FloppyData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
     FloppyData->Version = 2;
     FloppyData->Revision = 0;
     FloppyData->MaxDensity = MaxDensity[FloppyType];
@@ -1691,7 +1691,7 @@
     PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
     PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
 
-    KeyboardData = ((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+    KeyboardData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
     KeyboardData->Version = 0;
     KeyboardData->Revision = 0;
     KeyboardData->Type = 4;

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -208,7 +208,7 @@
       PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
       PartialDescriptor->u.DeviceSpecificData.DataSize = Table->Size;
 
-      memcpy(((PVOID)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR),
+      memcpy((PVOID)((ULONG_PTR)FullResourceDescriptor + sizeof(CM_FULL_RESOURCE_DESCRIPTOR)),
 	     Table,
 	     Table->Size);
 

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -258,7 +258,7 @@
 		// of checking the sector read count we will rely solely
 		// on the carry flag being set on error
 
-		Buffer += (NumberOfSectorsToRead * DriveGeometry.BytesPerSector);
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (NumberOfSectorsToRead * DriveGeometry.BytesPerSector));
 		SectorCount -= NumberOfSectorsToRead;
 		SectorNumber += NumberOfSectorsToRead;
 	}

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxdisk.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -387,7 +387,7 @@
       if (Junk == FALSE)
 	{
 	  IDEReadBlock(CommandPort, Buffer, IDE_SECTOR_BUF_SZ);
-	  Buffer += IDE_SECTOR_BUF_SZ;
+	  Buffer = (PVOID)((ULONG_PTR)Buffer + IDE_SECTOR_BUF_SZ);
 	}
       else
 	{

Modified: trunk/reactos/boot/freeldr/freeldr/cache/cache.c
--- trunk/reactos/boot/freeldr/freeldr/cache/cache.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/cache/cache.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -164,14 +164,14 @@
 		// Copy the portion requested into the buffer
 		//
 		RtlCopyMemory(Buffer,
-			(CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
+			(PVOID)((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
 			(CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
 		DbgPrint((DPRINT_CACHE, "1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, (CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector)));
 
 		//
 		// Update the buffer address
 		//
-		Buffer += (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector);
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
 
 		//
 		// Update the block count
@@ -204,7 +204,7 @@
 		//
 		// Update the buffer address
 		//
-		Buffer += CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector));
 
 		//
 		// Update the block count
@@ -237,7 +237,7 @@
 		//
 		// Update the buffer address
 		//
-		Buffer += SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector));
 
 		//
 		// Update the block count

Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c
--- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -298,7 +298,7 @@
 
 	for (CurrentOffset=0; CurrentOffset<DirectorySize; )
 	{
-		CurrentDirectoryEntry = (PEXT2_DIR_ENTRY)(DirectoryBuffer + CurrentOffset);
+		CurrentDirectoryEntry = (PEXT2_DIR_ENTRY)((ULONG_PTR)DirectoryBuffer + CurrentOffset);
 
 		if (CurrentDirectoryEntry->rec_len == 0)
 		{
@@ -401,7 +401,7 @@
 		DbgPrint((DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"));
 
 		// Copy the data from the link
-		RtlCopyMemory(Buffer, (PVOID)(Ext2FileInfo->Inode.i_block) + Ext2FileInfo->FilePointer, BytesToRead);
+		RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.i_block), BytesToRead);
 
 		if (BytesRead != NULL)
 		{
@@ -466,7 +466,7 @@
 		}
 		BytesToRead -= LengthInBlock;
 		Ext2FileInfo->FilePointer += LengthInBlock;
-		Buffer += LengthInBlock;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInBlock);
 	}
 
 	//
@@ -497,7 +497,7 @@
 			}
 			BytesToRead -= Ext2BlockSizeInBytes;
 			Ext2FileInfo->FilePointer += Ext2BlockSizeInBytes;
-			Buffer += Ext2BlockSizeInBytes;
+			Buffer = (PVOID)((ULONG_PTR)Buffer + Ext2BlockSizeInBytes);
 			NumberOfBlocks--;
 		}
 	}
@@ -523,7 +523,7 @@
 		}
 		Ext2FileInfo->FilePointer += BytesToRead;
 		BytesToRead -= BytesToRead;
-		Buffer += BytesToRead;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (ULONG_PTR)BytesToRead);
 	}
 
 	return TRUE;
@@ -878,7 +878,7 @@
 		return FALSE;
 	}
 
-	memcpy(Buffer, ((PVOID)FILESYSBUFFER + StartingOffset), Length);
+	memcpy(Buffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + StartingOffset), Length);
 
 	return TRUE;
 }

Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c
--- trunk/reactos/boot/freeldr/freeldr/fs/fat.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -860,7 +860,7 @@
 			}
 		}
 
-		fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
+		fat = *((USHORT *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset));
 		if (Cluster & 0x0001)
 			fat = fat >> 4;	/* Cluster number is ODD */
 		else
@@ -880,7 +880,7 @@
 			return FALSE;
 		}
 
-		fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
+		fat = *((USHORT *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset));
 
 		break;
 
@@ -897,7 +897,7 @@
 		}
 
 		// Get the fat entry
-		fat = (*((ULONG *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
+		fat = (*((ULONG *) ((ULONG_PTR)FILESYSBUFFER + ThisFatEntOffset))) & 0x0FFFFFFF;
 
 		break;
 
@@ -1091,7 +1091,7 @@
 		//
 		// Increment buffer address by cluster size
 		//
-		Buffer += SectorsPerCluster * BytesPerSector;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + (SectorsPerCluster * BytesPerSector));
 
 		//
 		// Get next cluster
@@ -1132,7 +1132,7 @@
 		return FALSE;
 	}
 
-	memcpy(Buffer, ((PVOID)FILESYSBUFFER + StartingOffset), Length);
+	memcpy(Buffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + StartingOffset), Length);
 
 	return TRUE;
 }
@@ -1234,7 +1234,7 @@
 		}
 		BytesToRead -= LengthInCluster;
 		FatFileInfo->FilePointer += LengthInCluster;
-		Buffer += LengthInCluster;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInCluster);
 	}
 
 	//
@@ -1265,7 +1265,7 @@
 			}
 			BytesToRead -= (NumberOfClusters * BytesPerCluster);
 			FatFileInfo->FilePointer += (NumberOfClusters * BytesPerCluster);
-			Buffer += (NumberOfClusters * BytesPerCluster);
+			Buffer = (PVOID)((ULONG_PTR)Buffer + (NumberOfClusters * BytesPerCluster));
 		}
 	}
 
@@ -1290,7 +1290,7 @@
 		}
 		FatFileInfo->FilePointer += BytesToRead;
 		BytesToRead -= BytesToRead;
-		Buffer += BytesToRead;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
 	}
 
 	return TRUE;

Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c
--- trunk/reactos/boot/freeldr/freeldr/fs/iso.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -81,12 +81,12 @@
 	while (TRUE)
 	{
 		Offset = Offset + Record->RecordLength;
-		Record = (PDIR_RECORD)(DirectoryBuffer + Offset);
+		Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);
 
 		if (Record->RecordLength == 0)
 		{
 			Offset = ROUND_UP(Offset, SECTORSIZE);
-			Record = (PDIR_RECORD)(DirectoryBuffer + Offset);
+			Record = (PDIR_RECORD)((ULONG_PTR)DirectoryBuffer + Offset);
 		}
 
 		if (Offset >= DirectoryLength)
@@ -159,7 +159,7 @@
 	//
 	// Now read directory contents into DirectoryBuffer
 	//
-	for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr += SECTORSIZE)
+	for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr = (PVOID)((ULONG_PTR)Ptr + SECTORSIZE))
 	{
 		if (!MachDiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
 		{
@@ -377,14 +377,14 @@
 		{
 			return FALSE;
 		}
-		RtlCopyMemory(Buffer, ((PVOID)DISKREADBUFFER + OffsetInSector), LengthInSector);
+		RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)DISKREADBUFFER + OffsetInSector), LengthInSector);
 		if (BytesRead != NULL)
 		{
 			*BytesRead += LengthInSector;
 		}
 		BytesToRead -= LengthInSector;
 		IsoFileInfo->FilePointer += LengthInSector;
-		Buffer += LengthInSector;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + LengthInSector);
 	}
 
 	//
@@ -417,7 +417,7 @@
 			}
 			BytesToRead -= SECTORSIZE;
 			IsoFileInfo->FilePointer += SECTORSIZE;
-			Buffer += SECTORSIZE;
+			Buffer = (PVOID)((ULONG_PTR)Buffer + SECTORSIZE);
 		}
 	}
 
@@ -442,7 +442,7 @@
 		}
 		IsoFileInfo->FilePointer += BytesToRead;
 		BytesToRead -= BytesToRead;
-		Buffer += BytesToRead;
+		Buffer = (PVOID)((ULONG_PTR)Buffer + BytesToRead);
 	}
 
 	DbgPrint((DPRINT_FILESYSTEM, "IsoReadFile() done\n"));

Modified: trunk/reactos/boot/freeldr/freeldr/linuxboot.c
--- trunk/reactos/boot/freeldr/freeldr/linuxboot.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/linuxboot.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -346,7 +346,7 @@
 
 	// Read in the rest of the linux setup sectors
 	FsSetFilePointer(LinuxKernelFile, 1024);
-	if (!FsReadFile(LinuxKernelFile, SetupSectorSize - 512, NULL, ((PVOID)LinuxSetupSector) + 512))
+	if (!FsReadFile(LinuxKernelFile, SetupSectorSize - 512, NULL, (PVOID)((ULONG_PTR)LinuxSetupSector + 512)))
 	{
 		return FALSE;
 	}
@@ -400,7 +400,7 @@
 		}
 
 		BytesLoaded += LINUX_READ_CHUNK_SIZE;
-		LoadAddress += LINUX_READ_CHUNK_SIZE;
+		LoadAddress = (PVOID)((ULONG_PTR)LoadAddress + LINUX_READ_CHUNK_SIZE);
 
 		UiDrawProgressBarCenter(BytesLoaded, LinuxKernelSize + LinuxInitrdSize, LinuxBootDescription);
 	}
@@ -491,7 +491,7 @@
 		}
 
 		BytesLoaded += LINUX_READ_CHUNK_SIZE;
-		LinuxInitrdLoadAddress += LINUX_READ_CHUNK_SIZE;
+		LinuxInitrdLoadAddress = (PVOID)((ULONG_PTR)LinuxInitrdLoadAddress + LINUX_READ_CHUNK_SIZE);
 
 		UiDrawProgressBarCenter(BytesLoaded + LinuxKernelSize, LinuxInitrdSize + LinuxKernelSize, LinuxBootDescription);
 	}

Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c
--- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -264,7 +264,7 @@
 
 	// Mark the pages that the lookup tabel occupies as reserved
 	PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
-	PageLookupTablePageCount = MmGetPageNumberFromAddress(PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE)) - PageLookupTableStartPage;
+	PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
 	DbgPrint((DPRINT_MEMORY, "Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount));
 	MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, MEMTYPE_RESERVED);
 }

Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -72,7 +72,7 @@
 	MemorySize = ROUND_UP(MemorySize, 4);
 	if (MemorySize <= SubAllocationRest)
 	{
-		MemPointer = SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest;
+		MemPointer = (PVOID)((ULONG_PTR)SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest);
 		SubAllocationRest -= MemorySize;
 		return MemPointer;
 	}

Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.c
--- trunk/reactos/boot/freeldr/freeldr/multiboot.c	2005-07-04 22:25:46 UTC (rev 16418)
+++ trunk/reactos/boot/freeldr/freeldr/multiboot.c	2005-07-04 23:05:17 UTC (rev 16419)
@@ -213,7 +213,7 @@
     Ke386SetCr0(Ke386GetCr0() | X86_CR0_PG | X86_CR0_WP);
 
     /* Jump to Kernel */
-    PagedJump = (ASMCODE)KernelEntryPoint;
+    PagedJump = (ASMCODE)(PVOID)(KernelEntryPoint);
     PagedJump(Magic, &LoaderBlock);
 }