diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-26 23:23:32 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-29 06:27:55 +0800 |
commit | c01426efecb82375c7c732f8c385b38cb9259168 (patch) | |
tree | f8e576715c19d5ee8b673b39653b8beb9428798e | |
parent | dadb4818ba230de02061ffd31ed71a0dec154885 (diff) | |
download | dexon-solidity-c01426efecb82375c7c732f8c385b38cb9259168.tar.gz dexon-solidity-c01426efecb82375c7c732f8c385b38cb9259168.tar.zst dexon-solidity-c01426efecb82375c7c732f8c385b38cb9259168.zip |
Make position optional in dev::validate
-rw-r--r-- | libdevcore/UTF8.h | 6 | ||||
-rw-r--r-- | libsolidity/ast/ASTJsonConverter.cpp | 3 | ||||
-rw-r--r-- | libsolidity/ast/Types.cpp | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/libdevcore/UTF8.h b/libdevcore/UTF8.h index 9bdc2b4f..b82fd1c6 100644 --- a/libdevcore/UTF8.h +++ b/libdevcore/UTF8.h @@ -32,4 +32,10 @@ namespace dev /// @returns false if it is invalid and the first invalid position in invalidPosition bool validate(std::string const& _input, size_t& _invalidPosition); +inline bool validate(std::string const& _input) +{ + size_t invalidPos; + return validate(_input, invalidPos); +} + } diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index 030b32ba..cf60c76a 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -417,9 +417,8 @@ bool ASTJsonConverter::visit(ElementaryTypeNameExpression const& _node) bool ASTJsonConverter::visit(Literal const& _node) { char const* tokenString = Token::toString(_node.token()); - size_t invalidPos = 0; Json::Value value{_node.value()}; - if (!dev::validate(_node.value(), invalidPos)) + if (!dev::validate(_node.value())) value = Json::nullValue; Token::Value subdenomination = Token::Value(_node.subDenomination()); addJsonNode(_node, "Literal", { diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index b22f3c08..4c8463b5 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -909,8 +909,7 @@ TypePointer StringLiteralType::mobileType() const bool StringLiteralType::isValidUTF8() const { - size_t dontCare {}; - return dev::validate(m_value, dontCare); + return dev::validate(m_value); } shared_ptr<FixedBytesType> FixedBytesType::smallestTypeForLiteral(string const& _literal) |