diff mbox

[v4l-utils,1/1] libv4l2subdev: Allow extra spaces between format strings

Message ID 1457728998-11906-1-git-send-email-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sakari Ailus March 11, 2016, 8:43 p.m. UTC
It's possible to pass more than one format string (and entity) to
v4l2_subdev_parse_setup_formats(), yet v4l2_subdev_parse_pad_format() does
not parse the string until the next non-space character.
v4l2_subdev_parse_setup_formats() expects to find a comma right after that
leading spaces before the comma to produce an error.

Seek until no spaces are seen.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 utils/media-ctl/libv4l2subdev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart March 17, 2016, 11:48 a.m. UTC | #1
Hi Sakari,

Thank you for the patch.

On Friday 11 March 2016 22:43:18 Sakari Ailus wrote:
> It's possible to pass more than one format string (and entity) to
> v4l2_subdev_parse_setup_formats(), yet v4l2_subdev_parse_pad_format() does
> not parse the string until the next non-space character.
> v4l2_subdev_parse_setup_formats() expects to find a comma right after that
> leading spaces before the comma to produce an error.
> 
> Seek until no spaces are seen.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/media-ctl/libv4l2subdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/utils/media-ctl/libv4l2subdev.c
> b/utils/media-ctl/libv4l2subdev.c index 1f5fca4..3dcf943 100644
> --- a/utils/media-ctl/libv4l2subdev.c
> +++ b/utils/media-ctl/libv4l2subdev.c
> @@ -723,6 +723,7 @@ int v4l2_subdev_parse_setup_formats(struct media_device
> *media, const char *p) if (ret < 0)
>  			return ret;
> 
> +		for (; isspace(*end); end++);
>  		p = end + 1;
>  	} while (*end == ',');
diff mbox

Patch

diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index 1f5fca4..3dcf943 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -723,6 +723,7 @@  int v4l2_subdev_parse_setup_formats(struct media_device *media, const char *p)
 		if (ret < 0)
 			return ret;
 
+		for (; isspace(*end); end++);
 		p = end + 1;
 	} while (*end == ',');