diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2018-09-03 09:05:53 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-09-12 11:25:21 +0800 |
commit | cfed8a37ec3cf974e4eaaa298da6704133b00019 (patch) | |
tree | 10d1470b11a2a471fd9667fc0db4e091eb93e1b7 /BaseTools | |
parent | 71127ce88392d2a0392cb0cb90eaa0245da14f05 (diff) | |
download | edk2-cfed8a37ec3cf974e4eaaa298da6704133b00019.zip edk2-cfed8a37ec3cf974e4eaaa298da6704133b00019.tar.gz edk2-cfed8a37ec3cf974e4eaaa298da6704133b00019.tar.bz2 |
BaseTools: Involve Dec default value to calculate Maxsize
Involve Dec default value to calculate Maxsize for structure PCD
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/Workspace/BuildClassObject.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 7e96370..b0f3cde 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -68,6 +68,19 @@ class PcdClassObject(object): self.PcdValueFromFdf = ""
self.DefinitionPosition = ("","")
+ @staticmethod
+ def GetPcdMaxSizeWorker(PcdString, MaxSize):
+ if PcdString.startswith("{") and PcdString.endswith("}"):
+ return max([len(PcdString.split(",")),MaxSize])
+
+ if PcdString.startswith("\"") or PcdString.startswith("\'"):
+ return max([len(PcdString)-2+1,MaxSize])
+
+ if PcdString.startswith("L\""):
+ return max([2*(len(PcdString)-3+1),MaxSize])
+
+ return max([len(PcdString),MaxSize])
+
## Get the maximum number of bytes
def GetPcdMaxSize(self):
if self.DatumType in TAB_PCD_NUMERIC_TYPES:
@@ -75,24 +88,11 @@ class PcdClassObject(object): MaxSize = int(self.MaxDatumSize, 10) if self.MaxDatumSize else 0
if self.PcdValueFromFdf:
- if self.PcdValueFromFdf.startswith("{") and self.PcdValueFromFdf.endswith("}"):
- MaxSize = max([len(self.PcdValueFromFdf.split(",")),MaxSize])
- elif self.PcdValueFromFdf.startswith("\"") or self.PcdValueFromFdf.startswith("\'"):
- MaxSize = max([len(self.PcdValueFromFdf)-2+1,MaxSize])
- elif self.PcdValueFromFdf.startswith("L\""):
- MaxSize = max([2*(len(self.PcdValueFromFdf)-3+1),MaxSize])
- else:
- MaxSize = max([len(self.PcdValueFromFdf),MaxSize])
-
+ MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromFdf,MaxSize)
if self.PcdValueFromComm:
- if self.PcdValueFromComm.startswith("{") and self.PcdValueFromComm.endswith("}"):
- return max([len(self.PcdValueFromComm.split(",")), MaxSize])
- elif self.PcdValueFromComm.startswith("\"") or self.PcdValueFromComm.startswith("\'"):
- return max([len(self.PcdValueFromComm)-2+1, MaxSize])
- elif self.PcdValueFromComm.startswith("L\""):
- return max([2*(len(self.PcdValueFromComm)-3+1), MaxSize])
- else:
- return max([len(self.PcdValueFromComm), MaxSize])
+ MaxSize = self.GetPcdMaxSizeWorker(self.PcdValueFromComm,MaxSize)
+ if hasattr(self, "DefaultValueFromDec"):
+ MaxSize = self.GetPcdMaxSizeWorker(self.DefaultValueFromDec,MaxSize)
return MaxSize
## Get the number of bytes
|