From patchwork Mon Mar 3 19:33:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22915 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DB83CBD808 for ; Mon, 3 Mar 2025 19:33:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 93E3668855; Mon, 3 Mar 2025 20:33:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="snZ9H/dx"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0ACF168822 for ; Mon, 3 Mar 2025 20:33:43 +0100 (CET) Received: from pb-laptop.local (185.221.143.4.nat.pool.zt.hu [185.221.143.4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7983E346 for ; Mon, 3 Mar 2025 20:32:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1741030331; bh=pLNAL2sHnnMs1orpl0gqC82erUf5YepjRKN5m7nj5HY=; h=From:To:Subject:Date:From; b=snZ9H/dx/rnlEm58TlbfpcLhS/tbbEEIhkKNuFwI8HGnA/PBTn307wD4ylVQn2SiD iLmuxUnbQLxQa3Jbh64wvn2Sk/YuL0HgggmBlfsRuLXboNToZzBkYK8RLvFq0kFRli IcQhcU/dnrO9dmT4EDlxcozrEU7r9CM8/guyE0+0= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] apps: qcam: Simplify `PixelFormat` search Date: Mon, 3 Mar 2025 20:33:39 +0100 Message-ID: <20250303193339.785634-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Since `PixelFormat` has `operator==()`, `std::find()` can be used directly, so do that to simplify. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/apps/qcam/main_window.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp index 3880a846e..d2ccbd231 100644 --- a/src/apps/qcam/main_window.cpp +++ b/src/apps/qcam/main_window.cpp @@ -386,10 +386,7 @@ int MainWindow::startCapture() /* Use a format supported by the viewfinder if available. */ std::vector formats = vfConfig.formats().pixelformats(); for (const PixelFormat &format : viewfinder_->nativeFormats()) { - auto match = std::find_if(formats.begin(), formats.end(), - [&](const PixelFormat &f) { - return f == format; - }); + auto match = std::find(formats.begin(), formats.end(), format); if (match != formats.end()) { vfConfig.pixelFormat = format; break;