On Sat, 08 Feb 2014 13:51:10 +0100
Klaus Schmidinger <klaus.schmidin...@tvdr.de> wrote:

> >          channels.c:45:119: warning: data argument not used by format 
> > string [-Wformat-extra-args]
> >            snprintf(buffer, sizeof(buffer), rid ? "%s-%d-%d-%d-%d" : 
> > "%s-%d-%d-%d", *cSource::ToString(source), nid, tid, sid, rid);
> >                                                                      
> > ~~~~~~~~~~~~~                                             ^
> 
> This is explicitly checked with 'rid ? ...', so the warning is
> unjustified (although the compiler probably has a hard time figuring
> that out ;-).

The warning is justified, because if rid is 0 it's still there as an
argument, but just happens to have a value of 0. I think you can make
snprintf "consume" it without printing anything by adding %.d to the
second format string.

> >          eit.c:223:43: warning: comparison of constant 176 with expression 
> > of type 'SI::LinkageType' is always false
> >                [-Wtautological-constant-out-of-range-compare]
> >                           if (ld->getLinkageType() == 0xB0) { // Premiere 
> > World
> >                               ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
> 
> I assume this is because the enum LinkageType doesn't contain 0xB0.
> However, the actual value that comes from the SI data may well be
> 0xB0, so I'm now typecasting uint(ld->getLinkageType()).

If 0xB0 has a significant meaning wouldn't it be a good idea to add it
to the enum?

> >          receiver.c:28:6: warning: indirection of non-volatile null pointer 
> > will be deleted, not trap [-Wnull-dereference]
> >               *(char *)0 = 0; // cause a segfault
> >               ^~~~~~~~~~
> >          receiver.c:28:6: note: consider using __builtin_trap() or 
> > qualifying pointer with 'volatile'
> 
> Can you suggest a different way of causing a segfault at this point?

You could add volatile as the warning suggests. Is there a good reason
not to use abort() instead?

_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to