Permalink
Browse files

Purge usage of g_strdup_printf() and fix a bunch of memory leaks.

  • Loading branch information...
1 parent d2ef6a9 commit 1e78cf1f5e5955ef695867df86cb121b17c92e80 @erikd committed Jan 26, 2012
Showing with 248 additions and 244 deletions.
  1. +5 −8 src/channelops.c
  2. +5 −5 src/db_slider.c
  3. +52 −55 src/file_dialogs.c
  4. +5 −5 src/file_sndfile1.c
  5. +47 −45 src/file_speex.c
  6. +43 −36 src/file_vorbis.c
  7. +11 −11 src/main.c
  8. +5 −5 src/notes.c
  9. +5 −7 src/paste_dialogs.c
  10. +1 −1 src/play.c
  11. +8 −9 src/question_dialogs.c
  12. +2 −2 src/samplerate.c
  13. +2 −2 src/sweep_app.h
  14. +33 −31 src/sweep_sample.c
  15. +14 −14 src/sweep_undo.c
  16. +4 −4 src/undo_dialog.c
  17. +6 −4 src/view.c
View
@@ -146,7 +146,7 @@ dup_channels (sw_sample * sample, int new_channels)
g_snprintf (buf, sizeof (buf), _("Duplicate from %d to %d channels"),
sample->sounddata->format->channels, new_channels);
}
-
+
schedule_operation (sample, buf, &dup_channels_op,
GINT_TO_POINTER(new_channels));
}
@@ -195,12 +195,9 @@ dup_channels_dialog_new_cb (GtkWidget * widget, gpointer data)
sw_sample * sample = view->sample;
GtkWidget * dialog;
GtkWidget * main_vbox;
- /*GtkWidget * label;*/
GtkWidget * chooser;
GtkWidget * button, * ok_button;
- /*gchar * current;*/
-
dialog = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW(dialog), _("Sweep: Duplicate channel"));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
@@ -488,7 +485,7 @@ do_stereo_swap (sw_sample * sample, gpointer data)
remaining -= n;
run_total += n;
-
+
percent = run_total / ctotal;
sample_set_progress_percent (sample, percent);
}
@@ -630,7 +627,7 @@ change_channels (sw_sample * sample, int new_channels)
g_snprintf (buf, sizeof (buf), _("Convert from %d to %d channels"),
sample->sounddata->format->channels, new_channels);
-
+
schedule_operation (sample, buf, &change_channels_op,
GINT_TO_POINTER(new_channels));
}
@@ -674,7 +671,7 @@ channels_dialog_new_cb (GtkWidget * widget, gpointer data)
GtkWidget * chooser;
GtkWidget * button, * ok_button;
- gchar * current;
+ gchar current [128];
dialog = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW(dialog), _("Sweep: Add/Remove channels"));
@@ -683,7 +680,7 @@ channels_dialog_new_cb (GtkWidget * widget, gpointer data)
main_vbox = GTK_DIALOG(dialog)->vbox;
- current = g_strdup_printf (_("Currently: %d channels"),
+ snprintf (current, sizeof (current), _("Currently: %d channels"),
sample->sounddata->format->channels);
label = gtk_label_new (current);
gtk_box_pack_start (GTK_BOX(main_vbox), label, TRUE, TRUE, 8);
View
@@ -120,15 +120,15 @@ db_slider_value_changed_cb (GtkWidget * widget, gpointer data)
{
GtkWidget * slider = (GtkWidget *)data;
gfloat value, db_value;
- gchar * db_text;
+ gchar db_text [16];
value = db_slider_get_value (DB_SLIDER(slider));
db_value = VALUE_TO_DB (value);
if (db_value > -10.0) {
- db_text = g_strdup_printf ("%1.1f dB", db_value);
+ snprintf (db_text, sizeof (db_text), "%1.1f dB", db_value);
} else {
- db_text = g_strdup_printf ("%2.0f dB", db_value);
+ snprintf (db_text, sizeof (db_text), "%2.0f dB", db_value);
}
gtk_label_set_text (GTK_LABEL(DB_SLIDER(slider)->db_label), db_text);
@@ -148,7 +148,7 @@ db_slider_build (GtkWidget * slider, gchar * title, gfloat value)
GtkObject * adj;
- gchar * range_text;
+ gchar range_text [128];
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER(slider), vbox);
@@ -182,7 +182,7 @@ db_slider_build (GtkWidget * slider, gchar * title, gfloat value)
db_slider_value_changed_cb (NULL, slider);
- range_text = g_strdup_printf ("%s\n[%2.0f to %2.0f dB]",
+ snprintf (range_text, sizeof (range_text), "%s\n[%2.0f to %2.0f dB]",
title,
VALUE_TO_DB(DB_SLIDER(slider)->lower),
VALUE_TO_DB(DB_SLIDER(slider)->upper));
Oops, something went wrong.

0 comments on commit 1e78cf1

Please sign in to comment.