Author: rfm
Date: Tue Mar 15 19:22:57 2016
New Revision: 39547

URL: http://svn.gna.org/viewcvs/gnustep?rev=39547&view=rev
Log:
consistency fixes

Modified:
    libs/base/trunk/ChangeLog
    libs/base/trunk/Source/NSCalendarDate.m
    libs/base/trunk/Source/NSTimeZone.m

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39547&r1=39546&r2=39547&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Tue Mar 15 19:22:57 2016
@@ -1,3 +1,9 @@
+2016-03-15  Richard Frith-Macdonald <[email protected]>
+
+       * Source/NSCalendarDate.m:
+       * Source/NSTimeZone.m:
+       Use NSInteger conmsistently (don't mix with int).
+
 2016-03-14  Richard Frith-Macdonald <[email protected]>
 
        * Source/NSUserDefaults.m: Log is we break the lock.

Modified: libs/base/trunk/Source/NSCalendarDate.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSCalendarDate.m?rev=39547&r1=39546&r2=39547&view=diff
==============================================================================
--- libs/base/trunk/Source/NSCalendarDate.m     (original)
+++ libs/base/trunk/Source/NSCalendarDate.m     Tue Mar 15 19:22:57 2016
@@ -201,22 +201,27 @@
 }
 
 static void
-gregorianDateFromAbsolute(NSInteger abs, int *day, int *month, int *year)
-{
+gregorianDateFromAbsolute(NSInteger abs,
+  NSInteger *day, NSInteger *month, NSInteger *year)
+{
+  NSInteger     y;
+  NSInteger     m;
+
   // Search forward year by year from approximate year
-  *year = abs/366;
-  while (abs >= absoluteGregorianDay(1, 1, (*year)+1))
-    {
-      (*year)++;
+  y = abs/366;
+  while (abs >= absoluteGregorianDay(1, 1, y+1))
+    {
+      y++;
     }
   // Search forward month by month from January
-  (*month) = 1;
-  while (abs > absoluteGregorianDay(lastDayOfGregorianMonth(*month, *year),
-    *month, *year))
-    {
-      (*month)++;
-    }
-  *day = abs - absoluteGregorianDay(1, *month, *year) + 1;
+  m = 1;
+  while (abs > absoluteGregorianDay(lastDayOfGregorianMonth(m, y), m, y))
+    {
+      m++;
+    }
+  *year = y;
+  *month = m;
+  *day = abs - absoluteGregorianDay(1, m, y) + 1;
 }
 
 /**
@@ -246,8 +251,9 @@
  * External - so NSTimeZone  can use it ... but should really be static.
  */
 void
-GSBreakTime(NSTimeInterval when, int *year, int *month, int *day,
-  int *hour, int *minute, int *second, int *mil)
+GSBreakTime(NSTimeInterval when,
+  NSInteger *year, NSInteger *month, NSInteger *day,
+  NSInteger *hour, NSInteger *minute, NSInteger *second, NSInteger *mil)
 {
   NSInteger h, m, dayOfEra;
   double a, b, c, d;
@@ -1643,7 +1649,7 @@
  */
 - (NSInteger) dayOfMonth
 {
-  int m, d, y;
+  NSInteger m, d, y;
   NSTimeInterval       when;
 
   when = _seconds_since_ref + offset(_time_zone, self);
@@ -1687,7 +1693,7 @@
  */
 - (NSInteger) dayOfYear
 {
-  int m, d, y, days, i;
+  NSInteger m, d, y, days, i;
   NSTimeInterval       when;
 
   when = _seconds_since_ref + offset(_time_zone, self);
@@ -1753,7 +1759,7 @@
  */
 - (NSInteger) monthOfYear
 {
-  int m, d, y;
+  NSInteger m, d, y;
   NSTimeInterval       when;
 
   when = _seconds_since_ref + offset(_time_zone, self);
@@ -1795,7 +1801,7 @@
  */
 - (NSInteger) yearOfCommonEra
 {
-  int m, d, y;
+  NSInteger m, d, y;
   NSTimeInterval       when;
 
   when = _seconds_since_ref + offset(_time_zone, self);
@@ -1850,13 +1856,13 @@
   unichar      *t;
   unsigned     length;
   unsigned     offset;
-  int          yd;
-  int          md;
-  int          dom;
-  int          hd;
-  int          mnd;
-  int          sd;
-  int          mil;
+  NSInteger    yd;
+  NSInteger    md;
+  NSInteger    dom;
+  NSInteger    hd;
+  NSInteger    mnd;
+  NSInteger    sd;
+  NSInteger    mil;
 } DescriptionInfo;
 
 static void Grow(DescriptionInfo *info, unsigned size)
@@ -2576,12 +2582,7 @@
                             month: (NSInteger *)month
                              year: (NSInteger *)year
 {
-  int   dd, mm, yy;
-
-  gregorianDateFromAbsolute(d, &dd, &mm, &yy);
-  *day = dd;
-  *month = mm;
-  *year = yy;
+  gregorianDateFromAbsolute(d, day, month, year);
 }
 
 @end
@@ -2603,7 +2604,7 @@
   NSTimeInterval       s;
   NSTimeInterval       oldOffset;
   NSTimeInterval       newOffset;
-  int                  i, year, month, day, hour, minute, second, mil;
+  NSInteger            i, year, month, day, hour, minute, second, mil;
 
   /* Apply timezone offset to _seconds_since_ref from GMT to local time,
    * then break into components in local time zone.
@@ -2763,9 +2764,9 @@
   int                  diff;
   int                  extra;
   int                  sign;
-  int                  mil;
-  int                  syear, smonth, sday, shour, sminute, ssecond;
-  int                  eyear, emonth, eday, ehour, eminute, esecond;
+  NSInteger            mil;
+  NSInteger            syear, smonth, sday, shour, sminute, ssecond;
+  NSInteger            eyear, emonth, eday, ehour, eminute, esecond;
 
   /* FIXME What if the two dates are in different time zones?
     How about daylight savings time?

Modified: libs/base/trunk/Source/NSTimeZone.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSTimeZone.m?rev=39547&r1=39546&r2=39547&view=diff
==============================================================================
--- libs/base/trunk/Source/NSTimeZone.m (original)
+++ libs/base/trunk/Source/NSTimeZone.m Tue Mar 15 19:22:57 2016
@@ -2575,8 +2575,9 @@
 
 /* IMPORT from NSCalendar date */
 void
-GSBreakTime(NSTimeInterval when, NSInteger*year, NSInteger*month, 
NSInteger*day,
-  NSInteger*hour, NSInteger*minute, NSInteger*second, NSInteger*mil);
+GSBreakTime(NSTimeInterval when,
+  NSInteger *year, NSInteger *month, NSInteger *day,
+  NSInteger *hour, NSInteger *minute, NSInteger *second, NSInteger *mil);
 
 
 @implementation GSWindowsTimeZone
@@ -2801,7 +2802,7 @@
 
 - (BOOL) isDaylightSavingTimeForDate: (NSDate*)aDate
 {
-  int year, month, day, hour, minute, second, mil;
+  NSInteger year, month, day, hour, minute, second, mil;
   int  dow;
   int daylightdate, count, maxdate;
   NSTimeInterval when;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to