[Nautilus-list] PATCH: eel gcc'isms



Hi,

Two kinds of fixes:

1) s/__FUNCTION__/G_GNUC_FUNCTION/

2) ternary operator problems: according to the standard the 2nd and the 3rd
   arguments shall "have compatible structure or union types".
   It also says that "For two qualified types to be compatible, both shall have
   the identically qualified version of a compatible type".

   So this is illegal and but gcc accepts it:

	struct s s1;
	const struct s s2;

	return expr ? s1 : s2;

   One way to fix this is to use if-else an other is to make the empty dimensions
   non-const but that's not nice.

Laca
   
Index: eel/eel-art-extensions.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/eel/eel/eel-art-extensions.c,v
retrieving revision 1.10
diff -u -r1.10 eel-art-extensions.c
--- eel/eel-art-extensions.c	10 Aug 2001 01:47:34 -0000	1.10
+++ eel/eel-art-extensions.c	6 Dec 2001 19:42:15 -0000
@@ -432,7 +432,11 @@
 
 	art_irect_intersect (&ab_intersection, &rectangle_a, &rectangle_b);
 
-	return art_irect_empty (&ab_intersection) ? eel_art_irect_empty : ab_intersection;
+	if (art_irect_empty (&ab_intersection)) {
+		return eel_art_irect_empty;
+	} else {
+		return ab_intersection;
+	}
 }
 
 /**
@@ -456,7 +460,11 @@
 
 	art_irect_union (&ab_union, &rectangle_a, &rectangle_b);
 
-	return art_irect_empty (&ab_union) ? eel_art_irect_empty : ab_union;
+	if (art_irect_empty (&ab_union)) {
+		return eel_art_irect_empty;
+	} else {
+		ab_union;
+	}
 }
 
 EelDimensions
Index: eel/eel-gdk-pixbuf-extensions.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/eel/eel/eel-gdk-pixbuf-extensions.c,v
retrieving revision 1.14
diff -u -r1.14 eel-gdk-pixbuf-extensions.c
--- eel/eel-gdk-pixbuf-extensions.c	6 Nov 2001 18:30:10 -0000	1.14
+++ eel/eel-gdk-pixbuf-extensions.c	6 Dec 2001 19:42:17 -0000
@@ -410,7 +410,7 @@
  * This function is useful in code that uses libart rect 
  * intersection routines.
  */
