[Privoxy-devel] cppcheck warnings in cgiedit.c
    Lee 
    ler762 at gmail.com
       
    Wed Jan  2 18:41:57 UTC 2019
    
    
  
cppcheck spits out a bunch of warnings for cgiedit.c:
[cgiedit.c:3196]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:3317]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:3440]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:3551]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:3673]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:3836]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
[cgiedit.c:4025]: (warning) %lu in format string (no. 1) requires
'unsigned long' but the argument type is 'signed long'.
All the warnings are for '(long) time(NULL)' in snprintf using a '%lu'
format - eg:
   snprintf(target, sizeof(target), CGI_PREFIX
"edit-actions-list?foo=%lu&f=%u#l%u",
            (long) time(NULL), file->identifier, sectionid);
If you wanted to get rid of the warnings, would it be better to change
for format to "%ld" or the type cast to "(unsigned long)"?
Thanks
Lee
    
    
More information about the Privoxy-devel
mailing list