From: dyamy-lee Date: Tue, 24 Sep 2024 11:34:15 +0000 (+0900) Subject: checking personal xml file exist X-Git-Tag: accepted/tizen/unified/20240930.043752~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9235618bb49a92b932de8d74643be6a790538222;p=platform%2Fcore%2Fuifw%2Ftts.git checking personal xml file exist Before checking the access about personal xml file, check the existance first. If there is no file and no personal voice list, it is not an error. Only accessing fail and parsing error are defined an error. Change-Id: I9eb1cff2a39e02a11b2bb0141c0ad292c3f0171d --- diff --git a/common/tts_config_mgr.c b/common/tts_config_mgr.c index aae206a6..a28f407e 100644 --- a/common/tts_config_mgr.c +++ b/common/tts_config_mgr.c @@ -2242,8 +2242,7 @@ int __tts_config_mgr_print_personal_info(const char* engine_id) j++; } } else { - tts_parser_free_personal_info(info); - return -1; + SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices"); } tts_parser_free_personal_info(info); @@ -2508,9 +2507,7 @@ int tts_config_mgr_get_personal_voice_list(const char* engine_id, tts_config_sup j++; } } else { - SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] No personal voices list"); - tts_parser_free_personal_info(info); - return TTS_CONFIG_ERROR_INVALID_VOICE; + SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices"); } tts_parser_free_personal_info(info); @@ -2560,8 +2557,9 @@ int tts_config_mgr_check_duplicate_personal_voice(const char* engine_id, const c j++; } } else { - return -1; + SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal voices"); } + tts_parser_free_personal_info(info); return 0; } \ No newline at end of file diff --git a/common/tts_config_parser.c b/common/tts_config_parser.c index deb271a6..f0837088 100644 --- a/common/tts_config_parser.c +++ b/common/tts_config_parser.c @@ -258,6 +258,13 @@ int tts_parser_get_personal_info(const char* path, tts_personal_info_s** persona xmlDocPtr doc = NULL; xmlNodePtr cur = NULL; + struct stat sb; + int ret = stat(path, &sb); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal xml file"); + return 0; + } + if (0 == access(path, F_OK)) { SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Success to access to %s", path); doc = xmlParseFile(path);