diff --git a/ChangeLog b/ChangeLog index 001b3c641..0581f3c05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-26 Wolfgang Sourdeau + + * SoObjects/SOGo/NSDictionary+BSJSONAdditions.m + (+dictionaryWithJSONString:): method moved from NSDictionary into + NSMutableDictionary for consistency. + 2009-11-26 Ludovic Marcotte * SoObjects/Mailer/SOGoMailObject+Draft.m diff --git a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.h b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.h index 1a32190a2..cf7f348d6 100644 --- a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.h +++ b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.h @@ -28,12 +28,10 @@ extern const int jsonDoNotIndent; @interface NSDictionary (BSJSONAdditions) -+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString; - (NSString *)jsonStringValue; @end - @interface NSDictionary (PrivateBSJSONAdditions) - (NSString *)jsonStringValueWithIndentLevel:(int)level; @@ -43,3 +41,9 @@ extern const int jsonDoNotIndent; - (NSString *)jsonIndentStringForLevel:(int)level; @end + +@interface NSMutableDictionary (BSJSONAdditions) + ++ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString; + +@end diff --git a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m index e9c658b86..7371143f4 100644 --- a/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m +++ b/SoObjects/SOGo/NSDictionary+BSJSONAdditions.m @@ -35,15 +35,6 @@ const int jsonDoNotIndent = -1; @implementation NSDictionary (BSJSONAdditions) -+ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString -{ - NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString]; - NSMutableDictionary *dictionary = nil; - [scanner scanJSONObject:&dictionary]; - [scanner release]; - return dictionary; -} - - (NSString *)jsonStringValue { return [self jsonStringValueWithIndentLevel:0]; @@ -197,3 +188,16 @@ const int jsonDoNotIndent = -1; } @end + +@implementation NSMutableDictionary (BSJSONAdditions) + ++ (NSMutableDictionary *)dictionaryWithJSONString:(NSString *)jsonString +{ + NSScanner *scanner = [[NSScanner alloc] initWithString:jsonString]; + NSMutableDictionary *dictionary = nil; + [scanner scanJSONObject:&dictionary]; + [scanner release]; + return dictionary; +} + +@end diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 2c032cba8..28720afce 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -428,7 +428,7 @@ static NSMutableCharacterSet *safeLDIFStartChars = nil; NSDictionary *jsonData; #warning this method is a quick and dirty way of detecting the file-format - jsonData = [NSDictionary dictionaryWithJSONString: self]; + jsonData = [NSMutableDictionary dictionaryWithJSONString: self]; return (jsonData != nil); } diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index ba4dc8d1a..e3e59e884 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -234,7 +234,7 @@ static NSString *uidColumnName = @"c_uid"; defFlags.modified = NO; [values release]; jsonValue = [self jsonRepresentation]; - values = [NSDictionary dictionaryWithJSONString: jsonValue]; + values = [NSMutableDictionary dictionaryWithJSONString: jsonValue]; if (values) [values retain]; else diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index 2c63369ca..dfb314ef4 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -499,7 +499,7 @@ static NSLock *lock = nil; aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid; contactInfos = [NSMutableDictionary dictionary]; jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: aUID]; - currentUser = [NSDictionary dictionaryWithJSONString: jsonUser]; + currentUser = [NSMutableDictionary dictionaryWithJSONString: jsonUser]; #if defined(THREADSAFE) [lock lock]; #endif diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 82680cdea..5707e881e 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -1496,7 +1496,7 @@ RANGE(2); if ([json length]) { attendees = [NSArray array]; - attendeesData = [NSDictionary dictionaryWithJSONString: json]; + attendeesData = [NSMutableDictionary dictionaryWithJSONString: json]; if (attendeesData) { newAttendees = [NSMutableArray array];