Hi,

I've fixed up some compile warnings in the attached patch; I think a
couple of cases may actually have been bugs. One case I have not touched
is converting between void * (64 bit here) and drm_handle_t (32 bit
here), as I don't understand the issues here; it would be nice if no
warnings were emitted if it is safe.

Additionally, the function libdrm/xf86drmSL.c:drmSLLookupNeighbors()
appears to be completely broken as it computes on the variable update
which is unconditionally undefined.

Matthew W.S. Bell
From 605963e604b8d7e3aa5ffa9ed87738bf1a0f0b7d Mon Sep 17 00:00:00 2001
Message-Id: <605963e604b8d7e3aa5ffa9ed87738bf1a0f0b7d.1265309634.git.matt...@bells23.org.uk>
From: Matthew W. S. Bell <[email protected]>
Date: Sat, 30 Jan 2010 02:14:44 +0000
Subject: [PATCH] Tidy up compile warnings by cleaning up types.

---
 tests/dristat.c             |    3 ++-
 tests/drmtest.c             |    4 +++-
 tests/modeprint/modeprint.c |    8 ++++----
 tests/modetest/modetest.c   |   38 +++++++++++++++++---------------------
 xf86drmSL.c                 |    3 ---
 5 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/tests/dristat.c b/tests/dristat.c
index 48c3b51..900a3e6 100644
--- a/tests/dristat.c
+++ b/tests/dristat.c
@@ -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);
     }
diff --git a/tests/drmtest.c b/tests/drmtest.c
index 15e5c4a..685a652 100644
--- a/tests/drmtest.c
+++ b/tests/drmtest.c
@@ -25,9 +25,11 @@
  *
  */
 
+#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) {
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index 595d444..8971914 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -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);
 		}
 	}
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 34d40ca..26405f4 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -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:%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;
diff --git a/xf86drmSL.c b/xf86drmSL.c
index 58aefac..acddb54 100644
--- a/xf86drmSL.c
+++ b/xf86drmSL.c
@@ -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;
 	
-- 
1.6.5

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to