mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Various timezone fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5503 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cea760a886
commit
538f642fd1
7 changed files with 34 additions and 26 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Tue Dec 14 5:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSTimeZone.m: ([+getTimeZoneFile:]) Removed misleading comment
|
||||
and hack.
|
||||
([+timeZoneWithName:]) Fixed bug in loading timezone data file (unusual
|
||||
formats could cause a crash).
|
||||
* Source/NSScanner.m: ([-initWithString:]) fix to handle being passed
|
||||
a nil string (return nil and log a warning).
|
||||
* NSTimeZones/NSTimeZones.tar: updated to latest info and made sure
|
||||
files are in the correct place.
|
||||
|
||||
Mon Dec 13 13:31:00 1999 Chris Ball <cball@fmco.com>
|
||||
|
||||
* Source/NSTimeZone.m: Replaced the original, correct comment and
|
||||
|
|
Binary file not shown.
|
@ -114,7 +114,13 @@ typedef struct {
|
|||
/*
|
||||
* Ensure that we have an NSGString so we can access its internals directly.
|
||||
*/
|
||||
if (fastClass(aString) == NSGString_class)
|
||||
if (aString == nil)
|
||||
{
|
||||
RELEASE(self);
|
||||
NSLog(@"Scanner initialised with nil string");
|
||||
return nil;
|
||||
}
|
||||
else if (fastClass(aString) == NSGString_class)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = RETAIN(aString);
|
||||
|
@ -131,9 +137,9 @@ typedef struct {
|
|||
}
|
||||
else
|
||||
{
|
||||
[self dealloc];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Scanner initialised with something not a string"];
|
||||
RELEASE(self);
|
||||
NSLog(@"Scanner initialised with something not a string");
|
||||
return nil;
|
||||
}
|
||||
[self setCharactersToBeSkipped: defaultSkipSet];
|
||||
_decimal = '.';
|
||||
|
|
|
@ -755,11 +755,13 @@ static NSMapTable *absolutes = 0;
|
|||
if (fread(zone_abbrevs, 1, names_size, file) != names_size)
|
||||
[NSException raise: fileException format: errMess];
|
||||
abbrevsArray = NSZoneMalloc(NSDefaultMallocZone(), sizeof(id)*names_size);
|
||||
i = 0;
|
||||
while (i < names_size)
|
||||
memset(abbrevsArray, '\0', sizeof(id)*names_size);
|
||||
for (i = 0; i < n_types; i++)
|
||||
{
|
||||
abbrevsArray[i] = [NSString stringWithCString: zone_abbrevs+i];
|
||||
i = (strchr(zone_abbrevs+i, '\0')-zone_abbrevs)+1;
|
||||
int pos = types[i].abbr_idx;
|
||||
|
||||
if (abbrevsArray[pos] == nil)
|
||||
abbrevsArray[pos] = [NSString stringWithCString: zone_abbrevs+pos];
|
||||
}
|
||||
NSZoneFree(NSDefaultMallocZone(), zone_abbrevs);
|
||||
|
||||
|
@ -976,14 +978,6 @@ static NSMapTable *absolutes = 0;
|
|||
NSString *path = [NSBundle pathForGNUstepResource: fileName
|
||||
ofType: @""
|
||||
inDirectory: TIME_ZONE_DIR];
|
||||
/*
|
||||
* OpenStep does NOT put all the GMT+-* timezones in the Etc directory so all
|
||||
* the OpenStep software will fail to work without this extra hack.
|
||||
*/
|
||||
if (path == nil)
|
||||
{
|
||||
path=[self getTimeZoneFile: [NSString stringWithFormat: @"Etc/%@", name]];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
|
@ -48,7 +48,7 @@ main (int argc, char *argv[])
|
|||
[dict setObject: name forKey: [detail timeZoneAbbreviation]];
|
||||
e = [dict keyEnumerator];
|
||||
while ((abbrev = [e nextObject]) != nil)
|
||||
NSLog(@"%@\t%@\n", abbrev, name);
|
||||
printf("%@\t%@\n", abbrev, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
|
@ -83,7 +83,7 @@ main (int argc, char *argv[])
|
|||
{
|
||||
e = [zones[i] objectEnumerator];
|
||||
while ((name = [e nextObject]) != nil)
|
||||
NSLog(@"%d %@\n", i, name);
|
||||
printf("%d %@\n", i, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
id detail;
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
NSLog(@"time zones for PST:\n%@\n",
|
||||
printf("time zones for PST:\n%@\n",
|
||||
[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]);
|
||||
NSLog(@"time zones:\n%@\n", [[NSTimeZone timeZoneArray] description]);
|
||||
NSLog(@"local time zone:\n%@\n", [[NSTimeZone localTimeZone] description]);
|
||||
[arp release];
|
||||
printf("time zones:\n%@\n", [[NSTimeZone timeZoneArray] description]);
|
||||
printf("local time zone:\n%@\n", [[NSTimeZone localTimeZone] description]);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue