{"id":24613,"url":"https://patchwork.libcamera.org/api/1.1/patches/24613/?format=json","web_url":"https://patchwork.libcamera.org/patch/24613/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20251013142329.1386-1-laurent.pinchart@ideasonboard.com>","date":"2025-10-13T14:23:29","name":"pipeline: simple: Avoid overusage of auto variables","commit_ref":"f4604eb152f5d24370c1160a2f10dcab87b1ef21","pull_url":null,"state":"accepted","archived":false,"hash":"895a315ebb6faeb3d7df286da553eea82a79392d","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24613/mbox/","series":[{"id":5495,"url":"https://patchwork.libcamera.org/api/1.1/series/5495/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5495","date":"2025-10-13T14:23:29","name":"pipeline: simple: Avoid overusage of auto variables","version":1,"mbox":"https://patchwork.libcamera.org/series/5495/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24613/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24613/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 C796FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Oct 2025 14:23:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 03CA4604F4;\n\tMon, 13 Oct 2025 16:23:38 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7071C6031A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Oct 2025 16:23:36 +0200 (CEST)","from pendragon.ideasonboard.com (82-203-166-19.bb.dnainternet.fi\n\t[82.203.166.19])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 6B59D183;\n\tMon, 13 Oct 2025 16:21:58 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wk9RxVMI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760365318;\n\tbh=RjB/COCbtcIivRvltMUt7rODDYE3Wys6iv/Azuyj4fM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=wk9RxVMIgOv7GrRU2vlC64fntrAEv9FyXgCc99CvFIT0A/ZQk3p3s2mGS2lU2FdFm\n\tQZ/8nxRww6RbuQmzOu4a8R1CZUXCXh26P1kqO46UKGXrqx4SyypEuL1Akem43STdpH\n\teWUytybaj7U/N5phphhqspWBnDkVhLqEkme4ZJSM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Robert Mader <robert.mader@collabora.com>","Subject":"[PATCH] pipeline: simple: Avoid overusage of auto variables","Date":"Mon, 13 Oct 2025 17:23:29 +0300","Message-ID":"<20251013142329.1386-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.49.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Using auto variables for simple types reduces readability. Spell out\nunsigned int explicitly here, and replace the <= 0 check with a zero\ncheck now that the explicit type shows the value can't be negative.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\n\nbase-commit: 05bfebed2657cc1d032c9796efd9041bfbdc881c","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex dec9f6514f8c..7b0783cdbc32 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -1266,8 +1266,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t\t\tcfg.frameSize = format.planes[0].size;\n \t\t}\n \n-\t\tconst auto bufferCount = cfg.bufferCount;\n-\t\tif (bufferCount <= 0)\n+\t\tconst unsigned int bufferCount = cfg.bufferCount;\n+\t\tif (!bufferCount)\n \t\t\tcfg.bufferCount = kNumBuffersDefault;\n \t\telse if (bufferCount > kNumBuffersMax)\n \t\t\tcfg.bufferCount = kNumBuffersMax;\n","prefixes":[]}