From bdb295fb3d618ac64b2473843273faf0e2408d8c Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 23 Dec 2016 17:28:42 +0900 Subject: [PATCH] Change deprecated api(readdir_r -> readdir) Change-Id: I64a910b280301347bda9eb7f5a1c8de509999a06 Signed-off-by: Suyeon Hwang --- client/stt_file.c | 7 +------ common/stt_config_mgr.c | 8 +------- engine-parser/src/stt-engine-parser.c | 4 ++-- server/sttd_server.c | 8 +------- 4 files changed, 5 insertions(+), 22 deletions(-) mode change 100644 => 100755 client/stt_file.c mode change 100644 => 100755 common/stt_config_mgr.c mode change 100644 => 100755 server/sttd_server.c diff --git a/client/stt_file.c b/client/stt_file.c old mode 100644 new mode 100755 index 11b4a35..030829f --- a/client/stt_file.c +++ b/client/stt_file.c @@ -359,16 +359,11 @@ int stt_file_initialize(void) /* Get file name from default engine directory */ DIR *dp = NULL; int ret = -1; - struct dirent entry; struct dirent *dirp = NULL; dp = opendir(STT_DEFAULT_ENGINE); if (NULL != dp) { do { - ret = readdir_r(dp, &entry, &dirp); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTFC, "[File ERROR] Fail to read directory"); - break; - } + dirp = readdir(dp); if (NULL != dirp) { if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) diff --git a/common/stt_config_mgr.c b/common/stt_config_mgr.c old mode 100644 new mode 100755 index d7e3105..b7cf83b --- a/common/stt_config_mgr.c +++ b/common/stt_config_mgr.c @@ -657,8 +657,6 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) static void __get_engine_list(const char* directory) { DIR *dp = NULL; - int ret = -1; - struct dirent entry; struct dirent *dirp = NULL; if (NULL == directory) { @@ -669,11 +667,7 @@ static void __get_engine_list(const char* directory) dp = opendir(directory); if (NULL != dp) { do { - ret = readdir_r(dp, &entry, &dirp); - if (0 != ret) { - SLOG(LOG_ERROR, stt_tag(), "[File ERROR] Fail to read directory"); - break; - } + dirp = readdir(dp); if (NULL != dirp) { if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) diff --git a/engine-parser/src/stt-engine-parser.c b/engine-parser/src/stt-engine-parser.c index 52a89dd..a7d297d 100755 --- a/engine-parser/src/stt-engine-parser.c +++ b/engine-parser/src/stt-engine-parser.c @@ -150,7 +150,7 @@ static void __insert_language_from_metadata(xmlNodePtr root, const char *languag languages_node = xmlNewNode(NULL, (const xmlChar*)STT_TAG_ENGINE_LANGUAGE_SET); lang = strsep(&tmp_lang, ","); - while(NULL != lang) { + while (NULL != lang) { LOGD("lang (%s)", lang); lang_node = xmlNewNode(NULL, (const xmlChar*)STT_TAG_ENGINE_LANGUAGE); xmlNodeSetContent(lang_node, (const xmlChar*)lang); @@ -171,7 +171,7 @@ int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgid, const char *appid, GList * uid_t uid = 0; int ret = -1; ret = pkgmgr_installer_info_get_target_uid(&uid); - if (ret < 0 ) { + if (ret < 0) { LOGE("[ERROR] Fail to get target uid"); return 0; } else { diff --git a/server/sttd_server.c b/server/sttd_server.c old mode 100644 new mode 100755 index d2f0bf2..591dd6d --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -542,9 +542,7 @@ int sttd_finalize() static void __read_proc() { DIR *dp = NULL; - struct dirent entry; struct dirent *dirp = NULL; - int ret = -1; int tmp; GList *iter = NULL; @@ -561,11 +559,7 @@ static void __read_proc() SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open proc"); } else { do { - ret = readdir_r(dp, &entry, &dirp); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to readdir"); - break; - } + dirp = readdir(dp); if (NULL != dirp) { tmp = atoi(dirp->d_name); -- 2.7.4