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 /MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | |
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
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/Setup.c')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 49 |
1 files changed, 35 insertions, 14 deletions
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);
|