From a25ff7904f6e797dfae28741306af5dd15483400 Mon Sep 17 00:00:00 2001 From: sumanth Date: Fri, 2 Dec 2011 12:41:23 +0530 Subject: [PATCH] prevent issues are fixed.Id:47337,55238,56400,56431,50159,55300,55301,5623156263. Change-Id: I023ece0b208eb2bdebcf63f9b449862602d1883e --- src/bin/test_fileselector.c | 9 +++++++-- src/bin/test_map.c | 7 ++++++- src/bin/test_panel.c | 2 +- src/lib/elm_calendar.c | 4 +++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/bin/test_fileselector.c b/src/bin/test_fileselector.c index 5d3ac87..3f5b271 100644 --- a/src/bin/test_fileselector.c +++ b/src/bin/test_fileselector.c @@ -119,6 +119,7 @@ test_fileselector(void *data __UNUSED__, void *event_info __UNUSED__) { Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt, *sep; + char *path = NULL; /* Set the locale according to the system pref. * If you dont do so the file selector will order the files list in @@ -147,8 +148,12 @@ test_fileselector(void *data __UNUSED__, elm_fileselector_is_save_set(fs, EINA_TRUE); /* make the file list a tree with dir expandable in place */ elm_fileselector_expandable_set(fs, EINA_FALSE); - /* start the fileselector in the home dir */ - elm_fileselector_path_set(fs, getenv("HOME")); + /* start the fileselector in the home dir + if home is not available, start from current dir */ + path = getenv("HOME"); + if (!path) + path = "."; + elm_fileselector_path_set(fs, path); /* allow fs to expand in x & y */ evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/bin/test_map.c b/src/bin/test_map.c index 8b1a033..3965469 100644 --- a/src/bin/test_map.c +++ b/src/bin/test_map.c @@ -348,6 +348,7 @@ static void map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Evas_Object *fs, *bg, *vbox, *hbox, *sep; + char *path = NULL; fs_win = elm_win_add(NULL, "fileselector", ELM_WIN_BASIC); elm_win_title_set(fs_win, "File Selector"); @@ -366,7 +367,11 @@ map_track_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED fs = elm_fileselector_add(fs_win); elm_fileselector_is_save_set(fs, EINA_TRUE); elm_fileselector_expandable_set(fs, EINA_FALSE); - elm_fileselector_path_set(fs, getenv("HOME")); + path = getenv("HOME"); + //if "HOME" is not available, set current dir. path + if (!path) + path = "."; + elm_fileselector_path_set(fs, path); evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(vbox, fs); diff --git a/src/bin/test_panel.c b/src/bin/test_panel.c index dcc7c58..ef89efc 100644 --- a/src/bin/test_panel.c +++ b/src/bin/test_panel.c @@ -90,7 +90,7 @@ _fill_list(Evas_Object *obj) Eina_List *dirs = NULL, *l; char *real; - if (!(d = opendir(getenv("HOME")))) return; + if ((!(getenv("HOME")))||(!(d = opendir(getenv("HOME"))))) return; while ((de = readdir(d))) { char buff[PATH_MAX]; diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c index 3ceb82f..89b52f7 100644 --- a/src/lib/elm_calendar.c +++ b/src/lib/elm_calendar.c @@ -711,6 +711,7 @@ elm_calendar_add(Evas_Object *parent) Widget_Data *wd; int i, t; Evas *e; + struct tm weekday_time; ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); @@ -758,7 +759,8 @@ elm_calendar_add(Evas_Object *parent) * just make it larger. :| */ char buf[20]; /* I don't know of a better way of doing it */ - if (strftime(buf, sizeof(buf), "%a", gmtime(&weekday))) + gmtime_r(&weekday, &weekday_time); + if (strftime(buf, sizeof(buf), "%a", &weekday_time)) { wd->weekdays[i] = eina_stringshare_add(buf); } -- 2.7.4