Merge pull request #1094 from vmiklos/wshadow-fixes-util

GH #1050 Util: fix gcc -Wshadow warnings
This commit is contained in:
Aleksandar Fabijanic 2015-12-26 00:17:24 +01:00
commit d69878cdd5
12 changed files with 83 additions and 83 deletions

View File

@ -54,9 +54,9 @@ public:
/// A key-value pair, used as event argument.
{
public:
KeyValue(const std::string& key, std::string& value):
_key(key),
_value(value)
KeyValue(const std::string& rKey, std::string& rValue):
_key(rKey),
_value(rValue)
{
}

View File

@ -471,9 +471,9 @@ inline const Poco::Timestamp& Application::startTime() const
inline Poco::Timespan Application::uptime() const
{
Poco::Timestamp now;
Poco::Timespan uptime = now - _startTime;
Poco::Timespan ret = now - _startTime;
return uptime;
return ret;
}

View File

@ -423,11 +423,11 @@ std::string AbstractConfiguration::internalExpand(const std::string& value) cons
}
std::string AbstractConfiguration::uncheckedExpand(const std::string& value) const
std::string AbstractConfiguration::uncheckedExpand(const std::string& rValue) const
{
std::string result;
std::string::const_iterator it = value.begin();
std::string::const_iterator end = value.end();
std::string::const_iterator it = rValue.begin();
std::string::const_iterator end = rValue.end();
while (it != end)
{
if (*it == '$')

View File

@ -78,7 +78,7 @@ Application::Application():
}
Application::Application(int argc, char* argv[]):
Application::Application(int argc, char* pArgv[]):
_pConfig(new LayeredConfiguration),
_initialized(false),
_unixOptions(true),
@ -87,7 +87,7 @@ Application::Application(int argc, char* argv[]):
_loadedConfigs(0)
{
setup();
init(argc, argv);
init(argc, pArgv);
}
@ -131,9 +131,9 @@ void Application::addSubsystem(Subsystem* pSubsystem)
}
void Application::init(int argc, char* argv[])
void Application::init(int argc, char* pArgv[])
{
setArgs(argc, argv);
setArgs(argc, pArgv);
init();
}
@ -363,15 +363,15 @@ int Application::main(const ArgVec& args)
}
void Application::setArgs(int argc, char* argv[])
void Application::setArgs(int argc, char* pArgv[])
{
_command = argv[0];
_command = pArgv[0];
_pConfig->setInt("application.argc", argc);
_unprocessedArgs.reserve(argc);
std::string argvKey = "application.argv[";
for (int i = 0; i < argc; ++i)
{
std::string arg(argv[i]);
std::string arg(pArgv[i]);
_pConfig->setString(argvKey + NumberFormatter::format(i) + "]", arg);
_unprocessedArgs.push_back(arg);
}
@ -403,13 +403,13 @@ void Application::processOptions()
ArgVec::iterator it = _unprocessedArgs.begin();
while (it != _unprocessedArgs.end() && !_stopOptionsProcessing)
{
std::string name;
std::string argName;
std::string value;
if (processor.process(*it, name, value))
if (processor.process(*it, argName, value))
{
if (!name.empty()) // "--" option to end options processing or deferred argument
if (!argName.empty()) // "--" option to end options processing or deferred argument
{
handleOption(name, value);
handleOption(argName, value);
}
it = _unprocessedArgs.erase(it);
}
@ -536,18 +536,18 @@ bool Application::findAppConfigFile(const Path& basePath, const std::string& app
}
void Application::defineOptions(OptionSet& options)
void Application::defineOptions(OptionSet& rOptions)
{
for (SubsystemVec::iterator it = _subsystems.begin(); it != _subsystems.end(); ++it)
{
(*it)->defineOptions(options);
(*it)->defineOptions(rOptions);
}
}
void Application::handleOption(const std::string& name, const std::string& value)
void Application::handleOption(const std::string& rName, const std::string& value)
{
const Option& option = _options.getOption(name);
const Option& option = _options.getOption(rName);
if (option.validator())
{
option.validator()->validate(option, value);
@ -560,14 +560,14 @@ void Application::handleOption(const std::string& name, const std::string& value
}
if (option.callback())
{
option.callback()->invoke(name, value);
option.callback()->invoke(rName, value);
}
}
void Application::setLogger(Logger& logger)
void Application::setLogger(Logger& rLogger)
{
_pLogger = &logger;
_pLogger = &rLogger;
}

View File

@ -100,7 +100,7 @@ void IniFileConfiguration::setRaw(const std::string& key, const std::string& val
void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
{
std::set<std::string> keys;
std::set<std::string> keySet;
std::string prefix = key;
if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size();
@ -114,10 +114,10 @@ void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
subKey = it->first.substr(psize);
else
subKey = it->first.substr(psize, end - psize);
if (keys.find(subKey) == keys.end())
if (keySet.find(subKey) == keySet.end())
{
range.push_back(subKey);
keys.insert(subKey);
keySet.insert(subKey);
}
}
}
@ -189,4 +189,4 @@ void IniFileConfiguration::parseLine(std::istream& istr)
} } // namespace Poco::Util
#endif // POCO_UTIL_NO_INIFILECONFIGURATION
#endif // POCO_UTIL_NO_INIFILECONFIGURATION

View File

@ -167,7 +167,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri
parentArray->add(newArray);
}
for(int i = 0; i <= *it - 1; ++i)
for(int j = 0; j <= *it - 1; ++j)
{
Poco::DynamicAny nullValue;
newArray->add(nullValue);

View File

@ -140,17 +140,17 @@ void LayeredConfiguration::setRaw(const std::string& key, const std::string& val
void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const
{
std::set<std::string> keys;
std::set<std::string> keySet;
for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc)
{
Keys partRange;
itc->pConfig->enumerate(key, partRange);
for (Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr)
{
if (keys.find(*itr) == keys.end())
if (keySet.find(*itr) == keySet.end())
{
range.push_back(*itr);
keys.insert(*itr);
keySet.insert(*itr);
}
}
}

View File

@ -58,7 +58,7 @@ void MapConfiguration::setRaw(const std::string& key, const std::string& value)
void MapConfiguration::enumerate(const std::string& key, Keys& range) const
{
std::set<std::string> keys;
std::set<std::string> keySet;
std::string prefix = key;
if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size();
@ -67,15 +67,15 @@ void MapConfiguration::enumerate(const std::string& key, Keys& range) const
if (it->first.compare(0, psize, prefix) == 0)
{
std::string subKey;
std::string::size_type end = it->first.find('.', psize);
if (end == std::string::npos)
std::string::size_type pos = it->first.find('.', psize);
if (pos == std::string::npos)
subKey = it->first.substr(psize);
else
subKey = it->first.substr(psize, end - psize);
if (keys.find(subKey) == keys.end())
subKey = it->first.substr(psize, pos - psize);
if (keySet.find(subKey) == keySet.end())
{
range.push_back(subKey);
keys.insert(subKey);
keySet.insert(subKey);
}
}
}

View File

@ -60,9 +60,9 @@ Option::Option(const Option& option):
}
Option::Option(const std::string& fullName, const std::string& shortName):
_shortName(shortName),
_fullName(fullName),
Option::Option(const std::string& rFullName, const std::string& rShortName):
_shortName(rShortName),
_fullName(rFullName),
_required(false),
_repeatable(false),
_argRequired(false),
@ -73,11 +73,11 @@ Option::Option(const std::string& fullName, const std::string& shortName):
}
Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required):
_shortName(shortName),
_fullName(fullName),
_description(description),
_required(required),
Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired):
_shortName(rShortName),
_fullName(rFullName),
_description(rDescription),
_required(isRequired),
_repeatable(false),
_argRequired(false),
_pValidator(0),
@ -87,11 +87,11 @@ Option::Option(const std::string& fullName, const std::string& shortName, const
}
Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required, const std::string& argName, bool argRequired):
_shortName(shortName),
_fullName(fullName),
_description(description),
_required(required),
Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired, const std::string& argName, bool argRequired):
_shortName(rShortName),
_fullName(rFullName),
_description(rDescription),
_required(isRequired),
_repeatable(false),
_argName(argName),
_argRequired(argRequired),
@ -173,10 +173,10 @@ Option& Option::repeatable(bool flag)
}
Option& Option::argument(const std::string& name, bool required)
Option& Option::argument(const std::string& name, bool isRequired)
{
_argName = name;
_argRequired = required;
_argRequired = isRequired;
return *this;
}
@ -189,9 +189,9 @@ Option& Option::noArgument()
}
Option& Option::group(const std::string& group)
Option& Option::group(const std::string& rGroup)
{
_group = group;
_group = rGroup;
return *this;
}

