]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
Fix nmake cleanall bugs.
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / VfrUtilityLib.cpp
index 21a479db68c29b6a4c0e54ebda705401bf8127ed..246820a08a2c331c9ffb7ba06a0317cc41b119a3 100644 (file)
@@ -2,7 +2,7 @@
   \r
   Vfr common library functions.\r
 \r
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "stdio.h"\r
 #include "stdlib.h"\r
+#include "CommonLib.h"\r
 #include "VfrUtilityLib.h"\r
 #include "VfrFormPkg.h"\r
 \r
@@ -1512,21 +1513,30 @@ CVfrDataStorage::MarkVarStoreIdUnused (
 \r
 EFI_VFR_RETURN_CODE\r
 CVfrDataStorage::DeclareNameVarStoreBegin (\r
-  IN CHAR8    *StoreName\r
+  IN CHAR8           *StoreName,\r
+  IN EFI_VARSTORE_ID VarStoreId\r
   )\r
 {\r
   SVfrVarStorageNode *pNode = NULL;\r
-  EFI_VARSTORE_ID    VarStoreId;\r
+  EFI_VARSTORE_ID    TmpVarStoreId;\r
 \r
   if (StoreName == NULL) {\r
     return VFR_RETURN_FATAL_ERROR;\r
   }\r
 \r
-  if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {\r
+  if (GetVarStoreId (StoreName, &TmpVarStoreId) == VFR_RETURN_SUCCESS) {\r
     return VFR_RETURN_REDEFINED;\r
   }\r
+  \r
+  if (VarStoreId == EFI_VARSTORE_ID_INVALID) {\r
+    VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);\r
+  } else {\r
+    if (ChekVarStoreIdFree (VarStoreId) == FALSE) {\r
+      return VFR_RETURN_VARSTOREID_REDEFINED;\r
+    }\r
+    MarkVarStoreIdUsed (VarStoreId);\r
+  }\r
 \r
-  VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);\r
   if ((pNode = new SVfrVarStorageNode (StoreName, VarStoreId)) == NULL) {\r
     return VFR_RETURN_UNDEFINED;\r
   }\r
@@ -2619,6 +2629,14 @@ CVfrQuestionDB::RegisterNewDateQuestion (
   CHAR8                 Index;\r
 \r
   if (BaseVarId == NULL && Name == NULL) {\r
+    if (QuestionId == EFI_QUESTION_ID_INVALID) {\r
+      QuestionId = GetFreeQuestionId ();\r
+    } else {\r
+      if (ChekQuestionIdFree (QuestionId) == FALSE) {\r
+        goto Err;\r
+      }\r
+      MarkQuestionIdUsed (QuestionId);\r
+    }\r
     return;\r
   }\r
 \r
@@ -2787,6 +2805,14 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
   CHAR8                 Index;\r
 \r
   if (BaseVarId == NULL && Name == NULL) {\r
+    if (QuestionId == EFI_QUESTION_ID_INVALID) {\r
+      QuestionId = GetFreeQuestionId ();\r
+    } else {\r
+      if (ChekQuestionIdFree (QuestionId) == FALSE) {\r
+        goto Err;\r
+      }\r
+      MarkQuestionIdUsed (QuestionId);\r
+    }\r
     return;\r
   }\r
 \r
@@ -3258,7 +3284,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
     return NULL;\r
   }\r
 \r
-  if ((pInFile = fopen (mStringFileName, "rb")) == NULL) {\r
+  if ((pInFile = fopen (LongFilePath (mStringFileName), "rb")) == NULL) {\r
     return NULL;\r
   }\r
 \r