Skip to content

Commit fc20134

Browse files
committed
Fix different names for parameters in declaration and definition
1 parent 091e039 commit fc20134

File tree

5 files changed

+57
-57
lines changed

5 files changed

+57
-57
lines changed

include/json/value.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,12 @@ Json::Value obj_value(Json::objectValue); // {}
427427
/// \post type() is unchanged
428428
void clear();
429429

430-
/// Resize the array to size elements.
430+
/// Resize the array to newSize elements.
431431
/// New elements are initialized to null.
432432
/// May only be called on nullValue or arrayValue.
433433
/// \pre type() is arrayValue or nullValue
434434
/// \post type() is arrayValue
435-
void resize(ArrayIndex size);
435+
void resize(ArrayIndex newSize);
436436

437437
/// Access an array element (zero based index ).
438438
/// If the array contains less than index element, then null value are
@@ -562,10 +562,10 @@ Json::Value obj_value(Json::objectValue); // {}
562562
/** \brief Remove the indexed array element.
563563
564564
O(n) expensive operations.
565-
Update 'removed' iff removed.
566-
\return true iff removed (no exceptions)
565+
Update 'removed' if removed.
566+
\return true if removed (no exceptions)
567567
*/
568-
bool removeIndex(ArrayIndex i, Value* removed);
568+
bool removeIndex(ArrayIndex index, Value* removed);
569569

570570
/// Return true if the object has a member named key.
571571
/// \note 'key' must be null-terminated.

src/lib_json/json_reader.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ bool Reader::parse(const std::string& document,
112112
return parse(begin, end, root, collectComments);
113113
}
114114

