diff --git a/ChangeLog b/ChangeLog index 447b57efe..83d9aadcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-29 Richard Frith-Macdonald + + * Source/NSData.m: when unable to open a file, log should be debug + level rather than warn level. + 2007-05-23 Fred Kiefer * Headers/Foundation/NSCompoundPredicate.h: Add some common ivars. diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index c542004d1..eb9798dc2 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -144,6 +144,78 @@ static vacallReturnTypeInfo returnTypeInfo [STATIC_CALLBACK_LIST_SIZE]; static void GSInvocationCallback(void *callback_data, va_alist args); +/* Count the number of subtypes in a structure + */ +static const char *gs_subtypes(const char *type, int *result) +{ + int count = 0; + + if (*type == _C_STRUCT_B) + { + type++; + while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ + while (*type != '\0' && *type != _C_STRUCT_E) + { + count++; + if (*type == _C_STRUCT_B) + { + /* count a nested structure as a single type. + */ + type = gs_subtypes (type, 0); + } + else + { + type = objc_skip_typespec (type); + } + } + if (*type == _C_STRUCT_E) + { + type++; /* step past end of struct */ + } + } + if (result != 0) + { + *result = count; + } + return type; +} + +/* return the index'th subtype + */ +static const char *gs_subtype(const char *type, int index) +{ + int count = 0; + + if (*type != _C_STRUCT_B) + { + return ""; + } + type++; + while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ + while (*type != '\0' && *type != _C_STRUCT_E) + { + if (count++ == index) + { + return type; + } + if (*type == _C_STRUCT_B) + { + /* count and skip a nested structure as a single type. + */ + type = gs_subtypes (type, 0); + } + else + { + type = objc_skip_typespec (type); + } + } + if (*type == _C_STRUCT_E) + { + type++; /* step past end of struct */ + } + return type; +} + /* * Recursively calculate the offset using the offset of the previous * sub-type diff --git a/Source/NSData.m b/Source/NSData.m index 3b39f0d61..c8402aaf6 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -164,7 +164,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone) if (theFile == 0) /* We failed to open the file. */ { - NSWarnFLog(@"Open (%@) attempt failed - %@", path, [NSError _last]); + NSDebugFLog(@"Open (%@) attempt failed - %@", path, [NSError _last]); goto failure; }