View File

@ -610,16 +610,16 @@ void ServerApplication::waitForTerminationRequest()
}
int ServerApplication::run(int argc, char** argv)
int ServerApplication::run(int argc, char** pArgv)
{
bool runAsDaemon = isDaemon(argc, argv);
bool runAsDaemon = isDaemon(argc, pArgv);
if (runAsDaemon)
{
beDaemon();
}
try
{
init(argc, argv);
init(argc, pArgv);
if (runAsDaemon)
{
int rc = chdir("/");
@ -668,12 +668,12 @@ int ServerApplication::run(const std::vector<std::string>& args)
}
bool ServerApplication::isDaemon(int argc, char** argv)
bool ServerApplication::isDaemon(int argc, char** pArgv)
{
std::string option("--daemon");
for (int i = 1; i < argc; ++i)
{
if (option == argv[i])
if (option == pArgv[i])
return true;
}
return false;
@ -708,17 +708,17 @@ void ServerApplication::beDaemon()
}
void ServerApplication::defineOptions(OptionSet& options)
void ServerApplication::defineOptions(OptionSet& rOptions)
{
Application::defineOptions(options);
Application::defineOptions(rOptions);
options.addOption(
rOptions.addOption(
Option("daemon", "", "Run application as a daemon.")
.required(false)
.repeatable(false)
.callback(OptionCallback<ServerApplication>(this, &ServerApplication::handleDaemon)));
options.addOption(
rOptions.addOption(
Option("pidfile", "", "Write the process ID of the application to given file.")
.required(false)
.repeatable(false)
@ -727,13 +727,13 @@ void ServerApplication::defineOptions(OptionSet& options)
}
void ServerApplication::handleDaemon(const std::string& name, const std::string& value)
void ServerApplication::handleDaemon(const std::string& rName, const std::string& Value)
{
config().setBool("application.runAsDaemon", true);
}
void ServerApplication::handlePidFile(const std::string& name, const std::string& value)
void ServerApplication::handlePidFile(const std::string& rName, const std::string& value)
{
std::ofstream ostr(value.c_str());
if (ostr.good())

View File

@ -30,8 +30,8 @@ namespace Util {
class TimerNotification: public Poco::Notification
{
public:
TimerNotification(Poco::TimedNotificationQueue& queue):
_queue(queue)
TimerNotification(Poco::TimedNotificationQueue& rQueue):
_queue(rQueue)
{
}
@ -54,8 +54,8 @@ private:
class StopNotification: public TimerNotification
{
public:
StopNotification(Poco::TimedNotificationQueue& queue):
TimerNotification(queue)
StopNotification(Poco::TimedNotificationQueue& rQueue):
TimerNotification(rQueue)
{
}
@ -74,8 +74,8 @@ public:
class CancelNotification: public TimerNotification
{
public:
CancelNotification(Poco::TimedNotificationQueue& queue):
TimerNotification(queue)
CancelNotification(Poco::TimedNotificationQueue& rQueue):
TimerNotification(rQueue)
{
}
@ -103,8 +103,8 @@ private:
class TaskNotification: public TimerNotification
{
public:
TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask):
TimerNotification(queue),
TaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask):
TimerNotification(rQueue),
_pTask(pTask)
{
}
@ -151,8 +151,8 @@ private:
class PeriodicTaskNotification: public TaskNotification
{
public:
PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval):
TaskNotification(queue, pTask),
PeriodicTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval):
TaskNotification(rQueue, pTask),
_interval(interval)
{
}
@ -185,8 +185,8 @@ private:
class FixedRateTaskNotification: public TaskNotification
{
public:
FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval, Poco::Clock clock):
TaskNotification(queue, pTask),
FixedRateTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval, Poco::Clock clock):
TaskNotification(rQueue, pTask),
_interval(interval),
_nextExecution(clock)
{

View File

@ -260,7 +260,7 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
{
using Poco::NumberFormatter;
std::multiset<std::string> keys;
std::multiset<std::string> keySet;
const Poco::XML::Node* pNode = findNode(key);
if (pNode)
{
@ -270,12 +270,12 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE)
{
const std::string& nodeName = pChild->nodeName();
int n = (int) keys.count(nodeName);
int n = (int) keySet.count(nodeName);
if (n)
range.push_back(nodeName + "[" + NumberFormatter::format(n) + "]");
else
range.push_back(nodeName);
keys.insert(nodeName);
keySet.insert(nodeName);
}
pChild = pChild->nextSibling();
}