[goobox] fixed some compiler warnings
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] fixed some compiler warnings
- Date: Mon, 18 Mar 2013 16:43:23 +0000 (UTC)
commit 91db1622e7b8aaa5d6a902f7841f62e894f28758
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Mar 18 15:49:54 2013 +0100
fixed some compiler warnings
configure.ac | 24 ++++++++++++++++++++++
copy-n-paste/Makefile.am | 9 ++++---
src/Makefile.am | 2 +-
src/dlg-preferences.c | 1 +
src/dlg-ripper.c | 18 ++++++++--------
src/gio-utils.c | 26 ++---------------------
src/goo-player-bar.c | 1 -
src/goo-player-info.c | 29 +--------------------------
src/goo-window.c | 1 -
src/gtk-utils.c | 49 +--------------------------------------------
10 files changed, 46 insertions(+), 114 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bb89320..dd16389 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,30 @@ fi
dnl ===========================================================================
+if test x$ENABLE_DEBUG = xyes; then
+ WARN_CFLAGS="-Wall -Wcast-align -Wtype-limits -Wclobbered -Wempty-body -Wignored-qualifiers
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare"
+else
+ WARN_CFLAGS="-Wall"
+fi
+
+for option in $WARN_CFLAGS; do
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $option"
+ AC_MSG_CHECKING([whether gcc understands $option])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[has_option=yes],[has_option=no])
+ if test x$has_option = xyes; then
+ WARNINGS="$WARNINGS $option"
+ fi
+ AC_MSG_RESULT($has_option)
+ CFLAGS="$SAVE_CFLAGS"
+ unset has_option
+ unset SAVE_CFLAGS
+done
+unset option
+CFLAGS="$CFLAGS $WARNINGS"
+
+dnl ===========================================================================
+
AC_ARG_ENABLE(run_in_place,
AS_HELP_STRING([--enable-run-in-place],[load ui data and extensions from the source tree]),
[case "${enableval}" in
diff --git a/copy-n-paste/Makefile.am b/copy-n-paste/Makefile.am
index d07144d..1e5a0ce 100644
--- a/copy-n-paste/Makefile.am
+++ b/copy-n-paste/Makefile.am
@@ -1,7 +1,8 @@
-INCLUDES = -DGTK_DISABLE_DEPRECATED \
- -DGDK_DISABLE_DEPRECATED \
- -DG_DISABLE_DEPRECATED \
- -UGETTEXT_PACKAGE
+AM_CPPFLAGS = \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DG_DISABLE_DEPRECATED \
+ -UGETTEXT_PACKAGE
noinst_LTLIBRARIES = libeggsmclient.la
diff --git a/src/Makefile.am b/src/Makefile.am
index dd868fd..328863d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,7 @@ else
uidir = $(datadir)/goobox/ui
endif
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/copy-n-paste/ \
diff --git a/src/dlg-preferences.c b/src/dlg-preferences.c
index cef2cec..27b50d3 100644
--- a/src/dlg-preferences.c
+++ b/src/dlg-preferences.c
@@ -24,6 +24,7 @@
#include <brasero3/brasero-drive-selection.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
+#include "dlg-preferences.h"
#include "goo-window.h"
#include "glib-utils.h"
#include "gtk-utils.h"
diff --git a/src/dlg-ripper.c b/src/dlg-ripper.c
index 7b76c98..3d46087 100644
--- a/src/dlg-ripper.c
+++ b/src/dlg-ripper.c
@@ -25,6 +25,7 @@
#include <brasero3/brasero-drive.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
+#include "dlg-ripper.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "main.h"
@@ -340,7 +341,7 @@ valid_filename_char (char c)
/* Remove special characters from a track title in order to make it a
* valid filename. */
-char *
+static char *
tracktitle_to_filename (const char *trackname,
gboolean escape)
{
@@ -565,13 +566,12 @@ save_playlist (DialogData *data)
static void
rip_current_track (DialogData *data)
{
- TrackInfo *track;
- char *msg;
- char *escaped;
- GFile *folder;
- GError *error = NULL;
- char *filename;
- GstStateChangeReturn ret;
+ TrackInfo *track;
+ char *msg;
+ char *escaped;
+ GFile *folder;
+ GError *error = NULL;
+ char *filename;
if (data->current_track == NULL) {
GtkWidget *d;
@@ -636,7 +636,7 @@ rip_current_track (DialogData *data)
g_file_delete (data->current_file, NULL, NULL);
- ret = gst_element_set_state (data->pipeline, GST_STATE_NULL);
+ gst_element_set_state (data->pipeline, GST_STATE_NULL);
g_object_set (G_OBJECT (data->sink), "file", data->current_file, NULL);
g_object_set (G_OBJECT (data->source), "track", track->number + 1, NULL);
diff --git a/src/gio-utils.c b/src/gio-utils.c
index 0399ca5..702a9c2 100644
--- a/src/gio-utils.c
+++ b/src/gio-utils.c
@@ -39,7 +39,7 @@ g_load_file_in_buffer (GFile *file,
{
GFileInputStream *istream;
gboolean retval;
- void *local_buffer;
+ guchar *local_buffer;
gsize count;
gssize n;
char tmp_buffer[BUFFER_SIZE];
@@ -83,7 +83,7 @@ typedef struct {
gpointer user_data;
GInputStream *stream;
guchar tmp_buffer[BUFFER_SIZE];
- void *buffer;
+ guchar *buffer;
gsize count;
} LoadData;
@@ -188,7 +188,7 @@ typedef struct {
GCancellable *cancellable;
BufferReadyCallback callback;
gpointer user_data;
- void *buffer;
+ guchar *buffer;
gsize count;
gsize written;
GError *error;
@@ -436,23 +436,3 @@ g_write_file (GFile *file,
return success;
}
-
-
-gboolean
-_g_directory_make (GFile *file,
- guint32 unix_mode,
- GError **error)
-{
- if (! g_file_make_directory (file, NULL, error)) {
- if (! (*error)->code == G_IO_ERROR_EXISTS)
- return FALSE;
- g_clear_error (error);
- }
-
- return g_file_set_attribute_uint32 (file,
- G_FILE_ATTRIBUTE_UNIX_MODE,
- unix_mode,
- G_FILE_QUERY_INFO_NONE,
- NULL,
- error);
-}
diff --git a/src/goo-player-bar.c b/src/goo-player-bar.c
index 58eff58..6e31415 100644
--- a/src/goo-player-bar.c
+++ b/src/goo-player-bar.c
@@ -263,7 +263,6 @@ goo_player_bar_construct (GooPlayerBar *self,
GtkWidget *main_box;
GtkWidget *button_box;
GtkWidget *button;
- GError *error = NULL;
frame = gtk_event_box_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "goobox-player-bar");
diff --git a/src/goo-player-info.c b/src/goo-player-info.c
index 56d911c..48dbeb8 100644
--- a/src/goo-player-info.c
+++ b/src/goo-player-info.c
@@ -90,8 +90,6 @@ goo_player_info_get_preferred_width (GtkWidget *widget,
int *minimum_width,
int *natural_width)
{
- GooPlayerInfo *info = GOO_PLAYER_INFO (widget);
-
*minimum_width = *natural_width = MIN_WIDTH;
}
@@ -163,7 +161,7 @@ cover_button_clicked_cb (GtkWidget *button,
/* -- drag and drop -- */
-void
+static void
cover_button_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
@@ -334,28 +332,6 @@ goo_player_info_finalize (GObject *object)
static void
-update_subtitle (GooPlayerInfo *info,
- TrackInfo *track)
-{
- AlbumInfo *album;
-
- album = goo_window_get_album (info->priv->window);
-
- if ((album->title == NULL) || (album->artist == NULL)) {
- g_free (info->priv->total_time);
- info->priv->total_time = (track->length > 0) ? _g_format_duration_for_display (track->length
* 1000) : NULL;
- set_title2 (info, info->priv->total_time);
- }
- else {
- set_title2 (info, album->artist);
- set_title3 (info, album->title);
- gtk_label_set_selectable (GTK_LABEL (info->priv->title2_label), TRUE);
- gtk_label_set_selectable (GTK_LABEL (info->priv->title3_label), TRUE);
- }
-}
-
-
-static void
show_simple_text (GooPlayerInfo *info,
const char *text)
{
@@ -530,8 +506,6 @@ static void
goo_player_info_set_cover (GooPlayerInfo *info,
const char *cover)
{
- gboolean cover_set = FALSE;
-
if (cover == NULL)
return;
@@ -560,7 +534,6 @@ goo_player_info_set_cover (GooPlayerInfo *info,
if (image != NULL) {
gtk_notebook_set_current_page (GTK_NOTEBOOK (info->priv->notebook), 1);
gtk_image_set_from_pixbuf (GTK_IMAGE (info->priv->cover_image), image);
- cover_set = TRUE;
g_object_unref (image);
}
else
diff --git a/src/goo-window.c b/src/goo-window.c
index f8ab473..c2faa2c 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -955,7 +955,6 @@ static void
goo_window_unrealize (GtkWidget *widget)
{
GooWindow *window;
- gboolean playlist_visible;
window = GOO_WINDOW (widget);
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index cd11abc..90a85a0 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -31,51 +31,6 @@
#define RESOURCE_UI_PATH "/org/gnome/Goobox/ui/"
-static GtkWidget *
-create_button (const char *stock_id,
- const char *text)
-{
- GtkWidget *button;
- GtkWidget *hbox;
- GtkWidget *image;
- GtkWidget *label;
- GtkWidget *align;
- const char *label_text;
- gboolean text_is_stock;
- GtkStockItem stock_item;
-
- button = gtk_button_new ();
-
- if (gtk_stock_lookup (text, &stock_item)) {
- label_text = stock_item.label;
- text_is_stock = TRUE;
- } else {
- label_text = text;
- text_is_stock = FALSE;
- }
-
- if (text_is_stock)
- image = gtk_image_new_from_stock (text, GTK_ICON_SIZE_BUTTON);
- else
- image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
- label = gtk_label_new_with_mnemonic (label_text);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-
- gtk_widget_set_can_default (button, TRUE);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
-
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (button), align);
- gtk_container_add (GTK_CONTAINER (align), hbox);
-
- gtk_widget_show_all (button);
-
- return button;
-}
-
-
GtkWidget *
_gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
@@ -410,7 +365,7 @@ get_file_icon_pixbuf (GFileIcon *icon,
}
-gboolean
+static gboolean
scale_keeping_ratio_min (int *width,
int *height,
int min_width,
@@ -448,7 +403,7 @@ scale_keeping_ratio_min (int *width,
}
-gboolean
+static gboolean
scale_keeping_ratio (int *width,
int *height,
int max_width,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]