/*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2017 Colin Leroy <colin@colino.net> and
- * the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2023 the Claws Mail team and Colin Leroy <colin@colino.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
);
if (!calendar) {
- g_warning ("can't generate calendar");
+ g_warning("can't generate calendar");
g_free(organizer);
g_free(tmpfile);
g_free(attendee);
ICAL_VEVENT_COMPONENT, (void*)0);
if (!ievent) {
- g_warning ("can't generate event");
+ g_warning("can't generate event");
g_free(organizer);
g_free(tmpfile);
g_free(attendee);
day, dd, mon, yyyy, hh, mm, ss, tzoffset(&t));
#else
GDateTime *dt = g_date_time_new_from_unix_local(t);
- gchar *buf2 = g_date_time_format(dt, "%a, %e %b %Y %H:%M:%S %z");
+ if (dt == NULL) {
+ g_warning("failed getting date/time");
+ g_snprintf(buf, len, "(NULL)");
+ return;
+ }
+
+ gchar *ret = g_date_time_format(dt, "%a, %e %b %Y %T %z");
g_date_time_unref(dt);
- strncpy(buf, buf2, len);
- g_free(buf2);
+
+ if (ret == NULL) {
+ g_warning("failed formatting date/time");
+ g_snprintf(buf, len, "(NULL)");
+ return;
+ }
+
+ g_snprintf(buf, len, ret);
+ g_free(ret);
#endif
}
);
if (!calendar) {
- g_warning ("can't generate calendar");
+ g_warning("can't generate calendar");
g_free(tmpfile);
icalcomponent_free(ievent);
return NULL;
xml_tag_add_attr(tag, xml_attr_new("type", tmp));
g_free(tmp);
- tmp = g_strdup_printf("%ld", event->postponed);
+ tmp = g_strdup_printf("%"CM_TIME_FORMAT, event->postponed);
xml_tag_add_attr(tag, xml_attr_new("postponed", tmp));
g_free(tmp);
xml_free_tree(rootnode);
if (prefs_file_close(pfile) < 0) {
- g_warning("failed to write event.");
+ g_warning("failed to write event");
return;
}
memset(date, 0, sizeof(date));
prop = icalcomponent_get_first_property(ievent, ICAL_SUMMARY_PROPERTY);
- if (prop) {
- summary = g_strdup(icalproperty_get_summary(prop));
- icalproperty_free(prop);
- } else {
- summary = g_strdup("");
- }
+ summary = g_strdup(icalproperty_get_summary(prop));
+ icalproperty_free(prop);
+ if (!summary)
+ summary = g_strdup(_("[no summary]"));
while (strchr(summary, '\n'))
*(strchr(summary, '\n')) = ' ';