From be403dd2b9759d32ab3e69bc739d3afa6fc9a7b1 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 15 Oct 2004 10:50:54 +0000 Subject: [PATCH] minor fixes git-svn-id: http://svn.opengroupware.org/SOPE/trunk@259 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 5 ++ .../FdExt.subproj/NSString+Escaping.m | 55 +++++++++---------- .../NGExtensions/NSString+Escaping.h | 5 +- sope-core/NGExtensions/Version | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 751d7f5b..23364de7 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,8 @@ +2004-10-15 Helge Hess + + * FdExt.subproj/NSString+Escaping.m: minor code cleanups, removed a + superflous if() condition (v4.3.124) + 2004-10-14 Marcus Mueller * v4.3.123 diff --git a/sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m b/sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m index 0ef980c0..a228be80 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m @@ -18,13 +18,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ - #include #include "common.h" -@implementation NSString (Escaping) +@implementation NSString(Escaping) - (NSString *)stringByApplyingCEscaping { // Unicode! @@ -77,46 +75,45 @@ { NSMutableString *safeString; unsigned length; - NSRange prevRange, escRange; - BOOL needsEscaping; + NSRange prevRange, escRange; + NSRange todoRange; + BOOL needsEscaping; length = [self length]; prevRange = NSMakeRange(0, length); escRange = [self rangeOfCharacterFromSet:_escSet options:0 range:prevRange]; needsEscaping = escRange.length > 0 ? YES : NO; - if (!needsEscaping) { + if (!needsEscaping) return self; /* cheap */ - } safeString = [NSMutableString stringWithCapacity:length]; - if (needsEscaping) { - NSRange todoRange; - length = prevRange.length; - do { - NSString *s; + length = prevRange.length; + do { + NSString *s; - prevRange.length = escRange.location - prevRange.location; - if (prevRange.length > 0) - [safeString appendString:[self substringWithRange:prevRange]]; - s = [_esc stringByEscapingString:[self substringWithRange:escRange]]; - if (s) + prevRange.length = escRange.location - prevRange.location; + if (prevRange.length > 0) + [safeString appendString:[self substringWithRange:prevRange]]; + + s = [_esc stringByEscapingString:[self substringWithRange:escRange]]; + if (s != nil) [safeString appendString:s]; - prevRange.location = NSMaxRange(escRange); - todoRange.location = prevRange.location; - todoRange.length = length - prevRange.location; - escRange = [self rangeOfCharacterFromSet:_escSet - options:0 - range:todoRange]; - } - while(escRange.length > 0); - if(todoRange.length > 0) { - [safeString appendString:[self substringWithRange:todoRange]]; - } + prevRange.location = NSMaxRange(escRange); + todoRange.location = prevRange.location; + todoRange.length = length - prevRange.location; + escRange = [self rangeOfCharacterFromSet:_escSet + options:0 + range:todoRange]; } + while(escRange.length > 0); + + if (todoRange.length > 0) + [safeString appendString:[self substringWithRange:todoRange]]; + return safeString; } -@end +@end /* NSString(Escaping) */ diff --git a/sope-core/NGExtensions/NGExtensions/NSString+Escaping.h b/sope-core/NGExtensions/NGExtensions/NSString+Escaping.h index d0a95c21..19004943 100644 --- a/sope-core/NGExtensions/NGExtensions/NSString+Escaping.h +++ b/sope-core/NGExtensions/NGExtensions/NSString+Escaping.h @@ -18,8 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ - #ifndef __NGExtensions_NSString_Escaping_H__ #define __NGExtensions_NSString_Escaping_H__ @@ -35,7 +33,8 @@ - (NSString *)stringByApplyingCEscaping; - (NSString *)stringByEscapingCharactersFromSet:(NSCharacterSet *)_set - usingStringEscaping:()_esc; + usingStringEscaping:(id)_esc; + @end #endif /* __NGExtensions_NSString_Escaping_H__ */ diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 902b0e2d..bb8ba195 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=123 +SUBMINOR_VERSION:=124 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5