Message ID | 20240624192941.22943-8-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Quoting Laurent Pinchart (2024-06-24 20:29:38) > Multiple local functions are defined in the global namespace without the > static keyword. This compiles fine for now, but will cause a missing > declaration warning when we enable thel. To prepare for that, move the s/thel/them/ > function declaration to an anonymous namespace. > > While at it, for consistency, include an existing static function in the > namespace and drop the static keyword. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > src/apps/cam/main.cpp | 4 ++++ > src/apps/common/dng_writer.cpp | 6 +++++- > src/apps/qcam/main.cpp | 4 ++++ > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp > index 4f87f200db21..460dbc813060 100644 > --- a/src/apps/cam/main.cpp > +++ b/src/apps/cam/main.cpp > @@ -344,12 +344,16 @@ std::string CamApp::cameraName(const Camera *camera) > return name; > } > > +namespace { > + > void signalHandler([[maybe_unused]] int signal) > { > std::cout << "Exiting" << std::endl; > CamApp::instance()->quit(); > } > > +} /* namespace */ > + > int main(int argc, char **argv) > { > CamApp app; > diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp > index 59f1fa23543b..58e35f3f9e1b 100644 > --- a/src/apps/common/dng_writer.cpp > +++ b/src/apps/common/dng_writer.cpp > @@ -126,6 +126,8 @@ struct Matrix3d { > float m[9]; > }; > > +namespace { > + > void packScanlineSBGGR8(void *output, const void *input, unsigned int width) > { > const uint8_t *in = static_cast<const uint8_t *>(input); > @@ -282,7 +284,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, > } > } > > -static const std::map<PixelFormat, FormatInfo> formatInfo = { > +const std::map<PixelFormat, FormatInfo> formatInfo = { > { formats::SBGGR8, { > .bitsPerSample = 8, > .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, > @@ -381,6 +383,8 @@ static const std::map<PixelFormat, FormatInfo> formatInfo = { > } }, > }; > > +} /* namespace */ > + > int DNGWriter::write(const char *filename, const Camera *camera, > const StreamConfiguration &config, > const ControlList &metadata, > diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp > index 9846fba58508..d0bde14130fb 100644 > --- a/src/apps/qcam/main.cpp > +++ b/src/apps/qcam/main.cpp > @@ -21,6 +21,8 @@ > > using namespace libcamera; > > +namespace { > + > void signalHandler([[maybe_unused]] int signal) > { > qInfo() << "Exiting"; > @@ -52,6 +54,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) > return options; > } > > +} /* namespace */ > + > int main(int argc, char **argv) > { > QApplication app(argc, argv); > -- > Regards, > > Laurent Pinchart >
diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index 4f87f200db21..460dbc813060 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -344,12 +344,16 @@ std::string CamApp::cameraName(const Camera *camera) return name; } +namespace { + void signalHandler([[maybe_unused]] int signal) { std::cout << "Exiting" << std::endl; CamApp::instance()->quit(); } +} /* namespace */ + int main(int argc, char **argv) { CamApp app; diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp index 59f1fa23543b..58e35f3f9e1b 100644 --- a/src/apps/common/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp @@ -126,6 +126,8 @@ struct Matrix3d { float m[9]; }; +namespace { + void packScanlineSBGGR8(void *output, const void *input, unsigned int width) { const uint8_t *in = static_cast<const uint8_t *>(input); @@ -282,7 +284,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, } } -static const std::map<PixelFormat, FormatInfo> formatInfo = { +const std::map<PixelFormat, FormatInfo> formatInfo = { { formats::SBGGR8, { .bitsPerSample = 8, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, @@ -381,6 +383,8 @@ static const std::map<PixelFormat, FormatInfo> formatInfo = { } }, }; +} /* namespace */ + int DNGWriter::write(const char *filename, const Camera *camera, const StreamConfiguration &config, const ControlList &metadata, diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp index 9846fba58508..d0bde14130fb 100644 --- a/src/apps/qcam/main.cpp +++ b/src/apps/qcam/main.cpp @@ -21,6 +21,8 @@ using namespace libcamera; +namespace { + void signalHandler([[maybe_unused]] int signal) { qInfo() << "Exiting"; @@ -52,6 +54,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) return options; } +} /* namespace */ + int main(int argc, char **argv) { QApplication app(argc, argv);
Multiple local functions are defined in the global namespace without the static keyword. This compiles fine for now, but will cause a missing declaration warning when we enable thel. To prepare for that, move the function declaration to an anonymous namespace. While at it, for consistency, include an existing static function in the namespace and drop the static keyword. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/apps/cam/main.cpp | 4 ++++ src/apps/common/dng_writer.cpp | 6 +++++- src/apps/qcam/main.cpp | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-)