diff --git a/ChangeLog b/ChangeLog index daca9dbff..64a05caf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-08-01 Richard Frith-Macdonald + + * Source/NSProxy.m: Include limits.h for UINT_MAX + * Source/NSProcessInfo.m: Avoid crash when given invalid argument list + * Source/NSString.m: Minor cleanup for coding standards and remove + pointer dereferencing of object which causes problems with new + compiler + Problems reported by Alexander and Roland + 2003-07-31 David Ayers * Created tag 'pre-header-reorg-20030731'. diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index f4774fc95..88548a517 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -187,7 +187,7 @@ _gnu_process_args(int argc, char *argv[], char *env[]) free(_gnu_arg_zero); } - if (argv != 0) + if (argv != 0 && argv[0] != 0) { _gnu_arg_zero = (char*)malloc(strlen(argv[0]) + 1); strcpy(_gnu_arg_zero, argv[0]); @@ -214,7 +214,7 @@ _gnu_process_args(int argc, char *argv[], char *env[]) } } #else - fprintf(stderr, "Error: for some reason, argv == NULL " + fprintf(stderr, "Error: for some reason, argv not properly set up " "during GNUstep base initialization\n"); abort(); #endif diff --git a/Source/NSProxy.m b/Source/NSProxy.m index 015233ae5..1ef69142e 100644 --- a/Source/NSProxy.m +++ b/Source/NSProxy.m @@ -35,6 +35,11 @@ #include "Foundation/NSDistantObject.h" #include "Foundation/NSPortCoder.h" +#ifdef HAVE_LIMITS_H +/* For UINT_MAX */ +#include +#endif + @class NSDistantObject; #ifndef NeXT_RUNTIME diff --git a/Source/NSString.m b/Source/NSString.m index 57aee09d1..ddc7bb799 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -2711,54 +2711,69 @@ handle_printf_atsign (FILE *stream, matchesIntoArray: (NSArray**)outputArray filterTypes: (NSArray*)filterTypes { - NSString *base_path = [self stringByDeletingLastPathComponent]; - NSString *last_compo = [self lastPathComponent]; - NSString *tmp_path; + NSString *base_path = [self stringByDeletingLastPathComponent]; + NSString *last_compo = [self lastPathComponent]; + NSString *tmp_path; NSDirectoryEnumerator *e; NSMutableArray *op = nil; - unsigned match_count = 0; + unsigned match_count = 0; if (outputArray != 0) - op = (NSMutableArray*)[NSMutableArray array]; + { + op = (NSMutableArray*)[NSMutableArray array]; + } if (outputName != NULL) - *outputName = nil; + { + *outputName = nil; + } if ([base_path length] == 0) - base_path = @"."; + { + base_path = @"."; + } e = [[NSFileManager defaultManager] enumeratorAtPath: base_path]; while (tmp_path = [e nextObject], tmp_path) { /* Prefix matching */ - if (YES == flag) + if (flag == YES) { /* Case sensitive */ - if (NO == [tmp_path hasPrefix: last_compo]) - continue ; + if ([tmp_path hasPrefix: last_compo] == NO) + { + continue; + } } - else + else if ([[tmp_path uppercaseString] + hasPrefix: [last_compo uppercaseString]] == NO) { - if (NO == [[tmp_path uppercaseString] - hasPrefix: [last_compo uppercaseString]]) - continue; + continue; } /* Extensions filtering */ - if (filterTypes && - (NO == [filterTypes containsObject: [tmp_path pathExtension]])) - continue ; + if (filterTypes + && ([filterTypes containsObject: [tmp_path pathExtension]] == NO)) + { + continue; + } /* Found a completion */ match_count++; if (outputArray != NULL) - [*op addObject: tmp_path]; + { + [op addObject: tmp_path]; + } if ((outputName != NULL) && ((*outputName == nil) || (([*outputName length] < [tmp_path length])))) - *outputName = tmp_path; + { + *outputName = tmp_path; + } } if (outputArray != NULL) - *outputArray = AUTORELEASE([op copy]); + { + *outputArray = AUTORELEASE([op copy]); + } return match_count; }