public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Yonghong Zhu <yonghong.zhu@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH v1 3/7] Basetools/GenFds: refactor class FV
Date: Mon, 24 Sep 2018 07:28:14 -0700	[thread overview]
Message-ID: <abd993ee49120c8ac17a37f62780cffcc610b30f.1537799017.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1537799017.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1537799017.git.jaben.carsey@intel.com>

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.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@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 f99bb6215115..ff2efd8d7a57 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2089,8 +2089,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)
@@ -2101,9 +2100,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



  parent reply	other threads:[~2018-09-24 14:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 14:28 [PATCH v1 0/7] BaseTools/GenFds: cleanup GenFds Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 1/7] " Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 2/7] BaseTools/GenFds: change objects to sets Jaben Carsey
2018-09-24 14:28 ` Jaben Carsey [this message]
2018-09-24 14:28 ` [PATCH v1 4/7] BaseTools/GenFds: remove MacroDict parameter Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 5/7] BaseTools/GenFds: refactor FdfParser warnings Jaben Carsey
2018-09-24 14:28 ` [PATCH v1 6/7] BaseTools/GenFds: Remove duplicate function calls Jaben Carsey
2018-09-25 13:45   ` Feng, Bob C
2018-09-24 14:28 ` [PATCH v1 7/7] BaseTools/GenFds: create and use new variable in FdfParser Jaben Carsey
2018-09-25 13:45   ` Feng, Bob C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abd993ee49120c8ac17a37f62780cffcc610b30f.1537799017.git.jaben.carsey@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox