From: Jay Freeman (saurik) Date: Thu, 7 Oct 2010 04:08:21 +0000 (-0700) Subject: Use a category for [WebScriptObject -countByEnumeratingWithState:objects:count:]. X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/8a4106c2f2a665de84c7074ed4aaba85bab8d751?hp=78f1a54baaecde3ef9db01c1b3558a3500d4a141 Use a category for [WebScriptObject -countByEnumeratingWithState:objects:count:]. --- diff --git a/Cydia.mm b/Cydia.mm index 6c029d1b..7531f893 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -618,7 +618,9 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar @end /* }}} */ -NSUInteger WebScriptObject$countByEnumeratingWithState$objects$count$(WebScriptObject *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) { +@implementation WebScriptObject (NSFastEnumeration) + +- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count { size_t length([self count] - state->state); if (length <= 0) return 0; @@ -631,6 +633,8 @@ NSUInteger WebScriptObject$countByEnumeratingWithState$objects$count$(WebScriptO return length; } +@end + NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) { size_t length([self length] - state->state); if (length <= 0) @@ -8713,7 +8717,6 @@ int main(int argc, char *argv[]) { _pooled PackageName = reinterpret_cast(method_getImplementation(class_getInstanceMethod([Package class], @selector(cyname)))); /* Library Hacks {{{ */ - class_addMethod(objc_getClass("WebScriptObject"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &WebScriptObject$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16"); class_addMethod(objc_getClass("DOMNodeList"), @selector(countByEnumeratingWithState:objects:count:), (IMP) &DOMNodeList$countByEnumeratingWithState$objects$count$, "I20@0:4^{NSFastEnumerationState}8^@12I16"); $WebDefaultUIKitDelegate = objc_getClass("WebDefaultUIKitDelegate");