From e6951139c0544116330b12e287fe45e30bbab11c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:38 -0600 Subject: lib: Allow using 0x when a decimal value is requested U-Boot mostly uses hex for value input, largely because addresses are much easier to understand in hex. But in some cases a decimal value is requested, such as where the value is small or hex does not make sense in the context. In these cases it is sometimes useful to be able to provide a hex value in any case, if only to resolve any ambiguity. Add this functionality, for increased flexibility. Signed-off-by: Simon Glass --- test/str_ut.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/str_ut.c') diff --git a/test/str_ut.c b/test/str_ut.c index 0d1bf39..d2840d5 100644 --- a/test/str_ut.c +++ b/test/str_ut.c @@ -89,7 +89,7 @@ static int str_simple_strtoul(struct unit_test_state *uts) ut_assertok(run_strtoul(uts, str2, 10, 1099, 4, upper)); ut_assertok(run_strtoul(uts, str2, 16, 0x1099ab, 6, upper)); ut_assertok(run_strtoul(uts, str3, 16, 0xb, 3, upper)); - ut_assertok(run_strtoul(uts, str3, 10, 0, 1, upper)); + ut_assertok(run_strtoul(uts, str3, 10, 0xb, 3, upper)); /* Octal */ ut_assertok(run_strtoul(uts, str6, 0, 63, 3, upper)); @@ -144,7 +144,7 @@ static int str_simple_strtoull(struct unit_test_state *uts) ut_assertok(run_strtoull(uts, str2, 10, 1099, 4, upper)); ut_assertok(run_strtoull(uts, str2, 16, 0x1099ab, 6, upper)); ut_assertok(run_strtoull(uts, str3, 16, 0xb, 3, upper)); - ut_assertok(run_strtoull(uts, str3, 10, 0, 1, upper)); + ut_assertok(run_strtoull(uts, str3, 10, 0xb, 3, upper)); /* Octal */ ut_assertok(run_strtoull(uts, str6, 0, 63, 3, upper)); -- cgit v1.1