Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions drivers/filesystems/udfs/Include/phys_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ UDFReadData(
uint32 BSh=Vcb->SectorShift;
NTSTATUS status;
ULONG _ReadBytes = 0;
uint32 to_read;

(*ReadBytes) = 0;
if (!Length) return STATUS_SUCCESS;
Expand All @@ -1117,17 +1116,16 @@ UDFReadData(
}
// read sector_size-aligned part
i = Length >> BSh;
while(i) {
to_read = min(i, 64);
status = UDFReadSectors(IrpContext, Vcb, Translate, Lba, to_read, Direct, Buffer, &_ReadBytes);
if (i) {
status = UDFReadSectors(IrpContext, Vcb, Translate, Lba, i, Direct, Buffer, &_ReadBytes);
(*ReadBytes) += _ReadBytes;
if (!NT_SUCCESS(status)) {
return status;
}
Buffer += to_read<<BSh;
Length -= to_read<<BSh;
Lba += to_read;
i -= to_read;
l = i<<BSh;
if (!(Length = Length - l)) return STATUS_SUCCESS;
Lba += i;
Buffer += l;
}
// read head of the last sector
if (!Length) return STATUS_SUCCESS;
Expand Down