From 78f3ac51b7d073d12da6a3b9b7d80d91e04ce3a7 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 4 Apr 2022 13:52:06 -0400 Subject: Make DecodeBase{32,64} return optional instead of taking bool* --- src/i2p.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/i2p.cpp') diff --git a/src/i2p.cpp b/src/i2p.cpp index 66f19b90d0..e08b5461fe 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -69,12 +69,11 @@ static std::string SwapBase64(const std::string& from) static Binary DecodeI2PBase64(const std::string& i2p_b64) { const std::string& std_b64 = SwapBase64(i2p_b64); - bool invalid; - Binary decoded = DecodeBase64(std_b64, &invalid); - if (invalid) { + auto decoded = DecodeBase64(std_b64); + if (!decoded) { throw std::runtime_error(strprintf("Cannot decode Base64: \"%s\"", i2p_b64)); } - return decoded; + return std::move(*decoded); } /** -- cgit v1.2.3