diff options
Diffstat (limited to 'MdePkg/Library/BaseLib/String.c')
-rw-r--r-- | MdePkg/Library/BaseLib/String.c | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index 637c96e7b3..f16e1099be 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -406,10 +406,12 @@ StrDecimalToUintn ( IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result))) {
- return MAX_UINTN;
+ Status = StrDecimalToUintnS (String, (CHAR16 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -455,10 +457,12 @@ StrDecimalToUint64 ( IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result))) {
- return MAX_UINT64;
+ Status = StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -505,10 +509,12 @@ StrHexToUintn ( IN CONST CHAR16 *String
)
{
- UINTN Result;
+ UINTN Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (StrHexToUintnS (String, (CHAR16 **)NULL, &Result))) {
- return MAX_UINTN;
+ Status = StrHexToUintnS (String, (CHAR16 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -555,10 +561,12 @@ StrHexToUint64 ( IN CONST CHAR16 *String
)
{
- UINT64 Result;
+ UINT64 Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (StrHexToUint64S (String, (CHAR16 **)NULL, &Result))) {
- return MAX_UINT64;
+ Status = StrHexToUint64S (String, (CHAR16 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -999,10 +1007,12 @@ AsciiStrDecimalToUintn ( IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result))) {
- return MAX_UINTN;
+ Status = AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -1044,10 +1054,12 @@ AsciiStrDecimalToUint64 ( IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result))) {
- return MAX_UINT64;
+ Status = AsciiStrDecimalToUint64S (String, (CHAR8 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -1093,10 +1105,12 @@ AsciiStrHexToUintn ( IN CONST CHAR8 *String
)
{
- UINTN Result;
+ UINTN Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result))) {
- return MAX_UINTN;
+ Status = AsciiStrHexToUintnS (String, (CHAR8 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
@@ -1142,10 +1156,12 @@ AsciiStrHexToUint64 ( IN CONST CHAR8 *String
)
{
- UINT64 Result;
+ UINT64 Result;
+ RETURN_STATUS Status;
- if (RETURN_ERROR (AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result))) {
- return MAX_UINT64;
+ Status = AsciiStrHexToUint64S (String, (CHAR8 **)NULL, &Result);
+ if (Status == RETURN_INVALID_PARAMETER) {
+ Result = 0;
}
return Result;
|