[PATCH] input: Fix format string for verify_internal_event

Mark Kettenis mark.kettenis at xs4all.nl
Mon May 16 01:13:56 PDT 2011


On Sat, May 14, 2011 at 04:31:10PM -0700, Jeremy Huddleston wrote:
> 
> inpututils.c:577:25: warning: conversion specifies type 'unsigned short' but the argument has type 'unsigned char' [-Wformat,Format String Issue]
>             ErrorF("%02hx ", *data);
>                     ~~~~^    ~~~~~
>                     %02hhx
> 1 warning generated.

While the fix isn't wrong, it's odd that clang complains about this.
Since ErrorF is a varargs function, *data will be promoted to int, so
while printing it with %02hx is a bit odd, it is perfectly legal C.
Because of the integer promotion, I would actually simply use %02x
here, since I think the h and hh length modifiers are a bit obscure.
Would clang complain about using %02x as well?


More information about the xorg-devel mailing list