diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-22 13:57:30 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-22 13:57:30 -0700 |
commit | 95b2d71016bc10f1419e3b49852e8bccb3194c1d (patch) | |
tree | 3d78ee19ac26bcd541f1c019ee10a42f3e6560e6 /xvinfo.c | |
parent | efd68bc7bf95959652619763bb5d37428546000d (diff) |
Fix sign mismatch warnings for loop index comparisons
xvinfo.c: In function ‘main’:
xvinfo.c:99:23: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (j = 0; j < nadaptors; j++) {
^
xvinfo.c:129:31: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (k = 0; k < ainfo[j].num_formats; k++, format++) {
^
xvinfo.c:198:31: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (n = 0; n < nencode; n++) {
^
xvinfo.c:207:35: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (n = 0; n < nencode; n++) {
^
xvinfo.c:222:35: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
for (n = 0; n < nencode; n++) {
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xvinfo.c')
-rw-r--r-- | xvinfo.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -25,7 +25,6 @@ main(int argc, char *argv[]) { Display *dpy; unsigned int ver, rev, eventB, reqB, errorB; - int i, j, k, n; unsigned int nencode, nadaptors; int nscreens, nattr, numImages; XvAdaptorInfo *ainfo; @@ -42,7 +41,7 @@ main(int argc, char *argv[]) PrintUsage(); if (argc != 1) { - for (i = 1; i < argc; i++) { + for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-display")) { if (++i >= argc) { fprintf (stderr, "%s: missing argument to -display\n", @@ -82,7 +81,7 @@ main(int argc, char *argv[]) nscreens = ScreenCount(dpy); - for (i = 0; i < nscreens; i++) { + for (int i = 0; i < nscreens; i++) { fprintf(stdout, "screen #%i\n", i); if (Success != XvQueryAdaptors(dpy, RootWindow(dpy, i), &nadaptors, &ainfo)) { @@ -96,7 +95,7 @@ main(int argc, char *argv[]) continue; } - for (j = 0; j < nadaptors; j++) { + for (unsigned int j = 0; j < nadaptors; j++) { fprintf(stdout, " Adaptor #%i: \"%s\"\n", j, ainfo[j].name); fprintf(stdout, " number of ports: %li\n", ainfo[j].num_ports); fprintf(stdout, " port base: %li\n", ainfo[j].base_id); @@ -126,7 +125,7 @@ main(int argc, char *argv[]) if (!shortmode) { fprintf(stdout, " supported visuals:\n"); - for (k = 0; k < ainfo[j].num_formats; k++, format++) { + for (unsigned long k = 0; k < ainfo[j].num_formats; k++, format++) { fprintf(stdout, " depth %i, visualID 0x%2lx\n", format->depth, format->visual_id); } @@ -137,7 +136,7 @@ main(int argc, char *argv[]) if (attributes && nattr) { fprintf(stdout, " number of attributes: %i\n", nattr); - for (k = 0; k < nattr; k++) { + for (int k = 0; k < nattr; k++) { fprintf(stdout, " \"%s\" (range %i to %i)\n", attributes[k].name, attributes[k].min_value, attributes[k].max_value); @@ -195,7 +194,7 @@ main(int argc, char *argv[]) if (encodings && nencode) { unsigned int ImageEncodings = 0; - for (n = 0; n < nencode; n++) { + for (unsigned int n = 0; n < nencode; n++) { if (!strcmp(encodings[n].name, "XV_IMAGE")) ImageEncodings++; } @@ -204,7 +203,7 @@ main(int argc, char *argv[]) fprintf(stdout, " number of encodings: %i\n", nencode - ImageEncodings); - for (n = 0; n < nencode; n++) { + for (unsigned int n = 0; n < nencode; n++) { if (strcmp(encodings[n].name, "XV_IMAGE")) { fprintf(stdout, " encoding ID #%li: \"%s\"\n", encodings[n].encoding_id, @@ -219,7 +218,7 @@ main(int argc, char *argv[]) } if (ImageEncodings && (ainfo[j].type & XvImageMask)) { - for (n = 0; n < nencode; n++) { + for (unsigned int n = 0; n < nencode; n++) { if (!strcmp(encodings[n].name, "XV_IMAGE")) { fprintf(stdout, " maximum XvImage size: %li x %li\n", @@ -234,7 +233,7 @@ main(int argc, char *argv[]) fprintf(stdout, " Number of image formats: %i\n", numImages); - for (n = 0; n < numImages; n++) { + for (int n = 0; n < numImages; n++) { char imageName[5]; snprintf(imageName, sizeof(imageName), "%c%c%c%c", |