[PATCH] Add (incomplete) decoder for Video4Linux ioctls

Mike Frysinger vapier at gentoo.org
Mon Mar 10 23:41:45 UTC 2014


On Tue 04 Mar 2014 17:41:27 William Manley wrote:
> +static void print_v4l2_format(const struct v4l2_format* fmt)

the spacing is incorrect around the *:
	static void print_v4l2_format(const struct v4l2_format *fmt)

> +{
> +	tprintf("type=");
> +	printxval(v4l2_formats, fmt->type, "V4L2_BUF_TYPE_???");
> +	tprintf(", fmt={");
> +	switch (fmt->type) {
> +		case V4L2_BUF_TYPE_VIDEO_CAPTURE:

i think our style says the case should be same indentation as the switch.  
especially for large funcs like this, it helps with over-indentation and 
staves off excessive wrapping.

	switch (fmt->type) {
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:

> +		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
> +		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :
> +		{

style issue: no space before the colon, and the brace should be cuddled up.
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {

> +			break;
> +		default:

blank line above the default

> +			for (n=0; n<c.count; ++n) {

needs spacing around ops:
	for (n = 0; n < c.count; ++n) {

> +				umove(tcp, (long) (c.controls + n), &ctrl);

is that cast really needed ?  i suspect not.

> +				}
> +				else {

we've been inconsistent, but i prefer this being one line:
	} else {

> +			switch (f.type)
> +			{

cuddle that brace
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140310/c876d24a/attachment.bin>


More information about the Strace-devel mailing list