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

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

Commit Message

Daniel Semkowicz June 24, 2022, 1:05 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

Laurent Pinchart June 24, 2022, 3:40 p.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Fri, Jun 24, 2022 at 03:05:23PM +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: Laurent Pinchart <laurent.pinchart@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 5812b122..9f7ab2af 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;

Patch
diff mbox series

diff --git a/src/cam/capture_script.cpp b/src/cam/capture_script.cpp
index 5812b122..9f7ab2af 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;