Skip to content

Instantly share code, notes, and snippets.

@Justasic
Last active December 16, 2015 15:19
Show Gist options
  • Save Justasic/5454695 to your computer and use it in GitHub Desktop.
Save Justasic/5454695 to your computer and use it in GitHub Desktop.
Fix Growl compile on XCode. Patch with the following command in the growl directory: patch -p1 < growl-xcode.patch
--- growl.new/Plugins/Actions/SMS/GrowlSMSDisplay.m 2013-04-24 12:50:06.000000000 -0700
+++ growl/Plugins/Actions/SMS/GrowlSMSDisplay.m 2013-04-24 12:38:47.000000000 -0700
@@ -138,7 +138,7 @@
CFDataRef postData = CFStringCreateExternalRepresentation(kCFAllocatorDefault, dataString, kCFStringEncodingUTF8, 0U);
CFURLRef clickatellURL = CFURLCreateWithString(kCFAllocatorDefault, CFSTR("https://api.clickatell.com/xml/xml"), NULL);
NSMutableURLRequest *post = [[NSMutableURLRequest alloc] initWithURL:(NSURL *)clickatellURL];
- CFStringRef contentLength = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%u"), CFDataGetLength(postData));
+ CFStringRef contentLength = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%lu"), CFDataGetLength(postData));
// NSLog(@"SMS display: Sending data: %@", postData);
diff -rupN growl.new/Plugins/Displays/GrowlDisplayWindowController.h growl/Plugins/Displays/GrowlDisplayWindowController.h
--- growl.new/Plugins/Displays/GrowlDisplayWindowController.h 2013-04-24 12:50:11.000000000 -0700
+++ growl/Plugins/Displays/GrowlDisplayWindowController.h 2013-04-24 12:25:10.000000000 -0700
@@ -98,6 +98,9 @@ typedef enum {
- (NSArray *) activeTransitions;
- (NSArray *) inactiveTransitions;
+// Fix
+NSInteger castMapRet(void *inptr);
+
/* start transitions using these methods - they return yes if one or more transitions were started. Will return no if transitions are present but their start and end times have not been configured appropriately */
- (BOOL) startAllTransitions;
- (BOOL) startTransition:(GrowlWindowTransition *)transition;
diff -rupN growl.new/Plugins/Displays/GrowlDisplayWindowController.m growl/Plugins/Displays/GrowlDisplayWindowController.m
--- growl.new/Plugins/Displays/GrowlDisplayWindowController.m 2013-04-24 12:50:11.000000000 -0700
+++ growl/Plugins/Displays/GrowlDisplayWindowController.m 2013-04-24 12:25:02.000000000 -0700
@@ -396,9 +396,20 @@ static NSMutableDictionary *existingInst
return result;
}
+// Used to fix stupid compiler errors on valid code.
+NSInteger castMapRet(void *inptr) {
+ union ushit
+ {
+ void *ptr;
+ NSInteger num;
+ } shit;
+ shit.ptr = inptr;
+ return shit.num;
+}
+
- (BOOL) startTransition:(GrowlWindowTransition *)transition {
- NSInteger startPercentage = (NSInteger) NSMapGet(startTimes, transition);
- NSInteger endPercentage = (NSInteger) NSMapGet(endTimes, transition);
+ NSInteger startPercentage = castMapRet(NSMapGet(startTimes, transition));
+ NSInteger endPercentage = castMapRet(NSMapGet(endTimes, transition));
// If there were no times set up then the end time would be NULL (0)...
if (endPercentage == 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment