[gdm-list] [PATCH] fix gcc warnings



Hi,

Some fixes for gcc warnings ...

cu
Ludwig


Index: gdm2/daemon/errorgui.c
===================================================================
--- gdm2.orig/daemon/errorgui.c
+++ gdm2/daemon/errorgui.c
@@ -317,12 +317,10 @@ gdm_error_box_full (GdmDisplay *d, GtkMe
 
 		if (details_label != NULL) {
  			if (strncmp (details_label, "NIL", 3) == 0)
-				g_free (details_label);
 				details_label = NULL;
 		}
 		if (details_file != NULL) {
 			if (strncmp (details_file, "NIL", 3) == 0)
-				g_free (details_file);
 				details_file = NULL;
 		}
 
Index: gdm2/daemon/gdmconfig.c
===================================================================
--- gdm2.orig/daemon/gdmconfig.c
+++ gdm2/daemon/gdmconfig.c
@@ -655,7 +655,7 @@ gdm_get_custom_config (struct stat *stat
  * appended, and never gdm.conf.
  */
 static gchar *
-gdm_get_per_display_custom_config_file (gchar *display)
+gdm_get_per_display_custom_config_file (const gchar *display)
 {
   return g_strdup_printf ("%s%s", custom_config_file, display);
 }
@@ -818,7 +818,7 @@ gboolean gdm_get_value_bool_per_display 
  * value if none exists.  Note that this value needs to be freed,
  * unlike the non-per-display version.
  */
-gchar * gdm_get_value_string_per_display (gchar *display, gchar *key)
+gchar * gdm_get_value_string_per_display (const gchar *display, gchar *key)
 {
    gchar *perdispval;
 
@@ -844,7 +844,7 @@ gchar * gdm_get_value_string_per_display
  * sure they are added to the if-test below.
  */
 void
-gdm_config_key_to_string_per_display (gchar *display, gchar *key, gchar **retval)
+gdm_config_key_to_string_per_display (const gchar *display, gchar *key, gchar **retval)
 {
    gchar *file;
    gchar **splitstr = g_strsplit (key, "/", 2);
Index: gdm2/daemon/gdmconfig.h
===================================================================
--- gdm2.orig/daemon/gdmconfig.h
+++ gdm2/daemon/gdmconfig.h
@@ -29,7 +29,7 @@ gchar*         gdm_get_custom_config_fil
 gchar*         gdm_get_value_string     (gchar *key);
 gboolean       gdm_get_value_bool       (gchar *key);
 gint           gdm_get_value_int        (gchar *key);
-gchar*         gdm_get_value_string_per_display (gchar *display,
+gchar*         gdm_get_value_string_per_display (const gchar *display,
                                                  gchar *key);
 gboolean       gdm_get_value_bool_per_display   (gchar *display,
                                                  gchar *key);
@@ -42,7 +42,7 @@ void           gdm_set_value_bool       
 void           gdm_set_value_int        (gchar *key,
                                          gint value);
 void           gdm_config_key_to_string_per_display
-                                        (gchar *file,
+                                        (const gchar *file,
                                          gchar *key,
                                          gchar **retval);
 void           gdm_config_key_to_string (gchar *file,
Index: gdm2/daemon/misc.c
===================================================================
--- gdm2.orig/daemon/misc.c
+++ gdm2/daemon/misc.c
@@ -2214,7 +2214,7 @@ gdm_reset_locale (void)
 	else if CHECK_LC("LC_MONETARY", LC_MONETARY)
 	else if CHECK_LC("LC_NUMERIC", LC_NUMERIC)
 	else if CHECK_LC("LC_TIME", LC_TIME)
-	else if CHECK_LC("LANG", NULL)
+	else if CHECK_LC("LANG", 0)
 
         g_string_set_size (line, 0);
       }
@@ -2227,7 +2227,7 @@ gdm_reset_locale (void)
     g_free (i18n_file_contents);
 }
 
-#undef CHECK_LC(value, category)
+#undef CHECK_LC
 
 #else /* ! NUM_OF_LIMITS */
 /* We have to go one by one here */
Index: gdm2/daemon/server.c
===================================================================
--- gdm2.orig/daemon/server.c
+++ gdm2/daemon/server.c
@@ -1395,7 +1395,7 @@ gdm_server_alloc (gint id, const gchar *
     
     hostname[1023] = '\0';
     if (gethostname (hostname, 1023) == -1)
-	    strcmp (hostname, "localhost.localdomain");
+	    strcpy (hostname, "localhost.localdomain");
 
     d = g_new0 (GdmDisplay, 1);
 
Index: gdm2/daemon/verify-pam.c
===================================================================
--- gdm2.orig/daemon/verify-pam.c
+++ gdm2/daemon/verify-pam.c
@@ -468,14 +468,14 @@ perhaps_translate_message (const char *m
 /* Internal PAM conversation function. Interfaces between the PAM
  * authentication system and the actual greeter program */
 
-static gint 
-gdm_verify_pam_conv (int num_msg, struct pam_message **msg,
+static int 
+gdm_verify_pam_conv (int num_msg, const struct pam_message **msg,
 		     struct pam_response **resp,
 		     void *appdata_ptr)
 {
     int replies = 0;
     int i;
-    char *s;
+    char *s = NULL;
     struct pam_response *reply = NULL;
     const void *p;
     const char *login;
@@ -501,7 +501,7 @@ gdm_verify_pam_conv (int num_msg, struct
     /* Here we set the login if it wasn't already set,
      * this is kind of anal, but this way we guarantee that
      * the greeter always is up to date on the login */
-    if (pam_get_item (pamh, PAM_USER, (void **)&p) == PAM_SUCCESS) {
+    if (pam_get_item (pamh, PAM_USER, &p) == PAM_SUCCESS) {
 	    login = (const char *)p;
 	    gdm_slave_greeter_ctl_no_ret (GDM_SETLOGIN, login);
     }
@@ -603,8 +603,8 @@ static struct pam_conv pamc = {
 /* Extra message to give on queries */
 static char *extra_standalone_message = NULL;
 
-static gint 
-gdm_verify_standalone_pam_conv (int num_msg, struct pam_message **msg,
+static int 
+gdm_verify_standalone_pam_conv (int num_msg, const struct pam_message **msg,
 				struct pam_response **resp,
 				void *appdata_ptr)
 {
@@ -929,7 +929,7 @@ authenticate_again:
     g_free (login);
     login = NULL;
     
-    if ((pamerr = pam_get_item (pamh, PAM_USER, (void **)&p)) != PAM_SUCCESS) {
+    if ((pamerr = pam_get_item (pamh, PAM_USER, &p)) != PAM_SUCCESS) {
 	    login = NULL;
 	    /* is not really an auth problem, but it will
 	       pretty much look as such, it shouldn't really
@@ -1249,7 +1249,7 @@ gdm_verify_setup_user (GdmDisplay *d, co
 	    goto setup_pamerr;
     }
 
-    if ((pamerr = pam_get_item (pamh, PAM_USER, (void **)&p)) != PAM_SUCCESS) {
+    if ((pamerr = pam_get_item (pamh, PAM_USER, &p)) != PAM_SUCCESS) {
 	    /* is not really an auth problem, but it will
 	       pretty much look as such, it shouldn't really
 	       happen */
Index: gdm2/daemon/xdmcp.c
===================================================================
--- gdm2.orig/daemon/xdmcp.c
+++ gdm2/daemon/xdmcp.c
@@ -349,7 +349,7 @@ gdm_xdmcp_init (void)
     if G_UNLIKELY (gethostname (hostbuf, 1023) != 0) {
 	gdm_error (_("%s: Could not get server hostname: %s!"), 
 		   "gdm_xdmcp_init", strerror (errno));
-	strcmp (hostbuf, "localhost.localdomain");
+	strcpy (hostbuf, "localhost.localdomain");
     }
 
     if ( ! initted) {
@@ -806,7 +806,7 @@ gdm_xdmcp_send_forward_query6 (GdmIndire
 
 	/* we depend on this being 2 elsewhere as well */
 	port.length = 2;
-	port.data = g_new (char, 2);
+	port.data = g_new (unsigned char, 2);
 	memcpy (port.data, &(clnt_sa->sin6_port), 2);
 	address.length = sizeof (struct in6_addr);
 	address.data = (void *)g_new (struct in6_addr, 1);
Index: gdm2/gui/gdmXnestchooser.c
===================================================================
--- gdm2.orig/gui/gdmXnestchooser.c
+++ gdm2/gui/gdmXnestchooser.c
@@ -168,7 +168,7 @@ static const GOptionEntry xnest_only_opt
 	{ "xnest", 'x', 0, G_OPTION_ARG_STRING, &xnest_binary, N_("Xnest command line"), N_("STRING") },
 	{ "xnest-extra-options", 'o', 0, G_OPTION_ARG_STRING, &xnest_options, N_("Extra options for Xnest"), N_("OPTIONS") },
 	{ "background", 'b', 0, G_OPTION_ARG_NONE, &background, N_("Run in background"), NULL },
-	{ G_OPTION_REMAINING, NULL, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, NULL },
+	{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, NULL },
 	{ NULL } 
 };
 
@@ -180,7 +180,7 @@ static const GOptionEntry options[] = {
 	{ "broadcast", 'B', 0, G_OPTION_ARG_NONE, &do_broadcast, N_("Run broadcast instead of indirect (chooser)"), NULL },
 	{ "background", 'b', 0, G_OPTION_ARG_NONE, &background, N_("Run in background"), NULL },
 	{ "no-gdm-check", '\0', 0, G_OPTION_ARG_NONE, &no_gdm_check, N_("Don't check for running GDM"), NULL },
-	{ G_OPTION_REMAINING, NULL, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, NULL },
+	{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args_remaining, NULL, NULL },
 	{ NULL } 
 };
 
Index: gdm2/gui/gdmchooser.c
===================================================================
--- gdm2.orig/gui/gdmchooser.c
+++ gdm2/gui/gdmchooser.c
@@ -90,8 +90,8 @@ static gchar *xdm_address = NULL;
 static gchar *client_address = NULL;
 static gint connection_type = 0;
 
+static void gdm_chooser_cancel (int);
 /* Exported for glade */
-void gdm_chooser_cancel (/*void*/);
 void gdm_chooser_add_host (void);
 void gdm_chooser_add_entry_changed (void);
 void gdm_chooser_manage (GtkButton *button, gpointer data);
@@ -1536,7 +1536,7 @@ gdm_chooser_add_entry_changed (void)
 }
 
 void
-gdm_chooser_cancel (/*void*/)
+gdm_chooser_cancel (int sig)
 {
     if (scan_time_handler > 0) {
 	    g_source_remove (scan_time_handler);
@@ -1907,7 +1907,7 @@ GOptionEntry chooser_options [] = {
           N_("Client address to return in response to xdm"), N_("ADDRESS") },
        { "connectionType", '\0', 0, G_OPTION_ARG_INT, &connection_type,
           N_("Connection type to return in response to xdm"), N_("TYPE") },
-       { G_OPTION_REMAINING, NULL, 0, G_OPTION_ARG_STRING_ARRAY, &chooser_hosts,
+       { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &chooser_hosts,
           NULL, NULL },
        { NULL }
  };
Index: gdm2/gui/gdmconfig.c
===================================================================
--- gdm2.orig/gui/gdmconfig.c
+++ gdm2/gui/gdmconfig.c
@@ -633,6 +633,7 @@ gdm_config_reload_string (gchar *key)
 	return changed;
 }
 
+#ifdef GDM_UNUSED_CODE
 static gboolean
 gdm_config_reload_translated_string (gchar *key)
 {
@@ -640,6 +641,7 @@ gdm_config_reload_translated_string (gch
 	_gdm_config_get_translated_string (key, TRUE, &changed);
 	return changed;
 }
+#endif
 
 gboolean
 gdm_config_reload_int (gchar *key)
Index: gdm2/gui/greeter/greeter_canvas_item.c
===================================================================
--- gdm2.orig/gui/greeter/greeter_canvas_item.c
+++ gdm2/gui/greeter/greeter_canvas_item.c
@@ -132,7 +132,7 @@ activate_button (GtkWidget *widget, gpoi
 		greeter_item_run_action_callback (id);
 }
 
-void 
+static void 
 menubar_done (GtkMenuShell *menushell, gpointer data)
 {
 	GreeterItemInfo *entry_info = greeter_lookup_id ("user-pw-entry");
Index: gdm2/gui/greeter/greeter_canvas_text.c
===================================================================
--- gdm2.orig/gui/greeter/greeter_canvas_text.c
+++ gdm2/gui/greeter/greeter_canvas_text.c
@@ -95,7 +95,7 @@ greeter_canvas_text_get_screen_dpi (Gree
                          0, G_MAXINT,
                          FALSE,
                          &type, NULL, &resources_length,
-                         (guchar **) &resources))
+                         (void*)&resources))
     {
       gdk_error_trap_pop ();
       return default_dpi;
Index: gdm2/gui/greeter/greeter_item_customlist.c
===================================================================
--- gdm2.orig/gui/greeter/greeter_item_customlist.c
+++ gdm2/gui/greeter/greeter_item_customlist.c
@@ -347,7 +347,7 @@ populate_language (GObject *object)
 }
 
 /* Callback helper function to set session value */
-void
+static void
 combo_session_selected (char *session_val)
 {
   GList *tmp;
Index: gdm2/gui/greeter/greeter_session.c
===================================================================
--- gdm2.orig/gui/greeter/greeter_session.c
+++ gdm2/gui/greeter/greeter_session.c
@@ -36,6 +36,7 @@
 #include "greeter.h"
 #include "greeter_session.h"
 #include "greeter_item_pam.h"
+#include "greeter_item_customlist.h"
 #include "greeter_configuration.h"
 #include "greeter_events.h"
 #include "greeter_parser.h"

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/




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