2004-11-16 23:33:58

by Randy.Dunlap

[permalink] [raw]
Subject: [PATCH] cx88: fix printk arg. type


drivers/media/video/cx88/cx88-blackbird.c:366: warning: long int
format, size_t arg (arg 3)

diffstat:=
drivers/media/video/cx88/cx88-blackbird.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Randy Dunlap <[email protected]>


Attachments:
cx88_types.patch (623.00 B)

2004-11-17 17:42:14

by Gerd Knorr

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

> - dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
> + dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel
printk specific thingy? Or is this standardized somewhere? So I could
use that in userspace code as well maybe?

Gerd

--
#define printk(args...) fprintf(stderr, ## args)

2004-11-17 18:27:51

by Jelle Foks

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

On Wed, 2004-11-17 at 12:25, Gerd Knorr wrote:
> > - dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
> > + dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",
>
> Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel
> printk specific thingy? Or is this standardized somewhere? So I could
> use that in userspace code as well maybe?

btw Gerd, did you see the patch I sent to the video4linux mailing list
last sunday? It includes some small fixes to make things much closer to
working (some +1/-1 type fixes). After that patch, the main open issue
is syncing the video scaling and audio muting settings between the two
video devices/chips (2388 and 23416) -> The cx23416 needs to be set to
the same (/related) video scaling settings as the 2388, and the 2388
audio must be unmuted for the mpeg stream to contain audio.

And of course then it needs some ioctl for the mpeg codec settings.

Jelle.

>
> Gerd


2004-11-17 18:44:55

by Gerd Knorr

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

> C99 spec defines 'z' only as a size_t format length modifier:

Thanks.

> Anyway, I agree with Al. Will you please change it to
> 'z' instead of 'Z'?

Done.

Gerd

--
#define printk(args...) fprintf(stderr, ## args)

2004-11-17 18:51:38

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

On Wed, Nov 17, 2004 at 06:25:19PM +0100, Gerd Knorr wrote:
> > - dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
> > + dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",
>
> Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel
> printk specific thingy? Or is this standardized somewhere? So I could
> use that in userspace code as well maybe?

'Z' is an obsolete equivalent of standard 'z'. That one is portable and it
is, indeed, available in userland (libc6 and anything C99-compliant). To
quote the manpage:

z A following integer conversion corresponds to a size_t or
ssize_t argument. (Linux libc5 has Z with this meaning. Don't
use it.)

t A following integer conversion corresponds to a ptrdiff_t argu-
ment.

Please, do s/Zd/zd/.

One more thing: folks, please stop using crap like "%08x", (int)pointer.
It's not only non-portable (consider 64bit boxen), it's extra work for
no good reason. "%p" is standard and will do the right thing with less
PITA.

2004-11-17 18:04:59

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

Gerd Knorr wrote:
>>- dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
>>+ dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",
>
>
> Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel
> printk specific thingy? Or is this standardized somewhere? So I could
> use that in userspace code as well maybe?

Kernel supports/allows 'Z' or 'z'.
C99 spec defines 'z' only as a size_t format length modifier:

z Specifies that a following d, i, o, u, x, or X conversion
specifier applies to a size_t or the corresponding signed integer type
argument; or that a following n conversion specifier applies to a
pointer to a signed integer type corresponding to size_t argument.

Anyway, I agree with Al. Will you please change it to
'z' instead of 'Z'?

Thanks,
--
~Randy

2004-11-17 19:29:43

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

Andrew Morton wrote:
> "Randy.Dunlap" <[email protected]> wrote:
>
>>Gerd Knorr wrote:

>> Kernel supports/allows 'Z' or 'z'.
>> C99 spec defines 'z' only as a size_t format length modifier:
>>
>> z Specifies that a following d, i, o, u, x, or X conversion
>> specifier applies to a size_t or the corresponding signed integer type
>> argument; or that a following n conversion specifier applies to a
>> pointer to a signed integer type corresponding to size_t argument.
>>
>> Anyway, I agree with Al. Will you please change it to
>> 'z' instead of 'Z'?
>
>
> gcc-2.95.x generates warnings for `z', but is happy with 'Z'.
>
> But I seem to be the only person who uses 2.95, and I patched my version to
> stop that warning anyway, so...

Argh, I had forgotten that one....

--
~Randy

2004-11-17 19:27:42

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] cx88: fix printk arg. type

"Randy.Dunlap" <[email protected]> wrote:
>
> Gerd Knorr wrote:
> >>- dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
> >>+ dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",
> >
> >
> > Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel
> > printk specific thingy? Or is this standardized somewhere? So I could
> > use that in userspace code as well maybe?
>
> Kernel supports/allows 'Z' or 'z'.
> C99 spec defines 'z' only as a size_t format length modifier:
>
> z Specifies that a following d, i, o, u, x, or X conversion
> specifier applies to a size_t or the corresponding signed integer type
> argument; or that a following n conversion specifier applies to a
> pointer to a signed integer type corresponding to size_t argument.
>
> Anyway, I agree with Al. Will you please change it to
> 'z' instead of 'Z'?

gcc-2.95.x generates warnings for `z', but is happy with 'Z'.

But I seem to be the only person who uses 2.95, and I patched my version to
stop that warning anyway, so...