jsoncpp: fix compiler warnings (should be reported upstream!)

Origin commit data
------------------
Branch: ni/coolstream
Commit: bdf80d43ff
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2015-06-01 (Mon, 01 Jun 2015)

Origin message was:
------------------
- jsoncpp: fix compiler warnings (should be reported upstream!)

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
gixxpunk
2015-06-01 12:00:00 +02:00
committed by vanhofen
parent 2816525c84
commit a87492a754

View File

@@ -1480,7 +1480,7 @@ bool OurReader::readStringSingleQuote() {
return c == '\''; return c == '\'';
} }
bool OurReader::readObject(Token& tokenStart) { bool OurReader::readObject(Token& /*tokenStart*/) {
Token tokenName; Token tokenName;
std::string name; std::string name;
Value init(objectValue); Value init(objectValue);
@@ -1541,7 +1541,7 @@ bool OurReader::readObject(Token& tokenStart) {
"Missing '}' or object member name", tokenName, tokenObjectEnd); "Missing '}' or object member name", tokenName, tokenObjectEnd);
} }
bool OurReader::readArray(Token& tokenStart) { bool OurReader::readArray(Token& /*tokenStart*/) {
Value init(arrayValue); Value init(arrayValue);
currentValue().swapPayload(init); currentValue().swapPayload(init);
skipSpaces(); skipSpaces();
@@ -2128,26 +2128,26 @@ UInt ValueIteratorBase::index() const {
} }
std::string ValueIteratorBase::name() const { std::string ValueIteratorBase::name() const {
char const* key; char const* mykey;
char const* end; char const* end;
key = memberName(&end); mykey = memberName(&end);
if (!key) return std::string(); if (!mykey) return std::string();
return std::string(key, end); return std::string(mykey, end);
} }
char const* ValueIteratorBase::memberName() const { char const* ValueIteratorBase::memberName() const {
const char* name = (*current_).first.data(); const char* myname = (*current_).first.data();
return name ? name : ""; return myname ? myname : "";
} }
char const* ValueIteratorBase::memberName(char const** end) const { char const* ValueIteratorBase::memberName(char const** end) const {
const char* name = (*current_).first.data(); const char* myname = (*current_).first.data();
if (!name) { if (!myname) {
*end = NULL; *end = NULL;
return NULL; return NULL;
} }
*end = name + (*current_).first.length(); *end = myname + (*current_).first.length();
return name; return myname;
} }
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
@@ -2444,14 +2444,14 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
// Notes: policy_ indicates if the string was allocated when // Notes: policy_ indicates if the string was allocated when
// a string is stored. // a string is stored.
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {} Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate) Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
: cstr_(str) : cstr_(str)
{ {
// allocate != duplicate // allocate != duplicate
storage_.policy_ = allocate; storage_.policy_ = allocate;
storage_.length_ = length; storage_.length_ = ulength;
} }
Value::CZString::CZString(const CZString& other) Value::CZString::CZString(const CZString& other)
@@ -2524,9 +2524,9 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
* memset( this, 0, sizeof(Value) ) * memset( this, 0, sizeof(Value) )
* This optimization is used in ValueInternalMap fast allocator. * This optimization is used in ValueInternalMap fast allocator.
*/ */
Value::Value(ValueType type) { Value::Value(ValueType vtype) {
initBasic(type); initBasic(vtype);
switch (type) { switch (vtype) {
case nullValue: case nullValue:
break; break;
case intValue: case intValue:
@@ -2817,12 +2817,12 @@ const char* Value::asCString() const {
return this_str; return this_str;
} }
bool Value::getString(char const** str, char const** end) const { bool Value::getString(char const** str, char const** myend) const {
if (type_ != stringValue) return false; if (type_ != stringValue) return false;
if (value_.string_ == 0) return false; if (value_.string_ == 0) return false;
unsigned length; unsigned length;
decodePrefixedString(this->allocated_, this->value_.string_, &length, str); decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
*end = *str + length; *myend = *str + length;
return true; return true;
} }
@@ -3169,8 +3169,8 @@ const Value& Value::operator[](int index) const {
return (*this)[ArrayIndex(index)]; return (*this)[ArrayIndex(index)];
} }
void Value::initBasic(ValueType type, bool allocated) { void Value::initBasic(ValueType vtype, bool allocated) {
type_ = type; type_ = vtype;
allocated_ = allocated; allocated_ = allocated;
comments_ = 0; comments_ = 0;
} }
@@ -3197,15 +3197,15 @@ Value& Value::resolveReference(const char* key) {
} }
// @param key is not null-terminated. // @param key is not null-terminated.
Value& Value::resolveReference(char const* key, char const* end) Value& Value::resolveReference(char const* key, char const* myend)
{ {
JSON_ASSERT_MESSAGE( JSON_ASSERT_MESSAGE(
type_ == nullValue || type_ == objectValue, type_ == nullValue || type_ == objectValue,
"in Json::Value::resolveReference(key, end): requires objectValue"); "in Json::Value::resolveReference(key, myend): requires objectValue");
if (type_ == nullValue) if (type_ == nullValue)
*this = Value(objectValue); *this = Value(objectValue);
CZString actualKey( CZString actualKey(
key, static_cast<unsigned>(end-key), CZString::duplicateOnCopy); key, static_cast<unsigned>(myend-key), CZString::duplicateOnCopy);
ObjectValues::iterator it = value_.map_->lower_bound(actualKey); ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
if (it != value_.map_->end() && (*it).first == actualKey) if (it != value_.map_->end() && (*it).first == actualKey)
return (*it).second; return (*it).second;
@@ -3223,13 +3223,13 @@ Value Value::get(ArrayIndex index, const Value& defaultValue) const {
bool Value::isValidIndex(ArrayIndex index) const { return index < size(); } bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
Value const* Value::find(char const* key, char const* end) const Value const* Value::find(char const* key, char const* myend) const
{ {
JSON_ASSERT_MESSAGE( JSON_ASSERT_MESSAGE(
type_ == nullValue || type_ == objectValue, type_ == nullValue || type_ == objectValue,
"in Json::Value::find(key, end, found): requires objectValue or nullValue"); "in Json::Value::find(key, myend, found): requires objectValue or nullValue");
if (type_ == nullValue) return NULL; if (type_ == nullValue) return NULL;
CZString actualKey(key, static_cast<unsigned>(end-key), CZString::noDuplication); CZString actualKey(key, static_cast<unsigned>(myend-key), CZString::noDuplication);
ObjectValues::const_iterator it = value_.map_->find(actualKey); ObjectValues::const_iterator it = value_.map_->find(actualKey);
if (it == value_.map_->end()) return NULL; if (it == value_.map_->end()) return NULL;
return &(*it).second; return &(*it).second;
@@ -3273,9 +3273,9 @@ Value const& Value::operator[](CppTL::ConstString const& key) const
Value& Value::append(const Value& value) { return (*this)[size()] = value; } Value& Value::append(const Value& value) { return (*this)[size()] = value; }
Value Value::get(char const* key, char const* end, Value const& defaultValue) const Value Value::get(char const* key, char const* myend, Value const& defaultValue) const
{ {
Value const* found = find(key, end); Value const* found = find(key, myend);
return !found ? defaultValue : *found; return !found ? defaultValue : *found;
} }
Value Value::get(char const* key, Value const& defaultValue) const Value Value::get(char const* key, Value const& defaultValue) const
@@ -3288,12 +3288,12 @@ Value Value::get(std::string const& key, Value const& defaultValue) const
} }
bool Value::removeMember(const char* key, const char* end, Value* removed) bool Value::removeMember(const char* key, const char* myend, Value* removed)
{ {
if (type_ != objectValue) { if (type_ != objectValue) {
return false; return false;
} }
CZString actualKey(key, static_cast<unsigned>(end-key), CZString::noDuplication); CZString actualKey(key, static_cast<unsigned>(myend-key), CZString::noDuplication);
ObjectValues::iterator it = value_.map_->find(actualKey); ObjectValues::iterator it = value_.map_->find(actualKey);
if (it == value_.map_->end()) if (it == value_.map_->end())
return false; return false;
@@ -3338,8 +3338,8 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
ArrayIndex oldSize = size(); ArrayIndex oldSize = size();
// shift left all items left, into the place of the "removed" // shift left all items left, into the place of the "removed"
for (ArrayIndex i = index; i < (oldSize - 1); ++i){ for (ArrayIndex i = index; i < (oldSize - 1); ++i){
CZString key(i); CZString mykey(i);
(*value_.map_)[key] = (*this)[i + 1]; (*value_.map_)[mykey] = (*this)[i + 1];
} }
// erase the last one ("leftover") // erase the last one ("leftover")
CZString keyLast(oldSize - 1); CZString keyLast(oldSize - 1);
@@ -3355,9 +3355,9 @@ Value Value::get(const CppTL::ConstString& key,
} }
#endif #endif
bool Value::isMember(char const* key, char const* end) const bool Value::isMember(char const* key, char const* myend) const
{ {
Value const* value = find(key, end); Value const* value = find(key, myend);
return NULL != value; return NULL != value;
} }
bool Value::isMember(char const* key) const bool Value::isMember(char const* key) const