[Xfce4-commits] r23086 - libxfcegui4/trunk/libxfcegui4

Olivier Fourdan olivier at xfce.org
Mon Sep 4 21:02:57 UTC 2006


Author: olivier
Date: 2006-09-04 21:02:56 +0000 (Mon, 04 Sep 2006)
New Revision: 23086

Modified:
   libxfcegui4/trunk/libxfcegui4/xfce_clock.c
Log:
Issue a warning instead of silently ignoring fals params

Modified: libxfcegui4/trunk/libxfcegui4/xfce_clock.c
===================================================================
--- libxfcegui4/trunk/libxfcegui4/xfce_clock.c	2006-09-04 21:02:55 UTC (rev 23085)
+++ libxfcegui4/trunk/libxfcegui4/xfce_clock.c	2006-09-04 21:02:56 UTC (rev 23086)
@@ -721,13 +721,16 @@
 xfce_clock_format_time_to_utf8 (gchar * dest, gsize dst_size,
                                 const gchar * fmt, struct tm *tm)
 {
-    if (dest == NULL || fmt == NULL || tm == NULL)
-        return;
+    gchar *dummy;
 
-    gchar *dummy = g_locale_from_utf8 (fmt, -1, NULL, NULL, NULL);
+    g_return_if_fail (dest != NULL);
+    g_return_if_fail (fmt != NULL);
+    g_return_if_fail (tm != NULL);
 
-    strftime (dest, 256, dummy, tm);
+    dummy = g_locale_from_utf8 (fmt, -1, NULL, NULL, NULL);
+    strftime (dest, (size_t) dst_size, dummy, tm);
     g_free (dummy);
+
     dummy = g_locale_to_utf8 (dest, -1, NULL, NULL, NULL);
     g_strlcpy (dest, dummy, dst_size);
     g_free (dummy);
@@ -754,12 +757,11 @@
         case XFCE_CLOCK_DIGITAL:
             if (clock->show_formatted)
             {
-
                 time_t ticks = time (0);
                 struct tm *tm = localtime (&ticks);
 
-                xfce_clock_format_time_to_utf8 (buffer, 256, clock->format_string, tm);
-
+                xfce_clock_format_time_to_utf8 (buffer, sizeof(buffer), 
+                                                clock->format_string, tm);
             }
             else if (clock->military_time)
             {
@@ -838,13 +840,11 @@
             {
                 width = ln * DIGITS_HUGE_WIDTH;
                 height = DIGITS_HUGE_HEIGHT;
-
             }
             else if (clock->led_size == DIGIT_LARGE)
             {
                 width = ln * DIGITS_LARGE_WIDTH;
                 height = DIGITS_LARGE_HEIGHT;
-
             }
             else if (clock->led_size == DIGIT_MEDIUM)
             {



More information about the Xfce4-commits mailing list