Skip to content
This repository
Browse code

Added ARC support

  • Loading branch information...
commit 7c655a6b51942179d7a593b88ab7f7c55eb5085d 1 parent eab9262
Alex Nichol authored
26 KBCKit/KBDecodeObjC.m
@@ -46,20 +46,28 @@
46 46 uint8_t typeNum = 0;
47 47 // read an type, then the object.
48 48 if (!kb_decode_read_type(ctx, &typeSub, &typeNum)) {
  49 +#if !__has_feature(objc_arc)
49 50 [array release];
  51 +#endif
50 52 return nil;
51 53 }
52 54 if (typeSub == 0) break;
53 55 NSObject * nextObject = kb_decode_objc_object(ctx, typeSub);
54 56 if (!nextObject) {
  57 +#if !__has_feature(objc_arc)
55 58 [array release];
  59 +#endif
56 60 return nil;
57 61 }
58 62 [array addObject:nextObject];
59 63 }
60 64 // If I were to create an immutable array enclosing this, it
61 65 // would take a few more milliseconds... no thanks.
  66 +#if !__has_feature(objc_arc)
62 67 return [array autorelease];
  68 +#else
  69 + return array;
  70 +#endif
63 71 }
64 72
65 73 NSDictionary * kb_decode_objc_dictionary (KBContextRef ctx, uint8_t type) {
@@ -69,7 +77,9 @@
69 77 uint8_t typeNum = 0;
70 78 char * keyStr = NULL;
71 79 if (!kb_decode_dictionary_key(ctx, type, &keyStr)) {
  80 +#if !__has_feature(objc_arc)
72 81 [dictionary release];
  82 +#endif
73 83 return nil;
74 84 }
75 85 if (!keyStr) break;
@@ -79,27 +89,39 @@
79 89 freeWhenDone:YES];
80 90 if (!objKey) {
81 91 free(keyStr);
  92 +#if !__has_feature(objc_arc)
82 93 [dictionary release];
  94 +#endif
83 95 return nil;
84 96 }
85 97 // read an type, then the object.
86 98 if (!kb_decode_read_type(ctx, &type, &typeNum)) {
  99 +#if !__has_feature(objc_arc)
87 100 [objKey release];
88 101 [dictionary release];
  102 +#endif
89 103 return nil;
90 104 }
91 105 NSObject * nextObject = kb_decode_objc_object(ctx, type);
92 106 if (!nextObject) {
  107 +#if !__has_feature(objc_arc)
93 108 [objKey release];
94 109 [dictionary release];
  110 +#endif
95 111 return nil;
96 112 }
97 113 [dictionary setObject:nextObject forKey:objKey];
  114 +#if !__has_feature(objc_arc)
98 115 [objKey release];
  116 +#endif
99 117 }
100 118 // If I were to create an immutable dictionary enclosing this, it
101 119 // would take a few more milliseconds... no thanks.
  120 +#if !__has_feature(objc_arc)
102 121 return [dictionary autorelease];
  122 +#else
  123 + return dictionary;
  124 +#endif
103 125 }
104 126
105 127 NSString * kb_decode_objc_string (KBContextRef ctx, uint8_t type) {
@@ -114,7 +136,11 @@
114 136 if (!string) {
115 137 free(buffer);
116 138 }
  139 +#if !__has_feature(objc_arc)
117 140 return [string autorelease];
  141 +#else
  142 + return string;
  143 +#endif
118 144 }
119 145
120 146 NSNumber * kb_decode_objc_integer (KBContextRef ctx, uint8_t type) {
10 KeyedBits.xcodeproj/project.pbxproj
@@ -536,26 +536,28 @@
536 536 FAEDCAD314365D79004F8C87 /* Debug */ = {
537 537 isa = XCBuildConfiguration;
538 538 buildSettings = {
539   - ARCHS = "$(ARCHS_STANDARD_32_BIT)";
  539 + ARCHS = "$(NATIVE_ARCH_ACTUAL)";
  540 + CLANG_ENABLE_OBJC_ARC = NO;
540 541 EXECUTABLE_PREFIX = "";
541 542 GCC_PRECOMPILE_PREFIX_HEADER = YES;
542 543 GCC_PREFIX_HEADER = "LibKBCKit/LibKBCKit-Prefix.pch";
543 544 MACOSX_DEPLOYMENT_TARGET = 10.6;
544 545 PRODUCT_NAME = "$(TARGET_NAME)";
545   - SDKROOT = macosx10.6;
  546 + SDKROOT = macosx10.7;
546 547 };
547 548 name = Debug;
548 549 };
549 550 FAEDCAD414365D79004F8C87 /* Release */ = {
550 551 isa = XCBuildConfiguration;
551 552 buildSettings = {
552   - ARCHS = "$(ARCHS_STANDARD_32_BIT)";
  553 + ARCHS = "$(NATIVE_ARCH_ACTUAL)";
  554 + CLANG_ENABLE_OBJC_ARC = NO;
553 555 EXECUTABLE_PREFIX = "";
554 556 GCC_PRECOMPILE_PREFIX_HEADER = YES;
555 557 GCC_PREFIX_HEADER = "LibKBCKit/LibKBCKit-Prefix.pch";
556 558 MACOSX_DEPLOYMENT_TARGET = 10.6;
557 559 PRODUCT_NAME = "$(TARGET_NAME)";
558   - SDKROOT = macosx10.6;
  560 + SDKROOT = macosx10.7;
559 561 };
560 562 name = Release;
561 563 };
BIN  KeyedBits.xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown

0 comments on commit 7c655a6

Please sign in to comment.
Something went wrong with that request. Please try again.