From 978cb216bb2ec309a377e45b29f4adcea9407c4d Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 29 Sep 2005 10:28:56 +0000 Subject: [PATCH] added -isNotEmpty to NSData git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1143 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 4 ++++ sope-core/NGExtensions/EOExt.subproj/EOKeyGrouping.m | 6 ++++-- sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m | 11 +++++++++++ sope-core/NGExtensions/Version | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index d2ff66c8..7935158d 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,7 @@ +2005-09-28 Helge Hess + + * FdExt.subproj/NSNull+misc.m: added -isNotEmpty to NSData (v4.5.175) + 2005-09-14 Helge Hess * NGBundleManager.m: avoid an autorelease call in class lookup, added diff --git a/sope-core/NGExtensions/EOExt.subproj/EOKeyGrouping.m b/sope-core/NGExtensions/EOExt.subproj/EOKeyGrouping.m index 368cf95d..7a2a990d 100644 --- a/sope-core/NGExtensions/EOExt.subproj/EOKeyGrouping.m +++ b/sope-core/NGExtensions/EOExt.subproj/EOKeyGrouping.m @@ -25,8 +25,10 @@ @implementation EOKeyGrouping - (id)initWithKey:(NSString *)_key { - if ((self = [super initWithDefaultName:nil])) { - self->key = [_key copy]; + if ((self = [super initWithDefaultName:nil]) != nil) { + self->key = [_key copy]; + + // TODO: create on-demand? self->groupNames = [[NSMutableArray alloc] initWithCapacity:32]; } return self; diff --git a/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m b/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m index 550a3dec..35f5e4f8 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSNull+misc.m @@ -237,6 +237,9 @@ static inline BOOL doAbort(void) { if ((len = [self length]) == 0) return NO; + // TODO: just check the first char for performance ... + // But: a single space should be treated as emtpy, since this is very common + // in SQL (Sybase in special) for (i = 0; i < len; i++) { if (!isspace([self characterAtIndex:i])) return YES; @@ -262,3 +265,11 @@ static inline BOOL doAbort(void) { } @end /* NSDictionary(NSNullMisc) */ + +@implementation NSData(NSNullMisc) + +- (BOOL)isNotEmpty { + return [self length] == 0 ? NO : YES; +} + +@end /* NSData(NSNullMisc) */ diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 00285053..0470f28d 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=174 +SUBMINOR_VERSION:=175 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5