1) initialize UiFvName via __init__ parameter. No change to default behavior.
2) initialize 3 empty lists in __init__. Curently not guarenteed initialized.

Cc: Yonghong Zhu <yonghong....@intel.com>
Cc: Liming Gao <liming....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.car...@intel.com>
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 6 +-----
 BaseTools/Source/Python/GenFds/Fv.py        | 9 +++++----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 29c5a60d6afe..fa82d8f174d5 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2090,8 +2090,7 @@ class FdfParser:
         if not self._IsToken(TAB_SECTION_END):
             raise Warning("expected ']'", self.FileName, 
self.CurrentLineNumber)
 
-        FvObj = FV()
-        FvObj.UiFvName = self.CurrentFvName
+        FvObj = FV(Name=self.CurrentFvName)
         self.Profile.FvDict[self.CurrentFvName] = FvObj
 
         Status = self._GetCreateFile(FvObj)
@@ -2102,9 +2101,6 @@ class FdfParser:
 
         self._GetAddressStatements(FvObj)
 
-        FvObj.FvExtEntryTypeValue = []
-        FvObj.FvExtEntryType = []
-        FvObj.FvExtEntryData = []
         while True:
             self._GetSetStatements(FvObj)
 
diff --git a/BaseTools/Source/Python/GenFds/Fv.py 
b/BaseTools/Source/Python/GenFds/Fv.py
index acb133573d72..cd19dff6c325 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -37,8 +37,8 @@ class FV (object):
     #
     #   @param  self        The object pointer
     #
-    def __init__(self):
-        self.UiFvName = None
+    def __init__(self, Name=None):
+        self.UiFvName = Name
         self.CreateFileName = None
         self.BlockSizeList = []
         self.DefineVarDict = {}
@@ -61,7 +61,9 @@ class FV (object):
         self.FvForceRebase = None
         self.FvRegionInFD = None
         self.UsedSizeEnable = False
-
+        self.FvExtEntryTypeValue = []
+        self.FvExtEntryType = []
+        self.FvExtEntryData = []
     ## AddToBuffer()
     #
     #   Generate Fv and add it to the Buffer
@@ -77,7 +79,6 @@ class FV (object):
     #   @retval string      Generated FV file path
     #
     def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, 
BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False):
-
         if BaseAddress is None and self.UiFvName.upper() + 'fv' in 
GenFdsGlobalVariable.ImageBinDict:
             return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 
'fv']
 
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to