NetworkPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr

It is the follow up of 3ab41b7a32
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
This commit is contained in:
Star Zeng
2016-06-15 13:38:03 +08:00
parent b68ccac17c
commit b9679cd745
8 changed files with 87 additions and 52 deletions

View File

@@ -255,6 +255,7 @@ HttpBootDhcp6ExtractUriInfo (
EFI_DHCP6_PACKET_OPTION *Option;
EFI_IPv6_ADDRESS IpAddr;
CHAR8 *HostName;
UINTN HostNameSize;
CHAR16 *HostNameStr;
EFI_STATUS Status;
@@ -349,14 +350,15 @@ HttpBootDhcp6ExtractUriInfo (
if (EFI_ERROR (Status)) {
return Status;
}
HostNameStr = AllocateZeroPool ((AsciiStrLen (HostName) + 1) * sizeof (CHAR16));
HostNameSize = AsciiStrSize (HostName);
HostNameStr = AllocateZeroPool (HostNameSize * sizeof (CHAR16));
if (HostNameStr == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
AsciiStrToUnicodeStr (HostName, HostNameStr);
AsciiStrToUnicodeStrS (HostName, HostNameStr, HostNameSize);
Status = HttpBootDns (Private, HostNameStr, &IpAddr);
FreePool (HostNameStr);
if (EFI_ERROR (Status)) {
@@ -752,6 +754,7 @@ HttpBootGetBootFile (
UINTN ContentLength;
HTTP_BOOT_CACHE_CONTENT *Cache;
UINT8 *Block;
UINTN UrlSize;
CHAR16 *Url;
BOOLEAN IdentityMode;
UINTN ReceivedSize;
@@ -770,11 +773,12 @@ HttpBootGetBootFile (
//
// First, check whether we already cached the requested Uri.
//
Url = AllocatePool ((AsciiStrLen (Private->BootFileUri) + 1) * sizeof (CHAR16));
UrlSize = AsciiStrSize (Private->BootFileUri);
Url = AllocatePool (UrlSize * sizeof (CHAR16));
if (Url == NULL) {
return EFI_OUT_OF_RESOURCES;
}
AsciiStrToUnicodeStr (Private->BootFileUri, Url);
AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
if (!HeaderOnly) {
Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);
if (Status != EFI_NOT_FOUND) {
@@ -873,11 +877,6 @@ HttpBootGetBootFile (
}
RequestData->Method = HeaderOnly ? HttpMethodHead : HttpMethodGet;
RequestData->Url = Url;
if (RequestData->Url == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ERROR_4;
}
AsciiStrToUnicodeStr (Private->BootFileUri, RequestData->Url);
//
// 2.3 Record the request info in a temp cache item.