Fixed svace
[apps/core/preloaded/indicator-win.git] / modules / clock / clock.c
index 2042d97..27c705f 100644 (file)
@@ -39,9 +39,9 @@
 
 #define SYSTEM_RESUME          "system_wakeup"
 
-#define TIME_FONT_SIZE_24              ELM_SCALE_SIZE(14)
-#define TIME_FONT_SIZE_12              ELM_SCALE_SIZE(14)
-#define AMPM_FONT_SIZE         ELM_SCALE_SIZE(13)
+#define TIME_FONT_SIZE_24              ELM_SCALE_SIZE(30)
+#define TIME_FONT_SIZE_12              ELM_SCALE_SIZE(30)
+#define AMPM_FONT_SIZE         ELM_SCALE_SIZE(29)
 
 #define TIME_FONT_COLOR                200, 200, 200, 255
 #define AMPM_FONT_COLOR                200, 200, 200, 255
@@ -170,7 +170,7 @@ static void indicator_clock_changed_cb(void *data)
 
        /* Set time */
        ctime = time(NULL);
-       ts = localtime(&ctime);
+       localtime_r(&ctime, ts);
        if (ts == NULL) {
                _E("Fail to get localtime !");
                return;
@@ -423,7 +423,7 @@ static int register_clock_module(void *data)
 
 static int unregister_clock_module(void)
 {
-       int ret;
+       int ret = 0;
 
        //ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_TIME_CHANGED);
        ret = ret | vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT_TIME1224, regionformat_changed);
@@ -467,6 +467,8 @@ static char *_string_replacer(const char *src, const char *pattern, const char *
        int idx = 0;
        int out_idx = 0;
        int out_sz = 0;
+       int replace_len = 0;
+
        enum {
                STATE_START,
                STATE_FIND,
@@ -484,6 +486,12 @@ static char *_string_replacer(const char *src, const char *pattern, const char *
                return NULL;
        }
 
+       replace_len = strlen(replace);
+       if (replace_len) {
+               ERR("Ratio");
+               return NULL;
+       }
+
        out_idx = 0;
        for (state = STATE_START, ptr = src; state != STATE_END; ptr++) {
                switch (state) {
@@ -521,7 +529,7 @@ static char *_string_replacer(const char *src, const char *pattern, const char *
      * If there is no space for copying the replacement,
      * Extend size of the return buffer.
      */
-                               if (out_sz - out_idx < strlen(replace) + 1) {
+                               if (out_sz - out_idx < replace_len + 1) {
                                        tmp = _extend_heap(ret, &out_sz, strlen(replace) + 1);
                                        if (!tmp) {
                                                free(ret);
@@ -530,7 +538,7 @@ static char *_string_replacer(const char *src, const char *pattern, const char *
                                        ret = tmp;
                                }
 
-                               strcpy(ret + out_idx, replace);
+                               strncpy(ret + out_idx, replace, replace_len);
                                out_idx += strlen(replace);
 
                                state = STATE_FIND;
@@ -693,11 +701,11 @@ void indicator_get_time_by_region(char* output,void *data)
 
        if(clock_mode == INDICATOR_CLOCK_MODE_12H)
        {
-               strcpy(time_skeleton,"hm");
+               strncpy(time_skeleton,"hm", 2);
        }
        else
        {
-               strcpy(time_skeleton,"Hm");
+               strncpy(time_skeleton,"Hm", 2);
        }
        char* timezone_id = NULL;
        timezone_id = util_get_timezone_str();
@@ -731,9 +739,10 @@ void indicator_get_time_by_region(char* output,void *data)
                                    bestPatternCapacity, &status);
 
        char a_best_pattern[64] = {0,};
+       char *last_pattern = NULL;
        u_austrcpy(a_best_pattern, bestPattern);
-       char *a_best_pattern_fixed = strtok(a_best_pattern, "a");
-       a_best_pattern_fixed = strtok(a_best_pattern_fixed, " ");
+       char *a_best_pattern_fixed = strtok_r(a_best_pattern, "a", &last_pattern);
+       a_best_pattern_fixed = strtok_r(a_best_pattern_fixed, " ", &last_pattern);
        if(a_best_pattern_fixed)
        {
                u_uastrcpy(bestPattern, a_best_pattern_fixed);