[PATCH xinput 1/2] Silence compiler warning
Jeremy Huddleston
jeremyhu at apple.com
Sun May 8 09:05:43 PDT 2011
Yeah, but Peter's patch allows xinput to keep chugging along, reporting what it sees (invalid as it may be from a buggy server). I think that behavior is better than jumping ship at the first sign of trouble.
On May 8, 2011, at 6:07 AM, Simon Thum wrote:
> On 05/05/2011 01:14 AM, Peter Hutterer wrote:
>> Static analysis claims that ptr += size may assign garbage. But since the
>> protocol requires format to be 8, 16 or 32, size should always have a valid
>> value. Initialize to 0 to shut up clang.
> Perhaps it would be preferable to have something like:
>
> switch(format) {
> //...8,16,32
> default: print("Sunken ship"); exit(-1);
> }
>
> If exit is __noreturn__, clang should shut up as well.
>
> Cheers,
>
> Simon
>
>
>>
>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>> ---
>> src/property.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/property.c b/src/property.c
>> index f8b21c7..87f9fc6 100644
>> --- a/src/property.c
>> +++ b/src/property.c
>> @@ -59,7 +59,7 @@ print_property(Display *dpy, XDevice* dev, Atom property)
>> int act_format;
>> unsigned long nitems, bytes_after;
>> unsigned char *data, *ptr;
>> - int j, done = False, size;
>> + int j, done = False, size = 0;
>>
>> name = XGetAtomName(dpy, property);
>> printf("\t%s (%ld):\t", name, property);
>
More information about the xorg-devel
mailing list