diff options
-rw-r--r-- | ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c index 059845c04d..6443a7bf44 100644 --- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c +++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c @@ -155,8 +155,6 @@ FileOpen ( EFI_STATUS Status = EFI_SUCCESS;
UINTN SemihostHandle;
CHAR8 *AsciiFileName;
- CHAR8 *AsciiPtr;
- UINTN Length;
UINT32 SemihostMode;
BOOLEAN IsRoot;
@@ -164,19 +162,12 @@ FileOpen ( return EFI_INVALID_PARAMETER;
}
- // Semihost interface requires ASCII filesnames
- Length = StrSize (FileName);
-
- AsciiFileName = AllocatePool (Length);
+ // Semihost interface requires ASCII filenames
+ AsciiFileName = AllocatePool ((StrLen (FileName) + 1) * sizeof (CHAR8));
if (AsciiFileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
-
- AsciiPtr = AsciiFileName;
-
- while (Length--) {
- *AsciiPtr++ = *FileName++ & 0xFF;
- }
+ UnicodeStrToAsciiStr (FileName, AsciiFileName);
if ((AsciiStrCmp (AsciiFileName, "\\") == 0) ||
(AsciiStrCmp (AsciiFileName, "/") == 0) ||
|