summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-03-22 14:09:24 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-05-11 19:02:54 +0100
commit85124337dcc78a341138df0041dc00db71e8f08f (patch)
tree7484a6874c6c544370f501cb9541804addedb2fd
parent6c916a144d048387fb51b58bd0f837e5bfac70db (diff)
oss4: Avoid g_quark_to_string (g_quark_from_string ()) madness
We to the strdup inside gst_oss4_mixer_control_get_translated_name() instead of in the only caller.
-rw-r--r--sys/oss4/oss4-mixer.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/oss4/oss4-mixer.c b/sys/oss4/oss4-mixer.c
index db7f0d278..cabd6b73a 100644
--- a/sys/oss4/oss4-mixer.c
+++ b/sys/oss4/oss4-mixer.c
@@ -850,7 +850,7 @@ static struct
/* Decent i18n is pretty much impossible with OSS's way of providing us with
* mixer labels (and the fact that they are pretty much random), but that
* doesn't mean we shouldn't at least try. */
-static const gchar *
+static gchar *
gst_oss4_mixer_control_get_translated_name (GstOss4MixerControl * mc)
{
gchar name[128] = { 0, };
@@ -866,11 +866,11 @@ gst_oss4_mixer_control_get_translated_name (GstOss4MixerControl * mc)
/* main virtual mixer controls (we hide the stream volumes) */
if (sscanf (mc->mixext.extname, "vmix%d-%32c", &dummy, vmix_str) == 2) {
if (strcmp (vmix_str, "src") == 0)
- return _("Virtual Mixer Input");
+ return g_strdup (_("Virtual Mixer Input"));
else if (strcmp (vmix_str, "vol") == 0)
- return _("Virtual Mixer Output");
+ return g_strdup (_("Virtual Mixer Output"));
else if (strcmp (vmix_str, "channels") == 0)
- return _("Virtual Mixer Channels");
+ return g_strdup (_("Virtual Mixer Channels"));
}
g_strlcpy (name, mc->mixext.extname, sizeof (name));
@@ -914,7 +914,7 @@ gst_oss4_mixer_control_get_translated_name (GstOss4MixerControl * mc)
for (i = 0; i < G_N_ELEMENTS (labels); ++i) {
if (g_strcasecmp (ptr, labels[i].oss_name) == 0) {
g_snprintf (name, sizeof (name), fmtbuf, _(labels[i].label), num);
- return g_quark_to_string (g_quark_from_string (name));
+ return g_strdup (name);
}
}
} while ((ptr = strchr (ptr, '.')) != NULL);
@@ -922,7 +922,7 @@ gst_oss4_mixer_control_get_translated_name (GstOss4MixerControl * mc)
/* failing that, just replace periods with spaces */
g_strdelimit (name, ".", ' ');
g_snprintf (scratch, sizeof (scratch), fmtbuf, name);
- return g_quark_to_string (g_quark_from_string (scratch)); /* eek */
+ return g_strdup (scratch);
}
static const gchar *
@@ -1505,12 +1505,11 @@ gst_oss4_mixer_create_tracks (GstOss4Mixer * mixer, const GList * controls)
if (track == NULL)
continue;
- /* The mixer API requires this to be g_strdup'd */
- track->label = g_strdup (gst_oss4_mixer_control_get_translated_name (mc));
+ track->label = gst_oss4_mixer_control_get_translated_name (mc);
track->flags = 0;
GST_LOG ("translated label: %s [%s] = %s", track->label, mc->mixext.id,
- gst_oss4_mixer_control_get_translated_name (mc));
+ track->label);
/* This whole 'a track is either INPUT or OUTPUT' model is just flawed,
* esp. if a slider's role can be changed on the fly, like when you change