/** @file\r
+Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.\r
\r
Copyright (c) 2007 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- ConfigRouting.c\r
-\r
-Abstract:\r
-\r
- Implementation for EFI_HII_CONFIG_ROUTING_PROTOCOL.\r
-\r
-Revision History\r
-\r
-\r
**/\r
\r
\r
\r
}\r
\r
-\r
-/**\r
- Adjusts the size of a previously allocated buffer.\r
-\r
-\r
- @param OldPool A pointer to the buffer whose size is being adjusted.\r
- @param OldSize The size of the current buffer.\r
- @param NewSize The size of the new buffer.\r
-\r
- @return The new buffer allocated.\r
-\r
-**/\r
-VOID *\r
-ReallocatePool (\r
- IN VOID *OldPool,\r
- IN UINTN OldSize,\r
- IN UINTN NewSize\r
- )\r
-{\r
- VOID *NewPool;\r
-\r
- NewPool = NULL;\r
- if (NewSize != 0) {\r
- NewPool = AllocateZeroPool (NewSize);\r
- }\r
-\r
- if (OldPool != NULL) {\r
- if (NewPool != NULL) {\r
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);\r
- }\r
-\r
- gBS->FreePool (OldPool);\r
- }\r
-\r
- return NewPool;\r
-}\r
-\r
-\r
/**\r
Append a string to a multi-string format.\r
\r
if (MultiStringSize + AppendStringSize > MAX_STRING_LENGTH ||\r
MultiStringSize > MAX_STRING_LENGTH) {\r
*MultiString = (EFI_STRING) ReallocatePool (\r
- (VOID *) (*MultiString),\r
MultiStringSize,\r
- MultiStringSize + AppendStringSize\r
+ MultiStringSize + AppendStringSize,\r
+ (VOID *) (*MultiString)\r
);\r
+ ASSERT (*MultiString != NULL);\r
}\r
-\r
//\r
// Append the incoming string\r
//\r
EFI_STRING AccessResults;\r
BOOLEAN FirstElement;\r
\r
- //\r
- // For size reduction, please define PcdSupportFullConfigRoutingProtocol \r
- // as FALSE. But this renders the system to not 100% compliant with\r
- // UEFI 2.1. Use this with caution.\r
- //\r
- if (!FeaturePcdGet (PcdSupportFullConfigRoutingProtocol)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
if (This == NULL || Progress == NULL || Results == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
UINTN NumberConfigAccessHandles;\r
BOOLEAN FirstElement;\r
\r
- //\r
- // For size reduction, please define PcdSupportFullConfigRoutingProtocol \r
- // as FALSE. But this renders the system to not 100% compliant with\r
- // UEFI 2.1. Use this with caution.\r
- //\r
- if (!FeaturePcdGet (PcdSupportFullConfigRoutingProtocol)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
if (This == NULL || Results == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
AccessResults = NULL;\r
}\r
}\r
- gBS->FreePool (ConfigAccessHandles);\r
+ FreePool (ConfigAccessHandles);\r
\r
return EFI_SUCCESS; \r
}\r
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
EFI_STRING AccessProgress;\r
\r
- //\r
- // For size reduction, please define PcdSupportFullConfigRoutingProtocol \r
- // as FALSE. But this renders the system to not 100% compliant with\r
- // UEFI 2.1. Use this with caution.\r
- //\r
- if (!FeaturePcdGet (PcdSupportFullConfigRoutingProtocol)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
if (This == NULL || Progress == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
if (Value != NULL) {\r
FreePool (Value);\r
}\r
- if (ConfigElement) {\r
+ if (ConfigElement != NULL) {\r
FreePool (ConfigElement);\r
}\r
\r
// Get Offset\r
//\r
Status = GetValueOfNumber (StringPtr, &TmpBuffer, &Length);\r
- if (Status == EFI_OUT_OF_RESOURCES) {\r
+ if (EFI_ERROR (Status)) {\r
*Progress = ConfigResp;\r
goto Exit;\r
}\r
// Get Value\r
//\r
Status = GetValueOfNumber (StringPtr, &Value, &Length);\r
- if (Status == EFI_OUT_OF_RESOURCES) {\r
+ if (EFI_ERROR (Status)) {\r
*Progress = ConfigResp;\r
goto Exit;\r
}\r
BOOLEAN NameFlag;\r
BOOLEAN PathFlag;\r
\r
- //\r
- // For size reduction, please define PcdSupportFullConfigRoutingProtocol \r
- // as FALSE. But this renders the system to not 100% compliant with\r
- // UEFI 2.1. Use this with caution.\r
- //\r
- if (!FeaturePcdGet (PcdSupportFullConfigRoutingProtocol)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
HdrStart = NULL;\r
HdrEnd = NULL;\r
GuidStr = NULL;\r
\r
Exit:\r
\r
- if (!EFI_ERROR (Status)) {\r
+ if (!EFI_ERROR (Status) && (Result != NULL)) {\r
//\r
// Copy the <ConfigHdr> and <ConfigBody>\r
//\r