[refactor] Organize STRING
This commit is contained in:
+4
-14
@@ -1,7 +1,7 @@
|
||||
#include <fs.h>
|
||||
#include <serial.h>
|
||||
#include <memory/heap.h>
|
||||
#include <common.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
extern EFI_SYSTEM_TABLE *ST;
|
||||
|
||||
@@ -537,14 +537,7 @@ struct list_ctx {
|
||||
};
|
||||
|
||||
static void name_to_ascii(const CHAR16 *Name, char *Ascii, UINTN ascii_sz) {
|
||||
UINTN i = 0;
|
||||
for (; Name[i] && i < ascii_sz - 1; i++) {
|
||||
if (Name[i] >= 0x20 && Name[i] <= 0x7E)
|
||||
Ascii[i] = (char)Name[i];
|
||||
else
|
||||
Ascii[i] = '?';
|
||||
}
|
||||
Ascii[i] = 0;
|
||||
wstr_to_ascii(Ascii, (WString)Name, ascii_sz);
|
||||
}
|
||||
|
||||
static void list_callback(void *ctx, const CHAR16 *Name, UINT8 Attr,
|
||||
@@ -633,10 +626,7 @@ struct find_ctx {
|
||||
};
|
||||
|
||||
static BOOLEAN name_match(const CHAR16 *a, const CHAR16 *b) {
|
||||
UINTN i = 0;
|
||||
for (; a[i] && b[i]; i++)
|
||||
if (a[i] != b[i]) return FALSE;
|
||||
return a[i] == 0 && b[i] == 0;
|
||||
return wstr_eq((WString)a, (WString)b);
|
||||
}
|
||||
|
||||
static void find_callback(void *ctx, const CHAR16 *Name, UINT8 Attr,
|
||||
@@ -651,7 +641,7 @@ static void find_callback(void *ctx, const CHAR16 *Name, UINT8 Attr,
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS fs_read(const CHAR16 *Path, void **Buffer, UINTN *Size) {
|
||||
EFI_STATUS fs_read(WString Path, void **Buffer, UINTN *Size) {
|
||||
if (!g_fs_inited) return EFI_NOT_READY;
|
||||
|
||||
const CHAR16 *p = Path;
|
||||
|
||||
Reference in New Issue
Block a user