From ce8fa7740cdbb0f065a42fc5f7a608ece9d64c94 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Fri, 4 Dec 2015 09:11:42 +0100
Subject: [PATCH] GH #1050 JSON: fix gcc -Wshadow warnings

---
 Foundation/include/Poco/Nullable.h    | 20 ++++++++++----------
 JSON/include/Poco/JSON/Array.h        |  8 ++++----
 JSON/include/Poco/JSON/Object.h       | 12 ++++++------
 JSON/include/Poco/JSON/PrintHandler.h |  4 ++--
 JSON/src/Array.cpp                    |  4 ++--
 JSON/src/Object.cpp                   | 12 ++++++------
 JSON/src/ParseHandler.cpp             |  6 +++---
 JSON/src/PrintHandler.cpp             | 12 ++++++------
 8 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/Foundation/include/Poco/Nullable.h b/Foundation/include/Poco/Nullable.h
index adceafd87..7857ffe68 100644
--- a/Foundation/include/Poco/Nullable.h
+++ b/Foundation/include/Poco/Nullable.h
@@ -74,9 +74,9 @@ public:
 	{
 	}
 
-	Nullable(const C& value): 
+	Nullable(const C& rValue): 
 		/// Creates a Nullable with the given value.
-		_value(value), 
+		_value(rValue), 
 		_isNull(false)
 	{
 	}
@@ -93,10 +93,10 @@ public:
 	{
 	}
 
-	Nullable& assign(const C& value)
+	Nullable& assign(const C& rValue)
 		/// Assigns a value to the Nullable.
 	{
-		_value  = value;
+		_value  = rValue;
 		_isNull = false;
 		return *this;
 	}
@@ -116,10 +116,10 @@ public:
 		return *this;
 	}
 	
-	Nullable& operator = (const C& value)
+	Nullable& operator = (const C& rValue)
 		/// Assigns a value to the Nullable.
 	{
-		return assign(value);
+		return assign(rValue);
 	}
 
 	Nullable& operator = (const Nullable& other)
@@ -148,10 +148,10 @@ public:
 		return (_isNull && other._isNull) || (_isNull == other._isNull && _value == other._value);
 	}
 
-	bool operator == (const C& value) const
+	bool operator == (const C& rValue) const
 		/// Compares Nullable with value for equality
 	{
-		return (!_isNull && _value == value);
+		return (!_isNull && _value == rValue);
 	}
 
 	bool operator == (const NullType&) const
@@ -160,10 +160,10 @@ public:
 		return _isNull;
 	}
 
-	bool operator != (const C& value) const
+	bool operator != (const C& rValue) const
 		/// Compares Nullable with value for non equality
 	{
-		return !(*this == value);
+		return !(*this == rValue);
 	}
 
 	bool operator != (const Nullable<C>& other) const
diff --git a/JSON/include/Poco/JSON/Array.h b/JSON/include/Poco/JSON/Array.h
index 2707e7181..0e83274f2 100644
--- a/JSON/include/Poco/JSON/Array.h
+++ b/JSON/include/Poco/JSON/Array.h
@@ -300,9 +300,9 @@ public:
 		throw BadCastException();
 	}
 
-	void convert(bool& value) const
+	void convert(bool& rValue) const
 	{
-		value = !_val.isNull() && _val->size() > 0;
+		rValue = !_val.isNull() && _val->size() > 0;
 	}
 
 	void convert(float&) const
@@ -439,9 +439,9 @@ public:
 		throw BadCastException();
 	}
 
-	void convert(bool& value) const
+	void convert(bool& rValue) const
 	{
-		value = _val.size() > 0;
+		rValue = _val.size() > 0;
 	}
 
 	void convert(float&) const
diff --git a/JSON/include/Poco/JSON/Object.h b/JSON/include/Poco/JSON/Object.h
index f4be10fb2..534ff4f07 100644
--- a/JSON/include/Poco/JSON/Object.h
+++ b/JSON/include/Poco/JSON/Object.h
@@ -216,8 +216,8 @@ private:
 		if (indent > 0) out << std::endl;
 		
 		typename C::const_iterator it = container.begin();
-		typename C::const_iterator end = container.end();
-		for (; it != end;)
+		typename C::const_iterator itEnd = container.end();
+		for (; it != itEnd;)
 		{
 			for(unsigned int i = 0; i < indent; i++) out << ' ';
 
@@ -392,9 +392,9 @@ public:
 		throw BadCastException();
 	}
 
-	void convert(bool& value) const
+	void convert(bool& rValue) const
 	{
-		value = !_val.isNull() && _val->size() > 0;
+		rValue = !_val.isNull() && _val->size() > 0;
 	}
 
 	void convert(float&) const
@@ -534,9 +534,9 @@ public:
 		throw BadCastException();
 	}
 
-	void convert(bool& value) const
+	void convert(bool& rValue) const
 	{
-		value = _val.size() > 0;
+		rValue = _val.size() > 0;
 	}
 
 	void convert(float&) const
