Avoid compilation warnings on 10.6

This commit is contained in:
Bjorn Winckler
2009-09-01 22:42:35 +02:00
parent 6907a6b43e
commit 25133f7d03
8 changed files with 51 additions and 10 deletions
+6 -1
View File
@@ -42,7 +42,12 @@
#import <Cocoa/Cocoa.h>
@interface DBPrefsWindowController : NSWindowController {
@interface DBPrefsWindowController : NSWindowController
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
// 10.6 has turned delegate messages into formal protocols
<NSAnimationDelegate, NSToolbarDelegate>
#endif
{
NSMutableArray *toolbarIdentifiers;
NSMutableDictionary *toolbarViews;
NSMutableDictionary *toolbarItems;
+12 -4
View File
@@ -1927,6 +1927,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
}
// HACK: fileAttributesAtPath was deprecated in 10.5
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4)
#define MM_fileAttributes(fm,p) [fm attributesOfItemAtPath:p error:NULL]
#else
#define MM_fileAttributes(fm,p) [fm fileAttributesAtPath:p traverseLink:YES]
#endif
- (NSDate *)rcFilesModificationDate
{
// Check modification dates for ~/.vimrc and ~/.gvimrc and return the
@@ -1938,20 +1945,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSFileManager *fm = [NSFileManager defaultManager];
NSString *path = [@"~/.vimrc" stringByExpandingTildeInPath];
NSDictionary *attr = [fm fileAttributesAtPath:path traverseLink:YES];
NSDictionary *attr = MM_fileAttributes(fm, path);
if (!attr) {
path = [@"~/_vimrc" stringByExpandingTildeInPath];
attr = [fm fileAttributesAtPath:path traverseLink:YES];
attr = MM_fileAttributes(fm, path);
}
NSDate *modDate = [attr objectForKey:NSFileModificationDate];
if (modDate)
date = modDate;
path = [@"~/.gvimrc" stringByExpandingTildeInPath];
attr = [fm fileAttributesAtPath:path traverseLink:YES];
attr = MM_fileAttributes(fm, path);
if (!attr) {
path = [@"~/_gvimrc" stringByExpandingTildeInPath];
attr = [fm fileAttributesAtPath:path traverseLink:YES];
attr = MM_fileAttributes(fm, path);
}
modDate = [attr objectForKey:NSFileModificationDate];
if (modDate)
@@ -1959,6 +1966,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return date;
}
#undef MM_fileAttributes
- (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments
{
+6 -1
View File
@@ -20,7 +20,12 @@
@interface MMVimController : NSObject {
@interface MMVimController : NSObject
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
// 10.6 has turned delegate messages into formal protocols
<NSToolbarDelegate, NSOpenSavePanelDelegate>
#endif
{
unsigned identifier;
BOOL isInitialized;
MMWindowController *windowController;
-1
View File
@@ -27,7 +27,6 @@
*/
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMTextView.h"
#import "MMVimController.h"
+5
View File
@@ -414,7 +414,12 @@ enum {
identifier:(long)ident
{
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4)
[scroller setDoubleValue:val];
[scroller setKnobProportion:prop];
#else
[scroller setFloatValue:val knobProportion:prop];
#endif
[scroller setEnabled:prop != 1.f];
}
+6 -1
View File
@@ -17,7 +17,12 @@
@class MMVimController;
@class MMVimView;
@interface MMWindowController : NSWindowController {
@interface MMWindowController : NSWindowController
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5)
// 10.6 has turned delegate messages into formal protocols
<NSWindowDelegate>
#endif
{
MMVimController *vimController;
MMVimView *vimView;
BOOL setupDone;
+12
View File
@@ -18,6 +18,18 @@
#define MM_ENABLE_PLUGINS
// Taken from /usr/include/AvailabilityMacros.h
#ifndef MAC_OS_X_VERSION_10_4
# define MAC_OS_X_VERSION_10_4 1040
#endif
#ifndef MAC_OS_X_VERSION_10_5
# define MAC_OS_X_VERSION_10_5 1050
#endif
#ifndef MAC_OS_X_VERSION_10_6
# define MAC_OS_X_VERSION_10_6 1060
#endif
//
// This is the protocol MMBackend implements.
+4 -2
View File
@@ -113,8 +113,10 @@ static int MMPlugInArchMinorVersion = 0;
NSString *errstr = nil;
id res = [vimController evaluateVimExpressionCocoa:vimExpression
errorString:&errstr];
if (!res)
[NSException raise:@"VimEvaluationException" format:errstr];
if (!res) {
// Setting format to %@ instead of just passing errstr avoids warning.
[NSException raise:@"VimEvaluationException" format:@"%@", errstr];
}
return res;
}