1.4.2: compile time warnings
Looks like some parts of the code can be discarded without any impact.
First just stats.
[tkloczko@ss-desktop SPECS]$ rpmbuild -ba --with check --with failing_tests xscope.spec --quiet 2>&1 | grep -- -W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
11 -Wunused-but-set-variable
8 -Wunused-function
5 -Wformat=
4 -Wpointer-sign
1 -Wunused-variable
Warnings log:
decodenas.c: In function 'DecodeAudioError':
decodenas.c:318:11: warning: unused variable 'Error' [-Wunused-variable]
318 | short Error = IByte(&buf[1]);
| ^~~~~
print_render.c: In function 'RenderQueryPictFormatsReply':
print_render.c:82:10: warning: variable 'v' set but not used [-Wunused-but-set-variable]
82 | long v;
| ^
print_render.c:81:10: warning: variable 'd' set but not used [-Wunused-but-set-variable]
81 | long d;
| ^
print_render.c:80:10: warning: variable 's' set but not used [-Wunused-but-set-variable]
80 | long s;
| ^
print_render.c:78:10: warning: variable 'n' set but not used [-Wunused-but-set-variable]
78 | long n;
| ^
print_wcp.c: In function 'WcpAnalyzeImage1RLL':
print_wcp.c:73:39: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat=]
73 | fprintf(stdout, "%s %9d %9d:", Leader, y, (char *) data - buf);
| ~~^ ~~~~~~~~~~~~~~~~~~~
| | |
| int long int
| %9ld
print_wcp.c:103:42: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long int' [-Wformat=]
103 | fprintf(stdout, "%s%20s: %d, %d %d\n", Leader, error,
| ~^
| |
| int
| %ld
104 | x, y - 1, (char *) data - buf);
| ~~~~~~~~~~~~~~~~~~~
| |
| long int
print_wcp.c: In function 'WcpAnalyzeImageNLRU':
print_wcp.c:180:39: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat=]
180 | fprintf(stdout, "%s %9d %9d:", Leader, y, (char *) data - buf);
| ~~^ ~~~~~~~~~~~~~~~~~~~
| | |
| int long int
| %9ld
print_wcp.c:220:43: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'PIXEL' {aka 'long unsigned int'} [-Wformat=]
220 | fprintf(stdout, " %3ld:%0*x", run, bytes * 2, pix);
| ~~~^ ~~~
| | |
| unsigned int PIXEL {aka long unsigned int}
| %0*lx
print_wcp.c:229:42: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long int' [-Wformat=]
229 | fprintf(stdout, "%s%20s: %d, %d %d\n", Leader, error,
| ~^
| |
| int
| %ld
230 | x, y - 1, (char *) data - buf);
| ~~~~~~~~~~~~~~~~~~~
| |
| long int
printnas.c: In function 'PrintSuccessfulAudioSetUpReply':
printnas.c:105:11: warning: variable 'm' set but not used [-Wunused-but-set-variable]
105 | short m;
| ^
printnas.c:104:11: warning: variable 'n' set but not used [-Wunused-but-set-variable]
104 | short n;
| ^
printnas.c: In function 'AudioListDevicesReply':
printnas.c:326:10: warning: variable 'n' set but not used [-Wunused-but-set-variable]
326 | long n;
| ^
printnas.c: In function 'AuDeviceAttributes':
printnas.c:354:9: warning: variable 'l' set but not used [-Wunused-but-set-variable]
354 | int l;
| ^
At top level:
printnas.c:221:1: warning: 'AudioImplementationError' defined but not used [-Wunused-function]
221 | AudioImplementationError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~~~~~~~~~~
printnas.c:210:1: warning: 'AudioLengthError' defined but not used [-Wunused-function]
210 | AudioLengthError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~~
printnas.c:198:1: warning: 'AudioIDChoiceError' defined but not used [-Wunused-function]
198 | AudioIDChoiceError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~~~~
printnas.c:187:1: warning: 'AudioAllocError' defined but not used [-Wunused-function]
187 | AudioAllocError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~
printnas.c:176:1: warning: 'AudioAccessError' defined but not used [-Wunused-function]
176 | AudioAccessError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~~
printnas.c:165:1: warning: 'AudioMatchError' defined but not used [-Wunused-function]
165 | AudioMatchError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~
printnas.c:153:1: warning: 'AudioValueError' defined but not used [-Wunused-function]
153 | AudioValueError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~
printnas.c:142:1: warning: 'AudioRequestError' defined but not used [-Wunused-function]
142 | AudioRequestError(const unsigned char *buf)
| ^~~~~~~~~~~~~~~~~
print_randr.c: In function 'RandrOldGetScreenInfoReply':
print_randr.c:85:20: warning: variable 'ngvg' set but not used [-Wunused-but-set-variable]
85 | unsigned short ngvg;
| ^~~~
print_randr.c:84:20: warning: variable 'nvg' set but not used [-Wunused-but-set-variable]
84 | unsigned short nvg;
| ^~~
print_randr.c:83:20: warning: variable 'nsize' set but not used [-Wunused-but-set-variable]
83 | unsigned short nsize;
| ^~~~~
scope.c: In function 'DataFromRawFile':
scope.c:1387:36: warning: pointer targets in passing argument 1 of 'fgets' differ in signedness [-Wpointer-sign]
1387 | if (fgets(FDinfo[rawfd].buffer, BUFFER_SIZE, raw) == NULL) {
| ~~~~~~~~~~~~~^~~~~~~
| |
| unsigned char *
In file included from /usr/include/stdio.h:894,
from scope.h:58,
from scope.c:51:
/usr/include/bits/stdio2.h:262:25: note: expected 'char * restrict' but argument is of type 'unsigned char *'
262 | fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ~~~~~~~~~~~~~~~~~^~~
scope.c:1391:58: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness [-Wpointer-sign]
1391 | FDinfo[rawfd].bufcount = strlen(FDinfo[rawfd].buffer);
| ~~~~~~~~~~~~~^~~~~~~
| |
| unsigned char *
In file included from /usr/include/X11/Xos.h:62,
from scope.h:56,
from scope.c:51:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'unsigned char *'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
scope.c:1395:12: warning: pointer targets in assignment from 'unsigned char *' to 'char *' differ in signedness [-Wpointer-sign]
1395 | in = FDinfo[rawfd].buffer;
| ^
scope.c:1483:43: warning: pointer targets in passing argument 1 of 'warn' differ in signedness [-Wpointer-sign]
1483 | warn(FDinfo[rawfd].buffer);
| ~~~~~~~~~~~~~^~~~~~~
| |
| unsigned char *
In file included from scope.h:127,
from scope.c:51:
proto.h:6:30: note: expected 'const char *' but argument is of type 'unsigned char *'
6 | extern void warn(const char *s);
| ~~~~~~~~~~~~^