Update NewHii library

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8063 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-04-12 02:47:10 +00:00
parent 6d3ea23f11
commit cd8ec63636
2 changed files with 23 additions and 32 deletions

View File

@ -365,6 +365,7 @@ HiiIsConfigHdrMatch (
is an optional parameter that may be NULL. is an optional parameter that may be NULL.
@param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional
parameter that may be NULL. parameter that may be NULL.
@param[in] BufferSize Length in bytes of buffer to hold retrived data.
@retval NULL The uncommitted data could not be retrieved. @retval NULL The uncommitted data could not be retrieved.
@retval Other A pointer to a buffer containing the uncommitted data. @retval Other A pointer to a buffer containing the uncommitted data.
@ -374,7 +375,8 @@ UINT8 *
EFIAPI EFIAPI
HiiGetBrowserData ( HiiGetBrowserData (
IN CONST EFI_GUID *VariableGuid, OPTIONAL IN CONST EFI_GUID *VariableGuid, OPTIONAL
IN CONST CHAR16 *VariableName OPTIONAL IN CONST CHAR16 *VariableName, OPTIONAL
IN UINTN BlockSize
); );
/** /**

View File

@ -868,6 +868,7 @@ InternalHiiBlockToConfig (
If ConfigResp is NULL, then ASSERT(). If ConfigResp is NULL, then ASSERT().
@param[in] ConfigResp Pointer to a Null-terminated Unicode string. @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 NULL The block could not be generated..
@retval Other Pointer to the allocated block. @retval Other Pointer to the allocated block.
@ -876,32 +877,16 @@ InternalHiiBlockToConfig (
UINT8 * UINT8 *
EFIAPI EFIAPI
InternalHiiConfigToBlock ( InternalHiiConfigToBlock (
IN CONST EFI_STRING ConfigResp IN EFI_STRING ConfigResp,
IN UINTN BlockSize
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN BlockSize;
UINT8 TempBlock;
CHAR16 *Progress; CHAR16 *Progress;
UINT8 *Block; UINT8 *Block;
ASSERT (ConfigResp != NULL); ASSERT (ConfigResp != NULL);
//
// Get the size of the buffer required for <ConfigResp> conversion
//
BlockSize = 0;
Status = gHiiConfigRouting->ConfigToBlock (
gHiiConfigRouting,
ConfigResp,
&TempBlock,
&BlockSize,
&Progress
);
if (Status != EFI_BUFFER_TOO_SMALL) {
return NULL;
}
// //
// Allocate a buffer to hold the <ConfigResp> conversion // Allocate a buffer to hold the <ConfigResp> conversion
// //
@ -1583,6 +1568,7 @@ HiiIsConfigHdrMatch (
is an optional parameter that may be NULL. is an optional parameter that may be NULL.
@param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional
parameter that may be NULL. parameter that may be NULL.
@param[in] BufferSize Length in bytes of buffer to hold retrived data.
@retval NULL The uncommitted data could not be retrieved. @retval NULL The uncommitted data could not be retrieved.
@retval Other A pointer to a buffer containing the uncommitted data. @retval Other A pointer to a buffer containing the uncommitted data.
@ -1592,7 +1578,8 @@ UINT8 *
EFIAPI EFIAPI
HiiGetBrowserData ( HiiGetBrowserData (
IN CONST EFI_GUID *VariableGuid, OPTIONAL IN CONST EFI_GUID *VariableGuid, OPTIONAL
IN CONST CHAR16 *VariableName OPTIONAL IN CONST CHAR16 *VariableName, OPTIONAL
IN UINTN BlockSize
) )
{ {
EFI_STRING ResultsData; EFI_STRING ResultsData;
@ -1615,7 +1602,9 @@ HiiGetBrowserData (
ConfigResp = AllocateZeroPool (Size); ConfigResp = AllocateZeroPool (Size);
UnicodeSPrint (ConfigResp, Size, L"%s&%s", mConfigHdrTemplate, ResultsData); UnicodeSPrint (ConfigResp, Size, L"%s&%s", mConfigHdrTemplate, ResultsData);
//
// Free the allocated buffer
//
FreePool (ResultsData); FreePool (ResultsData);
if (ConfigResp == NULL) { if (ConfigResp == NULL) {
return NULL; return NULL;
@ -1624,12 +1613,9 @@ HiiGetBrowserData (
// //
// Convert <ConfigResp> to a buffer // Convert <ConfigResp> to a buffer
// //
Block = InternalHiiConfigToBlock (ConfigResp); Block = InternalHiiConfigToBlock (ConfigResp, BlockSize);
FreePool (ConfigResp); FreePool (ConfigResp);
//
// Return converted buffer
//
return Block; return Block;
} }
@ -2665,12 +2651,6 @@ InternalHiiUpdateFormPackageData (
// //
if ((UpdateIfrOpHdr->Length == IfrOpHdr->Length) && \ if ((UpdateIfrOpHdr->Length == IfrOpHdr->Length) && \
(CompareMem (IfrOpHdr, UpdateIfrOpHdr, UpdateIfrOpHdr->Length) == 0)) { (CompareMem (IfrOpHdr, UpdateIfrOpHdr, UpdateIfrOpHdr->Length) == 0)) {
//
// Keep the End opcode flag
//
CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
BufferPos += IfrOpHdr->Length;
UpdatePackageLength += IfrOpHdr->Length;
break; break;
} }
// //
@ -2701,6 +2681,15 @@ InternalHiiUpdateFormPackageData (
AddOpCode = (EFI_IFR_OP_HEADER *) ((UINT8 *) (AddOpCode) + AddOpCode->Length); AddOpCode = (EFI_IFR_OP_HEADER *) ((UINT8 *) (AddOpCode) + AddOpCode->Length);
AddSize += AddOpCode->Length; AddSize += AddOpCode->Length;
} }
if (OpCodeBufferEnd != NULL) {
//
// Add the end opcode
//
CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
BufferPos += IfrOpHdr->Length;
UpdatePackageLength += IfrOpHdr->Length;
}
// //
// Set update flag // Set update flag
// //