mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 01:37:00 +00:00
refactor: Enable remaining clang-tidy cppcoreguidelines checks (#6538)
This commit is contained in:
@@ -94,7 +94,7 @@ Reader::parse(char const* beginDoc, char const* endDoc, Value& root)
|
||||
|
||||
nodes_.push(&root);
|
||||
bool successful = readValue(0);
|
||||
Token token;
|
||||
Token token{};
|
||||
skipCommentTokens(token);
|
||||
|
||||
if (!root.isNull() && !root.isArray() && !root.isObject())
|
||||
@@ -114,7 +114,7 @@ Reader::parse(char const* beginDoc, char const* endDoc, Value& root)
|
||||
bool
|
||||
Reader::readValue(unsigned depth)
|
||||
{
|
||||
Token token;
|
||||
Token token{};
|
||||
skipCommentTokens(token);
|
||||
if (depth > nest_limit)
|
||||
return addError("Syntax error: maximum nesting depth exceeded", token);
|
||||
@@ -395,7 +395,7 @@ Reader::readString()
|
||||
bool
|
||||
Reader::readObject(Token& tokenStart, unsigned depth)
|
||||
{
|
||||
Token tokenName;
|
||||
Token tokenName{};
|
||||
std::string name;
|
||||
currentValue() = Value(objectValue);
|
||||
|
||||
@@ -420,7 +420,7 @@ Reader::readObject(Token& tokenStart, unsigned depth)
|
||||
if (!decodeString(tokenName, name))
|
||||
return recoverFromError(tokenObjectEnd);
|
||||
|
||||
Token colon;
|
||||
Token colon{};
|
||||
|
||||
if (!readToken(colon) || colon.type_ != tokenMemberSeparator)
|
||||
{
|
||||
@@ -440,7 +440,7 @@ Reader::readObject(Token& tokenStart, unsigned depth)
|
||||
if (!ok) // error already set
|
||||
return recoverFromError(tokenObjectEnd);
|
||||
|
||||
Token comma;
|
||||
Token comma{};
|
||||
|
||||
if (!readToken(comma) ||
|
||||
(comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
|
||||
@@ -470,7 +470,7 @@ Reader::readArray(Token& tokenStart, unsigned depth)
|
||||
|
||||
if (*current_ == ']') // empty array
|
||||
{
|
||||
Token endArray;
|
||||
Token endArray{};
|
||||
readToken(endArray);
|
||||
return true;
|
||||
}
|
||||
@@ -487,7 +487,7 @@ Reader::readArray(Token& tokenStart, unsigned depth)
|
||||
if (!ok) // error already set
|
||||
return recoverFromError(tokenArrayEnd);
|
||||
|
||||
Token token;
|
||||
Token token{};
|
||||
// Accept Comment after last item in the array.
|
||||
ok = readToken(token);
|
||||
|
||||
@@ -591,7 +591,7 @@ Reader::decodeDouble(Token& token)
|
||||
{
|
||||
double value = 0;
|
||||
int const bufferSize = 32;
|
||||
int count;
|
||||
int count = 0;
|
||||
int length = int(token.end_ - token.start_);
|
||||
// Sanity check to avoid buffer overflow exploits.
|
||||
if (length < 0)
|
||||
@@ -689,7 +689,7 @@ Reader::decodeString(Token& token, std::string& decoded)
|
||||
break;
|
||||
|
||||
case 'u': {
|
||||
unsigned int unicode;
|
||||
unsigned int unicode = 0;
|
||||
|
||||
if (!decodeUnicodeCodePoint(token, current, end, unicode))
|
||||
return false;
|
||||
@@ -727,7 +727,7 @@ Reader::decodeUnicodeCodePoint(Token& token, Location& current, Location end, un
|
||||
token,
|
||||
current);
|
||||
|
||||
unsigned int surrogatePair;
|
||||
unsigned int surrogatePair = 0;
|
||||
|
||||
if (*current != '\\' || *(current + 1) != 'u')
|
||||
return addError(
|
||||
@@ -796,7 +796,7 @@ bool
|
||||
Reader::recoverFromError(TokenType skipUntilToken)
|
||||
{
|
||||
int errorCount = int(errors_.size());
|
||||
Token skip;
|
||||
Token skip{};
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -867,7 +867,7 @@ Reader::getLocationLineAndColumn(Location location, int& line, int& column) cons
|
||||
std::string
|
||||
Reader::getLocationLineAndColumn(Location location) const
|
||||
{
|
||||
int line, column;
|
||||
int line = 0, column = 0;
|
||||
getLocationLineAndColumn(location, line, column);
|
||||
return "Line " + std::to_string(line) + ", Column " + std::to_string(column);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user