diff --git a/JSON/include/Poco/JSON/PrintHandler.h b/JSON/include/Poco/JSON/PrintHandler.h
index b063565ad..de95539c1 100644
--- a/JSON/include/Poco/JSON/PrintHandler.h
+++ b/JSON/include/Poco/JSON/PrintHandler.h
@@ -119,9 +119,9 @@ private:
 };
 
 
-inline void PrintHandler::setIndent(unsigned indent)
+inline void PrintHandler::setIndent(unsigned newIndent)
 {
-	_indent = indent;
+	_indent = newIndent;
 }
 
 
diff --git a/JSON/src/Array.cpp b/JSON/src/Array.cpp
index d49c01077..94a5866ac 100644
--- a/JSON/src/Array.cpp
+++ b/JSON/src/Array.cpp
@@ -149,10 +149,10 @@ Array::operator const Poco::Dynamic::Array& () const
 	if (!_pArray)
 	{
 		ValueVec::const_iterator it = _values.begin();
-		ValueVec::const_iterator end = _values.end();
+		ValueVec::const_iterator itEnd = _values.end();
 		_pArray = new Poco::Dynamic::Array;
 		int index = 0;
-		for (; it != end; ++it, ++index)
+		for (; it != itEnd; ++it, ++index)
 		{
 			if (isObject(it))
 			{
diff --git a/JSON/src/Object.cpp b/JSON/src/Object.cpp
index f55be8149..1718b8773 100644
--- a/JSON/src/Object.cpp
+++ b/JSON/src/Object.cpp
@@ -104,8 +104,8 @@ void Object::stringify(std::ostream& out, unsigned int indent, int step) const
 const std::string& Object::getKey(KeyPtrList::const_iterator& iter) const
 {
 	ValueMap::const_iterator it = _values.begin();
-	ValueMap::const_iterator end = _values.end();
-	for (; it != end; ++it)
+	ValueMap::const_iterator itEnd = _values.end();
+	for (; it != itEnd; ++it)
 	{
 		if (it->first == **iter) return it->first;
 	}
@@ -121,8 +121,8 @@ void Object::set(const std::string& key, const Dynamic::Var& value)
 	if (_preserveInsOrder)
 	{
 		KeyPtrList::iterator it = _keys.begin();
-		KeyPtrList::iterator end = _keys.end();
-		for (; it != end; ++it)
+		KeyPtrList::iterator itEnd = _keys.end();
+		for (; it != itEnd; ++it)
 		{
 			if (key == **it) return;
 		}
@@ -164,9 +164,9 @@ Object::operator const Poco::DynamicStruct& () const
 	if (!_pStruct)
 	{
 		ValueMap::const_iterator it = _values.begin();
-		ValueMap::const_iterator end = _values.end();
+		ValueMap::const_iterator itEnd = _values.end();
 		_pStruct = new Poco::DynamicStruct;
-		for (; it != end; ++it)
+		for (; it != itEnd; ++it)
 		{
 			if (isObject(it))
 			{
diff --git a/JSON/src/ParseHandler.cpp b/JSON/src/ParseHandler.cpp
index 74296493a..cb1cb248b 100644
--- a/JSON/src/ParseHandler.cpp
+++ b/JSON/src/ParseHandler.cpp
@@ -122,20 +122,20 @@ void ParseHandler::key(const std::string& k)
 }
 
 
-void ParseHandler::setValue(const Var& value)
+void ParseHandler::setValue(const Var& rValue)
 {
 	Var parent = _stack.top();
 
 	if ( parent.type() == typeid(Array::Ptr) )
 	{
 		Array::Ptr arr = parent.extract<Array::Ptr>();
-		arr->add(value);
+		arr->add(rValue);
 	}
 	else if ( parent.type() == typeid(Object::Ptr) )
 	{
 		poco_assert_dbg(!_key.empty());
 		Object::Ptr obj = parent.extract<Object::Ptr>();
-		obj->set(_key, value);
+		obj->set(_key, rValue);
 		_key.clear();
 	}
 }
diff --git a/JSON/src/PrintHandler.cpp b/JSON/src/PrintHandler.cpp
index d88ee37ff..92bc6d09f 100644
--- a/JSON/src/PrintHandler.cpp
+++ b/JSON/src/PrintHandler.cpp
@@ -23,18 +23,18 @@ namespace Poco {
 namespace JSON {
 
 
-PrintHandler::PrintHandler(unsigned indent):
+PrintHandler::PrintHandler(unsigned newIndent):
 	_out(std::cout),
-	_indent(indent),
+	_indent(newIndent),
 	_array(0),
 	_objStart(true)
 {
 }
 
 
-PrintHandler::PrintHandler(std::ostream& out, unsigned indent):
+PrintHandler::PrintHandler(std::ostream& out, unsigned newIndent):
 	_out(out),
-	_indent(indent),
+	_indent(newIndent),
 	_array(0),
 	_objStart(true)
 {
@@ -172,10 +172,10 @@ void PrintHandler::value(UInt64 v)
 #endif
 
 
-void PrintHandler::value(const std::string& value)
+void PrintHandler::value(const std::string& rValue)
 {
 	arrayValue();
-	Stringifier::formatString(value, _out);
+	Stringifier::formatString(rValue, _out);
 	_objStart = false;
 }