From: klu2 Date: Mon, 19 Jun 2006 09:13:44 +0000 (+0000) Subject: Fix a bug to judege max value of UINT32, 0xFFFFFFFF is invalid UINT32 in JAVA. X-Git-Tag: edk2-stable201903~25224 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e59cdca8e82ca1165c4885f52666ae7b81140f75 Fix a bug to judege max value of UINT32, 0xFFFFFFFF is invalid UINT32 in JAVA. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@560 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java index d901336366..9a54a3e579 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java @@ -593,14 +593,25 @@ public class Token { public boolean isValidNullValue(String judgedValue) { int intValue; + String subStr; BigInteger bigIntValue; switch (datumType) { case UINT8: case UINT16: case UINT32: - intValue = Integer.decode(judgedValue); - if (intValue == 0) { + if (judgedValue.length() > 2) { + if ((judgedValue.charAt(0) == '0') && + ((judgedValue.charAt(1) == 'x') || (judgedValue.charAt(1) == 'X'))){ + subStr = judgedValue.substring(2, judgedValue.length()); + bigIntValue = new BigInteger(subStr, 16); + } else { + bigIntValue = new BigInteger(judgedValue); + } + } else { + bigIntValue = new BigInteger(judgedValue); + } + if (bigIntValue.bitCount() == 0) { return true; } break;