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:
Richard Frith-MacDonald 1999-12-14 07:33:47 +00:00
parent cea760a886
commit 538f642fd1
7 changed files with 34 additions and 26 deletions

View file

@ -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 = '.';

View file

@ -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;
}