refactor: use east const convention (#5409)

This change refactors the codebase to use the "east const convention", and adds a clang-format rule to follow this convention.
This commit is contained in:
Vito Tumas
2025-05-08 13:00:42 +02:00
committed by GitHub
parent 2db2791805
commit 3e152fec74
212 changed files with 812 additions and 795 deletions

View File

@@ -78,8 +78,8 @@ bool
Reader::parse(std::string const& document, Value& root)
{
document_ = document;
const char* begin = document_.c_str();
const char* end = begin + document_.length();
char const* begin = document_.c_str();
char const* end = begin + document_.length();
return parse(begin, end, root);
}
@@ -99,7 +99,7 @@ Reader::parse(std::istream& sin, Value& root)
}
bool
Reader::parse(const char* beginDoc, const char* endDoc, Value& root)
Reader::parse(char const* beginDoc, char const* endDoc, Value& root)
{
begin_ = beginDoc;
end_ = endDoc;
@@ -193,7 +193,7 @@ Reader::skipCommentTokens(Token& token)
}
bool
Reader::expectToken(TokenType type, Token& token, const char* message)
Reader::expectToken(TokenType type, Token& token, char const* message)
{
readToken(token);
@@ -629,7 +629,7 @@ bool
Reader::decodeDouble(Token& token)
{
double value = 0;
const int bufferSize = 32;
int const bufferSize = 32;
int count;
int length = int(token.end_ - token.start_);
// Sanity check to avoid buffer overflow exploits.
@@ -939,7 +939,7 @@ Reader::getFormatedErrorMessages() const
itError != errors_.end();
++itError)
{
const ErrorInfo& error = *itError;
ErrorInfo const& error = *itError;
formattedMessage +=
"* " + getLocationLineAndColumn(error.token_.start_) + "\n";
formattedMessage += " " + error.message_ + "\n";