sawfish r4275 - trunk/src



Author: tkorvola
Date: Sun Aug 31 13:15:30 2008
New Revision: 4275
URL: http://svn.gnome.org/viewvc/sawfish?rev=4275&view=rev

Log:
Remove some easier cases of gpointer abuse.

Modified:
   trunk/src/cursors.c
   trunk/src/events.c
   trunk/src/images.c
   trunk/src/libclient.c
   trunk/src/sawmill_subrs.h
   trunk/src/server.c
   trunk/src/windows.c

Modified: trunk/src/cursors.c
==============================================================================
--- trunk/src/cursors.c	(original)
+++ trunk/src/cursors.c	Sun Aug 31 13:15:30 2008
@@ -35,7 +35,8 @@
 make_bm_cursor (repv image, repv mask, repv fg, repv bg)
 {
     rep_GC_root gc_image, gc_mask, gc_fg, gc_bg;
-    int width, height, x_hot, y_hot;
+    unsigned width, height;
+    int x_hot, y_hot;
     Pixmap bm_image, bm_mask;
     Cursor cursor = 0;
 

Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c	(original)
+++ trunk/src/events.c	Sun Aug 31 13:15:30 2008
@@ -445,6 +445,7 @@
 {
     Window tmpw;
     int tmp;
+    unsigned tmpu;
     int x, y;
     
     /* Swallow any pending motion events as well. */
@@ -455,7 +456,7 @@
        until the pointer's position has been queried. I should
        check the Xlib manuals about this. */
     if(XQueryPointer(dpy, ev->xmotion.window,
-		     &tmpw, &tmpw, &x, &y, &tmp, &tmp, (gpointer) &tmp))
+		     &tmpw, &tmpw, &x, &y, &tmp, &tmp, &tmpu))
     {
 	record_mouse_position (x, y, ev->type, ev->xmotion.window);
     }
@@ -483,7 +484,7 @@
     unsigned char *prop;
     Atom actual;
     int format;
-    long nitems, bytes_after;
+    unsigned long nitems, bytes_after;
     char **text_list;
     XTextProperty tprop;
     int count;
@@ -491,10 +492,9 @@
     int convert_status;
 
     if (xproperty.state != PropertyNewValue
-        || XGetWindowProperty (dpy, w->id, xproperty.atom,
-                               0, 200, False, AnyPropertyType, &actual,
-                               &format, (gpointer) &nitems,
-                               (gpointer) &bytes_after, &prop) != Success
+        || XGetWindowProperty (dpy, w->id, xproperty.atom, 0, 200, False,
+                               AnyPropertyType, &actual, &format, &nitems,
+                               &bytes_after, &prop) != Success
         || actual == None)
         return FALSE;
 
@@ -507,7 +507,7 @@
     tprop.value = prop;
     tprop.encoding = actual;
     tprop.format = format;
