From 732ea045f506919a313bec5d7623b547967784fc Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 28 Jul 2020 12:45:47 +0100 Subject: cam: options: Rename optional arg to prevent shadowing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The parseValue function is given the optarg directly from the getopt library, but the function retains the same name. This causes an shadowed variable of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling shadowed variables. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/cam') diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 358507ea..417c3ab4 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -77,7 +77,7 @@ void OptionsBase::invalidate() template bool OptionsBase::parseValue(const T &opt, const Option &option, - const char *optarg) + const char *arg) { OptionValue value; @@ -88,9 +88,9 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, case OptionInteger: unsigned int integer; - if (optarg) { + if (arg) { char *endptr; - integer = strtoul(optarg, &endptr, 0); + integer = strtoul(arg, &endptr, 0); if (*endptr != '\0') return false; } else { @@ -101,12 +101,12 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, break; case OptionString: - value = OptionValue(optarg ? optarg : ""); + value = OptionValue(arg ? arg : ""); break; case OptionKeyValue: KeyValueParser *kvParser = option.keyValueParser; - KeyValueParser::Options keyValues = kvParser->parse(optarg); + KeyValueParser::Options keyValues = kvParser->parse(arg); if (!keyValues.valid()) return false; -- cgit v1.2.1