diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings index 2b30cc1..fc535c0 100644 Binary files a/English.lproj/InfoPlist.strings and b/English.lproj/InfoPlist.strings differ diff --git a/GeneratePreviewForURL.m b/GeneratePreviewForURL.m index a8cdb35..2f500c3 100644 --- a/GeneratePreviewForURL.m +++ b/GeneratePreviewForURL.m @@ -12,14 +12,16 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) { - CFDataRef data = (CFDataRef) renderMarkdown((NSURL*) url); + @autoreleasepool { + NSData *data = renderMarkdown((__bridge NSURL*) url); if (data) { - CFDictionaryRef props = (CFDictionaryRef) [NSDictionary dictionary]; - QLPreviewRequestSetDataRepresentation(preview, data, kUTTypeHTML, props); + NSDictionary *props = [[NSDictionary alloc] init]; + QLPreviewRequestSetDataRepresentation(preview, (__bridge CFDataRef)data, kUTTypeHTML, (__bridge CFDictionaryRef)props); } return noErr; + } } void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview) diff --git a/GenerateThumbnailForURL.m b/GenerateThumbnailForURL.m index 07c5e90..e3b5e08 100644 --- a/GenerateThumbnailForURL.m +++ b/GenerateThumbnailForURL.m @@ -19,7 +19,8 @@ OSStatus GenerateThumbnailForURL(void *thisInterface, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize) { - NSData *data = renderMarkdown((NSURL*) url); + @autoreleasepool { + NSData *data = renderMarkdown((__bridge NSURL*) url); if (data) { NSRect viewRect = NSMakeRect(0.0, 0.0, 600.0, 800.0); @@ -29,7 +30,7 @@ OSStatus GenerateThumbnailForURL(void *thisInterface, NSMakeSize((maxSize.width * (600.0/800.0)), maxSize.height)); - WebView* webView = [[[WebView alloc] initWithFrame: viewRect] autorelease]; + WebView* webView = [[WebView alloc] initWithFrame: viewRect]; [webView scaleUnitSquareToSize: scaleSize]; [[[webView mainFrame] frameView] setAllowsScrolling:NO]; [[webView mainFrame] loadData: data @@ -62,6 +63,7 @@ OSStatus GenerateThumbnailForURL(void *thisInterface, } return noErr; + } } void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail) diff --git a/QLMarkdown.xcodeproj/project.pbxproj b/QLMarkdown.xcodeproj/project.pbxproj index d395f71..6c6715b 100644 --- a/QLMarkdown.xcodeproj/project.pbxproj +++ b/QLMarkdown.xcodeproj/project.pbxproj @@ -43,7 +43,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 08FB77B6FE84183AC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 0A80BFA40E21A2E200C8BF14 /* markdown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = markdown.h; sourceTree = ""; }; 0A80BFA60E21A2ED00C8BF14 /* markdown.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = markdown.m; sourceTree = ""; }; @@ -109,6 +109,7 @@ ); name = QLMarkdown; sourceTree = ""; + usesTabs = 0; }; 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; @@ -333,36 +334,30 @@ 2CA3261F0896AD4900168862 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = NO; HEADER_SEARCH_PATHS = "./discount-config"; INFOPLIST_FILE = Info.plist; INSTALL_PATH = /Library/QuickLook; PRODUCT_NAME = QLMarkdown; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = qlgenerator; - ZERO_LINK = YES; }; name = Debug; }; 2CA326200896AD4900168862 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = NO; HEADER_SEARCH_PATHS = "./discount-config"; INFOPLIST_FILE = Info.plist; INSTALL_PATH = /Library/QuickLook; PRODUCT_NAME = QLMarkdown; - SDKROOT = macosx; - VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = qlgenerator; }; name = Release; @@ -370,11 +365,18 @@ 2CA326230896AD4900168862 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = ""; + SDKROOT = macosx; + STRIP_INSTALLED_PRODUCT = NO; WARNING_CFLAGS = "-Wall"; }; name = Debug; @@ -382,11 +384,15 @@ 2CA326240896AD4900168862 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "ppc i386 ppc64 x86_64"; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = ""; + SDKROOT = macosx; WARNING_CFLAGS = "-Wall"; }; name = Release; diff --git a/markdown.m b/markdown.m index e3a2c2e..27fe5a4 100644 --- a/markdown.m +++ b/markdown.m @@ -3,7 +3,8 @@ NSData* renderMarkdown(NSURL* url) { - NSString *styles = [NSString stringWithContentsOfFile:[[NSBundle bundleWithIdentifier: @"com.fiatdev.QLMarkdown"] + @autoreleasepool { + NSString *styles = [[NSString alloc] initWithContentsOfFile:[[NSBundle bundleWithIdentifier: @"com.fiatdev.QLMarkdown"] pathForResource:@"styles" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]; @@ -11,7 +12,7 @@ NSStringEncoding usedEncoding = 0; NSError *e = nil; - NSString *source = [NSString stringWithContentsOfURL:url usedEncoding:&usedEncoding error:&e]; + NSString *source = [[NSString alloc] initWithContentsOfURL:url usedEncoding:&usedEncoding error:&e]; if (usedEncoding == 0) { NSLog(@"Wasn't able to determine encoding for file “%@”", [url path]); @@ -27,4 +28,5 @@ free(output); return [html dataUsingEncoding:NSUTF8StringEncoding]; + } } \ No newline at end of file