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.20; helo=mga02.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 CA2C821106FB2 for ; Wed, 29 Aug 2018 22:27:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 22:27:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="84576863" Received: from shwdeopenpsi105.ccr.corp.intel.com ([10.239.9.110]) by fmsmga004.fm.intel.com with ESMTP; 29 Aug 2018 22:27:31 -0700 From: BobCF To: edk2-devel@lists.01.org Date: Thu, 30 Aug 2018 13:27:30 +0800 Message-Id: <20180830052730.63120-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [Patch] BaseTools: Involve Dec default value to calculate Maxsize 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: Thu, 30 Aug 2018 05:27:42 -0000 Involve Dec default value to calculate Maxsize for structure PCD Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 88465c59ea..32d202de5e 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -91,10 +91,19 @@ class PcdClassObject(object): 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]) + if hasattr(self, "DefaultValueFromDec"): + if self.DefaultValueFromDec.startswith("{") and self.DefaultValueFromDec.endswith("}"): + return max([len(self.DefaultValueFromDec.split(",")), MaxSize]) + elif self.DefaultValueFromDec.startswith("\"") or self.DefaultValueFromDec.startswith("\'"): + return max([len(self.DefaultValueFromDec)-2+1, MaxSize]) + elif self.DefaultValueFromDec.startswith("L\""): + return max([2*(len(self.DefaultValueFromDec)-3+1), MaxSize]) + else: + return max([len(self.DefaultValueFromDec), MaxSize]) return MaxSize ## Get the number of bytes def GetPcdSize(self): if self.DatumType in TAB_PCD_NUMERIC_TYPES: -- 2.16.2.windows.1