-EelDimensions
+const EelDimensions
 eel_gdk_pixbuf_get_dimensions (const GdkPixbuf *pixbuf)
 {
 	EelDimensions dimensions;
Index: eel/eel-gdk-pixbuf-extensions.h
===================================================================
RCS file: /sgnome/cvsroots/GNOME/eel/eel/eel-gdk-pixbuf-extensions.h,v
retrieving revision 1.11
diff -u -r1.11 eel-gdk-pixbuf-extensions.h
--- eel/eel-gdk-pixbuf-extensions.h	19 Oct 2001 23:17:33 -0000	1.11
+++ eel/eel-gdk-pixbuf-extensions.h	6 Dec 2001 19:42:17 -0000
@@ -160,7 +160,7 @@
 gboolean             eel_gdk_pixbuf_is_valid                  (const GdkPixbuf       *pixbuf);
 
 /* Access the dimensions of a pixbuf. */
-EelDimensions        eel_gdk_pixbuf_get_dimensions            (const GdkPixbuf       *pixbuf);
+const EelDimensions  eel_gdk_pixbuf_get_dimensions            (const GdkPixbuf       *pixbuf);
 
 /* Return the intersection of the pixbuf with the given rectangle. */
 ArtIRect             eel_gdk_pixbuf_intersect                 (const GdkPixbuf       *pixbuf,
Index: test/test-eel-clickable-image.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/eel/test/test-eel-clickable-image.c,v
retrieving revision 1.5
diff -u -r1.5 test-eel-clickable-image.c
--- test/test-eel-clickable-image.c	9 Nov 2001 01:43:50 -0000	1.5
+++ test/test-eel-clickable-image.c	6 Dec 2001 19:42:22 -0000
@@ -1,5 +1,6 @@
 #include "test.h"
 
+#include <glib/gmacros.h>
 #include <eel/eel-clickable-image.h>
 
 static void
@@ -8,7 +9,7 @@
 {
 	g_return_if_fail (EEL_IS_CLICKABLE_IMAGE (widget));
 
-	g_print ("%s(%p)\n", __FUNCTION__, widget);
+	g_print ("%s(%p)\n", G_GNUC_FUNCTION, widget);
 }
 
 static void
@@ -17,7 +18,7 @@
 {
 	g_return_if_fail (EEL_IS_CLICKABLE_IMAGE (widget));
 
-	g_print ("%s(%p)\n", __FUNCTION__, widget);
+	g_print ("%s(%p)\n", G_GNUC_FUNCTION, widget);
 }
 
 
@@ -27,7 +28,7 @@
 {
 	g_return_if_fail (EEL_IS_CLICKABLE_IMAGE (widget));
 
-	g_print ("%s(%p)\n", __FUNCTION__, widget);
+	g_print ("%s(%p)\n", G_GNUC_FUNCTION, widget);
 }
 
 static GtkWidget *
Index: test/test-eel-image-table.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/eel/test/test-eel-image-table.c,v
retrieving revision 1.6
diff -u -r1.6 test-eel-image-table.c
--- test/test-eel-image-table.c	9 Nov 2001 01:43:50 -0000	1.6
+++ test/test-eel-image-table.c	6 Dec 2001 19:42:23 -0000
@@ -1,5 +1,6 @@
 #include "test.h"
 
+#include <glib/gmacros.h>
 #include <eel/eel-image-table.h>
 #include <eel/eel-viewport.h>
 
@@ -94,7 +95,7 @@
 
 	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));
 
-//	g_print ("%s(%s)\n", __FUNCTION__, text);
+//	g_print ("%s(%s)\n", G_GNUC_FUNCTION, text);
 }
 
 static void
@@ -109,7 +110,7 @@
 
 	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));
 
-//	g_print ("%s(%s)\n", __FUNCTION__, text);
+//	g_print ("%s(%s)\n", G_GNUC_FUNCTION, text);
 }
 
 static void
@@ -124,7 +125,7 @@
 
 	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));
 
-	g_print ("%s(%s)\n", __FUNCTION__, text);
+	g_print ("%s(%s)\n", G_GNUC_FUNCTION, text);
 }
 
 static void
@@ -139,7 +140,7 @@
 
 	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));
 
-	g_print ("%s(%s)\n", __FUNCTION__, text);
+	g_print ("%s(%s)\n", G_GNUC_FUNCTION, text);
 }
 
 static void
@@ -154,7 +155,7 @@
 
 	text = eel_labeled_image_get_text (EEL_LABELED_IMAGE (item));
 
-	g_print ("%s(%s)\n", __FUNCTION__, text);
+	g_print ("%s(%s)\n", G_GNUC_FUNCTION, text);
 }
 
 static int
@@ -165,7 +166,7 @@
 
 	recursion_count++;
 
-	g_print ("%s(%d)\n", __FUNCTION__, recursion_count);
+	g_print ("%s(%d)\n", G_GNUC_FUNCTION, recursion_count);
 	gtk_widget_queue_resize (GTK_WIDGET (callback_data));
 
 	recursion_count--;
@@ -193,7 +194,7 @@
 	if (0) gtk_widget_size_allocate (GTK_WIDGET (image_table),
 					 &GTK_WIDGET (image_table)->allocation); 	
-	g_print ("%s(%d)\n", __FUNCTION__, recursion_count);
+	g_print ("%s(%d)\n", G_GNUC_FUNCTION, recursion_count);
 
 	recursion_count--;
 }




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