I've just run compilation with -Wall -Wextra on glib (version from
git). There are several types of error:
- Unused parameters and similar errors to which solutionis to tell
compilator to ignore it
- Unused variables and other. Since it is not a highly secure
pseudorandom generator I guess they can be safly secured.
- Apparent errors which are probably an error in interface.

The solution to first is to add extra code to a few places. The second
is simply remove the unused variables. The third case is harder as it
affects API.

For example the g_ptr_array_set_size (array, -1) is perfectly legal call
although the exact behaviour is undefined as I believe. Changing the
gint to guint would:
- Change nothing  for the 'non-purist' as the for (int i = ...) ... will
still work (the cast will be performed. May be a warning be generated -
but they are 'non-purist').
- It will help debuging for 'purist' as some errors may be detected.

I have 2 questions:
- should I work on some cleaning of the glib compilation? I.e. if such
type of patches will be commited at all or is it a waste of my time.
- should I 'fix' also a API in such patches, the API is too
'standarised' to do it now (if I submit around 2.0 it would be accepted)
or there are other reson of doing such parts in this specific way?

Regards
PS. Why git repo is  not updated since some time?
PPS. I'm attaching a small patch for some of the issues:

>From 986cf63b1cc08bc904f546aee10d3ebef9f71be0 Mon Sep 17 00:00:00 2001
From: Maciej Piechotka <uzytkown...@gmail.com>
Date: Mon, 29 Dec 2008 17:23:48 +0100
Subject: [PATCH] Fixed some -Wextra and -Wall warrings

---
 gio/gdesktopappinfo.c            |    2 +-
 gio/gemblem.c                    |    1 -
 gio/gemblemedicon.c              |    1 -
 gio/xdgmime/xdgmime.c            |    2 --
 glib/pcre/pcre_ucp_searchfuncs.c |    2 +-
 5 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index db907d3..d486d14 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -1303,7 +1303,7 @@ update_mimeapps_list (const char  *desktop_id,
 	     add the current list of (not yet listed) apps before it. */
 
 	  list[i] = NULL; /* Terminate current list so we can use it */
-	  system_list =  get_all_desktop_entries_for_mime_type (content_type, list);
+	  system_list =  get_all_desktop_entries_for_mime_type (content_type, (const char **)list);
 	  
 	  list = g_renew (char *, list, 1 + length + g_list_length (system_list) + 1);
 	  
diff --git a/gio/gemblem.c b/gio/gemblem.c
index 7ecc6f1..4cd70d3 100644
--- a/gio/gemblem.c
+++ b/gio/gemblem.c
@@ -314,7 +314,6 @@ g_emblem_from_tokens (gchar  **tokens,
   GEmblem *emblem;
   GIcon *icon;
   GEmblemOrigin origin;
-  char *s;
 
   emblem = NULL;
 
diff --git a/gio/gemblemedicon.c b/gio/gemblemedicon.c
index 36363f8..0fd221c 100644
--- a/gio/gemblemedicon.c
+++ b/gio/gemblemedicon.c
@@ -283,7 +283,6 @@ g_emblemed_icon_from_tokens (gchar  **tokens,
                              GError **error)
 {
   GEmblemedIcon *emblemed_icon;
-  char *s;
   int n;
 
   emblemed_icon = NULL;
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index 55018ee..c9bcfba 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/xdgmime.c
@@ -906,8 +906,6 @@ xdg_mime_remove_callback (int callback_id)
 const char *
 xdg_mime_get_icon (const char *mime)
 {
-  const char *icon;
-
   xdg_mime_init ();
   
   if (_caches)
diff --git a/glib/pcre/pcre_ucp_searchfuncs.c b/glib/pcre/pcre_ucp_searchfuncs.c
index 77ec8d1..449b791 100644
--- a/glib/pcre/pcre_ucp_searchfuncs.c
+++ b/glib/pcre/pcre_ucp_searchfuncs.c
@@ -113,7 +113,7 @@ Returns:      the other case or NOTACHAR if none
 unsigned int
 _pcre_ucp_othercase(const unsigned int c)
 {
-int other_case = NOTACHAR;
+unsigned int other_case = NOTACHAR;
 
 if (g_unichar_islower(c))
   other_case = g_unichar_toupper(c);
-- 
1.6.0.6

-- 
I've probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to