diff options
author | Liming Gao <liming.gao@intel.com> | 2013-11-18 07:41:21 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-11-18 07:41:21 +0000 |
commit | e8a47801a1dfdb148b1bfcd5bdc8ebc3bf51f92d (patch) | |
tree | 04e3ec271347360a5e9da898f1dccbce3d94681f /BaseTools/Source/Python/PatchPcdValue | |
parent | fddbbc661eeff8e9f94942fa2d47fb637404a040 (diff) | |
download | edk2-platforms-e8a47801a1dfdb148b1bfcd5bdc8ebc3bf51f92d.tar.xz |
Sync BaseTool trunk (version r2610) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14856 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/PatchPcdValue')
-rw-r--r-- | BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py index 3f6c575128..69c8244790 100644 --- a/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py +++ b/BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py @@ -72,7 +72,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): elif TypeName == 'VOID*': if MaxSize == 0: return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD." - ValueLength = MaxSize + ValueLength = int(MaxSize) else: return PARAMETER_INVALID, "PCD type %s is not valid." %(CommandOptions.PcdTypeName) # @@ -97,6 +97,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): # # Patch value into offset # + SavedStr = ValueString ValueString = ValueString.upper() ValueNumber = 0 if TypeName == 'BOOLEAN': @@ -109,9 +110,9 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): elif ValueString == 'FALSE': ValueNumber = 0 elif ValueString.startswith('0X'): - ValueNumber = int (Value, 16) + ValueNumber = int (ValueString, 16) else: - ValueNumber = int (Value) + ValueNumber = int (ValueString) if ValueNumber != 0: ValueNumber = 1 except: @@ -138,12 +139,13 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): ByteList[ValueOffset + Index] = ValueNumber % 0x100 ValueNumber = ValueNumber / 0x100 elif TypeName == 'VOID*': - if ValueString.startswith("L "): + ValueString = SavedStr + if ValueString.startswith('L"'): # # Patch Unicode String # Index = 0 - for ByteString in ValueString[2:]: + for ByteString in ValueString[2:-1]: # # Reserve zero as unicode tail # @@ -177,7 +179,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0): # Patch ascii string # Index = 0 - for ByteString in ValueString: + for ByteString in ValueString[1:-1]: # # Reserve zero as string tail # |