diff options
author | Pieter Wuille <pieter@wuille.net> | 2022-04-04 13:52:06 -0400 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-04-27 14:12:55 +0200 |
commit | 78f3ac51b7d073d12da6a3b9b7d80d91e04ce3a7 (patch) | |
tree | 60a138e61a7281fbba6391da8d0d73bd0c1f9fee /src/test/fuzz/base_encode_decode.cpp | |
parent | a65931e3ce66d87b8f83d67ecdbb46f137e6a670 (diff) |
Make DecodeBase{32,64} return optional instead of taking bool*
Diffstat (limited to 'src/test/fuzz/base_encode_decode.cpp')
-rw-r--r-- | src/test/fuzz/base_encode_decode.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/fuzz/base_encode_decode.cpp b/src/test/fuzz/base_encode_decode.cpp index 0d48a140f7..11dd820e4f 100644 --- a/src/test/fuzz/base_encode_decode.cpp +++ b/src/test/fuzz/base_encode_decode.cpp @@ -36,17 +36,16 @@ FUZZ_TARGET_INIT(base_encode_decode, initialize_base_encode_decode) assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string))); } - bool pf_invalid; - decoded = DecodeBase32(random_encoded_string, &pf_invalid); - if (!pf_invalid) { - const std::string encoded_string = EncodeBase32(decoded); + auto result = DecodeBase32(random_encoded_string); + if (result) { + const std::string encoded_string = EncodeBase32(*result); assert(encoded_string == TrimString(encoded_string)); assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string))); } - decoded = DecodeBase64(random_encoded_string, &pf_invalid); - if (!pf_invalid) { - const std::string encoded_string = EncodeBase64(decoded); + result = DecodeBase64(random_encoded_string); + if (result) { + const std::string encoded_string = EncodeBase64(*result); assert(encoded_string == TrimString(encoded_string)); assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string))); } |