[Muine] [RFC] Fixes for warnings in libmuine.



hey all,

I'm no expert C hacker, by any means, so I'd love some comment on this.
The attached patch + extra file (to go in libmuine/) should silence all
the warnings in compiling libmuine.so. This fixes compilation with
-Wextra in CFLAGS, etc. I used a UNUSED macro to silence the unused
parameters for functions, etc.

Thoughts? Improvements? Blatant gross things that need fixing?

-pete

-- 
Peter Johanson
<latexer gentoo org>
? libmuine/macros.h
Index: libmuine/metadata.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/metadata.c,v
retrieving revision 1.21
diff -u -B -r1.21 metadata.c
--- libmuine/metadata.c	6 Jul 2005 17:57:11 -0000	1.21
+++ libmuine/metadata.c	28 Jan 2006 05:23:23 -0000
@@ -39,6 +39,7 @@
 
 #include "ogg-helper.h"
 #include "metadata.h"
+#include "macros.h"
 
 struct _Metadata {
 	char *title;
@@ -722,7 +723,7 @@
 } CallbackData;
 
 static FLAC__StreamDecoderReadStatus
-FLAC_read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
+FLAC_read_callback (const FLAC__StreamDecoder *decoder __attribute ((unused)), FLAC__byte buffer[], unsigned *bytes, void *client_data)
 {
 	CallbackData *data = (CallbackData *) client_data;
 	GnomeVFSFileSize read;
@@ -741,8 +742,8 @@
 }
 
 static FLAC__StreamDecoderWriteStatus
-FLAC_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame,
-		     const FLAC__int32 *const buffer[], void *client_data)
+FLAC_write_callback (const FLAC__StreamDecoder *UNUSED(decoder), const FLAC__Frame *UNUSED(frame),
+		     const FLAC__int32 *const UNUSED(buffer[]), void *UNUSED(client_data))
 {
 	/* This callback should never be called, because we request that
 	 * FLAC only decodes metadata, never actual sound data. */
@@ -750,7 +751,7 @@
 }
 
 static void
-FLAC_metadata_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
+FLAC_metadata_callback (const FLAC__StreamDecoder *UNUSED(decoder), const FLAC__StreamMetadata *metadata, void *client_data)
 {
 	CallbackData *data = (CallbackData *) client_data;
 
@@ -783,7 +784,8 @@
 }
 
 static void
-FLAC_error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
+FLAC_error_callback (const FLAC__StreamDecoder *UNUSED(decoder), FLAC__StreamDecoderErrorStatus UNUSED(status),
+		     void *UNUSED(client_data))
 {
 }
 
Index: libmuine/mm-keys.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/mm-keys.c,v
retrieving revision 1.2
diff -u -B -r1.2 mm-keys.c
--- libmuine/mm-keys.c	25 Apr 2004 21:45:52 -0000	1.2
+++ libmuine/mm-keys.c	28 Jan 2006 05:23:23 -0000
@@ -21,6 +21,7 @@
 #include <stdio.h>
 
 #include "mm-keys.h"
+#include "macros.h"
 
 static void mmkeys_class_init (MmKeysClass *klass);
 static void mmkeys_init       (MmKeys      *object);
@@ -59,6 +60,7 @@
 				sizeof (MmKeys),
 				0,
 				(GInstanceInitFunc) mmkeys_init,
+				NULL
 			};
 
 		type = g_type_register_static (G_TYPE_OBJECT, "MmKeys",
@@ -204,7 +206,7 @@
 }
 
 static GdkFilterReturn
