aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-12 21:53:45 +0800
committerGitHub <noreply@github.com>2018-10-12 21:53:45 +0800
commit94526b2d92e469fc8679be1f5a2b56c4c1ed25be (patch)
treea85bb55dbb29de2d3e271160af3e5afcc7d9c228 /libdevcore
parent1d312c8e4073e2e7ce9a23a721013942e1e5c727 (diff)
parent914668c622b60eab4129d0a6b3776c20d8e614bd (diff)
downloaddexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar.gz
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar.bz2
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar.lz
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar.xz
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.tar.zst
dexon-solidity-94526b2d92e469fc8679be1f5a2b56c4c1ed25be.zip
Merge pull request #5145 from ethereum/hashLinker
Hash linker
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/CommonData.cpp10
-rw-r--r--libdevcore/CommonIO.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/libdevcore/CommonData.cpp b/libdevcore/CommonData.cpp
index 445d11cd..6d7c74d7 100644
--- a/libdevcore/CommonData.cpp
+++ b/libdevcore/CommonData.cpp
@@ -76,18 +76,18 @@ bytes dev::fromHex(std::string const& _s, WhenError _throw)
bool dev::passesAddressChecksum(string const& _str, bool _strict)
{
- string s = _str.substr(0, 2) == "0x" ? _str.substr(2) : _str;
+ string s = _str.substr(0, 2) == "0x" ? _str : "0x" + _str;
- if (s.length() != 40)
+ if (s.length() != 42)
return false;
if (!_strict && (
- _str.find_first_of("abcdef") == string::npos ||
- _str.find_first_of("ABCDEF") == string::npos
+ s.find_first_of("abcdef") == string::npos ||
+ s.find_first_of("ABCDEF") == string::npos
))
return true;
- return _str == dev::getChecksummedAddress(_str);
+ return s == dev::getChecksummedAddress(s);
}
string dev::getChecksummedAddress(string const& _addr)
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp
index 2005d087..1aa3504c 100644
--- a/libdevcore/CommonIO.cpp
+++ b/libdevcore/CommonIO.cpp
@@ -94,7 +94,7 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe
{
// create directory if not existent
fs::path p(_file);
- if (!fs::exists(p.parent_path()))
+ if (!p.parent_path().empty() && !fs::exists(p.parent_path()))
{
fs::create_directories(p.parent_path());
try