Permalink
Browse files

[delint] Delint the entire project.

  • Loading branch information...
jverkoey committed Feb 27, 2011
1 parent 6f7c853 commit 8464e20001426608cd88920b02b8fc0f12514190
Showing with 1,134 additions and 270 deletions.
  1. +16 −0 src/Three20/Three20.xcodeproj/project.pbxproj
  2. +1 −2 src/Three20/UnitTests/BasicTests.m
  3. +5 −3 src/Three20Core/Headers/TTCorePreprocessorMacros.h
  4. +3 −3 src/Three20Core/Headers/TTDebug.h
  5. +1 −1 src/Three20Core/Headers/TTExtensionInfo.h
  6. +2 −0 src/Three20Core/Sources/NSDataAdditions.m
  7. +11 −9 src/Three20Core/Sources/NSDateAdditions.m
  8. +10 −0 src/Three20Core/Sources/NSObjectAdditions.m
  9. +17 −7 src/Three20Core/Sources/NSStringAdditions.m
  10. +9 −9 src/Three20Core/Sources/TTEntityTables.m
  11. +4 −1 src/Three20Core/Sources/TTGlobalCoreLocale.m
  12. +1 −1 src/Three20Core/Sources/TTGlobalCorePaths.m
  13. +16 −0 src/Three20Core/Three20Core.xcodeproj/project.pbxproj
  14. +37 −22 src/Three20Core/UnitTests/CoreAdditionTests.m
  15. +1 −2 src/Three20Core/UnitTests/CoreGlobalTests.m
  16. +1 −2 src/Three20Core/UnitTests/CoreMarkupStripperTests.m
  17. +2 −2 src/Three20Network/Headers/TTURLRequest.h
  18. +1 −1 src/Three20Network/Headers/TTURLRequestModel.h
  19. +1 −1 src/Three20Network/Headers/TTUserInfo.h
  20. +1 −1 src/Three20Network/Sources/TTModel.m
  21. +7 −4 src/Three20Network/Sources/TTRequestLoader.m
  22. +11 −6 src/Three20Network/Sources/TTURLCache.m
  23. +14 −4 src/Three20Network/Sources/TTURLRequest.m
  24. +11 −1 src/Three20Network/Sources/TTURLRequestQueue.m
  25. +8 −8 src/Three20Network/Sources/TTUserInfo.m
  26. +16 −0 src/Three20Network/Three20Network.xcodeproj/project.pbxproj
  27. +2 −4 src/Three20Network/UnitTests/NetworkModelTests.m
  28. +5 −5 src/Three20Network/UnitTests/NetworkURLCacheTests.m
  29. +5 −2 src/Three20Style/Headers/TTBevelBorderStyle.h
  30. +2 −2 src/Three20Style/Headers/TTStyledButtonNode.h
  31. +1 −1 src/Three20Style/Headers/TTStyledElement.h
  32. +1 −1 src/Three20Style/Headers/TTStyledImageNode.h
  33. +2 −2 src/Three20Style/Headers/TTStyledLinkNode.h
  34. +1 −1 src/Three20Style/Headers/TTStyledTextNode.h
  35. +9 −2 src/Three20Style/Sources/TTBevelBorderStyle.m
  36. +29 −5 src/Three20Style/Sources/TTDefaultStyleSheet.m
  37. +4 −0 src/Three20Style/Sources/TTFourBorderStyle.m
  38. +11 −4 src/Three20Style/Sources/TTImageStyle.m
  39. +1 −0 src/Three20Style/Sources/TTInnerShadowStyle.m
  40. +1 −0 src/Three20Style/Sources/TTInsetStyle.m
  41. +2 −1 src/Three20Style/Sources/TTReflectiveFillStyle.m
  42. +2 −0 src/Three20Style/Sources/TTRoundedLeftArrowShape.m
  43. +1 −0 src/Three20Style/Sources/TTRoundedRectangleShape.m
  44. +1 −0 src/Three20Style/Sources/TTRoundedRightArrowShape.m
  45. +3 −0 src/Three20Style/Sources/TTShadowStyle.m
  46. +1 −0 src/Three20Style/Sources/TTStyleInternal.m
  47. +5 −0 src/Three20Style/Sources/TTStyledElement.m
  48. +19 −1 src/Three20Style/Sources/TTStyledLayout.m
  49. +2 −0 src/Three20Style/Sources/TTStyledNode.m
  50. +6 −0 src/Three20Style/Sources/TTStyledText.m
  51. +5 −2 src/Three20Style/Sources/TTStyledTextParser.m
  52. +7 −1 src/Three20Style/Sources/TTTextStyle.m
  53. +5 −5 src/Three20Style/Sources/UIColorAdditions.m
  54. +15 −0 src/Three20Style/Sources/UIImageAdditions.m
  55. +16 −0 src/Three20Style/Three20Style.xcodeproj/project.pbxproj
  56. +1 −2 src/Three20Style/UnitTests/StyleAdditionTests.m
  57. +1 −2 src/Three20Style/UnitTests/StyleGlobalTests.m
  58. +2 −2 src/Three20UI/Headers/TTActivityLabel.h
  59. +2 −2 src/Three20UI/Headers/TTButtonBar.h
  60. +4 −4 src/Three20UI/Headers/TTMessageController.h
  61. +1 −1 src/Three20UI/Headers/TTMessageRecipientField.h
  62. +3 −3 src/Three20UI/Headers/TTScrollView.h
  63. +1 −1 src/Three20UI/Headers/TTTabBar.h
  64. +1 −1 src/Three20UI/Headers/TTTableFooterInfiniteScrollView.h
  65. +5 −5 src/Three20UI/Headers/TTTableViewNetworkEnabledDelegate.h
  66. +1 −1 src/Three20UI/Headers/TTWebController.h
  67. +2 −0 src/Three20UI/Sources/TTActionSheetController.m
  68. +13 −0 src/Three20UI/Sources/TTActivityLabel.m
  69. +3 −1 src/Three20UI/Sources/TTAlertViewController.m
  70. +12 −0 src/Three20UI/Sources/TTButton.m
  71. +1 −0 src/Three20UI/Sources/TTButtonContent.m
  72. +1 −0 src/Three20UI/Sources/TTErrorView.m
  73. +3 −2 src/Three20UI/Sources/TTExtensionsController.m
  74. +1 −0 src/Three20UI/Sources/TTImageLayer.m
  75. +1 −0 src/Three20UI/Sources/TTImageView.m
  76. +2 −0 src/Three20UI/Sources/TTImageViewInternal.m
  77. +13 −5 src/Three20UI/Sources/TTLauncherButton.m
  78. +2 −0 src/Three20UI/Sources/TTLauncherHighlightView.m
  79. +2 −1 src/Three20UI/Sources/TTLauncherItem.m
  80. +15 −1 src/Three20UI/Sources/TTLauncherView.m
  81. +1 −0 src/Three20UI/Sources/TTLink.m
  82. +1 −0 src/Three20UI/Sources/TTListDataSource.m
  83. +9 −0 src/Three20UI/Sources/TTMessageController.m
  84. +8 −0 src/Three20UI/Sources/TTModelViewController.m
  85. +2 −1 src/Three20UI/Sources/TTPageControl.m
  86. +3 −1 src/Three20UI/Sources/TTPhotoView.m
  87. +65 −19 src/Three20UI/Sources/TTPhotoViewController.m
  88. +11 −0 src/Three20UI/Sources/TTPickerTextField.m
  89. +1 −0 src/Three20UI/Sources/TTPickerViewCell.m
  90. +6 −0 src/Three20UI/Sources/TTPostController.m
  91. +1 −0 src/Three20UI/Sources/TTRecursiveProgress.m
  92. +53 −4 src/Three20UI/Sources/TTScrollView.m
  93. +3 −0 src/Three20UI/Sources/TTSearchBar.m
  94. +1 −0 src/Three20UI/Sources/TTSearchDisplayController.m
  95. +7 −0 src/Three20UI/Sources/TTSearchTextField.m
  96. +5 −0 src/Three20UI/Sources/TTSearchTextFieldInternal.m
  97. +3 −0 src/Three20UI/Sources/TTSearchlightLabel.m
  98. +8 −0 src/Three20UI/Sources/TTSectionedDataSource.m
  99. +16 −3 src/Three20UI/Sources/TTStyledTextLabel.m
  100. +2 −0 src/Three20UI/Sources/TTTab.m
  101. +3 −1 src/Three20UI/Sources/TTTabBar.m
  102. +3 −0 src/Three20UI/Sources/TTTabBarInternal.m
  103. +8 −0 src/Three20UI/Sources/TTTabGrid.m
  104. +2 −0 src/Three20UI/Sources/TTTabStrip.m
  105. +1 −0 src/Three20UI/Sources/TTTableActivityItemCell.m
  106. +1 −0 src/Three20UI/Sources/TTTableControlCell.m
  107. +1 −0 src/Three20UI/Sources/TTTableFlushViewCell.m
  108. +14 −1 src/Three20UI/Sources/TTTableFooterInfiniteScrollView.m
  109. +2 −1 src/Three20UI/Sources/TTTableHeaderDragRefreshView.m
  110. +15 −6 src/Three20UI/Sources/TTTableImageItemCell.m
  111. +5 −0 src/Three20UI/Sources/TTTableMessageItemCell.m
  112. +6 −3 src/Three20UI/Sources/TTTableMoreButtonCell.m
  113. +1 −0 src/Three20UI/Sources/TTTableSubtitleItemCell.m
  114. +2 −0 src/Three20UI/Sources/TTTableTextItemCell.m
  115. +1 −0 src/Three20UI/Sources/TTTableView.m
  116. +36 −5 src/Three20UI/Sources/TTTableViewController.m
  117. +18 −1 src/Three20UI/Sources/TTTableViewDataSource.m
  118. +2 −0 src/Three20UI/Sources/TTTableViewDelegate.m
  119. +1 −0 src/Three20UI/Sources/TTTableViewDragRefreshDelegate.m
  120. +1 −0 src/Three20UI/Sources/TTTableViewGroupedVarHeightDelegate.m
  121. +5 −2 src/Three20UI/Sources/TTTableViewNetworkEnabledDelegate.m
  122. +9 −1 src/Three20UI/Sources/TTTextBarController.m
  123. +4 −0 src/Three20UI/Sources/TTTextEditor.m
  124. +10 −4 src/Three20UI/Sources/TTTextEditorInternal.m
  125. +5 −0 src/Three20UI/Sources/TTThumbsDataSource.m
  126. +1 −0 src/Three20UI/Sources/TTThumbsTableViewCell.m
  127. +2 −0 src/Three20UI/Sources/TTThumbsViewController.m
  128. +35 −13 src/Three20UI/Sources/TTWebController.m
  129. +5 −0 src/Three20UI/Sources/UINavigationControllerAdditions.m
  130. +1 −0 src/Three20UI/Sources/UITabBarControllerAdditions.m
  131. +3 −1 src/Three20UI/Sources/UITableViewAdditions.m
  132. +18 −4 src/Three20UI/Sources/UIViewAdditions.m
  133. +16 −0 src/Three20UI/Three20UI.xcodeproj/project.pbxproj
  134. +1 −2 src/Three20UI/UnitTests/UIGlobalTests.m
  135. +1 −1 src/Three20UICommon/Headers/TTGlobalUICommon.h
  136. +3 −1 src/Three20UICommon/Sources/TTBaseViewController.m
  137. +7 −0 src/Three20UICommon/Sources/TTGlobalUICommon.m
  138. +7 −2 src/Three20UICommon/Sources/UIViewControllerAdditions.m
  139. +16 −0 src/Three20UICommon/Three20UICommon.xcodeproj/project.pbxproj
  140. +1 −2 src/Three20UICommon/UnitTests/UICommonTests.m
  141. +2 −2 src/Three20UICommon/UnitTests/UIViewControllerAdditionTests.m
  142. +2 −2 src/Three20UINavigator/Headers/TTURLAction.h
  143. +1 −1 src/Three20UINavigator/Headers/UIViewController+TTNavigator.h
  144. +18 −3 src/Three20UINavigator/Sources/TTBaseNavigator.m
  145. +4 −0 src/Three20UINavigator/Sources/TTGlobalNavigatorMetrics.m
  146. +6 −0 src/Three20UINavigator/Sources/TTURLArguments.m
  147. +1 −0 src/Three20UINavigator/Sources/TTURLGeneratorPattern.m
  148. +9 −4 src/Three20UINavigator/Sources/TTURLMap.m
  149. +12 −0 src/Three20UINavigator/Sources/TTURLNavigatorPattern.m
  150. +1 −0 src/Three20UINavigator/Sources/TTURLSelector.m
  151. +3 −0 src/Three20UINavigator/Sources/TTURLWildcard.m
  152. +1 −0 src/Three20UINavigator/Sources/UIViewController+TTNavigator.m
  153. +16 −0 src/Three20UINavigator/Three20UINavigator.xcodeproj/project.pbxproj
  154. +1 −2 src/Three20UINavigator/UnitTests/TTURLActionTests.m
  155. +1 −2 src/Three20UINavigator/UnitTests/UIViewControllerAdditionTests.m
  156. +49 −12 src/UnitTests/Xcode324iOS41TestSuiteWorkaround.m
  157. +16 −0 src/extThree20CSSStyle/extThree20CSSStyle.xcodeproj/project.pbxproj
  158. +32 −0 src/extThree20JSON/extThree20JSON.xcodeproj/project.pbxproj
  159. +16 −0 src/extThree20XML/extThree20XML.xcodeproj/project.pbxproj
