From patchwork Sat Sep 28 15:22:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2047 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE09760BBA for ; Sat, 28 Sep 2019 17:22:57 +0200 (CEST) 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 5D961593 for ; Sat, 28 Sep 2019 17:22:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1569684177; bh=PWL7w3Qzlg3me3nqZo+QH5r4wW8kpm8361YLEuzOC4A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZGmIQwZVkLLZX2cUKxr3B2k49G51/XioOkNzkiiceYbtY/pd17Co9HwW6AyxKa6k7 4edTdwfgtiLeUTziQZcajeZi4lFyKIRome/RrDZxsHKRSh6K9xGBcNd6aUzac5mPki 2+6blsIXwY2Z274AJvE4kSYgcmifbjC9zn8zvvcY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 28 Sep 2019 18:22:31 +0300 Message-Id: <20190928152238.23752-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190928152238.23752-1-laurent.pinchart@ideasonboard.com> References: <20190928152238.23752-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/12] libcamera: controls: Remove the unused ControlList::update() method 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: , X-List-Received-Date: Sat, 28 Sep 2019 15:22:58 -0000 The ControlList::update() method is unused. While it is meant to fulfil a need of applications, having no user means that it is most probably not correctly designed. Remove the method, we will add it back later if needed. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/controls.h | 2 -- src/libcamera/controls.cpp | 28 ---------------------- test/controls/control_list.cpp | 43 ---------------------------------- 3 files changed, 73 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 9698bd1dd383..d4a74ada1b6a 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -158,8 +158,6 @@ public: val->set(value); } - void update(const ControlList &list); - private: const ControlValue *find(const ControlId &id) const; ControlValue *find(const ControlId &id); diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 8886660b7617..62cb2ff822bb 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -511,32 +511,4 @@ ControlValue *ControlList::find(const ControlId &id) return &controls_[&id]; } -/** - * \brief Update the list with a union of itself and \a other - * \param other The other list - * - * Update the control list to include all values from the \a other list. - * Elements in the list whose control IDs are contained in \a other are updated - * with the value from \a other. Elements in the \a other list that have no - * corresponding element in the list are added to the list with their value. - * - * The behaviour is undefined if the two lists refer to different Camera - * instances. - */ -void ControlList::update(const ControlList &other) -{ - if (other.camera_ != camera_) { - LOG(Controls, Error) - << "Can't update ControlList from a different camera"; - return; - } - - for (auto it : other) { - const ControlId *id = it.first; - const ControlValue &value = it.second; - - controls_[id] = value; - } -} - } /* namespace libcamera */ diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 053696814b67..8469ecf09439 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -141,49 +141,6 @@ protected: return TestFail; } - /* - * Test list merging. Create a new list, add two controls with - * one overlapping the existing list, merge the lists and clear - * the old list. Verify that the new list is empty and that the - * new list contains the expected items and values. - */ - ControlList newList(camera_.get()); - - newList.set(controls::Brightness, 128); - newList.set(controls::Saturation, 255); - newList.update(list); - - list.clear(); - - if (list.size() != 0) { - cout << "Old List should contain zero items" << endl; - return TestFail; - } - - if (!list.empty()) { - cout << "Old List should be empty" << endl; - return TestFail; - } - - if (newList.size() != 3) { - cout << "New list has incorrect size" << endl; - return TestFail; - } - - if (!newList.contains(controls::Brightness) || - !newList.contains(controls::Contrast) || - !newList.contains(controls::Saturation)) { - cout << "New list contains incorrect items" << endl; - return TestFail; - } - - if (newList.get(controls::Brightness) != 10 || - newList.get(controls::Contrast) != 20 || - newList.get(controls::Saturation) != 255) { - cout << "New list contains incorrect values" << endl; - return TestFail; - } - return TestPass; }