[FREELDR] Simplify some control branches in loops (#7417)

Collapse some tests; remove redundant `continue;`

Pointed out by Serge Gautherie.
This commit is contained in:
Hermès Bélusca-Maïto 2024-10-02 19:24:42 +02:00
parent 5ed33debf4
commit 3b928898ef
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 20 additions and 47 deletions

View file

@ -605,22 +605,13 @@ PcDiskReadLogicalSectorsLBA(
Int386(0x13, &RegsIn, &RegsOut); Int386(0x13, &RegsIn, &RegsOut);
/* If it worked return TRUE */ /* If it worked, or if it was a corrected ECC error
if (INT386_SUCCESS(RegsOut)) * and the data is still good, return success */
{ if (INT386_SUCCESS(RegsOut) || (RegsOut.b.ah == 0x11))
return TRUE; return TRUE;
}
/* If it was a corrected ECC error then the data is still good */ /* It failed, do the next retry */
else if (RegsOut.b.ah == 0x11) DiskResetController(DriveNumber);
{
return TRUE;
}
/* If it failed then do the next retry */
else
{
DiskResetController(DriveNumber);
continue;
}
} }
/* If we get here then the read failed */ /* If we get here then the read failed */
@ -715,22 +706,13 @@ PcDiskReadLogicalSectorsCHS(
{ {
Int386(0x13, &RegsIn, &RegsOut); Int386(0x13, &RegsIn, &RegsOut);
/* If it worked break out */ /* If it worked, or if it was a corrected ECC error
if (INT386_SUCCESS(RegsOut)) * and the data is still good, break out */
{ if (INT386_SUCCESS(RegsOut) || (RegsOut.b.ah == 0x11))
break; break;
}
/* If it was a corrected ECC error then the data is still good */ /* It failed, do the next retry */
else if (RegsOut.b.ah == 0x11) DiskResetController(DriveNumber);
{
break;
}
/* If it failed then do the next retry */
else
{
DiskResetController(DriveNumber);
continue;
}
} }
/* If we retried 3 times then fail */ /* If we retried 3 times then fail */

View file

@ -219,22 +219,13 @@ Pc98DiskReadLogicalSectorsLBA(
{ {
Int386(0x1B, &RegsIn, &RegsOut); Int386(0x1B, &RegsIn, &RegsOut);
/* If it worked return TRUE */ /* If it worked, or if it was a corrected ECC error
if (INT386_SUCCESS(RegsOut)) * and the data is still good, return success */
{ if (INT386_SUCCESS(RegsOut) || (RegsOut.b.ah == 0x08))
return TRUE; return TRUE;
}
/* If it was a corrected ECC error then the data is still good */ /* It failed, do the next retry */
else if (RegsOut.b.ah == 0x08) DiskResetController(DiskDrive);
{
return TRUE;
}
/* If it failed the do the next retry */
else
{
DiskResetController(DiskDrive);
continue;
}
} }
} }

View file

@ -668,7 +668,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
// See if the file name matches either the short or long name // See if the file name matches either the short or long name
// //
if (((strlen(FileName) == strlen(LfnNameBuffer)) && (_stricmp(FileName, LfnNameBuffer) == 0)) || if (((strlen(FileName) == strlen(LfnNameBuffer)) && (_stricmp(FileName, LfnNameBuffer) == 0)) ||
((strlen(FileName) == strlen(ShortNameBuffer)) && (_stricmp(FileName, ShortNameBuffer) == 0))) { ((strlen(FileName) == strlen(ShortNameBuffer)) && (_stricmp(FileName, ShortNameBuffer) == 0)))
{
// //
// We found the entry, now fill in the FAT_FILE_INFO struct // We found the entry, now fill in the FAT_FILE_INFO struct
// //
@ -702,7 +703,6 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
// //
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(UCHAR)); RtlZeroMemory(ShortNameBuffer, 13 * sizeof(UCHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(UCHAR)); RtlZeroMemory(LfnNameBuffer, 261 * sizeof(UCHAR));
continue;
} }
return FALSE; return FALSE;