diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2017-01-02 11:31:52 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2017-01-02 11:31:52 +0100 |
commit | ff79a9c213dfd75ea00ed5112d3a6e314601e064 (patch) | |
tree | 19ecef47bf11803fc4fc59e06c185c65aa7fdd19 /tikzit/src/common/Shape.m | |
parent | 9e4f8a6ff37161da4fa0af14604ad22d9c212fde (diff) | |
parent | 49c0d2041f0aae6d08d325b7f7fc1cd707d942f8 (diff) |
Merge branch 'arc'
Diffstat (limited to 'tikzit/src/common/Shape.m')
-rw-r--r-- | tikzit/src/common/Shape.m | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m index eb466e2..e887688 100644 --- a/tikzit/src/common/Shape.m +++ b/tikzit/src/common/Shape.m @@ -61,8 +61,12 @@ - (NSSet*)paths {return paths;} - (void)setPaths:(NSSet *)p { if (paths != p) { +#if __has_feature(objc_arc) + paths = p; +#else [paths release]; paths = [p retain]; +#endif [self calcBoundingRect]; } } @@ -79,16 +83,19 @@ } - (void)dealloc { +#if ! __has_feature(objc_arc) [paths release]; [styleTikz release]; [super dealloc]; +#endif } NSDictionary *shapeDictionary = nil; + (void)addShapesInDir:(NSString*)shapeDir to:(NSMutableDictionary*)shapeDict { NSFileManager *fileManager = [NSFileManager defaultManager]; - NSArray *files = [fileManager directoryContentsAtPath:shapeDir]; + NSError *err = nil; + NSArray *files = [fileManager contentsOfDirectoryAtPath:shapeDir error:&err]; if (files != nil) { NSString *nm; @@ -100,7 +107,9 @@ NSDictionary *shapeDictionary = nil; [shapeDir stringByAppendingPathComponent:f]]; if (sh != nil) { [shapeDict setObject:sh forKey:nm]; +#if ! __has_feature(objc_arc) [sh release]; +#endif } } } @@ -121,7 +130,9 @@ NSDictionary *shapeDictionary = nil; shapes[3], SHAPE_UP_TRIANGLE, shapes[4], SHAPE_DOWN_TRIANGLE, nil]; +#if ! __has_feature(objc_arc) for (int i = 0; i<5; ++i) [shapes[i] release]; +#endif NSString *systemShapeDir = [[SupportDir systemSupportDir] stringByAppendingPathComponent:@"shapes"]; NSString *userShapeDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"shapes"]; @@ -136,7 +147,9 @@ NSDictionary *shapeDictionary = nil; postNotificationName:@"ShapeDictionaryReplaced" object:self]; +#if ! __has_feature(objc_arc) [oldShapeDictionary release]; +#endif } + (NSDictionary*)shapeDictionary { @@ -146,7 +159,11 @@ NSDictionary *shapeDictionary = nil; + (Shape*)shapeForName:(NSString*)shapeName { Shape *s = [[[self shapeDictionary] objectForKey:shapeName] copy]; +#if __has_feature(objc_arc) + return s; +#else return [s autorelease]; +#endif } @end |