1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

core, plugins: check return code of strftime function

This commit is contained in:
Sébastien Helleu
2017-09-22 21:50:01 +02:00
parent ae66a4d8a5
commit 5aab494dd6
23 changed files with 130 additions and 72 deletions
+10 -6
View File
@@ -117,8 +117,9 @@ script_buffer_display_line_script (int line, struct t_script_repo *script)
if (script->date_added > 0)
{
tm = localtime (&script->date_added);
strftime (str_date, sizeof (str_date),
"%Y-%m-%d", tm);
if (strftime (str_date, sizeof (str_date),
"%Y-%m-%d", tm) == 0)
str_date[0] = '\0';
snprintf (str_item, sizeof (str_item),
"%s%s",
weechat_color (
@@ -232,8 +233,9 @@ script_buffer_display_line_script (int line, struct t_script_repo *script)
if (script->date_updated > 0)
{
tm = localtime (&script->date_updated);
strftime (str_date, sizeof (str_date),
"%Y-%m-%d", tm);
if (strftime (str_date, sizeof (str_date),
"%Y-%m-%d", tm) == 0)
str_date[0] = '\0';
snprintf (str_item, sizeof (str_item),
"%s%s",
weechat_color (
@@ -672,14 +674,16 @@ script_buffer_display_detail_script (struct t_script_repo *script)
}
line++;
tm = localtime (&script->date_added);
strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm);
if (strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm) == 0)
str_time[0] = '\0';
weechat_printf_y (script_buffer, line + 1,
"%s: %s",
script_buffer_detail_label (_(labels[line]), max_length),
str_time);
line++;
tm = localtime (&script->date_updated);
strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm);
if (strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm) == 0)
str_time[0] = '\0';
weechat_printf_y (script_buffer, line + 1,
"%s: %s",
script_buffer_detail_label (_(labels[line]), max_length),
+4 -2
View File
@@ -98,10 +98,12 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
weechat_hashtable_set (info, "script_md5sum", ptr_script->md5sum);
weechat_hashtable_set (info, "script_url", ptr_script->url);
tm = localtime (&ptr_script->date_added);
strftime (str_date, sizeof (str_date), "%Y-%m-%d %H:%M:%S", tm);
if (strftime (str_date, sizeof (str_date), "%Y-%m-%d %H:%M:%S", tm) == 0)
str_date[0] = '\0';
weechat_hashtable_set (info, "script_date_added", str_date);
tm = localtime (&ptr_script->date_updated);
strftime (str_date, sizeof (str_date), "%Y-%m-%d %H:%M:%S", tm);
if (strftime (str_date, sizeof (str_date), "%Y-%m-%d %H:%M:%S", tm) == 0)
str_date[0] = '\0';
weechat_hashtable_set (info, "script_date_updated", str_date);
weechat_hashtable_set (info, "script_version_loaded", ptr_script->version_loaded);