Change-Id: Icff1631b05f0ad6172c7824834e09b2ddd722c30
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
}
/* get file name from engine directory and get engine information from each filename */
}
/* get file name from engine directory and get engine information from each filename */
- DIR *dp;
- struct dirent *dirp;
+ DIR *dp = NULL;
+ int ret = -1;
+ struct dirent entry;
+ struct dirent *dirp = NULL;
dp = opendir(TTS_DEFAULT_ENGINE);
if (dp != NULL) {
dp = opendir(TTS_DEFAULT_ENGINE);
if (dp != NULL) {
- while ((dirp = readdir(dp)) != NULL) {
- ttsengine_info_s* info;
- char* filepath = NULL;
- int file_size;
+ do {
+ ret = readdir_r(dp, &entry, &dirp);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to read directory");
+ break;
+ }
- file_size = strlen(TTS_DEFAULT_ENGINE) + strlen(dirp->d_name) + 5;
- filepath = (char*)calloc(file_size, sizeof(char));
+ if (NULL != dirp) {
+ ttsengine_info_s* info;
+ char* filepath = NULL;
+ int file_size;
- if (NULL != filepath) {
- snprintf(filepath, file_size, "%s/%s", TTS_DEFAULT_ENGINE, dirp->d_name);
- } else {
- SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!");
- continue;
- }
+ file_size = strlen(TTS_DEFAULT_ENGINE) + strlen(dirp->d_name) + 5;
+ filepath = (char*)calloc(file_size, sizeof(char));
- /* get its info and update engine list */
- if (0 == __internal_get_engine_info(filepath, &info)) {
- /* add engine info to g_engine_list */
- g_engine_list = g_list_append(g_engine_list, info);
- }
+ if (NULL != filepath) {
+ snprintf(filepath, file_size, "%s/%s", TTS_DEFAULT_ENGINE, dirp->d_name);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
+ continue;
+ }
- if (NULL != filepath) free(filepath);
- }
+ /* get its info and update engine list */
+ if (0 == __internal_get_engine_info(filepath, &info)) {
+ /* add engine info to g_engine_list */
+ g_engine_list = g_list_append(g_engine_list, info);
+ }
+
+ if (NULL != filepath) free(filepath);
+ }
+ } while (NULL != dirp);
dp = opendir(TTS_DOWNLOAD_ENGINE);
if (dp != NULL) {
dp = opendir(TTS_DOWNLOAD_ENGINE);
if (dp != NULL) {
- while ((dirp = readdir(dp)) != NULL) {
- ttsengine_info_s* info;
- char* filepath = NULL;
- int file_size;
+ do {
+ ret = readdir_r(dp, &entry, &dirp);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to read directory");
+ break;
+ }
- file_size = strlen(TTS_DOWNLOAD_ENGINE) + strlen(dirp->d_name) + 5;
- filepath = (char*)calloc(file_size, sizeof(char));
+ if (NULL != dirp) {
+ ttsengine_info_s* info;
+ char* filepath = NULL;
+ int file_size;
- if (NULL != filepath) {
- snprintf(filepath, file_size, "%s/%s", TTS_DOWNLOAD_ENGINE, dirp->d_name);
- } else {
- SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!");
- continue;
- }
+ file_size = strlen(TTS_DOWNLOAD_ENGINE) + strlen(dirp->d_name) + 5;
+ filepath = (char*)calloc(file_size, sizeof(char));
- /* get its info and update engine list */
- if (0 == __internal_get_engine_info(filepath, &info)) {
- /* add engine info to g_engine_list */
- g_engine_list = g_list_append(g_engine_list, info);
- }
+ if (NULL != filepath) {
+ snprintf(filepath, file_size, "%s/%s", TTS_DOWNLOAD_ENGINE, dirp->d_name);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
+ continue;
+ }
- if (NULL != filepath) free(filepath);
- }
+ /* get its info and update engine list */
+ if (0 == __internal_get_engine_info(filepath, &info)) {
+ /* add engine info to g_engine_list */
+ g_engine_list = g_list_append(g_engine_list, info);
+ }
+
+ if (NULL != filepath) free(filepath);
+ }
+ } while (NULL != dirp);
int thread_count = ecore_thread_active_get();
int count = 0;
while (0 < thread_count) {
int thread_count = ecore_thread_active_get();
int count = 0;
while (0 < thread_count) {
count++;
if (100 == count) {
count++;
if (100 == count) {