doc = xmlParseFile(path);
if (doc == NULL) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse xml file");
return -1;
}
if (cur == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_BASE_TAG)) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT 'tts-engine'");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
if (cur == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
xmlFree(attr);
} else {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE_TYPE);
+ free(temp_voice);
+ temp_voice = NULL;
+ continue;
}
key = xmlNodeGetContent(voice_node);
SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE);
if (NULL != temp_voice) {
free(temp_voice);
+ temp_voice = NULL;
}
}
}
temp->pitch_support = true;
}
xmlFree(key);
+ key = NULL;
} else {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_PITCH_SUPPORT);
}
}
xmlFreeDoc(doc);
+ doc = NULL;
if (NULL == temp->name || NULL == temp->uuid) {
/* Invalid engine */
xmlChar *key;
bool is_default_open = false;
+ /* For Thread safety */
+ xmlInitParser();
+
if (0 != access(TTS_CONFIG, F_OK)) {
doc = xmlParseFile(TTS_DEFAULT_CONFIG);
if (doc == NULL) {
if (cur == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
if (cur == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
int tts_parser_unload_config(tts_config_s* config_info)
{
- if (NULL != g_config_doc) xmlFreeDoc(g_config_doc);
+ if (NULL != g_config_doc) {
+ xmlFreeDoc(g_config_doc);
+ g_config_doc = NULL;
+ }
if (NULL != config_info) {
if (NULL != config_info->engine_id) free(config_info->engine_id);
if (NULL != config_info->setting) free(config_info->setting);
if (cur_new == NULL || cur_old == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_BASE_TAG)) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
if (cur_new == NULL || cur_old == NULL) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
xmlFreeDoc(doc);
+ doc = NULL;
return -1;
}
cur_new = cur_new->next;
cur_old = cur_old->next;
}
-
- xmlFreeDoc(g_config_doc);
+
+ if (NULL != g_config_doc) {
+ xmlFreeDoc(g_config_doc);
+ g_config_doc = NULL;
+ }
g_config_doc = doc;
return 0;
if (SOUND_MANAGER_ERROR_NONE != ret) {
SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to acquire focus");
}
- ret = audio_out_set_stream_info(g_audio_h, g_stream_info_h);
- if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to set stream info");
- }
+ }
+ ret = audio_out_set_stream_info(g_audio_h, g_stream_info_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to set stream info");
}
return;
int ttse_set_private_data_set_cb(ttse_private_data_set_cb callback_func)
{
+ if (NULL == callback_func) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid parameter");
+ return TTSE_ERROR_INVALID_PARAMETER;
+ }
+
int ret = ttsd_set_private_data_set_cb(callback_func);
if (0 != ret) {
int ttse_set_private_data_requested_cb(ttse_private_data_requested_cb callback_func)
{
+ if (NULL == callback_func) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid parameter");
+ return TTSE_ERROR_INVALID_PARAMETER;
+ }
+
int ret = ttsd_set_private_data_requested_cb(callback_func);
if (0 != ret) {