Message ID | 20251013142329.1386-1-laurent.pinchart@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hello, On Mon, Oct 13, 2025 at 05:23:29PM +0300, Laurent Pinchart wrote: > Using auto variables for simple types reduces readability. Spell out > unsigned int explicitly here, and replace the <= 0 check with a zero > check now that the explicit type shows the value can't be negative. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <uajain@igalia.com> > --- > src/libcamera/pipeline/simple/simple.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index dec9f6514f8c..7b0783cdbc32 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -1266,8 +1266,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() > cfg.frameSize = format.planes[0].size; > } > > - const auto bufferCount = cfg.bufferCount; > - if (bufferCount <= 0) > + const unsigned int bufferCount = cfg.bufferCount; > + if (!bufferCount) > cfg.bufferCount = kNumBuffersDefault; > else if (bufferCount > kNumBuffersMax) > cfg.bufferCount = kNumBuffersMax; > > base-commit: 05bfebed2657cc1d032c9796efd9041bfbdc881c > -- > Regards, > > Laurent Pinchart >
Quoting Laurent Pinchart (2025-10-13 15:23:29) > Using auto variables for simple types reduces readability. Spell out > unsigned int explicitly here, and replace the <= 0 check with a zero > check now that the explicit type shows the value can't be negative. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/libcamera/pipeline/simple/simple.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index dec9f6514f8c..7b0783cdbc32 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -1266,8 +1266,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() > cfg.frameSize = format.planes[0].size; > } > > - const auto bufferCount = cfg.bufferCount; > - if (bufferCount <= 0) > + const unsigned int bufferCount = cfg.bufferCount; > + if (!bufferCount) > cfg.bufferCount = kNumBuffersDefault; Quite sure I proposed this but it didn't make it in - so: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > else if (bufferCount > kNumBuffersMax) > cfg.bufferCount = kNumBuffersMax; > > base-commit: 05bfebed2657cc1d032c9796efd9041bfbdc881c > -- > Regards, > > Laurent Pinchart >
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index dec9f6514f8c..7b0783cdbc32 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1266,8 +1266,8 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() cfg.frameSize = format.planes[0].size; } - const auto bufferCount = cfg.bufferCount; - if (bufferCount <= 0) + const unsigned int bufferCount = cfg.bufferCount; + if (!bufferCount) cfg.bufferCount = kNumBuffersDefault; else if (bufferCount > kNumBuffersMax) cfg.bufferCount = kNumBuffersMax;
Using auto variables for simple types reduces readability. Spell out unsigned int explicitly here, and replace the <= 0 check with a zero check now that the explicit type shows the value can't be negative. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) base-commit: 05bfebed2657cc1d032c9796efd9041bfbdc881c