Skip to content

Commit

Permalink
Make position optional in dev::validate
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Nov 28, 2016
1 parent dadb481 commit c01426e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions libdevcore/UTF8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
3 changes: 1 addition & 2 deletions libsolidity/ast/ASTJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
3 changes: 1 addition & 2 deletions libsolidity/ast/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c01426e

Please sign in to comment.