mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
consistency fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39547 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
328c9d3747
commit
9a94a17bb6
3 changed files with 43 additions and 35 deletions
|
@ -1,3 +1,9 @@
|
|||
2016-03-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSCalendarDate.m:
|
||||
* Source/NSTimeZone.m:
|
||||
Use NSInteger conmsistently (don't mix with int).
|
||||
|
||||
2016-03-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m: Log is we break the lock.
|
||||
|
|
|
@ -201,22 +201,27 @@ dayOfCommonEra(NSTimeInterval when)
|
|||
}
|
||||
|
||||
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))
|
||||
y = abs/366;
|
||||
while (abs >= absoluteGregorianDay(1, 1, y+1))
|
||||
{
|
||||
(*year)++;
|
||||
y++;
|
||||
}
|
||||
// Search forward month by month from January
|
||||
(*month) = 1;
|
||||
while (abs > absoluteGregorianDay(lastDayOfGregorianMonth(*month, *year),
|
||||
*month, *year))
|
||||
m = 1;
|
||||
while (abs > absoluteGregorianDay(lastDayOfGregorianMonth(m, y), m, y))
|
||||
{
|
||||
(*month)++;
|
||||
m++;
|
||||
}
|
||||
*day = abs - absoluteGregorianDay(1, *month, *year) + 1;
|
||||
*year = y;
|
||||
*month = m;
|
||||
*day = abs - absoluteGregorianDay(1, m, y) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,8 +251,9 @@ GSTime(unsigned day, unsigned month, unsigned year, unsigned hour, unsigned minu
|
|||
* 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 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
|
|||
*/
|
||||
- (NSInteger) dayOfMonth
|
||||
{
|
||||
int m, d, y;
|
||||
NSInteger m, d, y;
|
||||
NSTimeInterval when;
|
||||
|
||||
when = _seconds_since_ref + offset(_time_zone, self);
|
||||
|
@ -1687,7 +1693,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
|
|||
*/
|
||||
- (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 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
|
|||
*/
|
||||
- (NSInteger) monthOfYear
|
||||
{
|
||||
int m, d, y;
|
||||
NSInteger m, d, y;
|
||||
NSTimeInterval when;
|
||||
|
||||
when = _seconds_since_ref + offset(_time_zone, self);
|
||||
|
@ -1795,7 +1801,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
|
|||
*/
|
||||
- (NSInteger) yearOfCommonEra
|
||||
{
|
||||
int m, d, y;
|
||||
NSInteger m, d, y;
|
||||
NSTimeInterval when;
|
||||
|
||||
when = _seconds_since_ref + offset(_time_zone, self);
|
||||
|
@ -1850,13 +1856,13 @@ typedef struct {
|
|||
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 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
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 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
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 @@ static void outputValueWithFormat(int v, char *fldfmt, DescriptionInfo *info)
|
|||
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?
|
||||
|
|
|
@ -2575,8 +2575,9 @@ lastDayOfGregorianMonth(int month, int year)
|
|||
|
||||
/* 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 @@ GSBreakTime(NSTimeInterval when, NSInteger*year, NSInteger*month, NSInteger*day,
|
|||
|
||||
- (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;
|
||||
|
|
Loading…
Reference in a new issue