From a9e92cb68601a19d5e0969e4f3336be612edc72e Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 28 Nov 2016 22:07:55 +0000 Subject: [PATCH] Rename dev::validate to dev::validateUTF8 --- libdevcore/UTF8.cpp | 2 +- libdevcore/UTF8.h | 6 +++--- libsolidity/ast/ASTJsonConverter.cpp | 2 +- libsolidity/ast/Types.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libdevcore/UTF8.cpp b/libdevcore/UTF8.cpp index d742fe665..1c7ed17c7 100644 --- a/libdevcore/UTF8.cpp +++ b/libdevcore/UTF8.cpp @@ -28,7 +28,7 @@ namespace dev { -bool validate(std::string const& _input, size_t& _invalidPosition) +bool validateUTF8(std::string const& _input, size_t& _invalidPosition) { const size_t length = _input.length(); bool valid = true; diff --git a/libdevcore/UTF8.h b/libdevcore/UTF8.h index b82fd1c6d..753914e3f 100644 --- a/libdevcore/UTF8.h +++ b/libdevcore/UTF8.h @@ -30,12 +30,12 @@ namespace dev /// Validate an input for UTF8 encoding /// @returns false if it is invalid and the first invalid position in invalidPosition -bool validate(std::string const& _input, size_t& _invalidPosition); +bool validateUTF8(std::string const& _input, size_t& _invalidPosition); -inline bool validate(std::string const& _input) +inline bool validateUTF8(std::string const& _input) { size_t invalidPos; - return validate(_input, invalidPos); + return validateUTF8(_input, invalidPos); } } diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index cf60c76a9..f6b06be66 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -418,7 +418,7 @@ bool ASTJsonConverter::visit(Literal const& _node) { char const* tokenString = Token::toString(_node.token()); Json::Value value{_node.value()}; - if (!dev::validate(_node.value())) + if (!dev::validateUTF8(_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 4c8463b57..d9660bc08 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -896,7 +896,7 @@ std::string StringLiteralType::toString(bool) const { size_t invalidSequence; - if (!dev::validate(m_value, invalidSequence)) + if (!dev::validateUTF8(m_value, invalidSequence)) return "literal_string (contains invalid UTF-8 sequence at position " + dev::toString(invalidSequence) + ")"; return "literal_string \"" + m_value + "\""; @@ -909,7 +909,7 @@ TypePointer StringLiteralType::mobileType() const bool StringLiteralType::isValidUTF8() const { - return dev::validate(m_value); + return dev::validateUTF8(m_value); } shared_ptr FixedBytesType::smallestTypeForLiteral(string const& _literal)