]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/BdsLib/BdsFilePath.c
ArmPkg: Move IS_DEVICE_PATH_NODE for sharing
[mirror_edk2.git] / ArmPkg / Library / BdsLib / BdsFilePath.c
index aefeaed4ffb59efe3bb1020a55042c416d2e8542..41557bb91816e7df488298e72e44994090b2af6b 100644 (file)
@@ -24,9 +24,6 @@
 #include <Protocol/Dhcp4.h>\r
 #include <Protocol/Mtftp4.h>\r
 \r
-\r
-#define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype)))\r
-\r
 /* Type and defines to set up the DHCP4 options */\r
 \r
 typedef struct {\r
@@ -964,7 +961,7 @@ Mtftp4CheckPacket (
       Step      = (Context->DownloadedNbOfBytes   * TFTP_PROGRESS_SLIDER_STEPS) / Context->FileSize;\r
       if (Step > LastStep) {\r
         Print (mTftpProgressDelete);\r
-        StrCpy (Progress, mTftpProgressFrame);\r
+        CopyMem (Progress, mTftpProgressFrame, sizeof mTftpProgressFrame);\r
         for (Index = 1; Index < Step; Index++) {\r
           Progress[Index] = L'=';\r
         }\r
@@ -1044,6 +1041,7 @@ BdsTftpLoadImage (
   UINT64                   FileSize;\r
   UINT64                   TftpBufferSize;\r
   BDS_TFTP_CONTEXT         *TftpContext;\r
+  UINTN                    PathNameLen;\r
 \r
   ASSERT(IS_DEVICE_PATH_NODE (RemainingDevicePath, MESSAGING_DEVICE_PATH, MSG_IPv4_DP));\r
   IPv4DevicePathNode = (IPv4_DEVICE_PATH*)RemainingDevicePath;\r
@@ -1187,8 +1185,9 @@ BdsTftpLoadImage (
 \r
   // The Device Path might contain multiple FilePath nodes\r
   PathName      = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL*)(IPv4DevicePathNode + 1), FALSE, FALSE);\r
-  AsciiFilePath = AllocatePool (StrLen (PathName) + 1);\r
-  UnicodeStrToAsciiStr (PathName, AsciiFilePath);\r
+  PathNameLen   = StrLen (PathName) + 1;\r
+  AsciiFilePath = AllocatePool (PathNameLen);\r
+  UnicodeStrToAsciiStrS (PathName, AsciiFilePath, PathNameLen);\r
 \r
   //\r
   // Try to get the size of the file in bytes from the server. If it fails,\r