From: znek Date: Sat, 30 Oct 2004 01:21:51 +0000 (+0000) Subject: Bugfix for OSX X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7365ef73891652b03d9c52e0e6000863447e96f1;p=sope Bugfix for OSX git-svn-id: http://svn.opengroupware.org/SOPE/trunk@326 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-xml/SaxObjC/ChangeLog b/sope-xml/SaxObjC/ChangeLog index dad8af1d..edfdf1ab 100644 --- a/sope-xml/SaxObjC/ChangeLog +++ b/sope-xml/SaxObjC/ChangeLog @@ -1,3 +1,9 @@ +2004-10-30 Marcus Mueller + + * SaxObjectDecoder.m: provide fix for discovering mutable array on + Apple/CoreFoundation - this is rather disturbing, but Apple really + broke the concept of mutability for NSArray/NSDictionary. (v4.3.42) + 2004-09-22 Marcus Mueller * SaxObjC.xcode: minor fixes diff --git a/sope-xml/SaxObjC/SaxObjectModel.m b/sope-xml/SaxObjC/SaxObjectModel.m index 7c8f1d7c..8e150097 100644 --- a/sope-xml/SaxObjC/SaxObjectModel.m +++ b/sope-xml/SaxObjC/SaxObjectModel.m @@ -22,6 +22,11 @@ #include "SaxObjectModel.h" #include "common.h" +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY || \ + APPLE_FOUNDATION_LIBRARY +bool _CFArrayIsMutable(CFArrayRef dict); +#endif + static NSDictionary *mapDictsToObjects(NSDictionary *_dict, Class clazz) { NSMutableDictionary *md; NSEnumerator *e; @@ -45,6 +50,19 @@ static NSDictionary *mapDictsToObjects(NSDictionary *_dict, Class clazz) { static BOOL doDebug = NO; static NSArray *searchPathes = nil; +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY || \ + APPLE_FOUNDATION_LIBRARY +static Class NSCFArrayClass = Nil; + ++ (void)initialize { + static BOOL isInitialized = NO; + + if (isInitialized) return; + isInitialized = YES; + NSCFArrayClass = NSClassFromString(@"NSCFArray"); +#endif +} + + (NSArray *)saxMappingSearchPathes { if (searchPathes == nil) { NSMutableArray *ma; @@ -384,7 +402,13 @@ static NSArray *searchPathes = nil; [_object takeValue:[NSArray arrayWithObject:_value] forKey:_key]; } else { +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY || \ + APPLE_FOUNDATION_LIBRARY + if ([v isKindOfClass:NSCFArrayClass] && + _CFArrayIsMutable((CFArrayRef)v)) +#else if ([v respondsToSelector:@selector(addObject:)]) +#endif /* the value is mutable */ [v addObject:_value]; else { diff --git a/sope-xml/SaxObjC/Version b/sope-xml/SaxObjC/Version index b64cd580..6f16b3c2 100644 --- a/sope-xml/SaxObjC/Version +++ b/sope-xml/SaxObjC/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=41 +SUBMINOR_VERSION:=42