vconf-compat: add vconf_get_dbl, vconf_set_dbl 70/44070/1
authorSuchang Woo <suchang.woo@samsung.com>
Thu, 16 Jul 2015 11:38:31 +0000 (20:38 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Thu, 16 Jul 2015 11:38:31 +0000 (20:38 +0900)
Change-Id: I6a52f9c89f6738d51ad5f1d5a97e321c7049325c
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
vconf-compat/vconf.c
vconf-compat/vconf.h
vconf-compat/vconf.sym

index 18632e9..198c5fb 100644 (file)
@@ -560,6 +560,27 @@ EXPORT int vconf_set_str(const char *key, const char *strval)
        return r;
 }
 
+EXPORT int vconf_set_dbl(const char *key, double dblval)
+{
+       int r;
+       struct buxton_value *val;
+
+       if (!key) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       val = buxton_value_create_double(dblval);
+       if (!val)
+               return -1;
+
+       r = vconf_set(key, val);
+
+       buxton_value_free(val);
+
+       return r;
+}
+
 static int vconf_get(const char *key, enum buxton_key_type type,
                struct buxton_value **val)
 {
@@ -678,3 +699,30 @@ EXPORT char *vconf_get_str(const char *key)
        return str;
 }
 
+EXPORT int vconf_get_dbl(const char *key, double *dblval)
+{
+       int r;
+       struct buxton_value *val;
+       double d;
+
+       if (!key || !dblval) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       r = vconf_get(key, BUXTON_TYPE_DOUBLE, &val);
+       if (r == -1)
+               return -1;
+
+       r = buxton_value_get_double(val, &d);
+
+       buxton_value_free(val);
+
+       if (r == -1)
+               return -1;
+
+       *dblval = d;
+
+       return 0;
+}
+
index a75c80e..c43d345 100644 (file)
@@ -164,6 +164,16 @@ int vconf_set_bool(const char *key, int boolval);
 int vconf_set_str(const char *key, const char *strval);
 
 /**
+ * Set a double-precision float value
+ *
+ * @param[in] key the name of key
+ * @param[in] dblval a double value
+ * @return 0 on success, -1 on error
+ * @deprecated use buxton APIs
+ */
+int vconf_set_dbl(const char *key, double dblval);
+
+/**
  * Get an integer value
  *
  * @param[in] key the name of key
@@ -192,6 +202,16 @@ int vconf_get_bool(const char *key, int *boolval);
  */
 char *vconf_get_str(const char *key);
 
+/**
+ * Get a double-precision float value
+ *
+ * @param[in] key the name of key
+ * @param[out] dblval a pointer to a double value to be set
+ * @return 0 on success, -1 on error
+ * @deprecated use buxton APIs
+ */
+int vconf_get_dbl(const char *key, double *dblval);
+
 #ifdef __cplusplus
 }
 #endif
index b9c1b76..a76ac2e 100644 (file)
@@ -11,9 +11,11 @@ VCONF_BUXTON_1.0 {
                vconf_set_int;
                vconf_set_bool;
                vconf_set_str;
+               vconf_set_dbl;
                vconf_get_int;
                vconf_get_bool;
                vconf_get_str;
+               vconf_get_dbl;
        local:
                *;
 };