Merge "Fix defect that is detected by static analysis tool" into tizen accepted/tizen/unified/20220922.114004
authorWonnam Jang <wn.jang@samsung.com>
Wed, 21 Sep 2022 10:53:29 +0000 (10:53 +0000)
committerGerrit Code Review <gerrit@review>
Wed, 21 Sep 2022 10:53:29 +0000 (10:53 +0000)
common/tts_config_parser.c
engine-parser/src/tts-engine-language-pack-parser.c
packaging/tts.spec

index 35494f6..8d495b9 100644 (file)
@@ -559,7 +559,7 @@ int tts_parser_load_config(void)
                } while (0 != ret);
 
                /* Set mode */
-               if (0 > chmod(TTS_CONFIG, 0600)) {
+               if (0 > chmod(TTS_CONFIG, 0644)) {
                        SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
                }
 
@@ -663,7 +663,7 @@ int tts_parser_copy_xml(const char* original, const char* destination)
        }
 
        /* Set mode */
-       if (0 > chmod(destination, 0600)) {
+       if (0 > chmod(destination, 0644)) {
                SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
        }
 
index 19507b7..2199bc3 100644 (file)
 #define TTS_TAG_ENGINE_VOICE                   "voice"
 #define TTS_TAG_ENGINE_VOICE_TYPE              "type"
 
-#define TTS_CONFIG_BASE                tzplatform_mkpath(TZ_USER_HOME, "share/.voice")
-#define TTS_HOME               tzplatform_mkpath(TZ_USER_HOME, "share/.voice/tts")
-#define TTS_ENGINE_BASE                tzplatform_mkpath(TZ_USER_HOME, "share/.voice/tts/1.0")
-#define TTS_ENGINE_INFO                tzplatform_mkpath(TZ_USER_SHARE, ".voice/tts/1.0/engine-info")
+#define TTS_GLOBAL_CONFIG_BASE         tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice")
+#define TTS_GLOBAL_HOME                tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice/tts")
+#define TTS_GLOBAL_ENGINE_INFO         tzplatform_mkpath(tzplatform_getid("TZ_SYS_GLOBALUSER_DATA"), ".voice/tts/engine-info")
 
 #define TTS_METADATA_LANGUAGE  "http://tizen.org/metadata/tts-engine-language-pack/language"
 
@@ -73,44 +72,35 @@ static int __save_engine_info_xml(const char *pkgid)
        LOGD("=== Save engine info doc");
 
        /* Make directories */
-       if (0 != access(TTS_CONFIG_BASE, F_OK)) {
-               if (0 != mkdir(TTS_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_CONFIG_BASE);
+       if (0 != access(TTS_GLOBAL_CONFIG_BASE, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_CONFIG_BASE);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_CONFIG_BASE);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_CONFIG_BASE);
                }
        }
 
-       if (0 != access(TTS_HOME, F_OK)) {
-               if (0 != mkdir(TTS_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_HOME);
+       if (0 != access(TTS_GLOBAL_HOME, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_HOME);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_HOME);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_HOME);
                }
        }
 
-       if (0 != access(TTS_ENGINE_BASE, F_OK)) {
-               if (0 != mkdir(TTS_ENGINE_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_ENGINE_BASE);
+       if (0 != access(TTS_GLOBAL_ENGINE_INFO, F_OK)) {
+               if (0 != mkdir(TTS_GLOBAL_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
+                       LOGE("[ERROR] Fail to make directory : %s", TTS_GLOBAL_ENGINE_INFO);
                        return -1;
                } else {
-                       LOGD("Success to make directory : %s", TTS_ENGINE_BASE);
-               }
-       }
-
-       if (0 != access(TTS_ENGINE_INFO, F_OK)) {
-               if (0 != mkdir(TTS_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-                       LOGE("[ERROR] Fail to make directory : %s", TTS_ENGINE_INFO);
-                       return -1;
-               } else {
-                       LOGD("Success to make directory : %s", TTS_ENGINE_INFO);
+                       LOGD("Success to make directory : %s", TTS_GLOBAL_ENGINE_INFO);
                }
        }
 
        char path[256] = {'\0',};
-       snprintf(path, 256, "%s/%s.xml", TTS_ENGINE_INFO, pkgid);
+       snprintf(path, 256, "%s/%s.xml", TTS_GLOBAL_ENGINE_INFO, pkgid);
        int ret = xmlSaveFormatFile(path, g_doc, 1);
        LOGD("xmlSaveFile (%d)", ret);
        LOGD("===");
@@ -121,7 +111,7 @@ static int __remove_engine_info_xml(const char *pkgid)
 {
        LOGD("=== Remove engine info doc");
        char path[256] = {'\0',};
-       snprintf(path, 256, "%s/%s.xml", TTS_ENGINE_INFO, pkgid);
+       snprintf(path, 256, "%s/%s.xml", TTS_GLOBAL_ENGINE_INFO, pkgid);
        if (0 == access(path, F_OK)) {
                LOGD("Remove engine info xml(%s)", path);
                remove(path);
index f7efa9e..7cbbb87 100644 (file)
@@ -1,6 +1,6 @@
 Name:       tts
 Summary:    Text To Speech client library and daemon
-Version:    1.70.9
+Version:    1.70.10
 Release:    1
 Group:      Graphics & UI Framework/Voice Framework
 License:    Apache-2.0