From 6a75fb285803c88c3658a28aa87a3eb7b07cc4d8 Mon Sep 17 00:00:00 2001 From: fedor Date: Fri, 19 Feb 1999 21:47:15 +0000 Subject: [PATCH] subprojects, testing fiex git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3762 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/NSHost.m | 18 ++++++++++++++++++ Testing/fref.m | 12 ++++++++++-- Testing/release.m | 2 +- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2e6e325c..7d3daff13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1999-02-19 Adam Fedor + + * Source/NSHost.m ([NSHost +currentHost]): Check for host not found. + ([NSHost +hostWithName:]): Check for nil arg. + ([NSHost +hostWithAddress:]): Likewise. + + * Testing/release.m: Make array mutable. + * Testing/fref.m: Switch to NSArchiver/NSUnarchiver + Wed Feb 17 8:52:00 1999 Richard Frith-Macdonald * Source/NSProcessInfo.m: Include process name in arguments list as diff --git a/Source/NSHost.m b/Source/NSHost.m index e436eb1a6..0143fc247 100644 --- a/Source/NSHost.m +++ b/Source/NSHost.m @@ -155,6 +155,12 @@ static NSMutableDictionary *_hostCache = nil; } h = gethostbyname(name); + if (h == NULL) + { + NSLog(@"Unable to determine current host"); + return nil; + } + return [self _hostWithHostEntry:h name:[NSString stringWithCString:name]]; @@ -163,6 +169,12 @@ static NSMutableDictionary *_hostCache = nil; + (NSHost *)hostWithName:(NSString *)name { struct hostent *h; + + if (name == nil) + { + NSLog(@"Nil host name sent to +[NSHost hostWithName]"); + return nil; + } h = gethostbyname((char *)[name cString]); @@ -175,6 +187,12 @@ static NSMutableDictionary *_hostCache = nil; struct hostent *h; struct in_addr hostaddr; + if (address == nil) + { + NSLog(@"Nil address sent to +[NSHost hostWithAddress]"); + return nil; + } + hostaddr.s_addr = inet_addr((char *)[address cString]); if (hostaddr.s_addr == -1) { diff --git a/Testing/fref.m b/Testing/fref.m index ba0cb3394..7e700cf67 100644 --- a/Testing/fref.m +++ b/Testing/fref.m @@ -11,11 +11,11 @@ /* Both 1 works; both 0 works. 0 and 1 crash, as does NeXT's */ /* Use GNU Archiving features, if they are available. */ -#define TRY_GNU_ARCHIVING 1 +#define TRY_GNU_ARCHIVING 0 /* In the forward self-reference test, -initWithCoder substitutes another object for self. */ -#define SELF_REF_DECODE_SUBSTITUTES 1 +#define SELF_REF_DECODE_SUBSTITUTES 0 /* End of some parameters to vary. */ @@ -213,7 +213,11 @@ test_fref () [sub_foo release]; [array release]; +#if GNU_ARCHIVING + array = [Unarchiver unarchiveObjectWithFile: @"fref.dat"]; +#else array = [NSUnarchiver unarchiveObjectWithFile: @"fref.dat"]; +#endif foo = [array objectAtIndex: 1]; sub_foo = [foo subFoo]; printf ("Decoded: "); @@ -243,7 +247,11 @@ test_self_fref () [foo release]; [sub_foo release]; +#if GNU_ARCHIVING + foo = [Unarchiver unarchiveObjectWithFile: @"fref.dat"]; +#else foo = [NSUnarchiver unarchiveObjectWithFile: @"fref.dat"]; +#endif sub_foo = [foo subFoo]; printf ("Decoded: "); [sub_foo print]; diff --git a/Testing/release.m b/Testing/release.m index 7474a69aa..d58212d43 100644 --- a/Testing/release.m +++ b/Testing/release.m @@ -38,7 +38,7 @@ autorelease_test (int depth) { int n = 2; id os[n]; - id a = [NSArray new]; + id a = [NSMutableArray new]; int i; id arp;