[refactor] Organize INT
This commit is contained in:
+11
-11
@@ -216,7 +216,7 @@ static EFI_STATUS find_mbr_partition(struct block_dev *dev, UINT64 *StartLBA) {
|
||||
struct MBRPart *Parts = (struct MBRPart*)(Buf + 446);
|
||||
// Verify at least one non-zero partition entry exists
|
||||
BOOLEAN has_part = FALSE;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (SSINT32 i = 0; i < 4; i++) {
|
||||
if (Parts[i].Type != 0x00 && Parts[i].Type != 0xEE) {
|
||||
has_part = TRUE;
|
||||
break;
|
||||
@@ -224,7 +224,7 @@ static EFI_STATUS find_mbr_partition(struct block_dev *dev, UINT64 *StartLBA) {
|
||||
}
|
||||
if (!has_part) { kfree(Buf); return EFI_NOT_FOUND; }
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (SSINT32 i = 0; i < 4; i++) {
|
||||
UINT8 t = Parts[i].Type;
|
||||
if (t == 0x00 || t == 0xEE) continue;
|
||||
if (t == MBR_TYPE_FAT12 || t == MBR_TYPE_FAT16 ||
|
||||
@@ -238,7 +238,7 @@ static EFI_STATUS find_mbr_partition(struct block_dev *dev, UINT64 *StartLBA) {
|
||||
}
|
||||
|
||||
// Fallback: first non-empty partition
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (SSINT32 i = 0; i < 4; i++) {
|
||||
if (Parts[i].Type != 0x00) {
|
||||
*StartLBA = Parts[i].LBABegin;
|
||||
kfree(Buf);
|
||||
@@ -361,7 +361,7 @@ static EFI_STATUS fat_init(struct fat_fs *fs, struct block_dev *dev, UINT64 Part
|
||||
|
||||
static UINT8 lfn_checksum(const UINT8 *SFN) {
|
||||
UINT8 sum = 0;
|
||||
for (int i = 0; i < 11; i++)
|
||||
for (SSINT32 i = 0; i < 11; i++)
|
||||
sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + SFN[i];
|
||||
return sum;
|
||||
}
|
||||
@@ -381,17 +381,17 @@ static void lfn_reset(struct lfn_state *lfn) {
|
||||
static void lfn_add(struct lfn_state *lfn, const UINT8 *E) {
|
||||
if (lfn->count >= LFN_MAX_FRAGS) return;
|
||||
UINTN pos = 0;
|
||||
for (int i = 0; i < 5 && pos < LFN_FRAG_SIZE; i++) {
|
||||
for (SSINT32 i = 0; i < 5 && pos < LFN_FRAG_SIZE; i++) {
|
||||
CHAR16 c = *(const UINT16*)(E + 1 + i * 2);
|
||||
if (c == 0x0000 || c == 0xFFFF) { lfn->frags[lfn->count][pos] = 0; return; }
|
||||
lfn->frags[lfn->count][pos++] = c;
|
||||
}
|
||||
for (int i = 0; i < 6 && pos < LFN_FRAG_SIZE; i++) {
|
||||
for (SSINT32 i = 0; i < 6 && pos < LFN_FRAG_SIZE; i++) {
|
||||
CHAR16 c = *(const UINT16*)(E + 14 + i * 2);
|
||||
if (c == 0x0000 || c == 0xFFFF) { lfn->frags[lfn->count][pos] = 0; return; }
|
||||
lfn->frags[lfn->count][pos++] = c;
|
||||
}
|
||||
for (int i = 0; i < 2 && pos < LFN_FRAG_SIZE; i++) {
|
||||
for (SSINT32 i = 0; i < 2 && pos < LFN_FRAG_SIZE; i++) {
|
||||
CHAR16 c = *(const UINT16*)(E + 28 + i * 2);
|
||||
if (c == 0x0000 || c == 0xFFFF) { lfn->frags[lfn->count][pos] = 0; return; }
|
||||
lfn->frags[lfn->count][pos++] = c;
|
||||
@@ -413,11 +413,11 @@ static void lfn_build(struct lfn_state *lfn, CHAR16 *out, UINTN out_size) {
|
||||
|
||||
static void sfn_to_name(const UINT8 *E, CHAR16 *out, UINTN out_size) {
|
||||
UINTN pos = 0;
|
||||
for (int i = 0; i < 8 && pos < out_size - 1; i++)
|
||||
for (SSINT32 i = 0; i < 8 && pos < out_size - 1; i++)
|
||||
if (E[i] != ' ') out[pos++] = E[i];
|
||||
UINTN ext_start = pos;
|
||||
BOOLEAN has_ext = FALSE;
|
||||
for (int i = 8; i < 11 && pos < out_size - 1; i++) {
|
||||
for (SSINT32 i = 8; i < 11 && pos < out_size - 1; i++) {
|
||||
if (E[i] != ' ') {
|
||||
if (!has_ext) { out[pos++] = '.'; has_ext = TRUE; ext_start = pos; }
|
||||
out[pos++] = E[i];
|
||||
@@ -533,7 +533,7 @@ static BOOLEAN g_fs_inited = FALSE;
|
||||
|
||||
struct list_ctx {
|
||||
struct fat_fs *fs;
|
||||
int depth;
|
||||
SSINT32 depth;
|
||||
};
|
||||
|
||||
static void name_to_ascii(const CHAR16 *Name, char *Ascii, UINTN ascii_sz) {
|
||||
@@ -550,7 +550,7 @@ static void name_to_ascii(const CHAR16 *Name, char *Ascii, UINTN ascii_sz) {
|
||||
static void list_callback(void *ctx, const CHAR16 *Name, UINT8 Attr,
|
||||
UINT32 Size, UINT32 FirstClus) {
|
||||
struct list_ctx *lc = (struct list_ctx*)ctx;
|
||||
for (int i = 0; i < lc->depth; i++) serial_write(" ");
|
||||
for (SSINT32 i = 0; i < lc->depth; i++) serial_write(" ");
|
||||
|
||||
serial_write(Attr & 0x10 ? "[DIR] " : "[FILE] ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user