From patchwork Fri Jul 12 19:42:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 1674 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1972160C23 for ; Fri, 12 Jul 2019 21:42:22 +0200 (CEST) X-Halon-ID: 240f644d-a4dd-11e9-8d05-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [126.209.254.147]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 240f644d-a4dd-11e9-8d05-005056917f90; Fri, 12 Jul 2019 21:42:17 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sat, 13 Jul 2019 04:42:07 +0900 Message-Id: <20190712194207.2806-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: ipa_module: Fix open source licence verification 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: Fri, 12 Jul 2019 19:42:22 -0000 The second argument to std::array is the size of the array, not of the elements it contains. Fix this by turning the std::array into a simple array of const char pointers. Fixes: 099815b85377ac68 ("libcamera: ipa_module: add isOpenSource") Signed-off-by: Niklas Söderlund Reviewed-by: Paul Elder --- src/libcamera/ipa_module.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 93bb4889023bb433..f9e0896cb84eab0d 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -22,6 +22,7 @@ #include "log.h" #include "pipeline_handler.h" +#include "utils.h" /** * \file ipa_module.h @@ -478,7 +479,7 @@ bool IPAModule::match(PipelineHandler *pipe, */ bool IPAModule::isOpenSource() const { - static std::array osLicenses = { + static const char *osLicenses[] = { "GPL-2.0-only", "GPL-2.0-or-later", "GPL-3.0-only", @@ -489,8 +490,11 @@ bool IPAModule::isOpenSource() const "LGPL-3.0-or-later", }; - return std::find(osLicenses.begin(), osLicenses.end(), info_.license) - != osLicenses.end(); + for (unsigned int i = 0; i < ARRAY_SIZE(osLicenses); i++) + if (!strcmp(osLicenses[i], info_.license)) + return true; + + return false; } } /* namespace libcamera */