Merge from base release

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34755 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-02-15 03:01:38 +00:00
parent c66b0a6adf
commit e5691678b4
3 changed files with 44 additions and 10 deletions

View file

@ -71,21 +71,27 @@
#ifndef RETAIN
/**
* Basic retain operation ... calls [NSObject-retain]
* Basic retain operation ... calls [NSObject-retain]<br />
* Deprecated ... pointless on modern processors.
* Simply call the -retain method.
*/
#define RETAIN(object) [(object) retain]
#endif
#ifndef RELEASE
/**
* Basic release operation ... calls [NSObject-release]
* Basic release operation ... calls [NSObject-release]<br />
* Deprecated ... pointless on modern processors.
* Simply call the -release method.
*/
#define RELEASE(object) [(object) release]
#endif
#ifndef AUTORELEASE
/**
* Basic autorelease operation ... calls [NSObject-autorelease]
* Basic autorelease operation ... calls [NSObject-autorelease]<br />
* Deprecated ... pointless on modern processors.
* Simply call the -autorelease method.
*/
#define AUTORELEASE(object) [(object) autorelease]
#endif
@ -93,23 +99,31 @@
#ifndef TEST_RETAIN
/**
* Tested retain - only invoke the
* objective-c method if the receiver is not nil.
* objective-c method if the receiver is not nil.<br />
* Deprecated ... pointless on modern processors.
* Simply call the -retain method.
*/
#define TEST_RETAIN(object) ({\
id __object = (object); (__object != nil) ? [__object retain] : nil; })
#endif
#ifndef TEST_RELEASE
/**
* Tested release - only invoke the
* objective-c method if the receiver is not nil.
* objective-c method if the receiver is not nil.<br />
* Deprecated ... pointless on modern processors.
* Simply call the -release method.
*/
#define TEST_RELEASE(object) ({\
id __object = (object); if (__object != nil) [__object release]; })
#endif
#ifndef TEST_AUTORELEASE
/**
* Tested autorelease - only invoke the
* objective-c method if the receiver is not nil.
* objective-c method if the receiver is not nil.<br />
* Deprecated ... pointless on modern processors.
* Simply call the -autorelease method.
*/
#define TEST_AUTORELEASE(object) ({\
id __object = (object); (__object != nil) ? [__object autorelease] : nil; })
@ -118,7 +132,8 @@ id __object = (object); (__object != nil) ? [__object autorelease] : nil; })
#ifndef ASSIGN
/**
* ASSIGN(object,value) assigns the value to the object with
* appropriate retain and release operations.
* appropriate retain and release operations.<br />
* Use this to avoid retain/release errors.
*/
#define ASSIGN(object,value) ({\
id __object = object; \
@ -130,7 +145,8 @@ id __object = (object); (__object != nil) ? [__object autorelease] : nil; })
#ifndef ASSIGNCOPY
/**
* ASSIGNCOPY(object,value) assigns a copy of the value to the object
* with release of the original.
* with release of the original.<br />
* Use this to avoid retain/release errors.
*/
#define ASSIGNCOPY(object,value) ({\
id __object = object; \

View file

@ -66,7 +66,7 @@ NSString * const NSErrorFailingURLStringKey = @"NSErrorFailingURLStringKey";
@implementation NSString (NSURLPrivate)
/* Like the normal percent escape method, but with additional characters
* escaped.
* escaped (for use by file scheme URLs).
*/
- (NSString*) _stringByAddingPercentEscapes
{
@ -708,7 +708,15 @@ static NSUInteger urlAlign;
{
NSString *aUrlString = [NSString alloc];
aPath = [aPath _stringByAddingPercentEscapes];
if ([aScheme isEqualToString: @"file"])
{
aPath = [aPath _stringByAddingPercentEscapes];
}
else
{
aPath = [aPath
stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
}
if ([aHost length] > 0)
{
NSRange r = [aHost rangeOfString: @"@"];

View file

@ -121,6 +121,16 @@ int main()
"Simple relative URL fullPath works");
#endif
url = [NSURL URLWithString: @"http://1.2.3.4/a?b;foo"];
PASS_EQUAL([url absoluteString], @"http://1.2.3.4/a?b;foo",
"query and params not escaped");
url = [[[NSURL alloc] initWithScheme: @"http"
host: @"1.2.3.4"
path: @"/a?b;foo"] autorelease];
PASS_EQUAL([url absoluteString], @"http://1.2.3.4/a?b;foo",
"query and params not escaped");
url = [NSURL URLWithString: @"http://here.and.there/testing/one.html"];
rel = [NSURL URLWithString: @"/aaa/bbb/ccc/" relativeToURL: url];
PASS([[rel absoluteString]