summaryrefslogtreecommitdiffstats
path: root/gtk/src/values.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-03-05 20:28:11 +0000
committerjstebbins <[email protected]>2015-03-05 20:28:11 +0000
commit61f752e2436c34bbb36d5f50df95bf48b1932b4c (patch)
treea469546211dbbce716554e465bb8cd9e661c1a3f /gtk/src/values.c
parente008f370034803a0ca3d1389d919f2a145c0d605 (diff)
LinGui: random clean-ups
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6964 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/values.c')
-rw-r--r--gtk/src/values.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/gtk/src/values.c b/gtk/src/values.c
index 39f7303d8..966fda8fe 100644
--- a/gtk/src/values.c
+++ b/gtk/src/values.c
@@ -323,14 +323,7 @@ ghb_string_value(const gchar *str)
static GValue gval = {0,};
if (!G_IS_VALUE(&gval))
g_value_init(&gval, G_TYPE_STRING);
- if (str == NULL)
- {
- g_value_set_string(&gval, "");
- }
- else
- {
- g_value_set_string(&gval, str);
- }
+ g_value_set_string(&gval, str);
return &gval;
}
@@ -377,7 +370,6 @@ ghb_boolean_value(gboolean bval)
GValue*
ghb_string_value_new(const gchar *str)
{
- if (str == NULL) str = "";
GValue *gval = ghb_value_new(G_TYPE_STRING);
g_value_set_string(gval, str);
return gval;
@@ -739,9 +731,13 @@ xform_string_int(const GValue *sval, GValue *ival)
gchar *end;
const gchar *str = g_value_get_string(sval);
- gint val = g_strtod(str, &end);
- if (*end)
- val = (guint)(~0)>>1;
+ gint val = 0;
+ if (str != NULL)
+ {
+ val = g_strtod(str, &end);
+ if (*end)
+ val = (guint)(~0)>>1;
+ }
g_value_set_int(ival, val);
}
@@ -750,9 +746,13 @@ xform_string_int64(const GValue *sval, GValue *ival)
{
gchar *end;
const gchar *str = g_value_get_string(sval);
- gint64 val = g_strtod(str, &end);
- if (*end)
- val = (guint64)(~0L)>>1;
+ gint64 val = 0;
+ if (str != NULL)
+ {
+ val = g_strtod(str, &end);
+ if (*end)
+ val = (guint64)(~0L)>>1;
+ }
g_value_set_int64(ival, val);
}
@@ -760,7 +760,9 @@ static void
xform_string_double(const GValue *sval, GValue *dval)
{
const gchar *str = g_value_get_string(sval);
- double val = g_strtod(str, NULL);
+ double val = 0.0;
+ if (str != NULL)
+ val = g_strtod(str, NULL);
g_value_set_double(dval, val);
}