aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-02-16 09:26:27 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-02-16 09:26:53 +0100
commitce5fc02e61c8700e22601a1861295be6c4a41d74 (patch)
tree86770bc809d9a7c878bcb3b044cb0c99c5c4b905 /src
parent19324cf09cad19c8e42599cfb582140bf4b8828e (diff)
parentf31b6b899568e976eb9c18bc899e9e8328b524b5 (diff)
Merge #7536: test: test leading spaces for ParseHex
f31b6b8 test: test leading space for ParseHex (Wladimir J. van der Laan)
Diffstat (limited to 'src')
-rw-r--r--src/test/util_tests.cpp4
-rw-r--r--src/wallet/db.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 01bc2032d0..43e8ae9b36 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 50b0f40a6a..6af5413a9e 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<C
// Format of bdb dump is ascii lines:
// header lines...
// HEADER=END
- // hexadecimal key
- // hexadecimal value
- // ... repeated
+ // hexadecimal key
+ // hexadecimal value
+ // ... repeated
// DATA=END
string strLine;