summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7cb0313)
InternalShellIsHexOrDecimalNumber() wrongly treats "-" as a number.
The patch fixes this issue.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=730
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
Copyright 2016 Dell Inc.\r
\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
Copyright 2016 Dell Inc.\r
- Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
+ BOOLEAN LeadingZero;\r
+\r
+ if (String == NULL) {\r
+ return FALSE;\r
+ }\r
\r
//\r
// chop off a single negative sign\r
//\r
\r
//\r
// chop off a single negative sign\r
//\r
- if (String != NULL && *String == L'-') {\r
+ if (*String == L'-') {\r
- if (String == NULL) {\r
- return (FALSE);\r
+ if (*String == CHAR_NULL) {\r
+ return FALSE;\r
}\r
\r
//\r
// chop leading zeroes\r
//\r
}\r
\r
//\r
// chop leading zeroes\r
//\r
- while(String != NULL && *String == L'0'){\r
+ LeadingZero = FALSE;\r
+ while(*String == L'0'){\r
}\r
//\r
// allow '0x' or '0X', but not 'x' or 'X'\r
//\r
}\r
//\r
// allow '0x' or '0X', but not 'x' or 'X'\r
//\r
- if (String != NULL && (*String == L'x' || *String == L'X')) {\r
- if (*(String-1) != L'0') {\r
+ if (*String == L'x' || *String == L'X') {\r
+ if (!LeadingZero) {\r
//\r
// we got an x without a preceeding 0\r
//\r
//\r
// we got an x without a preceeding 0\r
//\r
//\r
// loop through the remaining characters and use the lib function\r
//\r
//\r
// loop through the remaining characters and use the lib function\r
//\r
- for ( ; String != NULL && *String != CHAR_NULL && !(StopAtSpace && *String == L' ') ; String++){\r
+ for ( ; *String != CHAR_NULL && !(StopAtSpace && *String == L' ') ; String++){\r
if (TimeNumbers && (String[0] == L':')) {\r
continue;\r
}\r
if (TimeNumbers && (String[0] == L':')) {\r
continue;\r
}\r