[libcamera-devel,v3,2/2] cam: capture_script: Check parseFrames() return value for errors
diff mbox series

Message ID 20220627122806.29586-3-dse@thaumatec.com
State Accepted
Headers show
Series
  • cam: Add Rectangle type parsing in capture script
Related show

Commit Message

Daniel Semkowicz June 27, 2022, 12:28 p.m. UTC
parseFrames() return value was ignored. If there was an error during
frame parsing, parsing was not stopped correctly.

Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>
---
 src/cam/capture_script.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi June 27, 2022, 4:10 p.m. UTC | #1
Hi Daniel,

On Mon, Jun 27, 2022 at 02:28:06PM +0200, Daniel Semkowicz via libcamera-devel wrote:
> parseFrames() return value was ignored. If there was an error during
> frame parsing, parsing was not stopped correctly.
>
> Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

FYI:
Laurent has give his RB tag on v2. Patch submitters are expected to
collect tags and add them to their next version they send.

Thanks
   j

> ---
>  src/cam/capture_script.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/cam/capture_script.cpp b/src/cam/capture_script.cpp
> index 6278a152..695de37b 100644
> --- a/src/cam/capture_script.cpp
> +++ b/src/cam/capture_script.cpp
> @@ -150,7 +150,9 @@ int CaptureScript::parseScript(FILE *script)
>  		std::string section = eventScalarValue(event);
>
>  		if (section == "frames") {
> -			parseFrames();
> +			ret = parseFrames();
> +			if (ret)
> +				return ret;
>  		} else {
>  			std::cerr << "Unsupported section '" << section << "'"
>  				  << std::endl;
> --
> 2.34.1
>
Daniel Semkowicz June 28, 2022, 6:45 a.m. UTC | #2
Hi Jacopo,

On Mon, Jun 27, 2022 at 6:10 PM Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> Hi Daniel,
>
> On Mon, Jun 27, 2022 at 02:28:06PM +0200, Daniel Semkowicz via libcamera-devel wrote:
> > parseFrames() return value was ignored. If there was an error during
> > frame parsing, parsing was not stopped correctly.
> >
> > Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>
>
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> FYI:
> Laurent has give his RB tag on v2. Patch submitters are expected to
> collect tags and add them to their next version they send.
>
> Thanks
>    j

Thank you for the review.

Sorry for the mistakes... It is new to me to push changes using mailing
list. I have read some instructions about this way of working, but
apparently there are still things that I haven't learned before I came
into contact with them in practice.

Best regards
Daniel

>
> > ---
> >  src/cam/capture_script.cpp | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/cam/capture_script.cpp b/src/cam/capture_script.cpp
> > index 6278a152..695de37b 100644
> > --- a/src/cam/capture_script.cpp
> > +++ b/src/cam/capture_script.cpp
> > @@ -150,7 +150,9 @@ int CaptureScript::parseScript(FILE *script)
> >               std::string section = eventScalarValue(event);
> >
> >               if (section == "frames") {
> > -                     parseFrames();
> > +                     ret = parseFrames();
> > +                     if (ret)
> > +                             return ret;
> >               } else {
> >                       std::cerr << "Unsupported section '" << section << "'"
> >                                 << std::endl;
> > --
> > 2.34.1
> >
Nicolas Dufresne via libcamera-devel Aug. 8, 2022, 10:31 a.m. UTC | #3
Hi Daniel,

On Mon, Jun 27, 2022 at 02:28:06PM +0200, Daniel Semkowicz via libcamera-devel wrote:
> parseFrames() return value was ignored. If there was an error during
> frame parsing, parsing was not stopped correctly.
> 
> Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/cam/capture_script.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cam/capture_script.cpp b/src/cam/capture_script.cpp
> index 6278a152..695de37b 100644
> --- a/src/cam/capture_script.cpp
> +++ b/src/cam/capture_script.cpp
> @@ -150,7 +150,9 @@ int CaptureScript::parseScript(FILE *script)
>  		std::string section = eventScalarValue(event);
>  
>  		if (section == "frames") {
> -			parseFrames();
> +			ret = parseFrames();
> +			if (ret)
> +				return ret;
>  		} else {
>  			std::cerr << "Unsupported section '" << section << "'"
>  				  << std::endl;
> -- 
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/cam/capture_script.cpp b/src/cam/capture_script.cpp
index 6278a152..695de37b 100644
--- a/src/cam/capture_script.cpp
+++ b/src/cam/capture_script.cpp
@@ -150,7 +150,9 @@  int CaptureScript::parseScript(FILE *script)
 		std::string section = eventScalarValue(event);
 
 		if (section == "frames") {
-			parseFrames();
+			ret = parseFrames();
+			if (ret)
+				return ret;
 		} else {
 			std::cerr << "Unsupported section '" << section << "'"
 				  << std::endl;