-filter_mmkeys (GdkXEvent *xevent, GdkEvent *event, gpointer data)
+filter_mmkeys (GdkXEvent *xevent, GdkEvent *UNUSED(event), gpointer data)
 {
 	XEvent *xev;
 	XKeyEvent *key;
Index: libmuine/ogg-helper.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/ogg-helper.c,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 ogg-helper.c
--- libmuine/ogg-helper.c	17 Jan 2004 15:30:57 -0000	1.1.1.1
+++ libmuine/ogg-helper.c	28 Jan 2006 05:23:23 -0000
@@ -24,9 +24,10 @@
 
 #include <libgnomevfs/gnome-vfs.h>
 #include "ogg-helper.h"
+#include "macros.h"
 
 size_t
-ogg_helper_read (void *ptr, size_t size, size_t nmemb, void *datasource)
+ogg_helper_read (void *ptr, size_t size, size_t UNUSED(nmemb), void *datasource)
 {
 	GnomeVFSResult res;
 	GnomeVFSFileSize bytes_read;
@@ -83,7 +84,7 @@
  * Thanks to Monty for the help
  */
 int
-ogg_helper_close_dummy (void *datasource)
+ogg_helper_close_dummy (void *UNUSED(datasource))
 {
 	return 0;
 }
Index: libmuine/player-gst.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/player-gst.c,v
retrieving revision 1.14
diff -u -B -r1.14 player-gst.c
--- libmuine/player-gst.c	1 May 2005 14:48:51 -0000	1.14
+++ libmuine/player-gst.c	28 Jan 2006 05:23:23 -0000
@@ -28,6 +28,7 @@
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <glib/gi18n.h>
 
+#include "macros.h"
 #include "player.h"
 
 static void player_class_init (PlayerClass     *klass);
@@ -88,6 +89,7 @@
 				sizeof (Player),
 				0,
 				(GInstanceInitFunc) player_init,
+				NULL
 			};
 
 			type = g_type_register_static (G_TYPE_OBJECT,
@@ -137,7 +139,7 @@
 }
 
 static void
-player_init (Player *player)
+player_init (Player *UNUSED(player))
 {
 }
 
@@ -254,7 +256,7 @@
 }
 
 static void
-eos_cb (GstElement *sink, Player *player)
+eos_cb (GstElement *UNUSED(sink), Player *player)
 {
 	player->priv->eos_idle_id = g_idle_add ((GSourceFunc) eos_idle_cb, player);
 }
@@ -276,10 +278,10 @@
 }
 
 static void
