From patchwork Mon Mar 10 17:02:54 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: 22942 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 6413EC32F1 for ; Mon, 10 Mar 2025 17:03:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 12CD8687F0; Mon, 10 Mar 2025 18:03:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UU+6yzIB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9982B61809 for ; Mon, 10 Mar 2025 18:03:00 +0100 (CET) Received: from pb-laptop.local (185.221.143.221.nat.pool.zt.hu [185.221.143.221]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BBEC6227 for ; Mon, 10 Mar 2025 18:01:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1741626084; bh=6GpX06e/HJL2ITugR7E5XcJa5A3HJ5vbdja2fSWYEgU=; h=From:To:Subject:Date:From; b=UU+6yzIBhBOWDh1HoP4jHZ7kiiMY2tNeQU9XWWY/bh3GMCN8fbF4H2DIIcN51aeMh VYb7G/xbSycuLmmjHwBhdQ1GXat83SwwV+u/3A+nxgnSts585jXtwhx9JembLC5McO 1jrPUD+mECNMovtiYCRRSWvUmHoBTjjUHIQIOwsg= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] libcamera: controls: Check size of enum Date: Mon, 10 Mar 2025 18:02:54 +0100 Message-ID: <20250310170254.185172-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" Only enums whose sizes match that of `int32_t` can be directly supported. Otherwise the expected size and the real size would disagree, leading to an assertion failure in `ControlValue::set()`. Signed-off-by: Barnabás Pőcze --- include/libcamera/controls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 7c7828ae5..4bfe9615c 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -125,7 +125,7 @@ struct control_type> : public control_type> { }; template -struct control_type>> : public control_type { +struct control_type && sizeof(T) == sizeof(int32_t)>> : public control_type { }; } /* namespace details */