From 8a4106c2f2a665de84c7074ed4aaba85bab8d751 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 6 Oct 2010 21:08:21 -0700 Subject: [PATCH 1/1] Use a category for [WebScriptObject -countByEnumeratingWithState:objects:count:]. --- Cydia.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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"); -- 2.45.2