Ok, reverting r43565. Someone will have to tell me why it works for me but not for buildbot

svn path=/trunk/; revision=43576
This commit is contained in:
Hervé Poussineau 2009-10-18 20:06:09 +00:00
parent 2d7ba2275a
commit 035a83011e

View file

@ -467,7 +467,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
{ {
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId); DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
UCHAR* Ptr = (UCHAR*)Buffer; UCHAR* Ptr = (UCHAR*)Buffer;
ULONG i, Length, Sectors; ULONG i, Length;
BOOLEAN ret; BOOLEAN ret;
*Count = 0; *Count = 0;
@ -475,13 +475,12 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
while (N > 0) while (N > 0)
{ {
Length = N; Length = N;
if (Length > DISKREADBUFFER_SIZE) if (Length > Context->SectorSize)
Length = DISKREADBUFFER_SIZE; Length = Context->SectorSize;
Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
ret = MachDiskReadLogicalSectors( ret = MachDiskReadLogicalSectors(
Context->DriveNumber, Context->DriveNumber,
Context->SectorNumber + Context->SectorOffset + i, Context->SectorNumber + Context->SectorOffset + i,
Sectors, 1,
(PVOID)DISKREADBUFFER); (PVOID)DISKREADBUFFER);
if (!ret) if (!ret)
return EIO; return EIO;
@ -489,7 +488,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
Ptr += Length; Ptr += Length;
*Count += Length; *Count += Length;
N -= Length; N -= Length;
i += Sectors; i++;
} }
return ESUCCESS; return ESUCCESS;