From 7bad646b7681db13c9c37d8645c7afc005594b37 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:23:40 +0000 Subject: [PATCH 1/6] Monotone-Parent: 8373ee4a182606382fcb3aea7864b142db4aaa95 Monotone-Revision: 4b7309393c3e0f0f0211dde1161875de6f69a117 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:23:40 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoCache.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SoObjects/SOGo/SOGoCache.m b/SoObjects/SOGo/SOGoCache.m index bbc940c87..e6cbf3090 100644 --- a/SoObjects/SOGo/SOGoCache.m +++ b/SoObjects/SOGo/SOGoCache.m @@ -58,12 +58,14 @@ static NSLock *lock; @implementation SOGoCache -#if defined(THREADSAFE) + (void) initialize { + #if defined(THREADSAFE) lock = [NSLock new]; -} #endif + s_userDefaults = [[NSMutableDictionary alloc] init]; + s_userSettings = [[NSMutableDictionary alloc] init]; +} + (NSTimeInterval) cleanupInterval { @@ -105,9 +107,6 @@ static NSLock *lock; cache = [[NSMutableDictionary alloc] init]; users = [[NSMutableDictionary alloc] init]; - s_userDefaults = [[NSMutableDictionary alloc] init]; - s_userSettings = [[NSMutableDictionary alloc] init]; - // We register ourself for notifications [[NSDistributedNotificationCenter defaultCenter] addObserver: self From 40aab6f8ca21f441f12a24f585ec4857bae3beab Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:24:09 +0000 Subject: [PATCH 2/6] Monotone-Parent: 4b7309393c3e0f0f0211dde1161875de6f69a117 Monotone-Revision: 6531438126de81058d8ee9b15839235efce21dc6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:24:09 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/NGCardsSaxHandler.m | 63 ++++++-------------------------- 1 file changed, 12 insertions(+), 51 deletions(-) diff --git a/SOPE/NGCards/NGCardsSaxHandler.m b/SOPE/NGCards/NGCardsSaxHandler.m index dac998c94..5f1cf0926 100644 --- a/SOPE/NGCards/NGCardsSaxHandler.m +++ b/SOPE/NGCards/NGCardsSaxHandler.m @@ -49,6 +49,7 @@ { if (content) free (content); + [self reset]; [cards release]; [currentGroup release]; [super dealloc]; @@ -71,7 +72,9 @@ content = NULL; } - vcs.isInVCardSet = 0; + vcs.isInVCardSet = 0; + vcs.isInVCard = 0; + vcs.isInGroup = 0; vcs.collectContent = 0; } @@ -86,7 +89,7 @@ - (void) startDocument { if (!cards) - cards = [[NSMutableArray alloc] initWithCapacity:16]; + cards = [[NSMutableArray alloc] initWithCapacity: 16]; [self reset]; } @@ -95,56 +98,12 @@ [self resetExceptResult]; } -/* common tags */ - -- (void) startValueTag: (NSString *) _tag - attributes: (id) _attrs -{ - /* a tag with types and attributes */ - unsigned i, count; - - [types removeAllObjects]; - [args removeAllObjects]; - - for (i = 0, count = [_attrs count]; i < count; i++) { - NSString *n, *v; - - n = [_attrs nameAtIndex:i]; - v = [_attrs valueAtIndex:i]; - - if ([n hasSuffix:@".type"] || [n isEqualToString:@"TYPE"]) { - /* - Note: types cannot be separated by comma! Its indeed always a space,eg - "work pref voice" - If you find commas, usually the vCard is broken. - */ - NSEnumerator *e; - NSString *k; - - e = [[v componentsSeparatedByString:@" "] objectEnumerator]; - while ((k = [e nextObject]) != nil) { - k = [k uppercaseString]; - if ([types containsObject:k]) continue; - [types addObject:k]; - } - } - else - [args setObject:v forKey:n]; - } -} - -- (void) endValueTag -{ - [types removeAllObjects]; - [args removeAllObjects]; -} - /* handle elements */ - (void) startGroup: (NSString *)_name { vcs.isInGroup = 1; - ASSIGNCOPY(currentGroup, _name); + ASSIGNCOPY (currentGroup, _name); } - (void) endGroup @@ -229,10 +188,12 @@ - (void) startCollectingContent { - if (content) { - free (content); - content = NULL; - } + if (content) + { + free (content); + content = NULL; + } + vcs.collectContent = 1; } From 438a582e0b8822307b8f9241cc986d0c49ad8528 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:24:14 +0000 Subject: [PATCH 3/6] Monotone-Parent: 6531438126de81058d8ee9b15839235efce21dc6 Monotone-Revision: d7b7ae74724e7afdc6963cf41a9aa032838ef603 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:24:14 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/NGCardsSaxHandler.h | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/SOPE/NGCards/NGCardsSaxHandler.h b/SOPE/NGCards/NGCardsSaxHandler.h index 5472fe59b..189fc777a 100644 --- a/SOPE/NGCards/NGCardsSaxHandler.h +++ b/SOPE/NGCards/NGCardsSaxHandler.h @@ -39,36 +39,23 @@ @interface NGCardsSaxHandler : SaxDefaultHandler { + unichar *content; + NSMutableArray *cards; + CardElement *currentElement; CardGroup *currentCardGroup; NSString *currentGroup; - unichar *content; unsigned contentLength; - NSMutableDictionary *xtags; - NSMutableDictionary *subvalues; NSMutableArray *types; - NSMutableDictionary *args; - NSMutableArray *tel; - NSMutableArray *adr; - NSMutableArray *email; - NSMutableArray *label; - NSMutableArray *url; - NSMutableArray *fburl; - NSMutableArray *caluri; - + struct { int isInVCardSet:1; int isInVCard:1; - int isInN:1; - int isInAdr:1; - int isInOrg:1; int isInGroup:1; - int isInGeo:1; int collectContent:1; - int reserved:24; } vcs; Class topGroupClass; From 2c95b16712678d37707c07ec094065739ae510c2 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:24:34 +0000 Subject: [PATCH 4/6] Monotone-Parent: d7b7ae74724e7afdc6963cf41a9aa032838ef603 Monotone-Revision: b58720a684a944a07a55afee823cab4819feaead Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:24:34 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/CardGroup.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SOPE/NGCards/CardGroup.m b/SOPE/NGCards/CardGroup.m index fabc12306..9f62afa98 100644 --- a/SOPE/NGCards/CardGroup.m +++ b/SOPE/NGCards/CardGroup.m @@ -68,7 +68,7 @@ static NGCardsSaxHandler *sax = nil; + (NSArray *) parseFromSource: (id) source { - static id cardParser; + static id cardParser; NSArray *cardGroups; cardGroups = nil; @@ -83,6 +83,7 @@ static NGCardsSaxHandler *sax = nil; [parser parseFromSource: source]; cardGroups = [sax cards]; + [sax reset]; } } From 715307143880083daa5f07ac0cf1bd4b428beb14 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:26:50 +0000 Subject: [PATCH 5/6] Monotone-Parent: b58720a684a944a07a55afee823cab4819feaead Monotone-Revision: 6a659b3123531a244f7d3ef9cfe8ccae60383bc0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:26:50 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/CardElement.m | 31 +++++++++++++------------------ SOPE/NGCards/ChangeLog | 5 +++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/SOPE/NGCards/CardElement.m b/SOPE/NGCards/CardElement.m index a20f65e7e..4b0415bae 100644 --- a/SOPE/NGCards/CardElement.m +++ b/SOPE/NGCards/CardElement.m @@ -105,17 +105,17 @@ - (void) dealloc { - if (tag) - [tag release]; - [values release]; +// [parent release]; + [tag release]; + [group release]; [attributes release]; - [parent release]; + [values release]; [super dealloc]; } - (void) setParent: (CardGroup *) aParent { - ASSIGN (parent, aParent); + parent = aParent; } - (id) parent @@ -128,6 +128,11 @@ ASSIGN (tag, aTag); } +- (NSString *) tag +{ + return tag; +} + - (void) setGroup: (NSString *) aGroup { ASSIGN (group, aGroup); @@ -216,11 +221,6 @@ [self addAttribute: @"type" value: aType]; } -- (NSString *) tag -{ - return tag; -} - - (NSArray *) values { return values; @@ -493,16 +493,12 @@ - (void) setValuesAsCopy: (NSMutableArray *) someValues { - [values release]; - values = someValues; - [values retain]; + ASSIGN (values, someValues); } - (void) setAttributesAsCopy: (NSMutableDictionary *) someAttributes { - [attributes release]; - attributes = someAttributes; - [attributes retain]; + ASSIGN (attributes, someAttributes); } - (CardGroup *) searchParentOfClass: (Class) parentClass @@ -537,6 +533,7 @@ { newChild = [[oldArray objectAtIndex: count] mutableCopyWithZone: aZone]; [newArray addObject: newChild]; + [newChild release]; } return newArray; @@ -565,7 +562,6 @@ new = [[self class] new]; [new setTag: [tag copyWithZone: aZone]]; [new setGroup: [group copyWithZone: aZone]]; - [new setParent: nil]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes withZone: aZone]]; @@ -581,7 +577,6 @@ new = [[self class] new]; [new setTag: [tag mutableCopyWithZone: aZone]]; [new setGroup: [group mutableCopyWithZone: aZone]]; - [new setParent: nil]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes withZone: aZone]]; diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index a137c046a..4191fcce8 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,8 @@ +2008-12-15 Wolfgang Sourdeau + + * CardElement.m ([CardElement -setParent:aParent]): no longer + retain the parent passed as parameter. + 2008-12-10 Wolfgang Sourdeau * iCalYearlyRecurrenceCalculator.m From 084a17d3bc940ce6f220c6a734d5aac8851c53dd Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 15 Dec 2008 22:27:45 +0000 Subject: [PATCH 6/6] Monotone-Parent: 6a659b3123531a244f7d3ef9cfe8ccae60383bc0 Monotone-Revision: e3d03c71b23436eb1ba6f15cfccc6c59a06df891 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-12-15T22:27:45 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 20 +++++++++++++++++++ .../Appointments/SOGoAppointmentFolder.m | 3 +-- .../Appointments/SOGoAppointmentObject.m | 2 +- SoObjects/SOGo/SOGoFolder.m | 2 +- SoObjects/SOGo/SOGoGCSFolder.m | 2 +- SoObjects/SOGo/SOGoParentFolder.m | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e9f2a87a..324e49ee0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2008-12-15 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder +webdavAclManager]): same as below. + + * SoObjects/Appointments/SOGoAppointmentObject.m + ([SOGoAppointmentObject +webdavAclManager]): same as below. + + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder +webdavAclManager]): + same as below. + + * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder + +webdavAclManager]): same as below. + + * SoObjects/SOGo/SOGoObject.m ([SOGoObject +webdavAclManager]): + same as below. + + * SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder + +webdavAclManager]): declare singleton as static to avoid leaking. + 2008-12-09 Francis Lachapelle * SoObjects/Appointments/SOGoAppointmentObject.m diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index cb73f2957..1fba2ed24 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -127,7 +127,7 @@ static Class sogoAppointmentFolderKlass = Nil; + (SOGoWebDAVAclManager *) webdavAclManager { - SOGoWebDAVAclManager *aclManager = nil; + static SOGoWebDAVAclManager *aclManager = nil; NSString *nsI; if (!aclManager) @@ -1071,7 +1071,6 @@ static Class sogoAppointmentFolderKlass = Nil; NSString **values, **currentValue; SoSecurityManager *mgr; SEL methodSel; - Class c; #warning things may crash here... values = calloc (100, sizeof (NSMutableString *)); diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 24ec497d1..cedb5dec3 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -58,7 +58,7 @@ + (SOGoWebDAVAclManager *) webdavAclManager { - SOGoWebDAVAclManager *aclManager = nil; + static SOGoWebDAVAclManager *aclManager = nil; NSString *nsD, *nsI; if (!aclManager) diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 4c51fc004..244583e42 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -46,7 +46,7 @@ + (SOGoWebDAVAclManager *) webdavAclManager { - SOGoWebDAVAclManager *webdavAclManager = nil; + static SOGoWebDAVAclManager *webdavAclManager = nil; if (!webdavAclManager) { diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 2bc01800a..21d0176d7 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -73,7 +73,7 @@ static NSArray *childRecordFields = nil; + (SOGoWebDAVAclManager *) webdavAclManager { - SOGoWebDAVAclManager *aclManager = nil; + static SOGoWebDAVAclManager *aclManager = nil; if (!aclManager) { diff --git a/SoObjects/SOGo/SOGoParentFolder.m b/SoObjects/SOGo/SOGoParentFolder.m index c760701eb..35210485d 100644 --- a/SoObjects/SOGo/SOGoParentFolder.m +++ b/SoObjects/SOGo/SOGoParentFolder.m @@ -54,7 +54,7 @@ static SoSecurityManager *sm = nil; + (SOGoWebDAVAclManager *) webdavAclManager { - SOGoWebDAVAclManager *aclManager = nil; + static SOGoWebDAVAclManager *aclManager = nil; if (!aclManager) {