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

View file

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

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
//
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
//
@ -702,7 +703,6 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
//
RtlZeroMemory(ShortNameBuffer, 13 * sizeof(UCHAR));
RtlZeroMemory(LfnNameBuffer, 261 * sizeof(UCHAR));
continue;
}
return FALSE;