summaryrefslogtreecommitdiff
path: root/applets/clock/clock.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2017-11-09 21:45:30 -0500
committerlukefromdc <[email protected]>2017-11-09 22:07:09 -0500
commitf7f9625da0417471dba802dd465ca1fefdc62c33 (patch)
treeaced013da11ef385c718063a92c20159afe63dc4 /applets/clock/clock.c
parent64cdec0796d325d07ffc9ec4b56110b621b2947b (diff)
downloadmate-panel-f7f9625da0417471dba802dd465ca1fefdc62c33.tar.bz2
mate-panel-f7f9625da0417471dba802dd465ca1fefdc62c33.tar.xz
Clock: don't check variables that can never be < 0 for < 0
check them for = 0 instead. Found by cppcheck http://man7.org/linux/man-pages/man3/strftime.3.html This always returns 0 or a positive number of bytes
Diffstat (limited to 'applets/clock/clock.c')
-rw-r--r--applets/clock/clock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 025d5bb3..75a01a50 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -569,13 +569,13 @@ format_time (ClockData *cd)
NULL, NULL, NULL);
if (!timeformat)
strcpy (hour, "???");
- else if (strftime (hour, sizeof (hour), timeformat, tm) <= 0)
+ else if (strftime (hour, sizeof (hour), timeformat, tm)== 0)
strcpy (hour, "???");
g_free (timeformat);
utf8 = g_locale_to_utf8 (hour, -1, NULL, NULL, NULL);
} else {
- if (strftime (hour, sizeof (hour), cd->timeformat, tm) <= 0)
+ if (strftime (hour, sizeof (hour), cd->timeformat, tm) == 0)
strcpy (hour, "???");
utf8 = g_locale_to_utf8 (hour, -1, NULL, NULL, NULL);
@@ -659,7 +659,7 @@ update_tooltip (ClockData * cd)
loc = g_locale_from_utf8 (_("%A %B %d (%%s)"), -1, NULL, NULL, NULL);
if (!loc)
strcpy (date, "???");
- else if (strftime (date, sizeof (date), loc, tm) <= 0)
+ else if (strftime (date, sizeof (date), loc, tm) == 0)
strcpy (date, "???");
g_free (loc);
@@ -1639,7 +1639,7 @@ copy_time (GtkAction *action,
if (!format)
strcpy (string, "???");
- else if (strftime (string, sizeof (string), format, tm) <= 0)
+ else if (strftime (string, sizeof (string), format, tm) == 0)
strcpy (string, "???");
g_free (format);
}
@@ -1668,7 +1668,7 @@ copy_date (GtkAction *action,
loc = g_locale_from_utf8 (_("%A, %B %d %Y"), -1, NULL, NULL, NULL);
if (!loc)
strcpy (string, "???");
- else if (strftime (string, sizeof (string), loc, tm) <= 0)
+ else if (strftime (string, sizeof (string), loc, tm) == 0)
strcpy (string, "???");
g_free (loc);