diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-06-08 22:42:18 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-06-08 22:42:18 -0700 |
commit | 4cc9e99a32a73858f3b9739c0cf8ec82bb35e93e (patch) | |
tree | 31fbd2791655a0e23e3bd0a173744d92602dd0f1 | |
parent | 058813ae78aec1b25c7c44b2a6188b7ae2264107 (diff) |
Make compilations with clang succeed.
-rw-r--r-- | CyteKit/WebView.h | 3 | ||||
-rw-r--r-- | CyteKit/WebView.mm | 4 | ||||
-rw-r--r-- | CyteKit/WebViewController.h | 2 | ||||
-rw-r--r-- | CyteKit/WebViewController.mm | 4 | ||||
-rw-r--r-- | CyteKit/WebViewTableViewCell.h | 4 | ||||
-rw-r--r-- | CyteKit/dispatchEvent.mm | 2 | ||||
-rw-r--r-- | MobileCydia.mm | 17 | ||||
-rw-r--r-- | makefile | 38 |
8 files changed, 54 insertions, 20 deletions
diff --git a/CyteKit/WebView.h b/CyteKit/WebView.h index c9e10c8..39fd8ff 100644 --- a/CyteKit/WebView.h +++ b/CyteKit/WebView.h @@ -58,6 +58,7 @@ enum CYWebPolicyDecision { }; @protocol CyteWebViewDelegate <UIWebViewDelegate> +@optional - (void) webView:(WebView *)view addMessageToConsole:(NSDictionary *)message; - (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener; - (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener; @@ -81,6 +82,8 @@ enum CYWebPolicyDecision { } - (id<CyteWebViewDelegate>) delegate; +- (void) setDelegate:(id<CyteWebViewDelegate>)delegate; + - (void) dispatchEvent:(NSString *)event; - (void) reloadFromOrigin; - (UIScrollView *) scrollView; diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm index 1706cc0..084926b 100644 --- a/CyteKit/WebView.mm +++ b/CyteKit/WebView.mm @@ -138,6 +138,10 @@ return (id<CyteWebViewDelegate>) [super delegate]; } +- (void) setDelegate:(id<CyteWebViewDelegate>)delegate { + [super setDelegate:delegate]; +} + /*- (WebView *) webView:(WebView *)view createWebViewWithRequest:(NSURLRequest *)request { id<CyteWebViewDelegate> delegate([self delegate]); WebView *created(nil); diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h index 9b9ba94..5807e78 100644 --- a/CyteKit/WebViewController.h +++ b/CyteKit/WebViewController.h @@ -138,6 +138,8 @@ - (void) applyLeftButton; - (UIBarButtonItem *) leftButton; +- (void) removeButton; + - (void) _didStartLoading; - (void) _didFinishLoading; diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index e5cfbb4..25e9aeb 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -534,7 +534,7 @@ float CYScrollViewDecelerationRateNormal; if ([frame parentFrame] == nil) { if (DOMDocument *document = [frame DOMDocument]) - if (DOMNodeList<NSFastEnumeration> *bodies = [document getElementsByTagName:@"body"]) + if (DOMNodeList *bodies = [document getElementsByTagName:@"body"]) for (DOMHTMLBodyElement *body in (id) bodies) { DOMCSSStyleDeclaration *style([document getComputedStyle:body pseudoElement:nil]); @@ -697,7 +697,7 @@ float CYScrollViewDecelerationRateNormal; - (UIBarButtonItem *) customButton { if (custom_ == nil) return nil; - else if (custom_ == [NSNull null]) + else if ((/*clang:*/id) custom_ == [NSNull null]) return (UIBarButtonItem *) [NSNull null]; return [[[UIBarButtonItem alloc] diff --git a/CyteKit/WebViewTableViewCell.h b/CyteKit/WebViewTableViewCell.h index c328e33..bff680e 100644 --- a/CyteKit/WebViewTableViewCell.h +++ b/CyteKit/WebViewTableViewCell.h @@ -45,7 +45,9 @@ #include "Menes/ObjectHandle.h" #include "CyteKit/WebView.h" -@interface CyteWebViewTableViewCell : UITableViewCell { +@interface CyteWebViewTableViewCell : UITableViewCell < + CyteWebViewDelegate +> { // XXX: I'm not really the delegate here: fix this! _H<CyteWebView, 1> webview_; } diff --git a/CyteKit/dispatchEvent.mm b/CyteKit/dispatchEvent.mm index 76e24af..81b7089 100644 --- a/CyteKit/dispatchEvent.mm +++ b/CyteKit/dispatchEvent.mm @@ -94,7 +94,7 @@ MSHook(void, UIWebBrowserView$_webTouchEventsRecognized$, UIWebBrowserView *self __attribute__((__constructor__)) static void $() { if (Class $UIWebBrowserView = objc_getClass("UIWebBrowserView")) { if (Method method = class_getInstanceMethod($UIWebBrowserView, @selector(_webTouchEventsRecognized:))) { - _UIWebBrowserView$_webTouchEventsRecognized$ = reinterpret_cast<void (*)(UIWebBrowserView *, SEL, id)>(method_getImplementation(method)); + _UIWebBrowserView$_webTouchEventsRecognized$ = reinterpret_cast<void (*)(UIWebBrowserView *, SEL, UIWebTouchEventsGestureRecognizer *)>(method_getImplementation(method)); method_setImplementation(method, reinterpret_cast<IMP>(&$UIWebBrowserView$_webTouchEventsRecognized$)); } } diff --git a/MobileCydia.mm b/MobileCydia.mm index a2936ef..a21a213 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -211,6 +211,10 @@ void PrintTimes() { #define _end } /* }}} */ +// XXX: I hate clang. Apple: please get over your petty hatred of GPL and fix your gcc fork +#define synchronized(lock) \ + synchronized(static_cast<NSObject *>(lock)) + extern NSString *Cydia_; #define lprintf(args...) fprintf(stderr, args) @@ -1327,7 +1331,7 @@ static void PackageImport(const void *key, const void *value, void *context) { CYString defaultIcon_; - _H<NSDictionary> record_; + _H<NSMutableDictionary> record_; BOOL trusted_; } @@ -3970,7 +3974,7 @@ static _H<NSMutableSet> Diversions_; @end @interface CydiaObject : NSObject { - _H<IndirectDelegate> indirect_; + _H<CyteWebViewController> indirect_; _transient id delegate_; } @@ -3996,7 +4000,7 @@ static _H<NSMutableSet> Diversions_; - (id) initWithDelegate:(IndirectDelegate *)indirect { if ((self = [super init]) != nil) { - indirect_ = indirect; + indirect_ = (CyteWebViewController *) indirect; } return self; } @@ -7659,12 +7663,13 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi /* Changes Controller {{{ */ @interface ChangesController : CyteViewController < + CyteWebViewDelegate, UITableViewDataSource, UITableViewDelegate > { _transient Database *database_; unsigned era_; - _H<NSArray> packages_; + _H<NSMutableArray> packages_; _H<NSMutableArray> sections_; _H<UITableView, 2> list_; _H<CyteWebView, 1> dickbar_; @@ -7903,7 +7908,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi } } - (void) _reloadData { - NSArray *packages; + NSMutableArray *packages; reload: if (true) { @@ -10438,7 +10443,7 @@ MSHook(id, NSURLConnection$init$, NSURLConnection *self, SEL _cmd, NSURLRequest Class $WAKWindow; -static CGSize $WAKWindow$screenSize(WAKWindow self, SEL _cmd) { +static CGSize $WAKWindow$screenSize(WAKWindow *self, SEL _cmd) { CGSize size([[UIScreen mainScreen] bounds].size); /*if ([$WAKWindow respondsToSelector:@selector(hasLandscapeOrientation)]) if ([$WAKWindow hasLandscapeOrientation]) @@ -1,9 +1,17 @@ -sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs +dev := /Developer/Platforms/iPhoneOS.platform/Developer +sdks := $(dev)/SDKs ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk))) - ios := $(word $(words $(ioss)),$(ioss)) + +# if you can tolerate clang, set this to blank gcc := 4.2 +ifeq ($(gcc),) +gxx := $(dev)/usr/bin/clang++ +else +gxx := $(dev)/usr/bin/g++-$(gcc) +endif + flags := link := @@ -21,18 +29,29 @@ endif sdk := $(sdks)/iPhoneOS$(ios).sdk flags += -F$(sdk)/System/Library/PrivateFrameworks -flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib -flags += -Wall -Werror -Wno-deprecated-declarations +flags += -I. -isystem sysroot/usr/include flags += -fmessage-length=0 flags += -g0 -O2 +flags += -fvisibility=hidden + +flags += -Wall + +ifeq ($(gcc),) +flags += -Wno-unknown-warning-option +flags += -Wno-logical-op-parentheses +else flags += -fobjc-exceptions flags += -fno-guess-branch-probability -flags += -fvisibility=hidden +endif + +flags += -Wno-deprecated-declarations xflags := xflags += -fobjc-call-cxx-cdtors xflags += -fvisibility-inlines-hidden +link += -Lsysroot/usr/lib + link += -framework CoreFoundation link += -framework CoreGraphics link += -framework Foundation @@ -59,9 +78,8 @@ backrow += -FAppleTV -framework BackRow -framework AppleTV version := $(shell ./version.sh) -#cycc = cycc -r4.2 -i$(ios) -o$@ -gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc) cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks +#cycc = cycc -r4.2 -i$(ios) -o$@ dirs := Menes CyteKit Cydia SDURLCache @@ -94,17 +112,17 @@ clean: Objects/%.o: %.c $(header) @mkdir -p $(dir $@) @echo "[cycc] $<" - @$(cycc) -c -o $@ -x c $< + @$(cycc) -c -x c $< Objects/%.o: %.m $(header) @mkdir -p $(dir $@) @echo "[cycc] $<" - @$(cycc) -c -o $@ $< $(flags) + @$(cycc) -c $< $(flags) Objects/%.o: %.mm $(header) @mkdir -p $(dir $@) @echo "[cycc] $<" - @$(cycc) -c -o $@ $< $(flags) $(xflags) + @$(cycc) -c $< $(flags) $(xflags) Objects/Version.o: version.h |