115-
bool Reader::parse(std::istream& sin, Value& root, bool collectComments) {
116-
// std::istream_iterator<char> begin(sin);
115+
bool Reader::parse(std::istream& is, Value& root, bool collectComments) {
116+
// std::istream_iterator<char> begin(is);
117117
// std::istream_iterator<char> end;
118118
// Those would allow streamed input from a file, if parse() were a
119119
// template function.
120120

121121
// Since JSONCPP_STRING is reference-counted, this at least does not
122122
// create an extra copy.
123123
JSONCPP_STRING doc;
124-
std::getline(sin, doc, (char)EOF);
124+
std::getline(is, doc, (char)EOF);
125125
return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
126126
}
127127

@@ -460,12 +460,12 @@ bool Reader::readString() {
460460
return c == '"';
461461
}
462462

463-
bool Reader::readObject(Token& tokenStart) {
463+
bool Reader::readObject(Token& token) {
464464
Token tokenName;
465465
JSONCPP_STRING name;
466466
Value init(objectValue);
467467
currentValue().swapPayload(init);
468-
currentValue().setOffsetStart(tokenStart.start_ - begin_);
468+
currentValue().setOffsetStart(token.start_ - begin_);
469469
while (readToken(tokenName)) {
470470
bool initialTokenOk = true;
471471
while (tokenName.type_ == tokenComment && initialTokenOk)
@@ -516,10 +516,10 @@ bool Reader::readObject(Token& tokenStart) {
516516
tokenObjectEnd);
517517
}
518518

519-
bool Reader::readArray(Token& tokenStart) {
519+
bool Reader::readArray(Token& token) {
520520
Value init(arrayValue);
521521
currentValue().swapPayload(init);
522-
currentValue().setOffsetStart(tokenStart.start_ - begin_);
522+
currentValue().setOffsetStart(token.start_ - begin_);
523523
skipSpaces();
524524
if (current_ != end_ && *current_ == ']') // empty array
525525
{
@@ -536,19 +536,19 @@ bool Reader::readArray(Token& tokenStart) {
536536
if (!ok) // error already set
537537
return recoverFromError(tokenArrayEnd);
538538

539-
Token token;
539+
Token currentToken;
540540
// Accept Comment after last item in the array.
541-
ok = readToken(token);
542-
while (token.type_ == tokenComment && ok) {
543-
ok = readToken(token);
541+
ok = readToken(currentToken);
542+
while (currentToken.type_ == tokenComment && ok) {
543+
ok = readToken(currentToken);
544544
}
545545
bool badTokenType =
546-
(token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
546+
(currentToken.type_ != tokenArraySeparator && currentToken.type_ != tokenArrayEnd);
547547
if (!ok || badTokenType) {
548548
return addErrorAndRecover("Missing ',' or ']' in array declaration",
549-
token, tokenArrayEnd);
549+
currentToken, tokenArrayEnd);
550550
}
551-
if (token.type_ == tokenArrayEnd)
551+
if (currentToken.type_ == tokenArrayEnd)
552552
break;
553553
}
554554
return true;
@@ -1450,12 +1450,12 @@ bool OurReader::readStringSingleQuote() {
14501450
return c == '\'';
14511451
}
14521452

1453-
bool OurReader::readObject(Token& tokenStart) {
1453+
bool OurReader::readObject(Token& token) {
14541454
Token tokenName;
14551455
JSONCPP_STRING name;
14561456
Value init(objectValue);
14571457
currentValue().swapPayload(init);
1458-
currentValue().setOffsetStart(tokenStart.start_ - begin_);
1458+
currentValue().setOffsetStart(token.start_ - begin_);
14591459
while (readToken(tokenName)) {
14601460
bool initialTokenOk = true;
14611461
while (tokenName.type_ == tokenComment && initialTokenOk)
@@ -1512,10 +1512,10 @@ bool OurReader::readObject(Token& tokenStart) {
15121512
tokenObjectEnd);
15131513
}
15141514

1515-
bool OurReader::readArray(Token& tokenStart) {
1515+
bool OurReader::readArray(Token& token) {
15161516
Value init(arrayValue);
15171517
currentValue().swapPayload(init);
1518-
currentValue().setOffsetStart(tokenStart.start_ - begin_);
1518+
currentValue().setOffsetStart(token.start_ - begin_);
15191519
skipSpaces();
15201520
if (current_ != end_ && *current_ == ']') // empty array
15211521
{
@@ -1532,19 +1532,19 @@ bool OurReader::readArray(Token& tokenStart) {
15321532
if (!ok) // error already set
15331533
return recoverFromError(tokenArrayEnd);
15341534

1535-
Token token;
1535+
Token currentToken;
15361536
// Accept Comment after last item in the array.
1537-
ok = readToken(token);
1538-
while (token.type_ == tokenComment && ok) {
1539-
ok = readToken(token);
1537+
ok = readToken(currentToken);
1538+
while (currentToken.type_ == tokenComment && ok) {
1539+
ok = readToken(currentToken);
15401540
}
15411541
bool badTokenType =
1542-
(token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
1542+
(currentToken.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
15431543
if (!ok || badTokenType) {
15441544
return addErrorAndRecover("Missing ',' or ']' in array declaration",
1545-
token, tokenArrayEnd);
1545+
currentToken, tokenArrayEnd);
15461546
}
1547-
if (token.type_ == tokenArrayEnd)
1547+
if (currentToken.type_ == tokenArrayEnd)
15481548
break;
15491549
}
15501550
return true;

src/lib_json/json_value.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
241241
// Notes: policy_ indicates if the string was allocated when
242242
// a string is stored.
243243

244-
Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
244+
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
245245

246246
Value::CZString::CZString(char const* str,
247-
unsigned ulength,
247+
unsigned length,
248248
DuplicationPolicy allocate)
249249
: cstr_(str) {
250250
// allocate != duplicate
251251
storage_.policy_ = allocate & 0x3;
252-
storage_.length_ = ulength & 0x3FFFFFFF;
252+
storage_.length_ = length & 0x3FFFFFFF;
253253
}
254254

255255
Value::CZString::CZString(const CZString& other) {
@@ -357,10 +357,10 @@ bool Value::CZString::isStaticString() const {
357357
* memset( this, 0, sizeof(Value) )
358358
* This optimization is used in ValueInternalMap fast allocator.
359359
*/
360-
Value::Value(ValueType vtype) {
360+
Value::Value(ValueType type) {
361361
static char const emptyString[] = "";
362-
initBasic(vtype);
363-
switch (vtype) {
362+
initBasic(type);
363+
switch (type) {
364364
case nullValue:
365365
break;
366366
case intValue:
@@ -418,10 +418,10 @@ Value::Value(const char* value) {
418418
value, static_cast<unsigned>(strlen(value)));
419419
}
420420

421-
Value::Value(const char* beginValue, const char* endValue) {
421+
Value::Value(const char* begin, const char* end) {
422422
initBasic(stringValue, true);
423423
value_.string_ = duplicateAndPrefixStringValue(
424-
beginValue, static_cast<unsigned>(endValue - beginValue));
424+
begin, static_cast<unsigned>(end - begin));
425425
}
426426

427427
Value::Value(const JSONCPP_STRING& value) {
@@ -645,14 +645,14 @@ unsigned Value::getCStringLength() const {
645645
}
646646
#endif
647647

648-
bool Value::getString(char const** str, char const** cend) const {
648+
bool Value::getString(char const** begin, char const** end) const {
649649
if (type_ != stringValue)
650650
return false;
651651
if (value_.string_ == 0)
652652
return false;
653653
unsigned length;
654-
decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
655-
*cend = *str + length;
654+
decodePrefixedString(this->allocated_, this->value_.string_, &length, begin);
655+
*end = *begin + length;
656656
return true;
657657
}
658658

@@ -1003,8 +1003,8 @@ const Value& Value::operator[](int index) const {
10031003
return (*this)[ArrayIndex(index)];
10041004
}
10051005

1006-
void Value::initBasic(ValueType vtype, bool allocated) {
1007-
type_ = vtype;
1006+
void Value::initBasic(ValueType type, bool allocated) {
1007+
type_ = type;
10081008
allocated_ = allocated;
10091009
comments_ = 0;
10101010
start_ = 0;
@@ -1101,13 +1101,13 @@ Value& Value::resolveReference(const char* key) {
11011101
}
11021102

11031103
// @param key is not null-terminated.
1104-
Value& Value::resolveReference(char const* key, char const* cend) {
1104+
Value& Value::resolveReference(char const* key, char const* end) {
11051105
JSON_ASSERT_MESSAGE(
11061106
type_ == nullValue || type_ == objectValue,
11071107
"in Json::Value::resolveReference(key, end): requires objectValue");
11081108
if (type_ == nullValue)
11091109
*this = Value(objectValue);
1110-
CZString actualKey(key, static_cast<unsigned>(cend - key),
1110+
CZString actualKey(key, static_cast<unsigned>(end - key),
11111111
CZString::duplicateOnCopy);
11121112
ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
11131113
if (it != value_.map_->end() && (*it).first == actualKey)
@@ -1126,13 +1126,13 @@ Value Value::get(ArrayIndex index, const Value& defaultValue) const {
11261126

11271127
bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
11281128

1129-
Value const* Value::find(char const* key, char const* cend) const {
1129+
Value const* Value::find(char const* begin, char const* end) const {
11301130
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
11311131
"in Json::Value::find(key, end, found): requires "
11321132
"objectValue or nullValue");
11331133
if (type_ == nullValue)
11341134
return NULL;
1135-
CZString actualKey(key, static_cast<unsigned>(cend - key),
1135+
CZString actualKey(begin, static_cast<unsigned>(end - begin),
11361136
CZString::noDuplication);
11371137
ObjectValues::const_iterator it = value_.map_->find(actualKey);
11381138
if (it == value_.map_->end())
@@ -1184,10 +1184,10 @@ Value& Value::append(Value&& value) {
11841184
}
11851185
#endif
11861186

1187-
Value Value::get(char const* key,
1188-
char const* cend,
1187+
Value Value::get(char const* begin,
1188+
char const* end,
11891189
Value const& defaultValue) const {
1190-
Value const* found = find(key, cend);
1190+
Value const* found = find(begin, end);
11911191
return !found ? defaultValue : *found;
11921192
}
11931193
Value Value::get(char const* key, Value const& defaultValue) const {
@@ -1197,11 +1197,11 @@ Value Value::get(JSONCPP_STRING const& key, Value const& defaultValue) const {
11971197
return get(key.data(), key.data() + key.length(), defaultValue);
11981198
}
11991199

1200-
bool Value::removeMember(const char* key, const char* cend, Value* removed) {
1200+
bool Value::removeMember(const char* begin, const char* end, Value* removed) {
12011201
if (type_ != objectValue) {
12021202
return false;
12031203
}
1204-
CZString actualKey(key, static_cast<unsigned>(cend - key),
1204+
CZString actualKey(begin, static_cast<unsigned>(end - begin),
12051205
CZString::noDuplication);
12061206
ObjectValues::iterator it = value_.map_->find(actualKey);
12071207
if (it == value_.map_->end())
@@ -1264,8 +1264,8 @@ Value Value::get(const CppTL::ConstString& key,
12641264
}
12651265
#endif
12661266

1267-
bool Value::isMember(char const* key, char const* cend) const {
1268-
Value const* value = find(key, cend);
1267+
bool Value::isMember(char const* begin, char const* end) const {
1268+
Value const* value = find(begin, end);
12691269
return NULL != value;
12701270
}
12711271
bool Value::isMember(char const* key) const {

src/lib_json/json_writer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,10 @@ void StreamWriterBuilder::setDefaults(Json::Value* settings) {
12451245
//! [StreamWriterBuilderDefaults]
12461246
}
12471247

1248-
JSONCPP_STRING writeString(StreamWriter::Factory const& builder,
1248+
JSONCPP_STRING writeString(StreamWriter::Factory const& factory,
12491249
Value const& root) {
12501250
JSONCPP_OSTRINGSTREAM sout;
1251-
StreamWriterPtr const writer(builder.newStreamWriter());
1251+
StreamWriterPtr const writer(factory.newStreamWriter());
12521252
writer->write(root, &sout);
12531253
return sout.str();
12541254
}

src/test_lib_json/jsontest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class Runner {
167167

168168
private:
169169
void listTests() const;
170-
bool testIndex(const JSONCPP_STRING& testName, unsigned int& index) const;
170+
bool testIndex(const JSONCPP_STRING& testName, unsigned int& indexOut) const;
171171
static void preventDialogOnCrash();
172172

173173
private:

0 commit comments

Comments
 (0)