-    tprop.nitems = strlen ((gpointer) prop);
+    tprop.nitems = strlen ((char *) prop);
 
 #ifdef X_HAVE_UTF8_STRING
     if (actual == xa_compound_text || actual == XA_STRING
@@ -528,8 +528,8 @@
         {
             if (count > 0)
             {
-                char * utf8str = g_locale_to_utf8(text_list[0], -1,
-                                                  NULL, NULL, NULL);
+                char *utf8str = g_locale_to_utf8(text_list[0], -1,
+                                                 NULL, NULL, NULL);
                 if (utf8str)
                 {
                     str = rep_string_dup (utf8str);
@@ -1351,7 +1351,7 @@
     while (XCheckWindowEvent (dpy, w, PropertyChangeMask, &ev)) ;
     XSelectInput (dpy, w, PropertyChangeMask | KeyPressMask);
     XChangeProperty (dpy, w, xa_sawmill_timestamp,
-		     XA_STRING, 8, PropModeReplace, (gpointer) "foo", 3);
+		     XA_STRING, 8, PropModeReplace, (unsigned char *)"foo", 3);
     XSelectInput (dpy, w, KeyPressMask);
     XWindowEvent (dpy, w, PropertyChangeMask, &ev);
 
@@ -1516,9 +1516,10 @@
     {
 	Window tmpw;
 	int tmp;
+        unsigned tmpu;
 	int x, y;
 	if(XQueryPointer(dpy, root_window, &tmpw, &tmpw,
-			 &x, &y, &tmp, &tmp, (gpointer) &tmp))
+			 &x, &y, &tmp, &tmp, &tmpu))
 	{
 	    record_mouse_position (x, y, -1, 0);
 	}

Modified: trunk/src/images.c
==============================================================================
--- trunk/src/images.c	(original)
+++ trunk/src/images.c	Sun Aug 31 13:15:30 2008
@@ -171,7 +171,8 @@
 }
 
 Pixmap
-make_bitmap (repv file, int *widthp, int *heightp, int *x_hotp, int *y_hotp)
+make_bitmap (repv file, unsigned *widthp, unsigned *heightp,
+             int *x_hotp, int *y_hotp)
 {
     bool delete;
     file = find_image_file (file, &delete);
@@ -179,7 +180,7 @@
     {
 	Pixmap bitmap;
 	int ret = XReadBitmapFile (dpy, root_window, rep_STR(file),
-				   (gpointer) widthp, (gpointer) heightp, &bitmap, x_hotp, y_hotp);
+				   widthp, heightp, &bitmap, x_hotp, y_hotp);
 
 	if (delete)
 	    Fdelete_file (file);

Modified: trunk/src/libclient.c
==============================================================================
--- trunk/src/libclient.c	(original)
+++ trunk/src/libclient.c	Sun Aug 31 13:15:30 2008
@@ -203,8 +203,8 @@
     unsigned long nitems;
     XEvent ev;
 
-    XChangeProperty (dpy, portal, xa_sawfish_request, XA_STRING,
-		     8, PropModeReplace, (gpointer) form, strlen (form));
+    XChangeProperty (dpy, portal, xa_sawfish_request, XA_STRING, 8,
+                     PropModeReplace, (unsigned char *) form, strlen (form));
     /* swallow the event created by the above */
     XWindowEvent (dpy, portal, PropertyChangeMask, &ev);
 

Modified: trunk/src/sawmill_subrs.h
==============================================================================
--- trunk/src/sawmill_subrs.h	(original)
+++ trunk/src/sawmill_subrs.h	Sun Aug 31 13:15:30 2008
@@ -189,7 +189,7 @@
 extern Colormap image_cmap;
 extern Visual *image_visual;
 extern int image_depth;
-extern Pixmap make_bitmap (repv file, int *widthp, int *heightp,
+extern Pixmap make_bitmap (repv file, unsigned *widthp, unsigned *heightp,
 			   int *x_hotp, int *y_hotp);
 extern repv Fmake_image (repv file, repv plist);
 extern repv Fmake_image_from_x_drawable (repv id, repv mask_id);

Modified: trunk/src/server.c
==============================================================================
--- trunk/src/server.c	(original)
+++ trunk/src/server.c	Sun Aug 31 13:15:30 2008
@@ -143,12 +143,12 @@
 {
     int confd;
     struct sockaddr_un addr;
-    int addr_len = sizeof (addr);
+    socklen_t addr_len;
 
     /* Linux manpage states that we can pass NULL for addr parameters,
        but that has been reported to crash on some systems.. */
 
-    confd = accept(socket_fd, (struct sockaddr *) &addr, (gpointer) &addr_len);
+    confd = accept(socket_fd, (struct sockaddr *) &addr, &addr_len);
 
     if(confd >= 0)
     {

Modified: trunk/src/windows.c
==============================================================================
--- trunk/src/windows.c	(original)
+++ trunk/src/windows.c	Sun Aug 31 13:15:30 2008
@@ -228,10 +228,10 @@
 get_window_protocols (Lisp_Window *w)
 {
     Atom *prot;
-    unsigned int n;
+    int n;
     w->does_wm_take_focus = 0;
     w->does_wm_delete_window = 0;
-    if (XGetWMProtocols (dpy, w->id, &prot, (gpointer) &n) != 0)
+    if (XGetWMProtocols (dpy, w->id, &prot, &n) != 0)
     {
 	int i;
 	for (i = 0; i < n; i++)
@@ -367,7 +367,7 @@
     {
         char **list;
         int count;
-        prop->nitems = strlen((gpointer) prop->value);
+        prop->nitems = strlen((char *) prop->value);
 #ifdef X_HAVE_UTF8_STRING
         if (Xutf8TextPropertyToTextList (dpy, prop, &list, &count) >= Success)
         {
@@ -1396,7 +1396,7 @@
        {
 	   Atom actual_type;
 	   int actual_format;
-	   long nitems, bytes_after;
+	   unsigned long nitems, bytes_after;
 	   union {
 	       unsigned long *l;
 	       unsigned char *c;
@@ -1411,7 +1411,7 @@
 	   if (XGetWindowProperty (dpy, VWIN (win)->id, kwm_win_icon,
 				   0, 2, False, kwm_win_icon,
 				   &actual_type, &actual_format,
-				   (gpointer) &nitems, (gpointer) &bytes_after,
+				   &nitems, &bytes_after,
 				   &data.c) == Success
 	       && actual_type == kwm_win_icon
 	       && bytes_after == 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]