mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Improvements suggested by Fred Kiefer for the current pull request
This commit is contained in:
parent
2a547271ad
commit
4aa11f3e48
2 changed files with 23 additions and 10 deletions
|
@ -2118,22 +2118,29 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
|||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
self = [self initWithName:nil value:nil];
|
||||
if(self != nil)
|
||||
{
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
ASSIGN(internal->_name, @""); //OSX behaviour is to set an empty string for the name property
|
||||
}
|
||||
{
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
value:(NSString *)value
|
||||
{
|
||||
self = [self init];
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
if(name)ASSIGNCOPY(internal->_name, name);
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
if(name)
|
||||
{
|
||||
ASSIGNCOPY(internal->_name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN(internal->_name, @""); //OSX behaviour is to set an empty string for nil name property
|
||||
}
|
||||
ASSIGNCOPY(internal->_value, value);
|
||||
}
|
||||
return self;
|
||||
|
@ -2267,8 +2274,14 @@ static NSCharacterSet *queryItemCharSet = nil;
|
|||
{
|
||||
//OSX behavior is to return nil for a string which cannot be used to initialize valid NSURL object
|
||||
NSURL* url = [NSURL URLWithString:URLString];
|
||||
if(url) return [self initWithURL:url resolvingAgainstBaseURL:NO];
|
||||
else return nil;
|
||||
if(url)
|
||||
{
|
||||
return [self initWithURL:url resolvingAgainstBaseURL:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype) initWithURL: (NSURL *)url
|
||||
|
|
|
@ -353,7 +353,7 @@ GSPathHandling("right");
|
|||
|
||||
item = [[NSURLQueryItem alloc] initWithName:@"myName" value:@"myValue"];
|
||||
PASS_EQUAL(item.name, @"myName", "NSURLQueryItem.name should not be nil");
|
||||
PASS_EQUAL(item.value, @"myValue", "NSURLQueryItem.value should be nil");
|
||||
PASS_EQUAL(item.value, @"myValue", "NSURLQueryItem.value should not be nil");
|
||||
|
||||
|
||||
[arp release]; arp = nil;
|
||||
|
|
Loading…
Reference in a new issue