From ee5f8d21156f870267ef59d41538517104d9d5a3 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Feb 2016 09:26:27 +0100 Subject: [PATCH] Merge #7536: test: test leading spaces for ParseHex f31b6b8 test: test leading space for ParseHex (Wladimir J. van der Laan) --- src/test/util_tests.cpp | 4 ++++ src/wallet/db.cpp | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index ac8e51a1d..043ade702 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -60,6 +60,10 @@ BOOST_AUTO_TEST_CASE(util_ParseHex) result = ParseHex("12 34 56 78"); BOOST_CHECK(result.size() == 4 && result[0] == 0x12 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78); + // Leading space must be supported (used in CDBEnv::Salvage) + result = ParseHex(" 89 34 56 78"); + BOOST_CHECK(result.size() == 4 && result[0] == 0x89 && result[1] == 0x34 && result[2] == 0x56 && result[3] == 0x78); + // Stop parsing at invalid value result = ParseHex("1234 invalid 1234"); BOOST_CHECK(result.size() == 2 && result[0] == 0x12 && result[1] == 0x34); diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 261611cd9..ca0c6fabf 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -193,9 +193,9 @@ bool CDBEnv::Salvage(const std::string& strFile, bool fAggressive, std::vector