aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1999-09-28 04:56:29 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-09-28 04:56:29 +0800
commit241a65b72b3620f85bad00fac28d268e5f47d2d6 (patch)
tree94f749268b21a9ae37a71ff2ad2cb91cc23e311a
parent9d0b58bb8eb5a2180c6d38d7e45c9396331dc725 (diff)
downloadgsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar.gz
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar.bz2
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar.lz
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar.xz
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.tar.zst
gsoc2013-evolution-241a65b72b3620f85bad00fac28d268e5f47d2d6.zip
Small fix -miguel
svn path=/trunk/; revision=1265
-rw-r--r--calendar/ChangeLog24
-rw-r--r--calendar/Makefile.am8
-rw-r--r--calendar/cal-util/calobj.c60
-rw-r--r--calendar/calendar-conduit.c4
-rw-r--r--calendar/calendar-pilot-sync.c4
-rw-r--r--calendar/calendar.c17
-rw-r--r--calendar/calobj.c60
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c4
-rw-r--r--calendar/eventedit.c26
-rw-r--r--calendar/gncal-day-panel.c8
-rw-r--r--calendar/gncal-todo.c6
-rw-r--r--calendar/gnome-cal.c1
-rw-r--r--calendar/gnome-month-item.c8
-rw-r--r--calendar/goto.c18
-rw-r--r--calendar/gui/Makefile.am8
-rw-r--r--calendar/gui/calendar-conduit.c4
-rw-r--r--calendar/gui/calendar-pilot-sync.c4
-rw-r--r--calendar/gui/calendar.c17
-rw-r--r--calendar/gui/eventedit.c26
-rw-r--r--calendar/gui/gncal-day-panel.c8
-rw-r--r--calendar/gui/gncal-todo.c6
-rw-r--r--calendar/gui/gnome-cal.c1
-rw-r--r--calendar/gui/gnome-month-item.c8
-rw-r--r--calendar/gui/goto.c18
-rw-r--r--calendar/gui/month-view.c24
-rw-r--r--calendar/gui/prop.c10
-rw-r--r--calendar/gui/year-view.c16
-rw-r--r--calendar/month-view.c24
-rw-r--r--calendar/pcs/calobj.c60
-rw-r--r--calendar/prop.c10
-rw-r--r--calendar/year-view.c16
31 files changed, 270 insertions, 238 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index fc1b49a92d..1dcc43d0fb 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,27 @@
+1999-09-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * month-view.c (add_event): ditto
+ (mark_current_day): ditto
+ (month_view_set): ditto
+
+ * goto.c (goto_dialog): ditto.
+
+ * gnome-month-item.c (gnome_month_item_init): ditto.
+
+ * gncal-day-panel.c (gncal_day_panel_new): ditto.
+
+ * getdate.c (RelativeDate): ditto.
+
+ * eventedit.c (set_all_day): ditto.
+ (ee_rp_init_rule): ditto.
+
+ * calendar.c (vcalendar_create_from_calendar): ditto.
+
+ * calendar-conduit.c (update_record): ditto.
+
+ * calobj.c (ical_object_generate_events): Get rid of pointers to
+ values returned from localtime, as it uses a static buffer.
+
1999-09-26 Eskil Olsen <deity@eskil.dk>
* corba-cal.c: the g_free that was commented out since glib said
was a duplicate free, was supposed to be a free.
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 90aa6c628b..5ed3d8fbae 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -9,16 +9,16 @@ gnorba_DATA = gnomecal.gnorba
help_base = $(datadir)/gnome/help/cal
if HAVE_GNOME_PILOT
-bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-applet
+bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-appleta calendar-pilot-sync
else
bin_PROGRAMS = gnomecal
endif
-INCLUDES = \
+INCLUDES = \
-I$(includedir) \
$(GNOME_INCLUDEDIR) \
- $(GNOME_CONDUIT_INCLUDEDIR) \
- $(PISOCK_INCLUDEDIR) \
+ $(GNOME_CONDUIT_INCLUDEDIR) \
+ $(PISOCK_INCLUDEDIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
GNOMECAL_CORBA_GENERATED = \
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 7e1a3635db..806c27d8ff 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -231,9 +231,9 @@ weekdaylist (iCalObject *o, char **str)
} while (isalpha (**str));
if (o->recur->weekday == 0){
- struct tm *tm = localtime (&o->dtstart);
+ struct tm tm = *localtime (&o->dtstart);
- o->recur->weekday = 1 << tm->tm_wday;
+ o->recur->weekday = 1 << tm.tm_wday;
}
}
@@ -336,9 +336,9 @@ daynumberlist (iCalObject *o, char **str)
* Some broken applications set this to zero
*/
if (val == 0){
- struct tm *day = localtime (&o->dtstart);
+ struct tm day = *localtime (&o->dtstart);
- val = day->tm_mday;
+ val = day.tm_mday;
}
o->recur->u.month_day = val;
first = 1;
@@ -883,27 +883,27 @@ static VObject *
save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
{
VObject *alarm_object;
- struct tm *tm;
+ struct tm tm;
time_t alarm_time;
if (!alarm->enabled)
return NULL;
- tm = localtime (&ical->dtstart);
+ tm = *localtime (&ical->dtstart);
switch (alarm->units){
case ALARM_MINUTES:
- tm->tm_min -= alarm->count;
+ tm.tm_min -= alarm->count;
break;
case ALARM_HOURS:
- tm->tm_hour -= alarm->count;
+ tm.tm_hour -= alarm->count;
break;
case ALARM_DAYS:
- tm->tm_mday -= alarm->count;
+ tm.tm_mday -= alarm->count;
break;
}
- alarm_time = mktime (tm);
+ alarm_time = mktime (&tm);
alarm_object = addProp (o, alarm_names [alarm->type]);
addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
@@ -1100,15 +1100,15 @@ ical_foreach (GList *events, calendarfn fn, void *closure)
static int
is_date_in_list (GList *list, struct tm *date)
{
- struct tm *tm;
+ struct tm tm;
for (; list; list = list->next){
time_t *timep = list->data;
- tm = localtime (timep);
- if (date->tm_mday == tm->tm_mday &&
- date->tm_mon == tm->tm_mon &&
- date->tm_year == tm->tm_year){
+ tm = *localtime (timep);
+ if (date->tm_mday == tm.tm_mday &&
+ date->tm_mon == tm.tm_mon &&
+ date->tm_year == tm.tm_year){
return 1;
}
}
@@ -1238,13 +1238,13 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_WEEKLY:
do {
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&current);
+ tm = *localtime (&current);
if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
/* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm->tm_wday)) {
+ if (ico->recur->weekday & (1 << tm.tm_wday)) {
if (!generate (ico, current, cb, closure))
return;
}
@@ -1252,7 +1252,7 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
/* Advance by day for scanning the week or by interval at week end */
- if (tm->tm_wday == 6)
+ if (tm.tm_wday == 6)
current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
else
current = time_add_day (current, 1);
@@ -1371,24 +1371,24 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_MONTHLY_BY_DAY:
do {
- struct tm *tm;
+ struct tm tm;
time_t t;
int p;
- tm = localtime (&current);
+ tm = *localtime (&current);
- p = tm->tm_mday;
- tm->tm_mday = ico->recur->u.month_day;
- t = mktime (tm);
+ p = tm.tm_mday;
+ tm.tm_mday = ico->recur->u.month_day;
+ t = mktime (&tm);
if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
if (!generate (ico, t, cb, closure))
return;
/* Advance by the appropriate number of months */
- tm->tm_mday = p;
- tm->tm_mon += ico->recur->interval;
- current = mktime (tm);
+ tm.tm_mday = p;
+ tm.tm_mon += ico->recur->interval;
+ current = mktime (&tm);
if (current == -1) {
g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
@@ -1421,9 +1421,9 @@ static int
duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
{
int *count = closure;
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&start);
+ tm = *localtime (&start);
(*count)++;
if (ico->recur->duration == *count) {
@@ -1470,7 +1470,7 @@ ical_object_new_from_string (const char *vcal_string)
iCalObject *ical = NULL;
VObject *cal, *event;
VObjectIterator i;
- char *object_name;
+ const char *object_name;
cal = Parse_MIME (vcal_string, strlen (vcal_string));
diff --git a/calendar/calendar-conduit.c b/calendar/calendar-conduit.c
index 3fd110100a..68bcae0887 100644
--- a/calendar/calendar-conduit.c
+++ b/calendar/calendar-conduit.c
@@ -425,9 +425,9 @@ ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
obj->recur->weekday |= 1 << wd;
if (obj->recur->weekday == 0){
- struct tm *tm = localtime (&obj->dtstart);
+ struct tm tm = *localtime (&obj->dtstart);
- obj->recur->weekday = 1 << tm->tm_wday;
+ obj->recur->weekday = 1 << tm.tm_wday;
}
break;
}
diff --git a/calendar/calendar-pilot-sync.c b/calendar/calendar-pilot-sync.c
index e8261197af..f4bc821500 100644
--- a/calendar/calendar-pilot-sync.c
+++ b/calendar/calendar-pilot-sync.c
@@ -245,9 +245,9 @@ update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, in
obj->recur->weekday |= 1 << wd;
if (obj->recur->weekday == 0){
- struct tm *tm = localtime (&obj->dtstart);
+ struct tm tm = *localtime (&obj->dtstart);
- obj->recur->weekday = 1 << tm->tm_wday;
+ obj->recur->weekday = 1 << tm.tm_wday;
}
break;
}
diff --git a/calendar/calendar.c b/calendar/calendar.c
index e6c6dddf59..cffd2476c4 100644
--- a/calendar/calendar.c
+++ b/calendar/calendar.c
@@ -358,15 +358,15 @@ vcalendar_create_from_calendar (Calendar *cal)
VObject *vcal;
GList *l;
time_t now = time (NULL);
- struct tm *tm;
+ struct tm tm;
/* WE call localtime for the side effect of setting tzname */
- tm = localtime (&now);
+ tm = *localtime (&now);
vcal = newVObject (VCCalProp);
addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
#if defined(HAVE_TM_ZONE)
- addPropValue (vcal, VCTimeZoneProp, tm->tm_zone);
+ addPropValue (vcal, VCTimeZoneProp, tm.tm_zone);
#elif defined(HAVE_TZNAME)
addPropValue (vcal, VCTimeZoneProp, tzname[0]);
#endif
@@ -391,6 +391,9 @@ vcalendar_create_from_calendar (Calendar *cal)
addVObjectProp (vcal, obj);
}
+ cleanVObject (vcal);
+ cleanStrTbl ();
+
return vcal;
}
@@ -417,8 +420,8 @@ calendar_save (Calendar *cal, char *fname)
g_free (backup_name);
}
- fp = fopen(fname,"w");
- if (fp) {
+ fp = fopen(fname,"w");
+ if (fp) {
writeVObject(fp, vcal);
fclose(fp);
if (strcmp(cal->filename, fname)) {
@@ -430,10 +433,10 @@ calendar_save (Calendar *cal, char *fname)
cal->file_time = s.st_mtime;
} else {
dlg = gnome_message_box_new(_("Failed to save calendar!"),
- GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
+ GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
gtk_widget_show(dlg);
}
-
+
cleanVObject (vcal);
cleanStrTbl ();
}
diff --git a/calendar/calobj.c b/calendar/calobj.c
index 7e1a3635db..806c27d8ff 100644
--- a/calendar/calobj.c
+++ b/calendar/calobj.c
@@ -231,9 +231,9 @@ weekdaylist (iCalObject *o, char **str)
} while (isalpha (**str));
if (o->recur->weekday == 0){
- struct tm *tm = localtime (&o->dtstart);
+ struct tm tm = *localtime (&o->dtstart);
- o->recur->weekday = 1 << tm->tm_wday;
+ o->recur->weekday = 1 << tm.tm_wday;
}
}
@@ -336,9 +336,9 @@ daynumberlist (iCalObject *o, char **str)
* Some broken applications set this to zero
*/
if (val == 0){
- struct tm *day = localtime (&o->dtstart);
+ struct tm day = *localtime (&o->dtstart);
- val = day->tm_mday;
+ val = day.tm_mday;
}
o->recur->u.month_day = val;
first = 1;
@@ -883,27 +883,27 @@ static VObject *
save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
{
VObject *alarm_object;
- struct tm *tm;
+ struct tm tm;
time_t alarm_time;
if (!alarm->enabled)
return NULL;
- tm = localtime (&ical->dtstart);
+ tm = *localtime (&ical->dtstart);
switch (alarm->units){
case ALARM_MINUTES:
- tm->tm_min -= alarm->count;
+ tm.tm_min -= alarm->count;
break;
case ALARM_HOURS:
- tm->tm_hour -= alarm->count;
+ tm.tm_hour -= alarm->count;
break;
case ALARM_DAYS:
- tm->tm_mday -= alarm->count;
+ tm.tm_mday -= alarm->count;
break;
}
- alarm_time = mktime (tm);
+ alarm_time = mktime (&tm);
alarm_object = addProp (o, alarm_names [alarm->type]);
addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
@@ -1100,15 +1100,15 @@ ical_foreach (GList *events, calendarfn fn, void *closure)
static int
is_date_in_list (GList *list, struct tm *date)
{
- struct tm *tm;
+ struct tm tm;
for (; list; list = list->next){
time_t *timep = list->data;
- tm = localtime (timep);
- if (date->tm_mday == tm->tm_mday &&
- date->tm_mon == tm->tm_mon &&
- date->tm_year == tm->tm_year){
+ tm = *localtime (timep);
+ if (date->tm_mday == tm.tm_mday &&
+ date->tm_mon == tm.tm_mon &&
+ date->tm_year == tm.tm_year){
return 1;
}
}
@@ -1238,13 +1238,13 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_WEEKLY:
do {
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&current);
+ tm = *localtime (&current);
if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
/* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm->tm_wday)) {
+ if (ico->recur->weekday & (1 << tm.tm_wday)) {
if (!generate (ico, current, cb, closure))
return;
}
@@ -1252,7 +1252,7 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
/* Advance by day for scanning the week or by interval at week end */
- if (tm->tm_wday == 6)
+ if (tm.tm_wday == 6)
current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
else
current = time_add_day (current, 1);
@@ -1371,24 +1371,24 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_MONTHLY_BY_DAY:
do {
- struct tm *tm;
+ struct tm tm;
time_t t;
int p;
- tm = localtime (&current);
+ tm = *localtime (&current);
- p = tm->tm_mday;
- tm->tm_mday = ico->recur->u.month_day;
- t = mktime (tm);
+ p = tm.tm_mday;
+ tm.tm_mday = ico->recur->u.month_day;
+ t = mktime (&tm);
if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
if (!generate (ico, t, cb, closure))
return;
/* Advance by the appropriate number of months */
- tm->tm_mday = p;
- tm->tm_mon += ico->recur->interval;
- current = mktime (tm);
+ tm.tm_mday = p;
+ tm.tm_mon += ico->recur->interval;
+ current = mktime (&tm);
if (current == -1) {
g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
@@ -1421,9 +1421,9 @@ static int
duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
{
int *count = closure;
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&start);
+ tm = *localtime (&start);
(*count)++;
if (ico->recur->duration == *count) {
@@ -1470,7 +1470,7 @@ ical_object_new_from_string (const char *vcal_string)
iCalObject *ical = NULL;
VObject *cal, *event;
VObjectIterator i;
- char *object_name;
+ const char *object_name;
cal = Parse_MIME (vcal_string, strlen (vcal_string));
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 3fd110100a..68bcae0887 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -425,9 +425,9 @@ ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
obj->recur->weekday |= 1 << wd;
if (obj->recur->weekday == 0){
- struct tm *tm = localtime (&obj->dtstart);
+ struct tm tm = *localtime (&obj->dtstart);
- obj->recur->weekday = 1 << tm->tm_wday;
+ obj->recur->weekday = 1 << tm.tm_wday;
}
break;
}
diff --git a/calendar/eventedit.c b/calendar/eventedit.c
index ea15cd0d7f..926bb6f09c 100644
--- a/calendar/eventedit.c
+++ b/calendar/eventedit.c
@@ -182,22 +182,22 @@ check_times (GnomeDateEdit *gde, EventEditor *ee)
static void
set_all_day (GtkToggleButton *toggle, EventEditor *ee)
{
- struct tm *tm;
+ struct tm tm;
time_t start_t;
start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- tm->tm_hour = day_begin;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (tm));
+ tm = *localtime (&start_t);
+ tm.tm_hour = day_begin;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm));
if (toggle->active)
- tm->tm_hour = day_end;
+ tm.tm_hour = day_end;
else
- tm->tm_hour++;
+ tm.tm_hour++;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
+ gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm));
}
/* Convenience function to create a properly-configured date editor widget */
@@ -951,9 +951,9 @@ ee_rp_init_rule (EventEditor *ee)
GSList *group;
int i, page, day_period, week_period, month_period, year_period;
int week_vector, default_day, def_pos, def_off;
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&ee->ical->dtstart);
+ tm = *localtime (&ee->ical->dtstart);
f = gtk_frame_new (_("Recurrence rule"));
@@ -977,8 +977,8 @@ ee_rp_init_rule (EventEditor *ee)
/* Default to today */
- week_vector = 1 << tm->tm_wday;
- default_day = tm->tm_mday;
+ week_vector = 1 << tm.tm_wday;
+ default_day = tm.tm_mday;
def_pos = 0;
def_off = 0;
diff --git a/calendar/gncal-day-panel.c b/calendar/gncal-day-panel.c
index bd91a18346..f041e3d6dd 100644
--- a/calendar/gncal-day-panel.c
+++ b/calendar/gncal-day-panel.c
@@ -95,7 +95,7 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
{
GncalDayPanel *dpanel;
GtkWidget *w;
- struct tm *tm;
+ struct tm tm;
g_return_val_if_fail (calendar != NULL, NULL);
@@ -148,7 +148,7 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
/* Gtk calendar */
- tm = localtime (&start_of_day);
+ tm = *localtime (&start_of_day);
w = gtk_calendar_new ();
dpanel->gtk_calendar = GTK_CALENDAR (w);
@@ -157,8 +157,8 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
| GTK_CALENDAR_SHOW_DAY_NAMES
| (week_starts_on_monday
? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
- gtk_calendar_select_month (dpanel->gtk_calendar, tm->tm_mon, tm->tm_year + 1900);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm->tm_mday);
+ gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
+ gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar),
"day_selected_double_click",
(GtkSignalFunc) calendar_day_selected,
diff --git a/calendar/gncal-todo.c b/calendar/gncal-todo.c
index 05611e14e8..941eddf453 100644
--- a/calendar/gncal-todo.c
+++ b/calendar/gncal-todo.c
@@ -515,10 +515,10 @@ static char *
convert_time_t_to_char (time_t t)
{
char buf[100];
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&t);
- strftime(buf, sizeof (buf), "%m/%d/%Y", tm);
+ tm = *localtime (&t);
+ strftime(buf, sizeof (buf), "%m/%d/%Y", &tm);
return g_strdup (buf);
}
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
index 21d9b78969..88e2f0bdce 100644
--- a/calendar/gnome-cal.c
+++ b/calendar/gnome-cal.c
@@ -18,6 +18,7 @@
#include "year-view.h"
#include "timeutil.h"
#include "main.h"
+#include "corba-cal.h"
GnomeApp *parent_class;
diff --git a/calendar/gnome-month-item.c b/calendar/gnome-month-item.c
index 4b8a9d75ac..58e393e4ee 100644
--- a/calendar/gnome-month-item.c
+++ b/calendar/gnome-month-item.c
@@ -749,15 +749,15 @@ static void
gnome_month_item_init (GnomeMonthItem *mitem)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
/* Initialize to the current month by default */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- mitem->year = tm->tm_year + 1900;
- mitem->month = tm->tm_mon;
+ mitem->year = tm.tm_year + 1900;
+ mitem->month = tm.tm_mon;
mitem->x = 0.0;
mitem->y = 0.0;
diff --git a/calendar/goto.c b/calendar/goto.c
index 20479889aa..41609da678 100644
--- a/calendar/goto.c
+++ b/calendar/goto.c
@@ -28,7 +28,7 @@ update (void)
{
GnomeCanvasItem *item;
time_t t;
- struct tm *tm;
+ struct tm tm;
unmark_month_item (month_item);
mark_month_item (month_item, gnome_calendar->cal);
@@ -44,10 +44,10 @@ update (void)
}
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if (((tm->tm_year + 1900) == month_item->year) && (tm->tm_mon == month_item->month)) {
- current_index = gnome_month_item_day2index (month_item, tm->tm_mday);
+ if (((tm.tm_year + 1900) == month_item->year) && (tm.tm_mon == month_item->month)) {
+ current_index = gnome_month_item_day2index (month_item, tm.tm_mday);
g_assert (current_index != -1);
item = gnome_month_item_num2child (month_item,
@@ -254,12 +254,12 @@ goto_dialog (GnomeCalendar *gcal)
GtkWidget *hbox;
GtkWidget *w;
GtkWidget *days;
- struct tm *tm;
+ struct tm tm;
gnome_calendar = gcal;
current_index = -1;
- tm = localtime (&gnome_calendar->current_display);
+ tm = *localtime (&gnome_calendar->current_display);
goto_win = gnome_dialog_new (_("Go to date"),
GNOME_STOCK_BUTTON_CANCEL,
@@ -282,17 +282,17 @@ goto_dialog (GnomeCalendar *gcal)
* month_item to be created.
*/
- days = create_days (tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+ days = create_days (tm.tm_mday, tm.tm_mon, tm.tm_year + 1900);
/* Year */
- w = create_year (tm->tm_year + 1900);
+ w = create_year (tm.tm_year + 1900);
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
/* Month */
- w = create_months (tm->tm_mon);
+ w = create_months (tm.tm_mon);
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 90aa6c628b..5ed3d8fbae 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -9,16 +9,16 @@ gnorba_DATA = gnomecal.gnorba
help_base = $(datadir)/gnome/help/cal
if HAVE_GNOME_PILOT
-bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-applet
+bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-appleta calendar-pilot-sync
else
bin_PROGRAMS = gnomecal
endif
-INCLUDES = \
+INCLUDES = \
-I$(includedir) \
$(GNOME_INCLUDEDIR) \
- $(GNOME_CONDUIT_INCLUDEDIR) \
- $(PISOCK_INCLUDEDIR) \
+ $(GNOME_CONDUIT_INCLUDEDIR) \
+ $(PISOCK_INCLUDEDIR) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
GNOMECAL_CORBA_GENERATED = \
diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c
index 3fd110100a..68bcae0887 100644
--- a/calendar/gui/calendar-conduit.c
+++ b/calendar/gui/calendar-conduit.c
@@ -425,9 +425,9 @@ ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
obj->recur->weekday |= 1 << wd;
if (obj->recur->weekday == 0){
- struct tm *tm = localtime (&obj->dtstart);
+ struct tm tm = *localtime (&obj->dtstart);
- obj->recur->weekday = 1 << tm->tm_wday;
+ obj->recur->weekday = 1 << tm.tm_wday;
}
break;
}
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
index e8261197af..f4bc821500 100644
--- a/calendar/gui/calendar-pilot-sync.c
+++ b/calendar/gui/calendar-pilot-sync.c
@@ -245,9 +245,9 @@ update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, in
obj->recur->weekday |= 1 << wd;
if (obj->recur->weekday == 0){
- struct tm *tm = localtime (&obj->dtstart);
+ struct tm tm = *localtime (&obj->dtstart);
- obj->recur->weekday = 1 << tm->tm_wday;
+ obj->recur->weekday = 1 << tm.tm_wday;
}
break;
}
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
index e6c6dddf59..cffd2476c4 100644
--- a/calendar/gui/calendar.c
+++ b/calendar/gui/calendar.c
@@ -358,15 +358,15 @@ vcalendar_create_from_calendar (Calendar *cal)
VObject *vcal;
GList *l;
time_t now = time (NULL);
- struct tm *tm;
+ struct tm tm;
/* WE call localtime for the side effect of setting tzname */
- tm = localtime (&now);
+ tm = *localtime (&now);
vcal = newVObject (VCCalProp);
addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
#if defined(HAVE_TM_ZONE)
- addPropValue (vcal, VCTimeZoneProp, tm->tm_zone);
+ addPropValue (vcal, VCTimeZoneProp, tm.tm_zone);
#elif defined(HAVE_TZNAME)
addPropValue (vcal, VCTimeZoneProp, tzname[0]);
#endif
@@ -391,6 +391,9 @@ vcalendar_create_from_calendar (Calendar *cal)
addVObjectProp (vcal, obj);
}
+ cleanVObject (vcal);
+ cleanStrTbl ();
+
return vcal;
}
@@ -417,8 +420,8 @@ calendar_save (Calendar *cal, char *fname)
g_free (backup_name);
}
- fp = fopen(fname,"w");
- if (fp) {
+ fp = fopen(fname,"w");
+ if (fp) {
writeVObject(fp, vcal);
fclose(fp);
if (strcmp(cal->filename, fname)) {
@@ -430,10 +433,10 @@ calendar_save (Calendar *cal, char *fname)
cal->file_time = s.st_mtime;
} else {
dlg = gnome_message_box_new(_("Failed to save calendar!"),
- GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
+ GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
gtk_widget_show(dlg);
}
-
+
cleanVObject (vcal);
cleanStrTbl ();
}
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index ea15cd0d7f..926bb6f09c 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -182,22 +182,22 @@ check_times (GnomeDateEdit *gde, EventEditor *ee)
static void
set_all_day (GtkToggleButton *toggle, EventEditor *ee)
{
- struct tm *tm;
+ struct tm tm;
time_t start_t;
start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = localtime (&start_t);
- tm->tm_hour = day_begin;
- tm->tm_min = 0;
- tm->tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (tm));
+ tm = *localtime (&start_t);
+ tm.tm_hour = day_begin;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm));
if (toggle->active)
- tm->tm_hour = day_end;
+ tm.tm_hour = day_end;
else
- tm->tm_hour++;
+ tm.tm_hour++;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (tm));
+ gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm));
}
/* Convenience function to create a properly-configured date editor widget */
@@ -951,9 +951,9 @@ ee_rp_init_rule (EventEditor *ee)
GSList *group;
int i, page, day_period, week_period, month_period, year_period;
int week_vector, default_day, def_pos, def_off;
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&ee->ical->dtstart);
+ tm = *localtime (&ee->ical->dtstart);
f = gtk_frame_new (_("Recurrence rule"));
@@ -977,8 +977,8 @@ ee_rp_init_rule (EventEditor *ee)
/* Default to today */
- week_vector = 1 << tm->tm_wday;
- default_day = tm->tm_mday;
+ week_vector = 1 << tm.tm_wday;
+ default_day = tm.tm_mday;
def_pos = 0;
def_off = 0;
diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c
index bd91a18346..f041e3d6dd 100644
--- a/calendar/gui/gncal-day-panel.c
+++ b/calendar/gui/gncal-day-panel.c
@@ -95,7 +95,7 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
{
GncalDayPanel *dpanel;
GtkWidget *w;
- struct tm *tm;
+ struct tm tm;
g_return_val_if_fail (calendar != NULL, NULL);
@@ -148,7 +148,7 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
/* Gtk calendar */
- tm = localtime (&start_of_day);
+ tm = *localtime (&start_of_day);
w = gtk_calendar_new ();
dpanel->gtk_calendar = GTK_CALENDAR (w);
@@ -157,8 +157,8 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
| GTK_CALENDAR_SHOW_DAY_NAMES
| (week_starts_on_monday
? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
- gtk_calendar_select_month (dpanel->gtk_calendar, tm->tm_mon, tm->tm_year + 1900);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm->tm_mday);
+ gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
+ gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar),
"day_selected_double_click",
(GtkSignalFunc) calendar_day_selected,
diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c
index 05611e14e8..941eddf453 100644
--- a/calendar/gui/gncal-todo.c
+++ b/calendar/gui/gncal-todo.c
@@ -515,10 +515,10 @@ static char *
convert_time_t_to_char (time_t t)
{
char buf[100];
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&t);
- strftime(buf, sizeof (buf), "%m/%d/%Y", tm);
+ tm = *localtime (&t);
+ strftime(buf, sizeof (buf), "%m/%d/%Y", &tm);
return g_strdup (buf);
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 21d9b78969..88e2f0bdce 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -18,6 +18,7 @@
#include "year-view.h"
#include "timeutil.h"
#include "main.h"
+#include "corba-cal.h"
GnomeApp *parent_class;
diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c
index 4b8a9d75ac..58e393e4ee 100644
--- a/calendar/gui/gnome-month-item.c
+++ b/calendar/gui/gnome-month-item.c
@@ -749,15 +749,15 @@ static void
gnome_month_item_init (GnomeMonthItem *mitem)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
/* Initialize to the current month by default */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- mitem->year = tm->tm_year + 1900;
- mitem->month = tm->tm_mon;
+ mitem->year = tm.tm_year + 1900;
+ mitem->month = tm.tm_mon;
mitem->x = 0.0;
mitem->y = 0.0;
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index 20479889aa..41609da678 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -28,7 +28,7 @@ update (void)
{
GnomeCanvasItem *item;
time_t t;
- struct tm *tm;
+ struct tm tm;
unmark_month_item (month_item);
mark_month_item (month_item, gnome_calendar->cal);
@@ -44,10 +44,10 @@ update (void)
}
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if (((tm->tm_year + 1900) == month_item->year) && (tm->tm_mon == month_item->month)) {
- current_index = gnome_month_item_day2index (month_item, tm->tm_mday);
+ if (((tm.tm_year + 1900) == month_item->year) && (tm.tm_mon == month_item->month)) {
+ current_index = gnome_month_item_day2index (month_item, tm.tm_mday);
g_assert (current_index != -1);
item = gnome_month_item_num2child (month_item,
@@ -254,12 +254,12 @@ goto_dialog (GnomeCalendar *gcal)
GtkWidget *hbox;
GtkWidget *w;
GtkWidget *days;
- struct tm *tm;
+ struct tm tm;
gnome_calendar = gcal;
current_index = -1;
- tm = localtime (&gnome_calendar->current_display);
+ tm = *localtime (&gnome_calendar->current_display);
goto_win = gnome_dialog_new (_("Go to date"),
GNOME_STOCK_BUTTON_CANCEL,
@@ -282,17 +282,17 @@ goto_dialog (GnomeCalendar *gcal)
* month_item to be created.
*/
- days = create_days (tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+ days = create_days (tm.tm_mday, tm.tm_mon, tm.tm_year + 1900);
/* Year */
- w = create_year (tm->tm_year + 1900);
+ w = create_year (tm.tm_year + 1900);
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
/* Month */
- w = create_months (tm->tm_mon);
+ w = create_months (tm.tm_mon);
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
index 8f74d43d60..5df7b7a23d 100644
--- a/calendar/gui/month-view.c
+++ b/calendar/gui/month-view.c
@@ -621,7 +621,7 @@ static int
add_event (iCalObject *ico, time_t start, time_t end, void *data)
{
struct iter_info *ii;
- struct tm *tm;
+ struct tm tm;
time_t t;
time_t day_begin_time, day_end_time;
@@ -638,8 +638,8 @@ add_event (iCalObject *ico, time_t start, time_t end, void *data)
*/
do {
- tm = localtime (&day_begin_time);
- g_string_sprintfa (ii->strings[ii->first_day_index + tm->tm_mday - 1], "%s\n", ico->summary);
+ tm = *localtime (&day_begin_time);
+ g_string_sprintfa (ii->strings[ii->first_day_index + tm.tm_mday - 1], "%s\n", ico->summary);
/* Next day */
@@ -703,7 +703,7 @@ static void
mark_current_day (MonthView *mv)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
GnomeCanvasItem *item;
/* Unmark the old day */
@@ -722,10 +722,10 @@ mark_current_day (MonthView *mv)
/* Mark the new day */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if (((tm->tm_year + 1900) == mv->year) && (tm->tm_mon == mv->month)) {
- mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm->tm_mday);
+ if (((tm.tm_year + 1900) == mv->year) && (tm.tm_mon == mv->month)) {
+ mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm.tm_mday);
g_assert (mv->old_current_index != -1);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
@@ -740,7 +740,7 @@ mark_current_day (MonthView *mv)
void
month_view_set (MonthView *mv, time_t month)
{
- struct tm *tm;
+ struct tm tm;
char buf[100];
g_return_if_fail (mv != NULL);
@@ -748,12 +748,12 @@ month_view_set (MonthView *mv, time_t month)
/* Title */
- tm = localtime (&month);
+ tm = *localtime (&month);
- mv->year = tm->tm_year + 1900;
- mv->month = tm->tm_mon;
+ mv->year = tm.tm_year + 1900;
+ mv->month = tm.tm_mon;
- strftime (buf, 100, _("%B %Y"), tm);
+ strftime (buf, 100, _("%B %Y"), &tm);
gnome_canvas_item_set (mv->title,
"text", buf,
diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c
index 87fad703f4..129407293b 100644
--- a/calendar/gui/prop.c
+++ b/calendar/gui/prop.c
@@ -412,7 +412,7 @@ fake_mark_days (void)
static void
set_current_day (void)
{
- struct tm *tm;
+ struct tm tm;
time_t t;
GnomeCanvasItem *item;
int day_index;
@@ -420,16 +420,16 @@ set_current_day (void)
/* Set the date */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
gnome_canvas_item_set (month_item,
- "year", tm->tm_year + 1900,
- "month", tm->tm_mon,
+ "year", tm.tm_year + 1900,
+ "month", tm.tm_mon,
NULL);
/* Highlight current day */
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm->tm_mday);
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm.tm_mday);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_LABEL + day_index);
gnome_canvas_item_set (item,
"fill_color", color_spec_from_picker (COLOR_PROP_CURRENT_DAY_FG),
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index 6b338bfdec..5744b4a88f 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -629,7 +629,7 @@ static void
mark_current_day (YearView *yv)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
int month_index, day_index;
GnomeCanvasItem *item;
@@ -652,11 +652,11 @@ mark_current_day (YearView *yv)
/* Mark the new day */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if ((tm->tm_year + 1900) == yv->year) {
- month_index = tm->tm_mon;
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm->tm_mday);
+ if ((tm.tm_year + 1900) == yv->year) {
+ month_index = tm.tm_mon;
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm.tm_mday);
g_assert (day_index != -1);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
@@ -673,15 +673,15 @@ mark_current_day (YearView *yv)
void
year_view_set (YearView *yv, time_t year)
{
- struct tm *tm;
+ struct tm tm;
char buf[100];
int i;
g_return_if_fail (yv != NULL);
g_return_if_fail (IS_YEAR_VIEW (yv));
- tm = localtime (&year);
- yv->year = tm->tm_year + 1900;
+ tm = *localtime (&year);
+ yv->year = tm.tm_year + 1900;
/* Heading */
diff --git a/calendar/month-view.c b/calendar/month-view.c
index 8f74d43d60..5df7b7a23d 100644
--- a/calendar/month-view.c
+++ b/calendar/month-view.c
@@ -621,7 +621,7 @@ static int
add_event (iCalObject *ico, time_t start, time_t end, void *data)
{
struct iter_info *ii;
- struct tm *tm;
+ struct tm tm;
time_t t;
time_t day_begin_time, day_end_time;
@@ -638,8 +638,8 @@ add_event (iCalObject *ico, time_t start, time_t end, void *data)
*/
do {
- tm = localtime (&day_begin_time);
- g_string_sprintfa (ii->strings[ii->first_day_index + tm->tm_mday - 1], "%s\n", ico->summary);
+ tm = *localtime (&day_begin_time);
+ g_string_sprintfa (ii->strings[ii->first_day_index + tm.tm_mday - 1], "%s\n", ico->summary);
/* Next day */
@@ -703,7 +703,7 @@ static void
mark_current_day (MonthView *mv)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
GnomeCanvasItem *item;
/* Unmark the old day */
@@ -722,10 +722,10 @@ mark_current_day (MonthView *mv)
/* Mark the new day */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if (((tm->tm_year + 1900) == mv->year) && (tm->tm_mon == mv->month)) {
- mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm->tm_mday);
+ if (((tm.tm_year + 1900) == mv->year) && (tm.tm_mon == mv->month)) {
+ mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm.tm_mday);
g_assert (mv->old_current_index != -1);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
@@ -740,7 +740,7 @@ mark_current_day (MonthView *mv)
void
month_view_set (MonthView *mv, time_t month)
{
- struct tm *tm;
+ struct tm tm;
char buf[100];
g_return_if_fail (mv != NULL);
@@ -748,12 +748,12 @@ month_view_set (MonthView *mv, time_t month)
/* Title */
- tm = localtime (&month);
+ tm = *localtime (&month);
- mv->year = tm->tm_year + 1900;
- mv->month = tm->tm_mon;
+ mv->year = tm.tm_year + 1900;
+ mv->month = tm.tm_mon;
- strftime (buf, 100, _("%B %Y"), tm);
+ strftime (buf, 100, _("%B %Y"), &tm);
gnome_canvas_item_set (mv->title,
"text", buf,
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
index 7e1a3635db..806c27d8ff 100644
--- a/calendar/pcs/calobj.c
+++ b/calendar/pcs/calobj.c
@@ -231,9 +231,9 @@ weekdaylist (iCalObject *o, char **str)
} while (isalpha (**str));
if (o->recur->weekday == 0){
- struct tm *tm = localtime (&o->dtstart);
+ struct tm tm = *localtime (&o->dtstart);
- o->recur->weekday = 1 << tm->tm_wday;
+ o->recur->weekday = 1 << tm.tm_wday;
}
}
@@ -336,9 +336,9 @@ daynumberlist (iCalObject *o, char **str)
* Some broken applications set this to zero
*/
if (val == 0){
- struct tm *day = localtime (&o->dtstart);
+ struct tm day = *localtime (&o->dtstart);
- val = day->tm_mday;
+ val = day.tm_mday;
}
o->recur->u.month_day = val;
first = 1;
@@ -883,27 +883,27 @@ static VObject *
save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
{
VObject *alarm_object;
- struct tm *tm;
+ struct tm tm;
time_t alarm_time;
if (!alarm->enabled)
return NULL;
- tm = localtime (&ical->dtstart);
+ tm = *localtime (&ical->dtstart);
switch (alarm->units){
case ALARM_MINUTES:
- tm->tm_min -= alarm->count;
+ tm.tm_min -= alarm->count;
break;
case ALARM_HOURS:
- tm->tm_hour -= alarm->count;
+ tm.tm_hour -= alarm->count;
break;
case ALARM_DAYS:
- tm->tm_mday -= alarm->count;
+ tm.tm_mday -= alarm->count;
break;
}
- alarm_time = mktime (tm);
+ alarm_time = mktime (&tm);
alarm_object = addProp (o, alarm_names [alarm->type]);
addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
@@ -1100,15 +1100,15 @@ ical_foreach (GList *events, calendarfn fn, void *closure)
static int
is_date_in_list (GList *list, struct tm *date)
{
- struct tm *tm;
+ struct tm tm;
for (; list; list = list->next){
time_t *timep = list->data;
- tm = localtime (timep);
- if (date->tm_mday == tm->tm_mday &&
- date->tm_mon == tm->tm_mon &&
- date->tm_year == tm->tm_year){
+ tm = *localtime (timep);
+ if (date->tm_mday == tm.tm_mday &&
+ date->tm_mon == tm.tm_mon &&
+ date->tm_year == tm.tm_year){
return 1;
}
}
@@ -1238,13 +1238,13 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_WEEKLY:
do {
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&current);
+ tm = *localtime (&current);
if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
/* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm->tm_wday)) {
+ if (ico->recur->weekday & (1 << tm.tm_wday)) {
if (!generate (ico, current, cb, closure))
return;
}
@@ -1252,7 +1252,7 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
/* Advance by day for scanning the week or by interval at week end */
- if (tm->tm_wday == 6)
+ if (tm.tm_wday == 6)
current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
else
current = time_add_day (current, 1);
@@ -1371,24 +1371,24 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar
case RECUR_MONTHLY_BY_DAY:
do {
- struct tm *tm;
+ struct tm tm;
time_t t;
int p;
- tm = localtime (&current);
+ tm = *localtime (&current);
- p = tm->tm_mday;
- tm->tm_mday = ico->recur->u.month_day;
- t = mktime (tm);
+ p = tm.tm_mday;
+ tm.tm_mday = ico->recur->u.month_day;
+ t = mktime (&tm);
if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
if (!generate (ico, t, cb, closure))
return;
/* Advance by the appropriate number of months */
- tm->tm_mday = p;
- tm->tm_mon += ico->recur->interval;
- current = mktime (tm);
+ tm.tm_mday = p;
+ tm.tm_mon += ico->recur->interval;
+ current = mktime (&tm);
if (current == -1) {
g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
@@ -1421,9 +1421,9 @@ static int
duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
{
int *count = closure;
- struct tm *tm;
+ struct tm tm;
- tm = localtime (&start);
+ tm = *localtime (&start);
(*count)++;
if (ico->recur->duration == *count) {
@@ -1470,7 +1470,7 @@ ical_object_new_from_string (const char *vcal_string)
iCalObject *ical = NULL;
VObject *cal, *event;
VObjectIterator i;
- char *object_name;
+ const char *object_name;
cal = Parse_MIME (vcal_string, strlen (vcal_string));
diff --git a/calendar/prop.c b/calendar/prop.c
index 87fad703f4..129407293b 100644
--- a/calendar/prop.c
+++ b/calendar/prop.c
@@ -412,7 +412,7 @@ fake_mark_days (void)
static void
set_current_day (void)
{
- struct tm *tm;
+ struct tm tm;
time_t t;
GnomeCanvasItem *item;
int day_index;
@@ -420,16 +420,16 @@ set_current_day (void)
/* Set the date */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
gnome_canvas_item_set (month_item,
- "year", tm->tm_year + 1900,
- "month", tm->tm_mon,
+ "year", tm.tm_year + 1900,
+ "month", tm.tm_mon,
NULL);
/* Highlight current day */
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm->tm_mday);
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm.tm_mday);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_LABEL + day_index);
gnome_canvas_item_set (item,
"fill_color", color_spec_from_picker (COLOR_PROP_CURRENT_DAY_FG),
diff --git a/calendar/year-view.c b/calendar/year-view.c
index 6b338bfdec..5744b4a88f 100644
--- a/calendar/year-view.c
+++ b/calendar/year-view.c
@@ -629,7 +629,7 @@ static void
mark_current_day (YearView *yv)
{
time_t t;
- struct tm *tm;
+ struct tm tm;
int month_index, day_index;
GnomeCanvasItem *item;
@@ -652,11 +652,11 @@ mark_current_day (YearView *yv)
/* Mark the new day */
t = time (NULL);
- tm = localtime (&t);
+ tm = *localtime (&t);
- if ((tm->tm_year + 1900) == yv->year) {
- month_index = tm->tm_mon;
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm->tm_mday);
+ if ((tm.tm_year + 1900) == yv->year) {
+ month_index = tm.tm_mon;
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm.tm_mday);
g_assert (day_index != -1);
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
@@ -673,15 +673,15 @@ mark_current_day (YearView *yv)
void
year_view_set (YearView *yv, time_t year)
{
- struct tm *tm;
+ struct tm tm;
char buf[100];
int i;
g_return_if_fail (yv != NULL);
g_return_if_fail (IS_YEAR_VIEW (yv));
- tm = localtime (&year);
- yv->year = tm->tm_year + 1900;
+ tm = *localtime (&year);
+ yv->year = tm.tm_year + 1900;
/* Heading */