From e5dab01618850f8c8be029336ad93dcd1680865f Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 11 Nov 2008 15:39:02 +0000 Subject: 1, Move device path utility macros from protocol's header file to DevicePathLib library classes 2, Remove Unpack type git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6455 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/UefiDevicePathLib/UefiDevicePathLib.c | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'MdePkg/Library/UefiDevicePathLib') diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c index 2d266c70b7..708b48a088 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c @@ -70,14 +70,14 @@ GetDevicePathSize ( // Search for the end of the device path structure // Start = DevicePath; - while (!EfiIsDevicePathEnd (DevicePath)) { - DevicePath = EfiNextDevicePathNode (DevicePath); + while (!IsDevicePathEnd (DevicePath)) { + DevicePath = NextDevicePathNode (DevicePath); } // // Compute the size and add back in the size of the end device path structure // - return ((UINTN) DevicePath - (UINTN) Start) + EfiDevicePathNodeLength (DevicePath); + return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath); } /** @@ -166,7 +166,7 @@ AppendDevicePath ( // Size1 = GetDevicePathSize (FirstDevicePath); Size2 = GetDevicePathSize (SecondDevicePath); - Size = Size1 + Size2 - EFI_END_DEVICE_PATH_LENGTH; + Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH; NewDevicePath = AllocatePool (Size); @@ -176,7 +176,7 @@ AppendDevicePath ( // Over write FirstDevicePath EndNode and do the copy // DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + - (Size1 - EFI_END_DEVICE_PATH_LENGTH)); + (Size1 - END_DEVICE_PATH_LENGTH)); CopyMem (DevicePath2, SecondDevicePath, Size2); } @@ -224,7 +224,7 @@ AppendDevicePathNode ( // NodeLength = DevicePathNodeLength (DevicePathNode); - TempDevicePath = AllocatePool (NodeLength + EFI_END_DEVICE_PATH_LENGTH); + TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH); if (TempDevicePath == NULL) { return NULL; } @@ -451,12 +451,12 @@ IsDevicePathMultiInstance ( } Node = DevicePath; - while (!EfiIsDevicePathEnd (Node)) { - if (EfiIsDevicePathEndInstance (Node)) { + while (!IsDevicePathEnd (Node)) { + if (IsDevicePathEndInstance (Node)) { return TRUE; } - Node = EfiNextDevicePathNode (Node); + Node = NextDevicePathNode (Node); } return FALSE; @@ -518,15 +518,16 @@ FileDevicePath ( IN CONST CHAR16 *FileName ) { - UINTN Size; + UINT16 Size; FILEPATH_DEVICE_PATH *FilePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *FileDevicePath; DevicePath = NULL; - Size = StrSize (FileName); - FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH); + Size = (UINT16) StrSize (FileName); + + FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH); if (FileDevicePath != NULL) { FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath; FilePath->Header.Type = MEDIA_DEVICE_PATH; -- cgit v1.2.3