From 40feb40b841e9c8b2fec5d21adf3c4b11fa8441e Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Wed, 5 Jul 2017 21:21:45 +0900 Subject: [PATCH] init_db : write boolean to 'T' or 'F' instead of 0x1 or 0x0 - To prevent misunderstanding false as the end of string - In addition, we can get the readbility Change-Id: If94ec9337f4360f696c242664e5d32401da5f934 Signed-off-by: Kichan Kwon --- src/init_db/system_info_db_init.c | 4 ++-- src/system_info.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/init_db/system_info_db_init.c b/src/init_db/system_info_db_init.c index 98245c9..f3eb9e9 100644 --- a/src/init_db/system_info_db_init.c +++ b/src/init_db/system_info_db_init.c @@ -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); } diff --git a/src/system_info.c b/src/system_info.c index 487aa28..4fbc050 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -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; } -- 2.7.4