Skip to content

Commit

Permalink
merge 6ea2f71
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwl committed Mar 31, 2015
2 parents c7666b5 + 6ea2f71 commit ffacaaa
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions Foundation/NSDate/NSDate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ FOUNDATION_EXPORT const NSTimeInterval NSTimeIntervalSince1970;
-initWithString:(NSString *)string;
-initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)seconds;
-initWithTimeIntervalSinceNow:(NSTimeInterval)seconds;
-initWithTimeIntervalSince1970:(NSTimeInterval)seconds;
-initWithTimeInterval:(NSTimeInterval)seconds sinceDate:(NSDate *)date;

+date;
Expand Down
8 changes: 6 additions & 2 deletions Foundation/NSDate/NSDate.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ +(NSTimeInterval)timeIntervalSinceReferenceDate {
NSPlatformTimeIntervalSinceReferenceDate()+seconds];
}

-initWithTimeIntervalSince1970:(NSTimeInterval)seconds {
return [self initWithTimeIntervalSinceReferenceDate:
-NSTimeIntervalSince1970+seconds];
}

-initWithTimeInterval:(NSTimeInterval)seconds sinceDate:(NSDate *)other {
return [self initWithTimeIntervalSinceReferenceDate:
[other timeIntervalSinceReferenceDate]+seconds];
Expand All @@ -91,8 +96,7 @@ +(NSTimeInterval)timeIntervalSinceReferenceDate {
}

+dateWithTimeIntervalSince1970:(NSTimeInterval)seconds {
return [[[self allocWithZone:NULL] initWithTimeIntervalSinceReferenceDate:
-NSTimeIntervalSince1970+seconds] autorelease];
return [[[self allocWithZone:NULL] initWithTimeIntervalSince1970:seconds] autorelease];
}


Expand Down
14 changes: 13 additions & 1 deletion Foundation/NSURL/NSURL.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>

@class NSURLHandle,NSNumber,NSData;
@class NSURLHandle,NSNumber,NSData,NSArray;

FOUNDATION_EXPORT NSString * const NSURLFileScheme;

Expand Down Expand Up @@ -73,3 +73,15 @@ FOUNDATION_EXPORT NSString * const NSURLFileScheme;

@end

@interface NSURL (NSURLPathUtilities)

+ (NSURL *)fileURLWithPathComponents:(NSArray *)components;
- (NSArray *)pathComponents;
- (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent isDirectory:(BOOL)isDirectory;
- (NSURL *)URLByAppendingPathExtension:(NSString *)pathExtension;
- (NSURL *)URLByDeletingPathExtension;

- (NSURL *)URLByStandardizingPath;
- (NSURL *)URLByResolvingSymlinksInPath;

@end
25 changes: 25 additions & 0 deletions Foundation/NSURL/NSURL.m
Original file line number Diff line number Diff line change
Expand Up @@ -899,3 +899,28 @@ - (NSString *)pathExtension
}

@end

@implementation NSURL (NSURLPathUtilities)

+ (NSURL *)fileURLWithPathComponents:(NSArray *)components {
return [NSURL fileURLWithPath:[NSString pathWithComponents:components]];
}

- (NSArray *)pathComponents {
return [[self path] pathComponents];
}

- (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent isDirectory:(BOOL)isDirectory {
NSUnimplementedMethod();
return nil;
}

- (NSURL *)URLByStandardizingPath {
return [NSURL fileURLWithPath:[[self path] stringByStandardizingPath]];
}

- (NSURL *)URLByResolvingSymlinksInPath {
return [NSURL fileURLWithPath:[[self path] stringByResolvingSymlinksInPath]];
}

@end
2 changes: 1 addition & 1 deletion objc/objc_class.m
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types) {
struct objc_method_list *methodList = calloc(sizeof(struct objc_method_list)+sizeof(struct objc_method), 1);
char *typescopy = (char *)malloc(strlen(types)+1);

newMethod->method_name = name;
newMethod->method_name = sel_getSelector(name);
strcpy(typescopy,(char *)types);
newMethod->method_types = typescopy;
newMethod->method_imp = imp;
Expand Down
4 changes: 2 additions & 2 deletions xcconfig/windows-i386-clang.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0
WINDOWS_i386_COMPILER_CFLAGS = -ccc-host-triple i386-pc-mingw32msvc -ccc-gcc-name i386-mingw32msvc-gcc -DWINDOWS=1 -D__WIN32__=1 -fno-builtin
WINDOWS_i386_COMPILER_LDFLAGS = -ccc-host-triple i386-pc-mingw32msvc -ccc-gcc-name i386-mingw32msvc-gcc

WINDOWS_i386_COMPILER_ISYSTEM = -isystem /Developer/Cocotron/1.0/Windows/i386/sysroot/mingw/include/
WINDOWS_i386_COMPILER_SYSLIB = /Developer/Cocotron/1.0/Windows/i386/sysroot/mingw/lib/
WINDOWS_i386_COMPILER_ISYSTEM = -isystem /Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/i386-mingw32msvc/include/
WINDOWS_i386_COMPILER_SYSLIB = /Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/i386-mingw32msvc/lib

0 comments on commit ffacaaa

Please sign in to comment.