diff options
author | Sam Bingner <sam@bingner.com> | 2020-08-20 11:15:15 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2020-08-20 11:15:15 -1000 |
commit | 39b1f27c909aee67526c4a7dbc9c8f1cbec98402 (patch) | |
tree | d2c79b157ee4e3365facc95ae0a9d38f940a5752 | |
parent | f280d3d5149b57ae58e35feb18351ed62a8fa7ec (diff) |
Clang still refuses to play nice, so just ivars for this another way
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | Tweak.xm | 10 |
2 files changed, 7 insertions, 6 deletions
@@ -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 @@ -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) |