From: helge Date: Mon, 3 Dec 2007 16:21:12 +0000 (+0000) Subject: fixed a usage of getCString on 10.5 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b44f465984a6444dc4ed079cf1ccd52332e8f84e;p=sope fixed a usage of getCString on 10.5 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1555 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 8e068ac0..5160bd4b 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,7 +1,12 @@ +2007-12-03 Helge Hess + + * NGExtensions/NSString+Formatting.h: replaced usage of deprecated + -getCString: method on MacOS 10.4 and later (v4.7.196) + 2007-07-31 Marcus Mueller * FdExt.subproj/NSMethodSignature+misc.m: added warning and bogus - implementation of -objCTypes for Leopard + implementation of -objCTypes for Leopard (v4.7.195) 2007-05-31 Helge Hess diff --git a/sope-core/NGExtensions/NGExtensions/NSString+Formatting.h b/sope-core/NGExtensions/NGExtensions/NSString+Formatting.h index ac564c6f..d42b3b6d 100644 --- a/sope-core/NGExtensions/NGExtensions/NSString+Formatting.h +++ b/sope-core/NGExtensions/NGExtensions/NSString+Formatting.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2007 SKYRIX Software AG + Copyright (C) 2007 Helge Hess This file is part of SOPE. @@ -43,17 +44,29 @@ // C support functions static inline int -xs_vsnprintf(char *str, size_t max, const char *fmt, va_list _ap) +xs_vsnprintf(char *_str, size_t max, const char *fmt, va_list _ap) { - NSString *obj = [NSString stringWithCFormat:str arguments:_ap]; - [obj getCString:str maxLength:(max - 1)]; + NSString *obj = [NSString stringWithCFormat:_str arguments:_ap]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + [obj getCString:_str maxLength:(max - 1) + encoding:[NSString defaultCStringEncoding]]; + return strlen(_str); +#else + [obj getCString:_str maxLength:(max - 1)]; return [obj cStringLength]; // return the len the string would have consumed +#endif } static inline int xs_vsprintf (char *_str, const char *_fmt, va_list _ap) { NSString *obj = [NSString stringWithCFormat:_str arguments:_ap]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + [obj getCString:_str maxLength:65535 /* no limit ... */ + encoding:[NSString defaultCStringEncoding]]; + return strlen(_str); +#else [obj getCString:_str]; return [obj cStringLength]; // return the length of the string +#endif } /* diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 6941a3f4..0b7786b9 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=195 +SUBMINOR_VERSION:=196 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39