init_db : write boolean to 'T' or 'F' instead of 0x1 or 0x0 96/137396/1 accepted/tizen/unified/20170706.193736 submit/tizen/20170706.010921
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 5 Jul 2017 12:21:45 +0000 (21:21 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 5 Jul 2017 12:21:45 +0000 (21:21 +0900)
- To prevent misunderstanding false as the end of string
- In addition, we can get the readbility

Change-Id: If94ec9337f4360f696c242664e5d32401da5f934
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/init_db/system_info_db_init.c
src/system_info.c

index 98245c9e388c1387f7e30cf8fca0bc231093a3bc..f3eb9e920b84e29d0279d0b20815024dd3a36f40 100644 (file)
@@ -95,7 +95,7 @@ static int db_set_value_foreach_runtime(GDBM_FILE *db, xmlNode *node,
        char value_intg[LANG_MAX];
        int ret;
 
-       memset(value_intg, strncmp(value, "true", 4) ? false : true, sizeof(value_intg));
+       memset(value_intg, strncmp(value, "true", 4) ? 'F' : 'T', sizeof(value_intg));
 
        for (rt = 0; rt < LANG_MAX; rt++) {
                if (!runtime[rt].xml_prop)
@@ -105,7 +105,7 @@ static int db_set_value_foreach_runtime(GDBM_FILE *db, xmlNode *node,
                if (!prop_val)
                        continue;
 
-               value_intg[runtime[rt].lang] = xmlStrcmp(prop_val, (xmlChar *)"on") ? false : true;
+               value_intg[runtime[rt].lang] = xmlStrcmp(prop_val, (xmlChar *)"on") ? 'F' : 'T';
 
                xmlFree(prop_val);
        }
index 487aa28e48ea5ca7af16acf20191c8821d08424e..4fbc050855035be0e42881ddc5b4ef05d56cedd8 100644 (file)
@@ -272,14 +272,14 @@ static int system_info_get_bool(enum tag_type tag, const char *key, bool *value)
                                if (!runtime[rt].runtime_type)
                                        break;
                                if (!strncmp(runtime_type, runtime[rt].runtime_type, RT_PREFIX)) {
-                                       *value = val[runtime[rt].lang];
+                                       *value = val[runtime[rt].lang] == 'T' ? true : false;
                                        return SYSTEM_INFO_ERROR_NONE;
                                }
                        }
                        _I("Unknown RUNTIME_TYPE, return default value");
                }
 
-               *value = val[runtime[DEFAULT].lang];
+               *value = val[runtime[DEFAULT].lang] == 'T' ? true : false;
                return SYSTEM_INFO_ERROR_NONE;
        }