summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2020-08-20 11:15:15 -1000
committerSam Bingner <sam@bingner.com>2020-08-20 11:15:15 -1000
commit39b1f27c909aee67526c4a7dbc9c8f1cbec98402 (patch)
treed2c79b157ee4e3365facc95ae0a9d38f940a5752
parentf280d3d5149b57ae58e35feb18351ed62a8fa7ec (diff)
Clang still refuses to play nice, so just ivars for this another way
-rw-r--r--Makefile3
-rw-r--r--Tweak.xm10
2 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index cf456e8..f9c6efb 100644
--- a/Makefile
+++ b/Makefile
@@ -5,12 +5,11 @@ PACKAGE_VERSION := $(shell ./version.sh)
include theos/makefiles/common.mk
TWEAK_NAME := MobileSafety
-MobileSafety_CFLAGS := -Wno-return-stack-address
MobileSafety_FILES := Tweak.xm
MobileSafety_FRAMEWORKS := UIKit
MobileSafety_OPTFLAG := -O2
-ADDITIONAL_CFLAGS += -Wno-error=tautological-undefined-compare -Wno-error=deprecated-declarations -Wno-error=return-stack-address
+ADDITIONAL_CFLAGS += -Wno-error=tautological-undefined-compare -Wno-error=deprecated-declarations
#ADDITIONAL_LDFLAGS += -Xarch_armv6 -Wl,-lgcc_s.1
#ADDITIONAL_LDFLAGS += -Xarch_armv6 -Wl,-segalign,4000 -Xarch_armv6 -ffixed-r9
diff --git a/Tweak.xm b/Tweak.xm
index 19d82b1..a8fa66c 100644
--- a/Tweak.xm
+++ b/Tweak.xm
@@ -29,10 +29,10 @@
// Because compiler is optimizing out checks for dereferenced null pointers
template <typename Type_>
-static inline Type_ &MYHookIvar(id self, const char *name) {
+static void MYHookIvar(id self, const char *name, Type_ *ivar_p) {
Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
void *value = ivar == NULL ? NULL : *reinterpret_cast<void **>(reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
- return *(reinterpret_cast<Type_ *>(&value));
+ *ivar_p = reinterpret_cast<Type_>(value);
}
@@ -334,8 +334,10 @@ static void AlertIfNeeded() {
%hook SBUIController
- (id) init {
if ((self = %orig()) != nil) {
- UIView *_contentLayer = MYHookIvar<UIView *>(self, "_contentLayer");
- UIView *_contentView = MYHookIvar<UIView *>(self, "_contentView");
+ UIView *_contentLayer;
+ MYHookIvar<UIView *>(self, "_contentLayer", &_contentLayer);
+ UIView *_contentView;
+ MYHookIvar<UIView *>(self, "_contentView", &_contentView);
UIView *layer;
if (_contentLayer != NULL)