-error_cb (GstElement *element,
-	  GstElement *source,
+error_cb (GstElement *UNUSED(element),
+	  GstElement *UNUSED(source),
 	  GError     *error,
-          char       *debug,
+          char       *UNUSED(debug),
 	  Player     *player)
 {
 	PlayerError *data = g_new0 (PlayerError, 1);
@@ -314,7 +316,7 @@
 }
 
 static void
-state_change_cb (GstElement *play, GstElementState old_state,
+state_change_cb (GstElement *UNUSED(play), GstElementState old_state,
 		 GstElementState new_state, Player *player)
 {
 	if (old_state == GST_STATE_PLAYING) {
Index: libmuine/pointer-list-model.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/pointer-list-model.c,v
retrieving revision 1.8
diff -u -B -r1.8 pointer-list-model.c
--- libmuine/pointer-list-model.c	24 Jan 2005 11:58:11 -0000	1.8
+++ libmuine/pointer-list-model.c	28 Jan 2006 05:23:24 -0000
@@ -24,21 +24,22 @@
 #include <config.h>
 #include <string.h>
 #include "pointer-list-model.h"
+#include "macros.h"
 
 static GtkTreeModelFlags
-pointer_list_model_get_flags (GtkTreeModel *tree_model)
+pointer_list_model_get_flags (GtkTreeModel *UNUSED(tree_model))
 {
   return GTK_TREE_MODEL_ITERS_PERSIST | GTK_TREE_MODEL_LIST_ONLY;
 }
 
 static int
-pointer_list_model_get_n_columns (GtkTreeModel *tree_model)
+pointer_list_model_get_n_columns (GtkTreeModel *UNUSED(tree_model))
 {
   return 1;
 }
 
 static GType
-pointer_list_model_get_column_type (GtkTreeModel *tree_model, int index)
+pointer_list_model_get_column_type (GtkTreeModel *UNUSED(tree_model), int index)
 {
   switch (index) {
   case 0:
@@ -198,23 +199,23 @@
 }
 
 static gboolean
-pointer_list_model_iter_parent (GtkTreeModel *tree_model,
-			     GtkTreeIter  *iter,
-			     GtkTreeIter  *child)
+pointer_list_model_iter_parent (GtkTreeModel *UNUSED(tree_model),
+			     GtkTreeIter  *UNUSED(iter),
+			     GtkTreeIter  *UNUSED(child))
 {
   return FALSE;
 }
 
 static gboolean
-pointer_list_model_iter_has_child (GtkTreeModel *tree_model,
-				GtkTreeIter  *iter)
+pointer_list_model_iter_has_child (GtkTreeModel *UNUSED(tree_model),
+				GtkTreeIter  *UNUSED(iter))
 {
   return FALSE;
 }
 
 static gboolean
 pointer_list_model_row_draggable (GtkTreeDragSource *drag_source,
-                                GtkTreePath       *path)
+                                GtkTreePath       *UNUSED(path))
 {
   g_return_val_if_fail (IS_POINTER_LIST_MODEL (drag_source), FALSE);
 
@@ -222,8 +223,8 @@
 }
   
 static gboolean
-pointer_list_model_drag_data_delete (GtkTreeDragSource *drag_source,
-                                   GtkTreePath       *path)
+pointer_list_model_drag_data_delete (GtkTreeDragSource *UNUSED(drag_source),
+                                   GtkTreePath       *UNUSED(path))
 {
   return FALSE;
 }
@@ -252,9 +253,9 @@
 }
 
 static gboolean
-pointer_list_model_drag_data_received (GtkTreeDragDest   *drag_dest,
-                                       GtkTreePath       *dest,
-                                       GtkSelectionData  *selection_data)
+pointer_list_model_drag_data_received (GtkTreeDragDest   *UNUSED(drag_dest),
+                                       GtkTreePath       *UNUSED(dest),
+                                       GtkSelectionData  *UNUSED(selection_data))
 {
   return FALSE;
 }
@@ -336,7 +337,7 @@
 }
 
 static void
-pointer_list_model_class_init (PointerListModelClass *klass)
+pointer_list_model_class_init (PointerListModelClass *UNUSED(klass))
 {
 }
 
@@ -367,7 +368,8 @@
 	NULL,		/* class_data */
 	sizeof (PointerListModel),
 	0,              /* n_preallocs */
-	(GInstanceInitFunc) pointer_list_model_init
+	(GInstanceInitFunc) pointer_list_model_init,
+	NULL
       };
 	    
       static const GInterfaceInfo tree_model_info = {
Index: libmuine/rb-cell-renderer-pixbuf.c
===================================================================
RCS file: /cvs/gnome/muine/libmuine/rb-cell-renderer-pixbuf.c,v
retrieving revision 1.2
diff -u -B -r1.2 rb-cell-renderer-pixbuf.c
--- libmuine/rb-cell-renderer-pixbuf.c	21 Jan 2004 22:52:45 -0000	1.2
+++ libmuine/rb-cell-renderer-pixbuf.c	28 Jan 2006 05:23:24 -0000
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 
 #include "rb-cell-renderer-pixbuf.h"
+#include "macros.h"
 
 static void rb_cell_renderer_pixbuf_get_property  (GObject                    *object,
 						   guint                       param_id,
@@ -76,6 +77,7 @@
 			sizeof (RBCellRendererPixbuf),
 			0,              /* n_preallocs */
 			(GInstanceInitFunc) rb_cell_renderer_pixbuf_init,
+			NULL
 		};
 
 		cell_pixbuf_type = g_type_register_static (GTK_TYPE_CELL_RENDERER, "RBCellRendererPixbuf", &cell_pixbuf_info, 0);
@@ -85,7 +87,7 @@
 }
 
 static void
-rb_cell_renderer_pixbuf_init (RBCellRendererPixbuf *cellpixbuf)
+rb_cell_renderer_pixbuf_init (RBCellRendererPixbuf *UNUSED(cellpixbuf))
 {
 }
 
@@ -228,7 +230,7 @@
 
 static void
 rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
-				  GtkWidget       *widget,
+				  GtkWidget       *UNUSED(widget),
 				  GdkRectangle    *cell_area,
 				  gint            *x_offset,
 				  gint            *y_offset,
@@ -278,9 +280,9 @@
 rb_cell_renderer_pixbuf_render (GtkCellRenderer    *cell,
 				GdkWindow          *window,
 				GtkWidget          *widget,
-				GdkRectangle       *background_area,
+				GdkRectangle       *UNUSED(background_area),
 				GdkRectangle       *cell_area,
-				GdkRectangle       *expose_area,
+				GdkRectangle       *UNUSED(expose_area),
 				guint               flags)
 
 {
/* -*- mode: C; c-file-style: "gnu" -*- */
/*
 * Copyright (C) 2006 Peter Johanson <peter peterjohanson com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __MACROS_H__
#define __MACROS_H__

#ifdef UNUSED
#elif defined(__GNUC__)
# define UNUSED(x) UNUSED_ ##x __attribute__((unused))
#elif defined(__LCLINT__)
# define UNUSED(x) /* unused@*/ x
#else
# define UNUSED(x) x
#endif

#endif /* __MACROS_H__ */


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