Message ID | 20190712194207.2806-1-niklas.soderlund@ragnatech.se |
---|---|
State | Accepted |
Commit | 8f1dbd6a92381e38ba4bf65bdc35d5475ae6dc0a |
Headers | show |
Series |
|
Related | show |
Hi Niklas, Thanks for the patch. On Sat, Jul 13, 2019 at 04:42:07AM +0900, Niklas Söderlund wrote: > 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. Sorry about that :/ > Fixes: 099815b85377ac68 ("libcamera: ipa_module: add isOpenSource") > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> That's much better than what I had :) Looks good to me. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> > --- > 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<const char *, sizeof(char *)> 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 */ > -- > 2.22.0 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi, On 2019-07-13 05:20:00 +0900, Paul Elder wrote: > Hi Niklas, > > Thanks for the patch. > > On Sat, Jul 13, 2019 at 04:42:07AM +0900, Niklas Söderlund wrote: > > 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. > > Sorry about that :/ > > > Fixes: 099815b85377ac68 ("libcamera: ipa_module: add isOpenSource") > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > That's much better than what I had :) > > Looks good to me. > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Thanks, I have pushed this with your tag. > > > --- > > 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<const char *, sizeof(char *)> 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 */ > > -- > > 2.22.0 > > > > _______________________________________________ > > libcamera-devel mailing list > > libcamera-devel@lists.libcamera.org > > https://lists.libcamera.org/listinfo/libcamera-devel
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<const char *, sizeof(char *)> 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 */
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 <niklas.soderlund@ragnatech.se> --- src/libcamera/ipa_module.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)