Index | Thread | Search

From:
Anton Lindqvist <anton@basename.se>
Subject:
Re: sys/uvideo: bypass unknown pixelformat to consumer
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
tech@openbsd.org
Date:
Sat, 11 Jan 2025 20:22:23 +0100

Download raw body.

Thread
On Sat, Jan 11, 2025 at 04:34:06PM +0100, Kirill A. Korinsky wrote:
> On Sat, 11 Jan 2025 14:42:01 +0100,
> Marcus Glocker <marcus@nazgul.ch> wrote:
> > 
> > On Sat, Jan 11, 2025 at 02:14:55PM GMT, Theo Buehler wrote:
> > 
> > > > > +	/* map GUID to pixel format if a matching entry is found */
> > > > > +	for (j = 0, nent = nitems(uvideo_map_fmts); j < nent; j++) {
> > > > > +		if (!memcmp(sc->sc_fmtgrp[i].format->u.uc.guidFormat,
> > > > > +			    uvideo_map_fmts[j].guidFormat, 16)) {
> > > 
> > > Secondary indent should be four spaces:
> > > 
> > > 		if (!memcmp(sc->sc_fmtgrp[i].format->u.uc.guidFormat,
> > > 		    uvideo_map_fmts[j].guidFormat, 16)) {
> > > 
> > > > > +			sc->sc_fmtgrp[i].pixelformat =
> > > > > +				uvideo_map_fmts[j].pixelformat;
> > > 
> > > here, too:
> > > 
> > > 			sc->sc_fmtgrp[i].pixelformat =
> > > 			    uvideo_map_fmts[j].pixelformat;
> > > 
> > 
> > Agree.  If you could in-corporate this as well Kirill please.
> 
> sure, here the diff.
> 
> and if anyone has emacs config which I can put into .dir-locals.el to match
> style, I'll be very apprieted!

You could use knfmt from ports (I'm the author) in diff mode.
That would have caught the nits pointed out by tb@ and more.

$ cvs -q diff -u uvideo.c | knfmt -Dd
--- uvideo.c.orig
+++ uvideo.c
@@ -1091,9 +1091,9 @@
 	/* map GUID to pixel format if a matching entry is found */
 	for (j = 0, nent = nitems(uvideo_map_fmts); j < nent; j++) {
 		if (!memcmp(sc->sc_fmtgrp[i].format->u.uc.guidFormat,
-			    uvideo_map_fmts[j].guidFormat, 16)) {
+		    uvideo_map_fmts[j].guidFormat, 16)) {
 			sc->sc_fmtgrp[i].pixelformat =
-				uvideo_map_fmts[j].pixelformat;
+			    uvideo_map_fmts[j].pixelformat;
 			break;
 		}
 	}
@@ -3009,7 +3009,7 @@
 		fmtdesc->flags = 0;
 		fmtdesc->pixelformat = sc->sc_fmtgrp[idx].pixelformat;
 		(void)strlcpy(fmtdesc->description,
-		    (char *) &fmtdesc->pixelformat,
+		    (char *)&fmtdesc->pixelformat,
 		    sizeof(fmtdesc->description));
 		bzero(fmtdesc->reserved, sizeof(fmtdesc->reserved));
 		break;

.. or if you're using git:

$ git diff uvideo.c | knfmt -Dd