summaryrefslogtreecommitdiffstats
path: root/gtk/src/values.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-09-08 02:13:48 +0000
committerjstebbins <[email protected]>2008-09-08 02:13:48 +0000
commit4d231bd034d3f73efae01eee686896234c202a85 (patch)
tree97641b0afecfd6d8e167e276198f75b8de7b3e63 /gtk/src/values.c
parentee19debd964cbd40df6097f34be0076162700550 (diff)
LinGui: yikes, this thing leaks worse than my roof, fixed
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1677 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/values.c')
-rw-r--r--gtk/src/values.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/gtk/src/values.c b/gtk/src/values.c
index b6be28af4..0f6c43285 100644
--- a/gtk/src/values.c
+++ b/gtk/src/values.c
@@ -48,101 +48,111 @@ ghb_value_dup(const GValue *val)
gint
ghb_value_int(const GValue *val)
{
+ gint result;
+
if (val == NULL) return 0;
- const GValue *gval;
GValue xform = {0,};
if (G_VALUE_TYPE(val) != G_TYPE_INT64)
{
g_value_init(&xform, G_TYPE_INT64);
if (!g_value_transform(val, &xform))
return 0;
- gval = &xform;
+ result = (gint)g_value_get_int64(&xform);
+ g_value_unset(&xform);
}
else
{
- gval = val;
+ result = (gint)g_value_get_int64(val);
}
- return (gint)g_value_get_int64(gval);
+ return result;
}
gint64
ghb_value_int64(const GValue *val)
{
+ gint64 result;
+
if (val == NULL) return 0;
- const GValue *gval;
GValue xform = {0,};
if (G_VALUE_TYPE(val) != G_TYPE_INT64)
{
g_value_init(&xform, G_TYPE_INT64);
if (!g_value_transform(val, &xform))
return 0;
- gval = &xform;
+ result = g_value_get_int64(&xform);
+ g_value_unset(&xform);
}
else
{
- gval = val;
+ result = g_value_get_int64(val);
}
- return g_value_get_int64(gval);
+ return result;
}
gdouble
ghb_value_double(const GValue *val)
{
+ gdouble result;
+
if (val == NULL) return 0;
- const GValue *gval;
GValue xform = {0,};
if (G_VALUE_TYPE(val) != G_TYPE_DOUBLE)
{
g_value_init(&xform, G_TYPE_DOUBLE);
if (!g_value_transform(val, &xform))
return 0;
- gval = &xform;
+ result = g_value_get_double(&xform);
+ g_value_unset(&xform);
}
else
{
- gval = val;
+ result = g_value_get_double(val);
}
- return g_value_get_double(gval);
+ return result;
}
gchar*
ghb_value_string(const GValue *val)
{
+ gchar *result;
+
if (val == NULL) return 0;
- const GValue *gval;
GValue xform = {0,};
if (G_VALUE_TYPE(val) != G_TYPE_STRING)
{
g_value_init(&xform, G_TYPE_STRING);
if (!g_value_transform(val, &xform))
return NULL;
- gval = &xform;
+ result = g_strdup(g_value_get_string(&xform));
+ g_value_unset(&xform);
}
else
{
- gval = val;
+ result = g_strdup(g_value_get_string(val));
}
- return g_strdup(g_value_get_string(gval));
+ return result;
}
gboolean
ghb_value_boolean(const GValue *val)
{
+ gboolean result;
+
if (val == NULL) return FALSE;
- const GValue *gval;
GValue xform = {0,};
if (G_VALUE_TYPE(val) != G_TYPE_BOOLEAN)
{
g_value_init(&xform, G_TYPE_BOOLEAN);
if (!g_value_transform(val, &xform))
return FALSE;
- gval = &xform;
+ result = g_value_get_boolean(&xform);
+ g_value_unset(&xform);
}
else
{
- gval = val;
+ result = g_value_get_boolean(val);
}
- return g_value_get_boolean(gval);
+ return result;
}
gint
@@ -446,9 +456,9 @@ ghb_value_set_combodata(
{
ghb_combodata_t combodata;
combodata.index = index;
- combodata.option = g_strdup(option);
- combodata.shortOpt = g_strdup(shortOpt);
- combodata.svalue = g_strdup(svalue);
+ combodata.option = (gchar*)option;
+ combodata.shortOpt = (gchar*)shortOpt;
+ combodata.svalue = (gchar*)svalue;
combodata.ivalue = ivalue;
g_value_set_boxed(gval, &combodata);
}