From 1d451ff9cf3427c5dc4ba1650d33b1b5aad76d7f Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 27 Apr 2009 04:55:02 +0000 Subject: Update HiiGetBrowserData API git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8176 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 98 +++++++++----------------------- 1 file changed, 28 insertions(+), 70 deletions(-) (limited to 'MdeModulePkg/Library/UefiHiiLib') diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index ea3c22348e..c8ef091ff7 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -446,63 +446,6 @@ InternalHiiBlockToConfig ( return ConfigResp; } -/** - Uses the ConfigToBlock() service of the Config Routing Protocol to - convert to a block. The block is allocated using - AllocatePool(). The caller is responsible for freeing the block - using FreePool(). - - If ConfigResp is NULL, then ASSERT(). - - @param[in] ConfigResp Pointer to a Null-terminated Unicode string. - @param[in] BufferSize Length in bytes of buffer to hold retrived data. - - @retval NULL The block could not be generated.. - @retval Other Pointer to the allocated block. - -**/ -UINT8 * -EFIAPI -InternalHiiConfigToBlock ( - IN EFI_STRING ConfigResp, - IN UINTN BlockSize - ) -{ - EFI_STATUS Status; - CHAR16 *Progress; - UINT8 *Block; - - ASSERT (ConfigResp != NULL); - - // - // Allocate a buffer to hold the conversion - // - Block = AllocateZeroPool (BlockSize); - if (Block == NULL) { - return NULL; - } - - // - // Convert to a buffer - // - Status = gHiiConfigRouting->ConfigToBlock ( - gHiiConfigRouting, - ConfigResp, - Block, - &BlockSize, - &Progress - ); - if (EFI_ERROR (Status)) { - FreePool (Block); - return NULL; - } - - // - // Return converted buffer - // - return Block; -} - /** Uses the BrowserCallback() service of the Form Browser Protocol to retrieve or set uncommitted data. If sata i being retrieved, then the buffer is @@ -1164,38 +1107,40 @@ HiiIsConfigHdrMatch ( /** Retrieves uncommited data from the Form Browser and converts it to a binary - buffer. The returned buffer is allocated using AllocatePool(). The caller - is responsible for freeing the returned buffer using FreePool(). + buffer. - @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional - parameter that may be NULL. @param[in] VariableName Pointer to a Null-terminated Unicode string. This is an optional parameter that may be NULL. + @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional + parameter that may be NULL. @param[in] BufferSize Length in bytes of buffer to hold retrived data. + @param[out] Block Buffer of data to be updated. - @retval NULL The uncommitted data could not be retrieved. - @retval Other A pointer to a buffer containing the uncommitted data. + @retval FALSE The uncommitted data could not be retrieved. + @retval TRUE The uncommitted data was retrieved. **/ -UINT8 * +BOOLEAN EFIAPI HiiGetBrowserData ( IN CONST EFI_GUID *VariableGuid, OPTIONAL IN CONST CHAR16 *VariableName, OPTIONAL - IN UINTN BlockSize + IN UINTN BlockSize, + OUT UINT8 *Block ) { EFI_STRING ResultsData; UINTN Size; EFI_STRING ConfigResp; - UINT8 *Block; + EFI_STATUS Status; + CHAR16 *Progress; // // Retrieve the results data from the Browser Callback // ResultsData = InternalHiiBrowserCallback (VariableGuid, VariableName, NULL); if (ResultsData == NULL) { - return NULL; + return FALSE; } // @@ -1211,16 +1156,29 @@ HiiGetBrowserData ( // FreePool (ResultsData); if (ConfigResp == NULL) { - return NULL; + return FALSE; } // // Convert to a buffer // - Block = InternalHiiConfigToBlock (ConfigResp, BlockSize); + Status = gHiiConfigRouting->ConfigToBlock ( + gHiiConfigRouting, + ConfigResp, + Block, + &BlockSize, + &Progress + ); + // + // Free the allocated buffer + // FreePool (ConfigResp); - return Block; + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; } /** -- cgit v1.2.3