[Commits] [SCM] claws branch, master, updated. 4.3.1-21-gf46349746
wwp at claws-mail.org
wwp at claws-mail.org
Mon Mar 3 13:01:05 UTC 2025
The branch, master has been updated
via f463497462ece85332e7f28af712448ca786f2e2 (commit)
from 0be593f936eb973ab957e2a439382a58bebd864d (commit)
Summary of changes:
src/common/xml.c | 14 ++++++++++++++
src/common/xml.h | 2 ++
src/imap.c | 8 ++++----
3 files changed, 20 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit f463497462ece85332e7f28af712448ca786f2e2
Author: wwp <subscript at free.fr>
Date: Mon Mar 3 13:58:39 2025 +0100
Fix CID 1643906: use time_t as much as possible and I/O them as long int.
diff --git a/src/common/xml.c b/src/common/xml.c
index 8b680edef..7e4287e95 100644
--- a/src/common/xml.c
+++ b/src/common/xml.c
@@ -510,6 +510,20 @@ XMLAttr *xml_attr_new_int(const gchar *name, const gint value)
return new_attr;
}
+XMLAttr *xml_attr_new_time_t(const gchar *name, const time_t value)
+{
+ XMLAttr *new_attr;
+ gchar *valuestr;
+
+ valuestr = g_strdup_printf("%ld", value);
+
+ new_attr = g_new(XMLAttr, 1);
+ new_attr->name = XML_STRING_ADD(name);
+ new_attr->value = valuestr;
+
+ return new_attr;
+}
+
void xml_tag_add_attr(XMLTag *tag, XMLAttr *attr)
{
tag->attr = g_list_prepend(tag->attr, attr);
diff --git a/src/common/xml.h b/src/common/xml.h
index 1ecca4239..9680a117e 100644
--- a/src/common/xml.h
+++ b/src/common/xml.h
@@ -88,6 +88,8 @@ XMLAttr *xml_attr_new (const gchar *name,
const gchar *value);
XMLAttr *xml_attr_new_int (const gchar *name,
const gint value);
+XMLAttr *xml_attr_new_time_t (const gchar *name,
+ const time_t value);
void xml_tag_add_attr (XMLTag *tag,
XMLAttr* attr);
diff --git a/src/imap.c b/src/imap.c
index 9518afe28..febab4c30 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -6318,9 +6318,9 @@ static void imap_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
if (!strcmp(attr->name, "uidnext"))
IMAP_FOLDER_ITEM(item)->uid_next = atoi(attr->value);
if (!strcmp(attr->name, "last_sync"))
- IMAP_FOLDER_ITEM(item)->last_sync = atoi(attr->value);
+ IMAP_FOLDER_ITEM(item)->last_sync = (time_t)atol(attr->value);
if (!strcmp(attr->name, "last_change"))
- IMAP_FOLDER_ITEM(item)->last_change = atoi(attr->value);
+ IMAP_FOLDER_ITEM(item)->last_change = (time_t)atol(attr->value);
}
if (IMAP_FOLDER_ITEM(item)->last_change == 0)
IMAP_FOLDER_ITEM(item)->last_change = time(NULL);
@@ -6336,9 +6336,9 @@ static XMLTag *imap_item_get_xml(Folder *folder, FolderItem *item)
#ifdef HAVE_LIBETPAN
xml_tag_add_attr(tag, xml_attr_new_int("uidnext",
IMAP_FOLDER_ITEM(item)->uid_next));
- xml_tag_add_attr(tag, xml_attr_new_int("last_sync",
+ xml_tag_add_attr(tag, xml_attr_new_time_t("last_sync",
IMAP_FOLDER_ITEM(item)->last_sync));
- xml_tag_add_attr(tag, xml_attr_new_int("last_change",
+ xml_tag_add_attr(tag, xml_attr_new_time_t("last_change",
IMAP_FOLDER_ITEM(item)->last_change));
#endif
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list