From ed2405a0ed4e880f78aa0536e83f39d1b91b721b Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Tue, 12 Mar 2013 00:57:05 +0000 Subject: [PATCH] ArmPkg/SemihostFs: Use Unicode to Ascii function for the conversion The Unicode to Ascii string conversion was done manually. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14186 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 15 +++------------ 1 file 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) || -- 2.39.2