* Headers/Foundation/NSCalendar.h: Add NSCopying protocol

* Source/NSCalendar.m: Retain ivar. Add copyWithZone:
	* Source/NSURL.m (-resourceSpecifier): Separate behavior for
	file scheme vs other schemes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31757 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2010-12-22 18:10:33 +00:00
parent 8d225f1583
commit 4f7b8c2089
4 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2010-12-22 Adam Fedor <fedor@gnu.org>
* Headers/Foundation/NSCalendar.h: Add NSCopying protocol
* Source/NSCalendar.m: Retain ivar. Add copyWithZone:
* Source/NSURL.m (-resourceSpecifier): Separate behavior for
file scheme vs other schemes.
2010-12-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendar.m: Fix to build with ICU 4.0

View file

@ -70,7 +70,7 @@ enum
@interface NSDateComponents : NSObject
@interface NSDateComponents : NSObject <NSCopying>
{
NSInteger _era;
NSInteger _year;

View file

@ -180,7 +180,7 @@ static UCalendarDateFields _NSCalendarUnitToDateField (NSCalendarUnit unit)
// It's much easier to keep a copy of the NSLocale's string representation
// than to have to build it everytime we have to open a UCalendar.
_localeId = [self _localeIdWithLocale: [NSLocale currentLocale]];
_localeId = RETAIN([self _localeIdWithLocale: [NSLocale currentLocale]]);
_tz = RETAIN([NSTimeZone defaultTimeZone]);
return self;
@ -506,4 +506,12 @@ static UCalendarDateFields _NSCalendarUnitToDateField (NSCalendarUnit unit)
_year = v;
}
- (id) copyWithZone: (NSZone*)zone
{
if (NSShouldRetainWithZone(self, zone))
return RETAIN(self);
else
return NSCopyObject(self, 0, zone);
}
@end

View file

@ -1769,7 +1769,14 @@ static unsigned urlAlign;
if (range.length > 0)
{
return [_urlString substringFromIndex: NSMaxRange(range)];
NSString *specifier;
/* MacOSX compatibility - file schemes just return the path (without
the "//") but everything else returns the whole specifier */
if ([[self scheme] isEqual: @"file"])
specifier = [_urlString substringFromIndex: NSMaxRange(range)];
else
specifier = [_urlString substringFromIndex: range.location+1];
return specifier;
}
else
{