X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=drivers%2Ffs%2Fvfat%2Ffat.c;fp=drivers%2Ffs%2Fvfat%2Ffat.c;h=7b57bf889092071f5355654b4ba4aa8b2eb25e7f;hp=c4356020bb1d18a43b66b2d23ff975cb3e6ffba4;hb=7c0cf90e3b750f1f0dc83b2eec9e5c68a512c30f;hpb=ee8b63255465d8c28be3e7bd11628015708fc1ab diff --git a/drivers/fs/vfat/fat.c b/drivers/fs/vfat/fat.c index c435602..7b57bf8 100644 --- a/drivers/fs/vfat/fat.c +++ b/drivers/fs/vfat/fat.c @@ -39,7 +39,6 @@ Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, */ { PVOID BaseAddress; - NTSTATUS Status; ULONG FATOffset; ULONG ChunkSize; PVOID Context; @@ -52,7 +51,7 @@ Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt, { return STATUS_UNSUCCESSFUL; } - CurrentCluster = (*(PULONG)(BaseAddress + (FATOffset % ChunkSize))) & 0x0fffffff; + CurrentCluster = (*(PULONG)((char*)BaseAddress + (FATOffset % ChunkSize))) & 0x0fffffff; if (CurrentCluster >= 0xffffff8 && CurrentCluster <= 0xfffffff) CurrentCluster = 0xffffffff; CcUnpinData(Context); @@ -69,7 +68,6 @@ Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, */ { PVOID BaseAddress; - NTSTATUS Status; ULONG FATOffset; ULONG ChunkSize; PVOID Context; @@ -82,7 +80,7 @@ Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, { return STATUS_UNSUCCESSFUL; } - CurrentCluster = *((PUSHORT)(BaseAddress + (FATOffset % ChunkSize))); + CurrentCluster = *((PUSHORT)((char*)BaseAddress + (FATOffset % ChunkSize))); if (CurrentCluster >= 0xfff8 && CurrentCluster <= 0xffff) CurrentCluster = 0xffffffff; CcUnpinData(Context); @@ -99,9 +97,7 @@ Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, */ { PUSHORT CBlock; - ULONG FATOffset; ULONG Entry; - NTSTATUS Status; PVOID BaseAddress; PVOID Context; LARGE_INTEGER Offset; @@ -114,7 +110,7 @@ Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, { return STATUS_UNSUCCESSFUL; } - CBlock = (PUSHORT)(BaseAddress + (CurrentCluster * 12) / 8); + CBlock = (PUSHORT)((char*)BaseAddress + (CurrentCluster * 12) / 8); if ((CurrentCluster % 2) == 0) { Entry = *CBlock & 0x0fff; @@ -143,7 +139,6 @@ FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, ULONG FatLength; ULONG StartCluster; ULONG i, j; - NTSTATUS Status; PVOID BaseAddress; ULONG ChunkSize; PVOID Context = 0; @@ -173,7 +168,7 @@ FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, return STATUS_UNSUCCESSFUL; } CHECKPOINT; - Block = (PUSHORT)(BaseAddress + i % ChunkSize); + Block = (PUSHORT)((char*)BaseAddress + i % ChunkSize); } if (*Block == 0) @@ -202,13 +197,11 @@ FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, PULONG Cluster) */ { ULONG FatLength; - ULONG FATOffset; ULONG StartCluster; ULONG Entry; PUSHORT CBlock; ULONG i, j; PVOID BaseAddress; - NTSTATUS Status; PVOID Context; LARGE_INTEGER Offset; @@ -226,7 +219,7 @@ FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, PULONG Cluster) { for (i = StartCluster; i < FatLength; i++) { - CBlock = (PUSHORT)(BaseAddress + (i * 12) / 8); + CBlock = (PUSHORT)((char*)BaseAddress + (i * 12) / 8); if ((i % 2) == 0) { Entry = *CBlock & 0xfff; @@ -259,7 +252,6 @@ FAT32FindAvailableCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster) ULONG FatLength; ULONG StartCluster; ULONG i, j; - NTSTATUS Status; PVOID BaseAddress; ULONG ChunkSize; PVOID Context = 0; @@ -287,7 +279,7 @@ FAT32FindAvailableCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster) DPRINT1("CcMapData(Offset %x, Length %d) failed\n", (ULONG)Offset.QuadPart, ChunkSize); return STATUS_UNSUCCESSFUL; } - Block = (PULONG)(BaseAddress + i % ChunkSize); + Block = (PULONG)((char*)BaseAddress + i % ChunkSize); } if ((*Block & 0x0fffffff) == 0) @@ -316,12 +308,10 @@ FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) * FUNCTION: Counts free cluster in a FAT12 table */ { - ULONG FATOffset; ULONG Entry; PVOID BaseAddress; ULONG ulCount = 0; ULONG i; - NTSTATUS Status; ULONG numberofclusters; LARGE_INTEGER Offset; PVOID Context; @@ -337,7 +327,7 @@ FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) for (i = 2; i < numberofclusters; i++) { - CBlock = (PUSHORT)(BaseAddress + (i * 12) / 8); + CBlock = (PUSHORT)((char*)BaseAddress + (i * 12) / 8); if ((i % 2) == 0) { Entry = *CBlock & 0x0fff; @@ -369,7 +359,6 @@ FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) ULONG ulCount = 0; ULONG i; ULONG ChunkSize; - NTSTATUS Status; PVOID Context = NULL; LARGE_INTEGER Offset; ULONG FatLength; @@ -391,7 +380,7 @@ FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) { return STATUS_UNSUCCESSFUL; } - Block = (PUSHORT)(BaseAddress + i % ChunkSize); + Block = (PUSHORT)((char*)BaseAddress + i % ChunkSize); } if (*Block == 0) ulCount++; @@ -416,7 +405,6 @@ FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) ULONG ulCount = 0; ULONG i; ULONG ChunkSize; - NTSTATUS Status; PVOID Context = NULL; LARGE_INTEGER Offset; ULONG FatLength; @@ -437,7 +425,7 @@ FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt) { return STATUS_UNSUCCESSFUL; } - Block = (PULONG)(BaseAddress + i % ChunkSize); + Block = (PULONG)((char*)BaseAddress + i % ChunkSize); } if ((*Block & 0x0fffffff) == 0) ulCount++; @@ -487,8 +475,6 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG FATsector; ULONG FATOffset; PUCHAR CBlock; - int i; - NTSTATUS Status; PVOID BaseAddress; PVOID Context; LARGE_INTEGER Offset; @@ -506,7 +492,7 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, if ((ClusterToWrite % 2) == 0) { *OldValue = CBlock[FATOffset] + ((CBlock[FATOffset + 1] & 0x0f) << 8); - CBlock[FATOffset] = NewValue; + CBlock[FATOffset] = (UCHAR)NewValue; CBlock[FATOffset + 1] &= 0xf0; CBlock[FATOffset + 1] |= (NewValue & 0xf00) >> 8; } @@ -515,7 +501,7 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt, *OldValue = (CBlock[FATOffset] >> 4) + (CBlock[FATOffset + 1] << 4); CBlock[FATOffset] &= 0x0f; CBlock[FATOffset] |= (NewValue & 0xf) << 4; - CBlock[FATOffset + 1] = NewValue >> 4; + CBlock[FATOffset + 1] = (UCHAR)(NewValue >> 4); } /* Write the changed FAT sector(s) to disk */ FATsector = FATOffset / DeviceExt->FatInfo.BytesPerSector; @@ -534,9 +520,7 @@ FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt, */ { PVOID BaseAddress; - NTSTATUS Status; ULONG FATOffset; - ULONG i; ULONG ChunkSize; PVOID Context; LARGE_INTEGER Offset; @@ -551,9 +535,9 @@ FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt, } DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset, ClusterToWrite); - Cluster = ((PUSHORT)(BaseAddress + (FATOffset % ChunkSize))); + Cluster = ((PUSHORT)((char*)BaseAddress + (FATOffset % ChunkSize))); *OldValue = *Cluster; - *Cluster = NewValue; + *Cluster = (USHORT)NewValue; CcSetDirtyPinnedData(Context, NULL); CcUnpinData(Context); return(STATUS_SUCCESS); @@ -569,9 +553,7 @@ FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt, */ { PVOID BaseAddress; - NTSTATUS Status; ULONG FATOffset; - ULONG i; ULONG ChunkSize; PVOID Context; LARGE_INTEGER Offset; @@ -587,7 +569,7 @@ FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt, } DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset, ClusterToWrite); - Cluster = ((PULONG)(BaseAddress + (FATOffset % ChunkSize))); + Cluster = ((PULONG)((char*)BaseAddress + (FATOffset % ChunkSize))); *OldValue = *Cluster & 0x0fffffff; *Cluster = (*Cluster & 0xf0000000) | (NewValue & 0x0fffffff);