diff options
author | Eric Dong <eric.dong@intel.com> | 2013-12-31 04:46:53 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-12-31 04:46:53 +0000 |
commit | 27bace9b3ee288a2befb63a405cc0882882ef136 (patch) | |
tree | 31152c46526bf8ce301944f64fe29a6a133cd7aa | |
parent | 3e108dfd7dcd495732e86d2d1339364033512ecf (diff) | |
download | edk2-platforms-27bace9b3ee288a2befb63a405cc0882882ef136.tar.xz |
Keep consistent about the return value between the caller and callee.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15032 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Include/Protocol/FormBrowserEx.h | 2 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 49 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 1 |
3 files changed, 38 insertions, 14 deletions
diff --git a/MdeModulePkg/Include/Protocol/FormBrowserEx.h b/MdeModulePkg/Include/Protocol/FormBrowserEx.h index afeb7c0c0f..3bb64c6ff9 100644 --- a/MdeModulePkg/Include/Protocol/FormBrowserEx.h +++ b/MdeModulePkg/Include/Protocol/FormBrowserEx.h @@ -27,6 +27,7 @@ typedef struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL EFI_FORM_BROWSER_EXTENSION #define BROWSER_NO_CHANGES 0
#define BROWSER_SAVE_CHANGES 1
#define BROWSER_DISCARD_CHANGES 2
+#define BROWSER_KEEP_CURRENT 3
//
// Browser actions. They can be cominbed together.
@@ -126,6 +127,7 @@ VOID @retval BROWSER_NO_CHANGES No browser data is changed.
@retval BROWSER_SAVE_CHANGES The changed browser data is saved.
@retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
+ @retval BROWSER_KEEP_CURRENT Browser keep current changes.
**/
typedef
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index c7c7f9ae43..11c9589ceb 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -4902,21 +4902,27 @@ IsBrowserDataModified ( LIST_ENTRY *Link;
FORM_BROWSER_FORMSET *FormSet;
- if (gCurrentSelection == NULL) {
- return FALSE;
- }
-
switch (gBrowserSettingScope) {
case FormLevel:
+ if (gCurrentSelection == NULL) {
+ return FALSE;
+ }
return IsNvUpdateRequiredForForm (gCurrentSelection->Form);
case FormSetLevel:
+ if (gCurrentSelection == NULL) {
+ return FALSE;
+ }
return IsNvUpdateRequiredForFormSet (gCurrentSelection->FormSet);
case SystemLevel:
Link = GetFirstNode (&gBrowserFormSetList);
while (!IsNull (&gBrowserFormSetList, Link)) {
FormSet = FORM_BROWSER_FORMSET_FROM_LINK (Link);
+ if (!ValidateFormSet(FormSet)) {
+ continue;
+ }
+
if (IsNvUpdateRequiredForFormSet (FormSet)) {
return TRUE;
}
@@ -4946,19 +4952,27 @@ ExecuteAction ( IN UINT16 DefaultId
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ FORM_BROWSER_FORMSET *FormSet;
+ FORM_BROWSER_FORM *Form;
- if (gCurrentSelection == NULL) {
+ if (gBrowserSettingScope < SystemLevel && gCurrentSelection == NULL) {
return EFI_NOT_READY;
}
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
+ FormSet = NULL;
+ Form = NULL;
+ if (gBrowserSettingScope < SystemLevel) {
+ FormSet = gCurrentSelection->FormSet;
+ Form = gCurrentSelection->Form;
+ }
//
// Executet the discard action.
//
if ((Action & BROWSER_ACTION_DISCARD) != 0) {
- Status = DiscardForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
+ Status = DiscardForm (FormSet, Form, gBrowserSettingScope);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -4968,7 +4982,7 @@ ExecuteAction ( // Executet the difault action.
//
if ((Action & BROWSER_ACTION_DEFAULT) != 0) {
- Status = ExtractDefault (gCurrentSelection->FormSet, gCurrentSelection->Form, DefaultId, gBrowserSettingScope, GetDefaultForAll, NULL, FALSE);
+ Status = ExtractDefault (FormSet, Form, DefaultId, gBrowserSettingScope, GetDefaultForAll, NULL, FALSE);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -4978,7 +4992,7 @@ ExecuteAction ( // Executet the submit action.
//
if ((Action & BROWSER_ACTION_SUBMIT) != 0) {
- Status = SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
+ Status = SubmitForm (FormSet, Form, gBrowserSettingScope);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -4995,7 +5009,7 @@ ExecuteAction ( // Executet the exit action.
//
if ((Action & BROWSER_ACTION_EXIT) != 0) {
- DiscardForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrowserSettingScope);
+ DiscardForm (FormSet, Form, gBrowserSettingScope);
if (gBrowserSettingScope == SystemLevel) {
if (ExitHandlerFunction != NULL) {
ExitHandlerFunction ();
@@ -5015,6 +5029,7 @@ ExecuteAction ( @retval BROWSER_NO_CHANGES No browser data is changed.
@retval BROWSER_SAVE_CHANGES The changed browser data is saved.
@retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
+ @retval BROWSER_KEEP_CURRENT Browser keep current changes.
**/
UINT32
@@ -5027,6 +5042,7 @@ SaveReminder ( FORM_BROWSER_FORMSET *FormSet;
BOOLEAN IsDataChanged;
UINT32 DataSavedAction;
+ UINT32 ConfirmRet;
DataSavedAction = BROWSER_NO_CHANGES;
IsDataChanged = FALSE;
@@ -5054,13 +5070,18 @@ SaveReminder ( // If data is changed, prompt user to save or discard it.
//
do {
- DataSavedAction = (UINT32) mFormDisplay->ConfirmDataChange();
+ ConfirmRet = (UINT32) mFormDisplay->ConfirmDataChange();
- if (DataSavedAction == BROWSER_SAVE_CHANGES) {
+ if (ConfirmRet == BROWSER_ACTION_SUBMIT) {
SubmitForm (NULL, NULL, SystemLevel);
+ DataSavedAction = BROWSER_SAVE_CHANGES;
break;
- } else if (DataSavedAction == BROWSER_DISCARD_CHANGES) {
+ } else if (ConfirmRet == BROWSER_ACTION_DISCARD) {
DiscardForm (NULL, NULL, SystemLevel);
+ DataSavedAction = BROWSER_DISCARD_CHANGES;
+ break;
+ } else if (ConfirmRet == BROWSER_ACTION_NONE) {
+ DataSavedAction = BROWSER_KEEP_CURRENT;
break;
}
} while (1);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 337abb3fb6..87305bad68 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -1327,6 +1327,7 @@ ExecuteAction ( @retval BROWSER_NO_CHANGES No browser data is changed.
@retval BROWSER_SAVE_CHANGES The changed browser data is saved.
@retval BROWSER_DISCARD_CHANGES The changed browser data is discard.
+ @retval BROWSER_KEEP_CURRENT Browser keep current changes.
**/
UINT32
|