[sound-juicer] Remove shadow variables
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] Remove shadow variables
- Date: Mon, 13 Feb 2017 10:56:39 +0000 (UTC)
commit ddb60b20983d7772c1f4526ce2c34ec12fd40c8a
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Mon Oct 10 16:21:23 2016 +0100
Remove shadow variables
Prefix global variables with sj_ to avoid local variables shadowing
them. Found with -Wshadow
https://bugzilla.gnome.org/show_bug.cgi?id=777692
libjuicer/sj-metadata-musicbrainz5.c | 8 ++--
src/sj-extracting.c | 40 +++++++-------
src/sj-main.c | 92 +++++++++++++++++-----------------
src/sj-play.c | 2 +-
src/sj-prefs.c | 4 +-
src/sound-juicer.h | 10 ++--
6 files changed, 78 insertions(+), 78 deletions(-)
---
diff --git a/libjuicer/sj-metadata-musicbrainz5.c b/libjuicer/sj-metadata-musicbrainz5.c
index 64581c5..c073645 100644
--- a/libjuicer/sj-metadata-musicbrainz5.c
+++ b/libjuicer/sj-metadata-musicbrainz5.c
@@ -1124,7 +1124,7 @@ mb5_list_albums (SjMetadata *metadata,
AlbumDetails *album;
Mb5Release full_release = NULL;
Mb5Metadata release_md = NULL;
- char *includes = "aliases artists artist-credits labels recordings \
+ char *release_includes = "aliases artists artist-credits labels recordings \
release-groups url-rels discids recording-level-rels work-level-rels work-rels \
artist-rels";
@@ -1132,7 +1132,7 @@ artist-rels";
* In order to get metadata for artist aliases & work / composer
* relationships we need to perform a custom query
*/
- release_md = query_musicbrainz (self, "release", disc->release_ids[i], includes, cancellable, error);
+ release_md = query_musicbrainz (self, "release", disc->release_ids[i], release_includes, cancellable,
error);
if (*error != NULL)
goto free_releases;
@@ -1152,10 +1152,10 @@ artist-rels";
* release-group, so run a separate query to get these urls
*/
char *releasegroupid = NULL;
- char *includes = "artists url-rels";
+ char *group_includes = "artists url-rels";
GET (releasegroupid, mb5_releasegroup_get_id, group);
- group_md = query_musicbrainz (self, "release-group", releasegroupid, includes, cancellable, error);
+ group_md = query_musicbrainz (self, "release-group", releasegroupid, group_includes, cancellable,
error);
g_free (releasegroupid);
if (*error != NULL) {
mb5_metadata_delete (release_md);
diff --git a/src/sj-extracting.c b/src/sj-extracting.c
index f61a3bd..0d17c00 100644
--- a/src/sj-extracting.c
+++ b/src/sj-extracting.c
@@ -60,7 +60,7 @@ typedef enum {
NORMAL = 3
} OverWriteModes;
-int overwrite_mode;
+int sj_overwrite_mode;
typedef enum {
BUTTON_SKIP = 1,
@@ -124,7 +124,7 @@ static guint cookie;
* Build the absolute filename for the specified track.
*
* The base path is the extern variable 'base_uri', the formats to use are the
- * extern variables 'path_pattern' and 'file_pattern'. Free the result when you
+ * extern variables 'sj_path_pattern' and 'sj_file_pattern'. Free the result when you
* have finished with it.
*/
static GFile *
@@ -137,10 +137,10 @@ build_filename (const TrackDetails *track, gboolean temp_filename, GError **erro
int max_realfile = INT_MAX;
GstEncodingProfile *profile;
- g_object_get (extractor, "profile", &profile, NULL);
+ g_object_get (sj_extractor, "profile", &profile, NULL);
- realpath = filepath_parse_pattern (path_pattern, track);
- new = g_file_get_child (base_uri, realpath);
+ realpath = filepath_parse_pattern (sj_path_pattern, track);
+ new = g_file_get_child (sj_base_uri, realpath);
uri = new;
g_free (realpath);
@@ -173,7 +173,7 @@ build_filename (const TrackDetails *track, gboolean temp_filename, GError **erro
g_set_error_literal (error, SJ_ERROR, SJ_ERROR_INTERNAL_ERROR, _("Name too long"));
return NULL;
}
- realfile = filepath_parse_pattern (file_pattern, track);
+ realfile = filepath_parse_pattern (sj_file_pattern, track);
if (temp_filename) {
filename = g_strdup_printf (".%.*s.%s", max_realfile-1, realfile, extension);
} else {
@@ -210,7 +210,7 @@ cleanup (void)
/* We're not extracting any more */
extracting = FALSE;
- brasero_drive_unlock (drive);
+ brasero_drive_unlock (sj_drive);
gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()),
cookie);
@@ -468,7 +468,7 @@ pop_and_extract (int *overwrite_mode)
gtk_tree_path_free(path);
/* Now actually do the extraction */
- sj_extractor_extract_track (extractor, track, temp_file, &error);
+ sj_extractor_extract_track (sj_extractor, track, temp_file, &error);
if (error) {
goto error;
} else
@@ -616,7 +616,7 @@ finished_actions (void)
/* Maybe eject */
if (eject_finished && successful_extract) {
- brasero_drive_eject (drive, FALSE, NULL);
+ brasero_drive_eject (sj_drive, FALSE, NULL);
}
/* Maybe open the target directory */
@@ -719,7 +719,7 @@ on_progress_cancel_clicked (GtkWidget *button, gpointer user_data)
GFile *file;
GError *error = NULL;
- sj_extractor_cancel_extract (extractor);
+ sj_extractor_cancel_extract (sj_extractor);
gtk_tree_model_get (GTK_TREE_MODEL (track_store), ¤t,
COLUMN_DETAILS, &track, -1);
@@ -758,7 +758,7 @@ on_extract_activate (GtkWidget *button, gpointer user_data)
total_extracting = 0;
current_duration = total_duration = 0;
before.seconds = -1;
- overwrite_mode = NORMAL;
+ sj_overwrite_mode = NORMAL;
gtk_tree_model_foreach (GTK_TREE_MODEL (track_store), extract_track_foreach_cb, NULL);
/* If the pending list is still empty, return */
if (total_extracting == 0) {
@@ -770,9 +770,9 @@ on_extract_activate (GtkWidget *button, gpointer user_data)
/* Initialise ourself */
if (!initialised) {
/* Connect to the SjExtractor signals */
- g_signal_connect (extractor, "progress", G_CALLBACK (on_progress_cb), NULL);
- g_signal_connect (extractor, "completion", G_CALLBACK (on_completion_cb), (gpointer)&overwrite_mode);
- g_signal_connect (extractor, "error", G_CALLBACK (on_error_cb), NULL);
+ g_signal_connect (sj_extractor, "progress", G_CALLBACK (on_progress_cb), NULL);
+ g_signal_connect (sj_extractor, "completion", G_CALLBACK (on_completion_cb),
(gpointer)&sj_overwrite_mode);
+ g_signal_connect (sj_extractor, "error", G_CALLBACK (on_error_cb), NULL);
extract_button = GET_WIDGET ("extract_button");
play_button = GET_WIDGET ("play_button");
@@ -818,7 +818,7 @@ on_extract_activate (GtkWidget *button, gpointer user_data)
g_object_set (G_OBJECT (artist_renderer), "editable", FALSE, NULL);
g_signal_handlers_block_by_func (track_listview, on_tracklist_row_activate, NULL);
- if (! brasero_drive_lock (drive, _("Extracting audio from CD"), &reason)) {
+ if (! brasero_drive_lock (sj_drive, _("Extracting audio from CD"), &reason)) {
g_warning ("Could not lock drive: %s", reason);
g_free (reason);
}
@@ -836,7 +836,7 @@ on_extract_activate (GtkWidget *button, gpointer user_data)
extracting = TRUE;
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (track_store), ¤t);
find_next ();
- pop_and_extract (&overwrite_mode);
+ pop_and_extract (&sj_overwrite_mode);
}
/*
@@ -988,7 +988,7 @@ filepath_parse_pattern (const char* pattern, const TrackDetails *track)
if (pattern == NULL || pattern[0] == 0)
return g_strdup (" ");
- fs_info = g_file_query_filesystem_info (base_uri, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+ fs_info = g_file_query_filesystem_info (sj_base_uri, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
NULL, NULL);
if (fs_info) {
filesystem_type = g_file_info_get_attribute_as_string (fs_info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
@@ -1158,9 +1158,9 @@ filepath_parse_pattern (const char* pattern, const TrackDetails *track)
case 'n':
/* Disc and track number */
if (track->album->disc_number > 0) {
- char *s = g_strdup_printf ("Disc %d - %02d", track->album->disc_number, track->number);
- string = sanitize_path (s, filesystem_type); /* strip spaces if required */
- g_free (s);
+ char *dtn = g_strdup_printf ("Disc %d - %02d", track->album->disc_number, track->number);
+ string = sanitize_path (dtn, filesystem_type); /* strip spaces if required */
+ g_free (dtn);
} else {
string = g_strdup_printf ("%d", track->number);
}
diff --git a/src/sj-main.c b/src/sj-main.c
index 430f1a7..0c86dfd 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -73,7 +73,7 @@ G_MODULE_EXPORT void on_activate_move_focus (GtkWidget *widget, gpointer data);
GtkBuilder *builder;
SjMetadataGetter *metadata;
-SjExtractor *extractor;
+SjExtractor *sj_extractor;
GSettings *sj_settings;
@@ -87,9 +87,9 @@ static GtkWidget *multiple_album_dialog, *status_bar, *submit_button, *reload_bu
GtkListStore *track_store;
GtkCellRenderer *toggle_renderer, *title_renderer, *artist_renderer, *composer_renderer;
-char *path_pattern, *file_pattern;
-GFile *base_uri;
-BraseroDrive *drive = NULL;
+char *sj_path_pattern, *sj_file_pattern;
+GFile *sj_base_uri;
+BraseroDrive *sj_drive = NULL;
gboolean strip_chars;
gboolean eject_finished;
gboolean open_finished;
@@ -104,7 +104,7 @@ static char *current_submit_url = NULL;
static GCancellable *reread_cancellable; /* weak reference */
gboolean autostart = FALSE, autoplay = FALSE;
-static char *device = NULL, **uris = NULL;
+static char *sj_device = NULL, **uris = NULL;
static guint debug_flags = 0;
@@ -218,7 +218,7 @@ static void on_eject_activate (GSimpleAction *action, GVariant *parameter, gpoin
{
disc_ejected_cb ();
eject_activated = TRUE;
- brasero_drive_eject (drive, FALSE, NULL);
+ brasero_drive_eject (sj_drive, FALSE, NULL);
}
G_MODULE_EXPORT gboolean on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
@@ -442,7 +442,7 @@ static void on_duplicate_activate (GSimpleAction *action, GVariant *parameter, g
GError *error = NULL;
const gchar* device;
- device = brasero_drive_get_device (drive);
+ device = brasero_drive_get_device (sj_drive);
if (!g_spawn_command_line_async (g_strconcat ("brasero -c ", device, NULL), &error)) {
GtkWidget *dialog;
@@ -697,19 +697,19 @@ static void baseuri_changed_cb (GSettings *settings, gchar *key, gpointer user_d
{
gchar *value;
g_assert (strcmp (key, SJ_SETTINGS_BASEURI) == 0);
- if (base_uri) {
- g_object_unref (base_uri);
+ if (sj_base_uri) {
+ g_object_unref (sj_base_uri);
}
value = g_settings_get_string (settings, key);
if (sj_str_is_empty (value)) {
- base_uri = sj_get_default_music_directory ();
+ sj_base_uri = sj_get_default_music_directory ();
} else {
GFileType file_type;
- base_uri = g_file_new_for_uri (value);
- file_type = g_file_query_file_type (base_uri, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL);
+ sj_base_uri = g_file_new_for_uri (value);
+ file_type = g_file_query_file_type (sj_base_uri, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL);
if (file_type != G_FILE_TYPE_DIRECTORY) {
- g_object_unref (base_uri);
- base_uri = sj_get_default_music_directory ();
+ g_object_unref (sj_base_uri);
+ sj_base_uri = sj_get_default_music_directory ();
}
}
g_free (value);
@@ -721,11 +721,11 @@ static void baseuri_changed_cb (GSettings *settings, gchar *key, gpointer user_d
static void path_pattern_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
g_assert (strcmp (key, SJ_SETTINGS_PATH_PATTERN) == 0);
- g_free (path_pattern);
- path_pattern = g_settings_get_string (settings, key);
- if (sj_str_is_empty (path_pattern)) {
- g_free (path_pattern);
- path_pattern = g_strdup (sj_get_default_path_pattern ());
+ g_free (sj_path_pattern);
+ sj_path_pattern = g_settings_get_string (settings, key);
+ if (sj_str_is_empty (sj_path_pattern)) {
+ g_free (sj_path_pattern);
+ sj_path_pattern = g_strdup (sj_get_default_path_pattern ());
}
/* TODO: sanity check the pattern */
}
@@ -736,11 +736,11 @@ static void path_pattern_changed_cb (GSettings *settings, gchar *key, gpointer u
static void file_pattern_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
g_assert (strcmp (key, SJ_SETTINGS_FILE_PATTERN) == 0);
- g_free (file_pattern);
- file_pattern = g_settings_get_string (settings, key);
- if (sj_str_is_empty (file_pattern)) {
- g_free (file_pattern);
- file_pattern = g_strdup (sj_get_default_file_pattern ());
+ g_free (sj_file_pattern);
+ sj_file_pattern = g_settings_get_string (settings, key);
+ if (sj_str_is_empty (sj_file_pattern)) {
+ g_free (sj_file_pattern);
+ sj_file_pattern = g_strdup (sj_get_default_file_pattern ());
}
/* TODO: sanity check the pattern */
}
@@ -755,9 +755,9 @@ static void paranoia_changed_cb (GSettings *settings, gchar *key, gpointer user_
value = g_settings_get_flags (settings, key);
if (value >= 0) {
if (value < 32) {
- sj_extractor_set_paranoia (extractor, value);
+ sj_extractor_set_paranoia (sj_extractor, value);
} else {
- sj_extractor_set_paranoia (extractor, DEFAULT_PARANOIA);
+ sj_extractor_set_paranoia (sj_extractor, DEFAULT_PARANOIA);
}
}
}
@@ -909,14 +909,14 @@ static void reread_cd (void)
/* Make sure nothing is playing */
stop_playback ();
- if (!drive)
+ if (!sj_drive)
sj_debug (DEBUG_CD, "Attempting to re-read NULL drive\n");
g_free (current_submit_url);
current_submit_url = NULL;
set_action_enabled ("submit-tracks", FALSE);
- if (!is_audio_cd (drive)) {
+ if (!is_audio_cd (sj_drive)) {
sj_debug (DEBUG_CD, "Media is not an audio CD\n");
set_action_state ("re-read(false)");
update_ui_for_album (NULL);
@@ -972,17 +972,17 @@ set_drive_from_device (const char *device)
{
BraseroMediumMonitor *monitor;
- if (drive) {
- g_object_unref (drive);
- drive = NULL;
+ if (sj_drive) {
+ g_object_unref (sj_drive);
+ sj_drive = NULL;
}
if (! device)
return;
monitor = brasero_medium_monitor_get_default ();
- drive = brasero_medium_monitor_get_drive (monitor, device);
- if (! drive) {
+ sj_drive = brasero_medium_monitor_get_drive (monitor, device);
+ if (!sj_drive) {
GtkWidget *dialog;
char *message;
message = g_strdup_printf (_("Sound Juicer could not use the CD-ROM device ā%sā"), device);
@@ -1039,16 +1039,16 @@ set_device (const char* device)
}
sj_metadata_getter_set_cdrom (metadata, device);
- sj_extractor_set_device (extractor, device);
+ sj_extractor_set_device (sj_extractor, device);
- if (drive != NULL) {
- tray_opened = brasero_drive_is_door_open (drive);
+ if (sj_drive != NULL) {
+ tray_opened = brasero_drive_is_door_open (sj_drive);
if (tray_opened == FALSE) {
reread_cd ();
}
/* Enable/disable the eject options based on wether the drive supports ejection */
- set_action_enabled ("eject", brasero_drive_can_eject (drive));
+ set_action_enabled ("eject", brasero_drive_can_eject (sj_drive));
}
}
@@ -1138,7 +1138,7 @@ static void profile_changed_cb (GSettings *settings, gchar *key, gpointer user_d
profile = rb_gst_get_encoding_profile (media_type);
g_free (media_type);
if (profile != NULL)
- g_object_set (extractor, "profile", profile, NULL);
+ g_object_set (sj_extractor, "profile", profile, NULL);
if (profile == NULL || !sj_extractor_supports_profile(profile)) {
GtkWidget *dialog;
@@ -1976,8 +1976,8 @@ startup_cb (GApplication *app, gpointer user_data)
gtk_tree_view_append_column (GTK_TREE_VIEW (track_listview), column);
}
- extractor = SJ_EXTRACTOR (sj_extractor_new());
- error = sj_extractor_get_new_error (extractor);
+ sj_extractor = SJ_EXTRACTOR (sj_extractor_new());
+ error = sj_extractor_get_new_error (sj_extractor);
if (error) {
error_on_start (error);
exit (1);
@@ -1999,15 +1999,15 @@ startup_cb (GApplication *app, gpointer user_data)
eject_changed_cb (sj_settings, SJ_SETTINGS_EJECT, NULL);
open_changed_cb (sj_settings, SJ_SETTINGS_OPEN, NULL);
audio_volume_changed_cb (sj_settings, SJ_SETTINGS_AUDIO_VOLUME, NULL);
- if (device == NULL && uris == NULL) {
+ if (sj_device == NULL && uris == NULL) {
/* FIXME: this should set the device gsettings key to a meaningful
* value if it's empty (which is the case until the user changes it in
* the prefs)
*/
device_changed_cb (sj_settings, SJ_SETTINGS_DEVICE, NULL);
} else {
- if (device)
- set_device (device);
+ if (sj_device)
+ set_device (sj_device);
else {
char *d;
@@ -2118,7 +2118,7 @@ int main (int argc, char **argv)
const GOptionEntry entries[] = {
{ "auto-start", 'a', 0, G_OPTION_ARG_NONE, &autostart, N_("Start extracting immediately"), NULL },
{ "play", 'p', 0, G_OPTION_ARG_NONE, &autoplay, N_("Start playing immediately"), NULL},
- { "device", 'd', 0, G_OPTION_ARG_FILENAME, &device, N_("What CD device to read"), N_("DEVICE") },
+ { "device", 'd', 0, G_OPTION_ARG_FILENAME, &sj_device, N_("What CD device to read"), N_("DEVICE") },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &uris, N_("URI to the CD device to read"),
NULL },
{ NULL }
};
@@ -2162,9 +2162,9 @@ int main (int argc, char **argv)
g_object_unref (app);
sj_metadata_helper_cleanup ();
- g_object_unref (base_uri);
+ g_object_unref (sj_base_uri);
g_object_unref (metadata);
- g_object_unref (extractor);
+ g_object_unref (sj_extractor);
g_object_unref (sj_settings);
brasero_media_library_stop ();
diff --git a/src/sj-play.c b/src/sj-play.c
index e0bc2c6..7a8fb3f 100644
--- a/src/sj-play.c
+++ b/src/sj-play.c
@@ -334,7 +334,7 @@ cb_source_setup (GstElement *playbin, GstElement *source, gpointer user_data)
g_object_set (source, "paranoia-mode", 0, NULL);
g_object_set (G_OBJECT (source),
- "device", brasero_drive_get_device (drive),
+ "device", brasero_drive_get_device (sj_drive),
NULL);
}
diff --git a/src/sj-prefs.c b/src/sj-prefs.c
index 8fa4ee2..87832b6 100644
--- a/src/sj-prefs.c
+++ b/src/sj-prefs.c
@@ -219,7 +219,7 @@ static void pattern_label_update (void)
.artist_id = NULL, /* artist ID */
};
- g_object_get (extractor, "profile", &profile, NULL);
+ g_object_get (sj_extractor, "profile", &profile, NULL);
/* It's possible the profile isn't set, in which case do nothing */
if (!profile) {
return;
@@ -424,7 +424,7 @@ void show_preferences_dialog ()
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_STRIP,
(GCallback)strip_changed_cb, NULL);
- g_signal_connect (extractor, "notify::profile", pattern_label_update, NULL);
+ g_signal_connect (sj_extractor, "notify::profile", pattern_label_update, NULL);
baseuri_changed_cb (sj_settings, SJ_SETTINGS_BASEURI, NULL);
settings_changed_cb (sj_settings, SJ_SETTINGS_AUDIO_PROFILE, profile_option);
diff --git a/src/sound-juicer.h b/src/sound-juicer.h
index 93751a8..66083cf 100644
--- a/src/sound-juicer.h
+++ b/src/sound-juicer.h
@@ -47,7 +47,7 @@ extern GtkBuilder *builder;
/**
* The extractor GObject being used
*/
-extern SjExtractor *extractor;
+extern SjExtractor *sj_extractor;
/**
* Set if currently extracting
@@ -91,22 +91,22 @@ extern GtkListStore *track_store;
/**
* The device we are extracting from.
*/
-extern BraseroDrive *drive;
+extern BraseroDrive *sj_drive;
/**
* The root path to write files too
*/
-extern GFile *base_uri;
+extern GFile *sj_base_uri;
/**
* The pattern to expand when naming folders
*/
-extern char *path_pattern;
+extern char *sj_path_pattern;
/**
* The pattern to expand when naming files
*/
-extern char *file_pattern;
+extern char *sj_file_pattern;
/**
* If file names should be shell-friendly (i.e no [ /&*?\] characters
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]