[almanah] Fix misuse of unsigned integers in calendar client



commit 3b2ffefd69cb9e7ce7504eb0ed4ca0e13b6efc8b
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat May 8 11:12:50 2010 +0100

    Fix misuse of unsigned integers in calendar client
    
    This is a bit of a hacky solution, but is probably safer than re-architecting
    the calendar client to use GDate types for year, month and day.

 src/event-factories/calendar-client.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/event-factories/calendar-client.c b/src/event-factories/calendar-client.c
index 6f4f438..b506114 100644
--- a/src/event-factories/calendar-client.c
+++ b/src/event-factories/calendar-client.c
@@ -405,9 +405,9 @@ calendar_client_init (CalendarClient *client)
                                                          (GConfClientNotifyFunc) calendar_client_timezone_changed_cb,
                                                          client, NULL, NULL);
 
-  client->priv->day   = -1;
-  client->priv->month = -1;
-  client->priv->year  = -1;
+  client->priv->day   = G_MAXUINT;
+  client->priv->month = G_MAXUINT;
+  client->priv->year  = G_MAXUINT;
 }
 
 static void
@@ -1579,8 +1579,8 @@ calendar_client_update_appointments (CalendarClient *client)
   char   *month_begin;
   char   *month_end;
 
-  if (client->priv->month == -1 ||
-      client->priv->year  == -1)
+  if (client->priv->month == G_MAXUINT ||
+      client->priv->year  == G_MAXUINT)
     return;
 
   month_begin = make_isodate_for_day_begin (1,
@@ -1629,9 +1629,9 @@ calendar_client_update_tasks (CalendarClient *client)
   char   *day_begin;
   char   *day_end;
 
-  if (client->priv->day   == -1 ||
-      client->priv->month == -1 ||
-      client->priv->year  == -1)
+  if (client->priv->day   == G_MAXUINT ||
+      client->priv->month == G_MAXUINT ||
+      client->priv->year  == G_MAXUINT)
     return;
 
   day_begin = make_isodate_for_day_begin (client->priv->day,
@@ -1991,9 +1991,9 @@ calendar_client_get_events (CalendarClient    *client,
   time_t  day_end;
 
   g_return_val_if_fail (CALENDAR_IS_CLIENT (client), NULL);
-  g_return_val_if_fail (client->priv->day   != -1 &&
-			client->priv->month != -1 &&
-			client->priv->year  != -1, NULL);
+  g_return_val_if_fail (client->priv->day   != G_MAXUINT &&
+			client->priv->month != G_MAXUINT &&
+			client->priv->year  != G_MAXUINT, NULL);
 
   day_begin = make_time_for_day_begin (client->priv->day,
 				       client->priv->month,
@@ -2048,8 +2048,8 @@ calendar_client_foreach_appointment_day (CalendarClient  *client,
 
   g_return_if_fail (CALENDAR_IS_CLIENT (client));
   g_return_if_fail (iter_func != NULL);
-  g_return_if_fail (client->priv->month != -1 &&
-		    client->priv->year  != -1);
+  g_return_if_fail (client->priv->month != G_MAXUINT &&
+		    client->priv->year  != G_MAXUINT);
 
   month_begin = make_time_for_day_begin (1,
 					 client->priv->month,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]