BaseTools: FdfParser - refactor functions to make static

make functions that doesn't use self into @staticmethod

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben
2018-04-14 04:51:35 +08:00
committed by Yonghong Zhu
parent cdc9b0c296
commit 227dbb1190
2 changed files with 11 additions and 10 deletions

View File

@ -1131,7 +1131,8 @@ class FdfParser:
self.__UndoToken()
return False
def __Verify(self, Name, Value, Scope):
@staticmethod
def __Verify(Name, Value, Scope):
if Scope in ['UINT64', 'UINT8']:
ValueNumber = 0
try:
@ -3200,16 +3201,16 @@ class FdfParser:
raise Warning("expected value of %s" % Name, self.FileName, self.CurrentLineNumber)
Value = self.__Token
if Name == 'IMAGE_HEADER_INIT_VERSION':
if self.__Verify(Name, Value, 'UINT8'):
if FdfParser.__Verify(Name, Value, 'UINT8'):
FmpData.Version = Value
elif Name == 'IMAGE_INDEX':
if self.__Verify(Name, Value, 'UINT8'):
if FdfParser.__Verify(Name, Value, 'UINT8'):
FmpData.ImageIndex = Value
elif Name == 'HARDWARE_INSTANCE':
if self.__Verify(Name, Value, 'UINT8'):
if FdfParser.__Verify(Name, Value, 'UINT8'):
FmpData.HardwareInstance = Value
elif Name == 'MONOTONIC_COUNT':
if self.__Verify(Name, Value, 'UINT64'):
if FdfParser.__Verify(Name, Value, 'UINT64'):
FmpData.MonotonicCount = Value
if FmpData.MonotonicCount.upper().startswith('0X'):
FmpData.MonotonicCount = (long)(FmpData.MonotonicCount, 16)