@@ -400,6 +400,7 @@
BEF31F360F352DF5000DE5D2 /* Headers */,
6E645F461187B01F00F08CB1 /* Protect Copied Headers */,
BEF31F370F352DF5000DE5D2 /* Sources */,
+ 668E6653131ADFFD00ACE4AB /* Lint */,
BEF31F380F352DF5000DE5D2 /* Frameworks */,
);
buildRules = (
@@ -594,6 +595,21 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 668E6653131ADFFD00ACE4AB /* Lint */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = Lint;
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = "/usr/bin/env python ../scripts/lint";
+ shellScript = "";
+ showEnvVarsInLog = 0;
+ };
6E645F461187B01F00F08CB1 /* Protect Copied Headers */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -14,8 +14,7 @@
// limitations under the License.
//
-// See: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/905-A-Unit-Test_Result_Macro_Reference/unit-test_results.html#//apple_ref/doc/uid/TP40007959-CH21-SW2
-// for unit test macros.
+// See: http://bit.ly/hS5nNh for unit test macros.
#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
@@ -26,11 +26,13 @@
#define __TTDEPRECATED_METHOD __attribute__((deprecated))
/**
- * Add this macro before each category implementation, so we don't have to use -all_load or -force_load
- * to load object files from static libraries that only contain categories and no classes.
+ * Add this macro before each category implementation, so we don't have to use
+ * -all_load or -force_load to load object files from static libraries that only contain
+ * categories and no classes.
* See http://developer.apple.com/library/mac/#qa/qa2006/qa1490.html for more info.
*/
-#define TT_FIX_CATEGORY_BUG(name) @interface TT_FIX_CATEGORY_BUG_##name @end @implementation TT_FIX_CATEGORY_BUG_##name @end
+#define TT_FIX_CATEGORY_BUG(name) @interface TT_FIX_CATEGORY_BUG_##name @end \
+ @implementation TT_FIX_CATEGORY_BUG_##name @end
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -68,11 +68,11 @@
int TTIsInDebugger();
// We leave the __asm__ in this macro so that when a break occurs, we don't have to step out of
// a "breakInDebugger" function.
- #define TTDASSERT(xx) { if(!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); \
- if(TTIsInDebugger()) { __asm__("int $3\n" : : ); }; } \
+ #define TTDASSERT(xx) { if (!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); \
+ if (TTIsInDebugger()) { __asm__("int $3\n" : : ); }; } \
} ((void)0)
#else
- #define TTDASSERT(xx) { if(!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); } } ((void)0)
+ #define TTDASSERT(xx) { if (!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); } } ((void)0)
#endif // #if TARGET_IPHONE_SIMULATOR
#else
@@ -34,6 +34,6 @@
@property (nonatomic, copy) NSString* version;
@property (nonatomic, copy) NSString* copyright;
@property (nonatomic, copy) NSString* license;
-@property (nonatomic, retain) NSArray* authors; // NSArray of TTExtensionAuthor* objects.
+@property (nonatomic, copy) NSArray* authors; // NSArray of TTExtensionAuthor* objects.
@end
@@ -45,6 +45,8 @@ - (NSString*)md5Hash {
];
}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)sha1Hash {
unsigned char result[CC_SHA1_DIGEST_LENGTH];
CC_SHA1([self bytes], [self length], result);
@@ -73,7 +73,7 @@ - (NSDate*)dateAtMidnight {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)formatTime {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"h:mm a", @"Date format: 1:05 pm");
formatter.locale = TTCurrentLocale();
@@ -85,7 +85,7 @@ - (NSString*)formatTime {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)formatDate {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat =
TTLocalizedString(@"EEEE, LLLL d, YYYY", @"Date format: Monday, July 27, 2009");
@@ -104,7 +104,7 @@ - (NSString*)formatShortTime {
} else if (diff < TT_5_DAYS) {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"EEEE", @"Date format: Monday");
formatter.locale = TTCurrentLocale();
@@ -113,7 +113,7 @@ - (NSString*)formatShortTime {
} else {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"M/d/yy", @"Date format: 7/27/09");
formatter.locale = TTCurrentLocale();
@@ -131,7 +131,7 @@ - (NSString*)formatDateTime {
} else if (diff < TT_5_DAYS) {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"EEE h:mm a", @"Date format: Mon 1:05 pm");
formatter.locale = TTCurrentLocale();
@@ -140,7 +140,7 @@ - (NSString*)formatDateTime {
} else {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"MMM d h:mm a", @"Date format: Jul 27 1:05 pm");
formatter.locale = TTCurrentLocale();
@@ -208,7 +208,7 @@ - (NSString*)formatShortRelativeTime {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)formatDay:(NSDateComponents*)today yesterday:(NSDateComponents*)yesterday {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"MMMM d", @"Date format: July 27");
formatter.locale = TTCurrentLocale();
@@ -220,9 +220,11 @@ - (NSString*)formatDay:(NSDateComponents*)today yesterday:(NSDateComponents*)yes
if (day.day == today.day && day.month == today.month && day.year == today.year) {
return TTLocalizedString(@"Today", @"");
+
} else if (day.day == yesterday.day && day.month == yesterday.month
&& day.year == yesterday.year) {
return TTLocalizedString(@"Yesterday", @"");
+
} else {
return [formatter stringFromDate:self];
}
@@ -232,7 +234,7 @@ - (NSString*)formatDay:(NSDateComponents*)today yesterday:(NSDateComponents*)yes
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)formatMonth {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"MMMM", @"Date format: July");
formatter.locale = TTCurrentLocale();
@@ -244,7 +246,7 @@ - (NSString*)formatMonth {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)formatYear {
static NSDateFormatter* formatter = nil;
- if (!formatter) {
+ if (nil == formatter) {
formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = TTLocalizedString(@"yyyy", @"Date format: 2009");
formatter.locale = TTCurrentLocale();
@@ -46,9 +46,11 @@ - (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObje
id anObject;
[invo getReturnValue:&anObject];
return anObject;
+
} else {
return nil;
}
+
} else {
return nil;
}
@@ -72,9 +74,11 @@ - (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObje
id anObject;
[invo getReturnValue:&anObject];
return anObject;
+
} else {
return nil;
}
+
} else {
return nil;
}
@@ -99,9 +103,11 @@ - (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObje
id anObject;
[invo getReturnValue:&anObject];
return anObject;
+
} else {
return nil;
}
+
} else {
return nil;
}
@@ -127,9 +133,11 @@ - (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObje
id anObject;
[invo getReturnValue:&anObject];
return anObject;
+
} else {
return nil;
}
+
} else {
return nil;
}
@@ -156,9 +164,11 @@ - (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObje
id anObject;
[invo getReturnValue:&anObject];
return anObject;
+
} else {
return nil;
}
+
} else {
return nil;
}
@@ -47,10 +47,12 @@ - (BOOL)isWhitespaceAndNewlines {
///////////////////////////////////////////////////////////////////////////////////////////////////
-// Deprecated - https://github.com/facebook/three20/issues/367
+/**
+ * Deprecated - https://github.com/facebook/three20/issues/367
+ */
- (BOOL)isEmptyOrWhitespace {
// A nil or NULL string is not the same as an empty string
- return !self.length ||
+ return 0 == self.length ||
![self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length;
}
@@ -63,8 +65,10 @@ - (NSString*)stringByRemovingHTMLTags {
///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copied and pasted from http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg28175.html
-// Deprecated
+/**
+ * Copied and pasted from http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg28175.html
+ * Deprecated
+ */
- (NSDictionary*)queryDictionaryUsingEncoding:(NSStringEncoding)encoding {
NSCharacterSet* delimiterSet = [NSCharacterSet characterSetWithCharactersInString:@"&;"];
NSMutableDictionary* pairs = [NSMutableDictionary dictionary];
@@ -97,17 +101,18 @@ - (NSDictionary*)queryContentsUsingEncoding:(NSStringEncoding)encoding {
[scanner scanCharactersFromSet:delimiterSet intoString:NULL];
NSArray* kvPair = [pairString componentsSeparatedByString:@"="];
if (kvPair.count == 1 || kvPair.count == 2) {
- NSString* key = [[kvPair objectAtIndex:0]
+ NSString* key = [[kvPair objectAtIndex:0]
stringByReplacingPercentEscapesUsingEncoding:encoding];
NSMutableArray* values = [pairs objectForKey:key];
- if (!values) {
+ if (nil == values) {
values = [NSMutableArray array];
[pairs setObject:values forKey:key];
}
if (kvPair.count == 1) {
[values addObject:[NSNull null]];
+
} else if (kvPair.count == 2) {
- NSString* value = [[kvPair objectAtIndex:1]
+ NSString* value = [[kvPair objectAtIndex:1]
stringByReplacingPercentEscapesUsingEncoding:encoding];
[values addObject:value];
}
@@ -130,6 +135,7 @@ - (NSString*)stringByAddingQueryDictionary:(NSDictionary*)query {
NSString* params = [pairs componentsJoinedByString:@"&"];
if ([self rangeOfString:@"?"].location == NSNotFound) {
return [self stringByAppendingFormat:@"?%@", params];
+
} else {
return [self stringByAppendingFormat:@"&%@", params];
}
@@ -155,8 +161,10 @@ - (NSComparisonResult)versionStringCompare:(NSString *)other {
// If one has an alpha part and the other doesn't, the one without is newer
if ([oneComponents count] < [twoComponents count]) {
return NSOrderedDescending;
+
} else if ([oneComponents count] > [twoComponents count]) {
return NSOrderedAscending;
+
} else if ([oneComponents count] == 1) {
// Neither has an alpha part, and we know the main parts are the same
return NSOrderedSame;
@@ -175,6 +183,8 @@ - (NSString*)md5Hash {
return [[self dataUsingEncoding:NSUTF8StringEncoding] md5Hash];
}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)sha1Hash {
return [[self dataUsingEncoding:NSUTF8StringEncoding] sha1Hash];
}
@@ -162,7 +162,7 @@ @implementation TTEntityTables (TTSingleton)
static TTEntityTables* sharedInstance = nil;
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)sharedInstance {
@synchronized(self) {
if (nil == sharedInstance) {
@@ -173,13 +173,13 @@ + (id)sharedInstance {
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (oneway void)superRelease {
[super release];
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
+ (void)releaseSharedInstance {
@synchronized(self) {
[sharedInstance superRelease];
@@ -189,7 +189,7 @@ + (void)releaseSharedInstance {
////////////////////////////////////////////////////////////////////////////////////////////////////
-// Ensure that [TTEntityTables alloc] returns the singleton object.
+///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)allocWithZone:(NSZone*)zone {
@synchronized(self) {
if (nil == sharedInstance) {
@@ -201,31 +201,31 @@ + (id)allocWithZone:(NSZone*)zone {
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)copyWithZone:(NSZone *)zone {
return sharedInstance;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)retain {
return sharedInstance;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (unsigned)retainCount {
return NSUIntegerMax;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (oneway void)release {
// Do nothing.
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)autorelease {
return sharedInstance;
}
Oops, something went wrong.

0 comments on commit 8464e20

Please sign in to comment.