From patchwork Tue Jan 15 15:18:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 238 Return-Path: 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 3CFDC60C8A for ; Tue, 15 Jan 2019 16:18:55 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CDC7B59B for ; Tue, 15 Jan 2019 16:18:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547565534; bh=Cz7Czp6CfYmmIFFQEF9MrZkpYtp+3MczlcvN8f3bK2M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=meaDl+JGkcAZcGOgsprs4u3aF3rVvGgyTuE+A7JFm/Bs3yQozi19h+DAFztQAnog0 A9U1x+5BogyDeLBg22k4cheVeIfT8dfMb8BD0GC52nO9gXdTGMLDqugGRwykZr8qqP vZQ9KbRh7di8F7A24msRTTIHbdp9Tp+/az0Hp97Q= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 15 Jan 2019 17:18:47 +0200 Message-Id: <20190115151849.1547-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190115151849.1547-1-laurent.pinchart@ideasonboard.com> References: <20190115151849.1547-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/8] libcamera: device_enumerator: Don't mark the search() function as const X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 15:18:55 -0000 While the DeviceEnumerator::search() function doesn't modify the instance directly, it returns a non-const pointer to a MediaEntity that is owned by the DeviceEnumerator instance. This breaks the const semantics. Don't mark the function as const. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/device_enumerator.cpp | 2 +- src/libcamera/include/device_enumerator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index 1653e4f4651a..18d7e86843e8 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -245,7 +245,7 @@ int DeviceEnumerator::addDevice(const std::string &devnode) * * \return pointer to the matching MediaDevice, or nullptr if no match is found */ -MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm) const +MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm) { for (MediaDevice *dev : devices_) { if (dev->busy()) diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h index 29737da7a225..b68c815827dd 100644 --- a/src/libcamera/include/device_enumerator.h +++ b/src/libcamera/include/device_enumerator.h @@ -41,7 +41,7 @@ public: virtual int init() = 0; virtual int enumerate() = 0; - MediaDevice *search(const DeviceMatch &dm) const; + MediaDevice *search(const DeviceMatch &dm); protected: int addDevice(const std::string &devnode);