This email list is read-only. Emails sent to this list will be discarded
----------------------------------
mconf/keymanager.c | 36 ++++++++++++++++++++++++++++--------
mconf/mconf-dbus.h | 1 +
2 files changed, 29 insertions(+), 8 deletions(-)
New commits:
commit 3de7fafff11fed25fb229f5524bd8479509b88c6
Author: Todd Brandt <[EMAIL PROTECTED]>
Date: Tue Sep 16 12:18:45 2008 -0700
compile errors fixed
Diff in this email is a maximum of 400 lines.
diff --git a/mconf/keymanager.c b/mconf/keymanager.c
index b7073b6..bd03286 100644
--- a/mconf/keymanager.c
+++ b/mconf/keymanager.c
@@ -5,12 +5,10 @@ static GQuark error_quark;
enum
{
ERROR_VAL_NOT_INT,
+ ERROR_VAL_NOT_FLOAT,
+ ERROR_VAL_NOT_BOOLEAN,
ERROR_COUNT
};
-static gchar *errortext[ERROR_COUNT] = {
-
-};
-
/* Create a new key */
@@ -88,8 +86,14 @@ mconf_read_key_int(MconfServer *server,
if(read_key(server, key, val, error))
{
- sscanf(*val, "%d", value);
- ret = TRUE;
+ if(sscanf(*val, "%d", value) != 1)
+ {
+ g_set_error (error, error_quark, ERROR_VAL_NOT_INT,
+ _("The value is not an integer"));
+ ret = FALSE;
+ } else {
+ ret = TRUE;
+ }
}
return ret;
}
@@ -104,8 +108,14 @@ mconf_read_key_float(MconfServer *server,
if(read_key(server, key, val, error))
{
- sscanf(*val, "%lf", value);
- ret = TRUE;
+ if(sscanf(*val, "%lf", value) != 1)
+ {
+ g_set_error (error, error_quark, ERROR_VAL_NOT_FLOAT,
+ _("The value is not a float"));
+ ret = FALSE;
+ } else {
+ ret = TRUE;
+ }
}
return ret;
}
@@ -121,6 +131,16 @@ mconf_read_key_bool(MconfServer *server,
if(read_key(server, key, val, error))
{
+ if((sscanf(*val, "%d", &ival) != 1)||
+ ((ival != 0)&&(ival != 1)))
+ {
+ g_set_error (error, error_quark, ERROR_VAL_NOT_BOOLEAN,
+ _("The value is not a boolean"));
+ ret = FALSE;
+ } else {
+ *value = (ival != 0);
+ ret = TRUE;
+ }
ret = TRUE;
}
return ret;
diff --git a/mconf/mconf-dbus.h b/mconf/mconf-dbus.h
index f461aff..622e71b 100644
--- a/mconf/mconf-dbus.h
+++ b/mconf/mconf-dbus.h
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <config.h>
#include <glib-object.h>
+#include <glib/gi18n.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-bindings.h>
#include <dbus/dbus-glib-lowlevel.h>
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits