{"id":10062,"url":"https://patchwork.libcamera.org/api/patches/10062/?format=json","web_url":"https://patchwork.libcamera.org/patch/10062/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201015223750.58563-2-kieran.bingham@ideasonboard.com>","date":"2020-10-15T22:37:40","name":"[libcamera-devel,v2,01/11] cam: options: Rename optional arg to prevent aliasing","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ee3292aa0041e9d4595db011e20fbbe06e456c02","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10062/mbox/","series":[{"id":1376,"url":"https://patchwork.libcamera.org/api/series/1376/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1376","date":"2020-10-15T22:37:39","name":"Shadowed Variables","version":2,"mbox":"https://patchwork.libcamera.org/series/1376/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10062/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10062/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 46483BE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Oct 2020 22:37:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC5B160E36;\n\tFri, 16 Oct 2020 00:37:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B0C56600F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Oct 2020 00:37:55 +0200 (CEST)","from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E432A42;\n\tFri, 16 Oct 2020 00:37:55 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DBoy6x5K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602801475;\n\tbh=WV+v2EAoJewCWepaPmgm4Izg7iqJ5wx+/vJhix2mXXg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DBoy6x5KsmPDbIDNyXtlbqA0pBo/uCKWd8JQw5gYzZ2pOtI0V36CFL/fe00EGG1vU\n\t+In81SvHflC4jadMJxSej/aKjB+H0GaSSbpoE41aGe1Zz6pfRtNipC5C1FhiYBZrHL\n\tO83k3cN4TQCGnjsEAphb0SKPEGfBYltey54iENjo=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu, 15 Oct 2020 23:37:40 +0100","Message-Id":"<20201015223750.58563-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20201015223750.58563-1-kieran.bingham@ideasonboard.com>","References":"<20201015223750.58563-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 01/11] cam: options: Rename optional\n\targ to prevent aliasing","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The parseValue function is given the optarg directly from the getopt\nlibrary, but the function retains the same name.\n\nThis causes an alias of the global optarg variable to be present in the\nparseValue function. While this is not harmful, rename it to work\ntowards disabling aliases variables.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/cam/options.cpp | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)","diff":"diff --git a/src/cam/options.cpp b/src/cam/options.cpp\nindex 358507eabf89..417c3ab49bc9 100644\n--- a/src/cam/options.cpp\n+++ b/src/cam/options.cpp\n@@ -77,7 +77,7 @@ void OptionsBase<T>::invalidate()\n \n template<typename T>\n bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n-\t\t\t\tconst char *optarg)\n+\t\t\t\tconst char *arg)\n {\n \tOptionValue value;\n \n@@ -88,9 +88,9 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n \tcase OptionInteger:\n \t\tunsigned int integer;\n \n-\t\tif (optarg) {\n+\t\tif (arg) {\n \t\t\tchar *endptr;\n-\t\t\tinteger = strtoul(optarg, &endptr, 0);\n+\t\t\tinteger = strtoul(arg, &endptr, 0);\n \t\t\tif (*endptr != '\\0')\n \t\t\t\treturn false;\n \t\t} else {\n@@ -101,12 +101,12 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n \t\tbreak;\n \n \tcase OptionString:\n-\t\tvalue = OptionValue(optarg ? optarg : \"\");\n+\t\tvalue = OptionValue(arg ? arg : \"\");\n \t\tbreak;\n \n \tcase OptionKeyValue:\n \t\tKeyValueParser *kvParser = option.keyValueParser;\n-\t\tKeyValueParser::Options keyValues = kvParser->parse(optarg);\n+\t\tKeyValueParser::Options keyValues = kvParser->parse(arg);\n \t\tif (!keyValues.valid())\n \t\t\treturn false;\n \n","prefixes":["libcamera-devel","v2","01/11"]}