OSDN Git Service

Tidy up compile warnings by cleaning up types.
authorMatthew W. S. Bell <matthew@bells23.org.uk>
Sat, 30 Jan 2010 02:14:44 +0000 (02:14 +0000)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 5 Feb 2010 00:45:10 +0000 (19:45 -0500)
tests/dristat.c
tests/drmtest.c
tests/modeprint/modeprint.c
tests/modetest/modetest.c
xf86drmSL.c

index 48c3b51..900a3e6 100644 (file)
@@ -108,7 +108,8 @@ static void getvm(int fd)
        flagname[6] = '\0';
        
        printf("    %4d 0x%08lx 0x%08lx %3.3s %6.6s 0x%08lx ",
-              i, offset, (unsigned long)size, typename, flagname, handle);
+              i, (unsigned long)offset, (unsigned long)size,
+              typename, flagname, (unsigned long)handle);
        if (mtrr < 0) printf("none\n");
        else          printf("%4d\n", mtrr);
     }
index 15e5c4a..685a652 100644 (file)
  *
  */
 
+#include <string.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
@@ -60,7 +62,7 @@ int drm_open_matching(const char *pci_glob, int flags)
        struct udev_device *device, *parent;
         struct udev_list_entry *entry;
        const char *pci_id, *path;
-       int i, fd;
+       int fd;
 
        udev = udev_new();
        if (udev == NULL) {
index 595d444..8971914 100644 (file)
@@ -89,7 +89,7 @@ int printMode(struct drm_mode_modeinfo *mode)
 
 int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t value)
 {
-       const unsigned char *name = NULL;
+       const char *name = NULL;
        int j;
 
        printf("Property: %s\n", props->name);
@@ -101,7 +101,7 @@ int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t
        if (props->count_values) {
                printf("\tvalues       :");
                for (j = 0; j < props->count_values; j++)
-                       printf(" %lld", props->values[j]);
+                       printf(" %llu", props->values[j]);
                printf("\n");
        }
 
@@ -116,7 +116,7 @@ int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, uint64_t
                        printf("blob is %d length, %08X\n", blob->length, *(uint32_t *)blob->data);
                        drmModeFreePropertyBlob(blob);
                } else {
-                       printf("error getting blob %lld\n", value);
+                       printf("error getting blob %llu\n", value);
                }
 
        } else {
@@ -169,7 +169,7 @@ int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uin
 
        if (modes) {
                for (i = 0; i < connector->count_modes; i++) {
-                       mode = &connector->modes[i];
+                       mode = (struct drm_mode_modeinfo *)&connector->modes[i];
                        printMode(mode);
                }
        }
index 34d40ca..26405f4 100644 (file)
@@ -47,6 +47,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/poll.h>
+#include <sys/time.h>
 
 #include "xf86drm.h"
 #include "xf86drmMode.h"
@@ -255,9 +256,10 @@ void dump_framebuffers(void)
                                resources->fbs[i], strerror(errno));
                        continue;
                }
-               printf("%d\t(%dx%d)\t%d\n",
+               printf("%u\t(%ux%u)\t%u\n",
                       fb->fb_id,
-                      fb->width, fb->height);
+                      fb->width, fb->height,
+                      fb->pitch);
 
                drmModeFreeFB(fb);
        }
@@ -272,7 +274,7 @@ void dump_framebuffers(void)
  * can bind it with a free crtc.
  */
 struct connector {
-       int id;
+       uint32_t id;
        char mode_str[64];
        drmModeModeInfo *mode;
        drmModeEncoder *encoder;
@@ -287,7 +289,7 @@ static void
 connector_find_mode(struct connector *c)
 {
        drmModeConnector *connector;
-       int i, j, size, ret, width, height;
+       int i, j;
 
        /* First, find the connector & mode */
        c->mode = NULL;
@@ -358,7 +360,7 @@ create_test_buffer(drm_intel_bufmgr *bufmgr,
 {
        drm_intel_bo *bo;
        unsigned int *fb_ptr;
-       int size, ret, i, stride;
+       int size, i, stride;
        div_t d;
        cairo_surface_t *surface;
        cairo_t *cr;
@@ -472,9 +474,7 @@ create_grey_buffer(drm_intel_bufmgr *bufmgr,
                   int width, int height, int *stride_out, drm_intel_bo **bo_out)
 {
        drm_intel_bo *bo;
-       unsigned int *fb_ptr;
-       int size, ret, i, stride;
-       div_t d;
+       int size, ret, stride;
 
        /* Mode size at 32 bpp */
        stride = width * 4;
@@ -509,7 +509,6 @@ page_flip_handler(int fd, unsigned int frame,
 {
        struct connector *c;
        unsigned int new_fb_id;
-       int len, ms;
        struct timeval end;
        double t;
 
@@ -536,13 +535,10 @@ page_flip_handler(int fd, unsigned int frame,
 static void
 set_mode(struct connector *c, int count, int page_flip)
 {
-       drmModeConnector *connector;
-       drmModeEncoder *encoder = NULL;
-       struct drm_mode_modeinfo *mode = NULL;
        drm_intel_bufmgr *bufmgr;
        drm_intel_bo *bo, *other_bo;
        unsigned int fb_id, other_fb_id;
-       int i, j, ret, width, height, x, stride;
+       int i, ret, width, height, x, stride;
        drmEventContext evctx;
 
        width = 0;
@@ -611,9 +607,9 @@ set_mode(struct connector *c, int count, int page_flip)
                                DRM_MODE_PAGE_FLIP_EVENT, &c[i]);
                gettimeofday(&c[i].start, NULL);
                c[i].swap_count = 0;
-               c[i].fb_id[0] = fb_id;
-               c[i].fb_id[1] = other_fb_id;
-               c[i].current_fb_id = fb_id;
+               c[i].fb_id[0] = fb_id;
+               c[i].fb_id[1] = other_fb_id;
+               c[i].current_fb_id = fb_id;
        }
 
        memset(&evctx, 0, sizeof evctx);
@@ -676,7 +672,7 @@ static int page_flipping_supported(int fd)
                return 0;
        }
 
-       return gp.value;
+       return *gp.value;
 }
 
 int main(int argc, char **argv)
@@ -685,8 +681,8 @@ int main(int argc, char **argv)
        int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0;
        int test_vsync = 0;
        char *modules[] = { "i915", "radeon" };
-       char *modeset = NULL, *mode, *connector;
-       int i, connector_id, count = 0;
+       char *modeset = NULL;
+       int i, count = 0;
        struct connector con_args[2];
        
        opterr = 0;
@@ -715,11 +711,11 @@ int main(int argc, char **argv)
                        con_args[count].crtc = -1;
                        if (sscanf(optarg, "%d:%64s",
                                   &con_args[count].id,
-                                  &con_args[count].mode_str) != 2 &&
+                                  con_args[count].mode_str) != 2 &&
                            sscanf(optarg, "%d@%d:%64s",
                                   &con_args[count].id,
                                   &con_args[count].crtc,
-                                  &con_args[count].mode_str) != 3)
+                                  con_args[count].mode_str) != 3)
                                usage(argv[0]);
                        count++;                                      
                        break;
index 58aefac..acddb54 100644 (file)
@@ -265,11 +265,8 @@ int drmSLLookupNeighbors(void *l, unsigned long key,
 {
     SkipListPtr   list = (SkipListPtr)l;
     SLEntryPtr    update[SL_MAX_LEVEL + 1];
-    SLEntryPtr    entry;
     int           retcode = 0;
 
-    entry = SLLocate(list, key, update);
-
     *prev_key   = *next_key   = key;
     *prev_value = *next_value = NULL;