From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 171B921C8EFB5 for ; Tue, 23 Oct 2018 10:29:32 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 10:29:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,417,1534834800"; d="scan'208";a="83823325" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.149]) by orsmga008.jf.intel.com with ESMTP; 23 Oct 2018 10:29:31 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Yonghong Zhu , Liming Gao Date: Tue, 23 Oct 2018 10:29:21 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [Patch v3 3/6] Basetools/GenFds: refactor class FV X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2018 17:29:32 -0000 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 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- 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 8b4d5e7fd863..9e806de0d294 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 30525bd11fcc..d89e7bfbdd6e 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