Revision: 13904
http://sourceforge.net/p/skim-app/code/13904
Author: hofman
Date: 2023-12-15 15:49:35 +0000 (Fri, 15 Dec 2023)
Log Message:
-----------
convert to use ARC
Modified Paths:
--------------
trunk/Configurations/Skim-Common.xcconfig
trunk/NSArray_SKExtensions.m
trunk/NSAttributedString_SKExtensions.m
trunk/NSBitmapImageRep_SKExtensions.m
trunk/NSCharacterSet_SKExtensions.m
trunk/NSColor_SKExtensions.m
trunk/NSCursor_SKExtensions.m
trunk/NSData_SKExtensions.m
trunk/NSDate_SKExtensions.m
trunk/NSDocument_SKExtensions.m
trunk/NSError_SKExtensions.m
trunk/NSFileManager_SKExtensions.m
trunk/NSGraphics_SKExtensions.m
trunk/NSImage_SKExtensions.m
trunk/NSMenu_SKExtensions.m
trunk/NSNumber_SKExtensions.m
trunk/NSObject_SKExtensions.m
trunk/NSParagraphStyle_SKExtensions.m
trunk/NSPasteboard_SKExtensions.h
trunk/NSPasteboard_SKExtensions.m
trunk/NSPointerArray_SKExtensions.m
trunk/NSShadow_SKExtensions.m
trunk/NSString_SKExtensions.m
trunk/NSURL_SKExtensions.m
trunk/NSValueTransformer_SKExtensions.m
trunk/NSWindowController_SKExtensions.m
trunk/NSWindow_SKExtensions.m
trunk/PDFAnnotationButtonWidget_SKExtensions.m
trunk/PDFAnnotationChoiceWidget_SKExtensions.m
trunk/PDFAnnotationCircle_SKExtensions.m
trunk/PDFAnnotationFreeText_SKExtensions.m
trunk/PDFAnnotationInk_SKExtensions.m
trunk/PDFAnnotationLine_SKExtensions.m
trunk/PDFAnnotationMarkup_SKExtensions.m
trunk/PDFAnnotationSquare_SKExtensions.m
trunk/PDFAnnotationTextWidget_SKExtensions.m
trunk/PDFAnnotationText_SKExtensions.m
trunk/PDFAnnotation_SKExtensions.m
trunk/PDFDestination_SKExtensions.m
trunk/PDFDocument_SKExtensions.m
trunk/PDFOutline_SKExtensions.m
trunk/PDFPage_SKExtensions.m
trunk/PDFSelection_SKExtensions.m
trunk/PDFView_SKExtensions.m
trunk/SKAlias.m
trunk/SKAnimatedBorderlessWindow.m
trunk/SKAnnotationTypeImageCell.m
trunk/SKApplication.m
trunk/SKApplicationController.h
trunk/SKApplicationController.m
trunk/SKAttachmentEmailer.m
trunk/SKBasePDFView.m
trunk/SKBookmark.m
trunk/SKBookmarkController.m
trunk/SKBookmarkSheetController.m
trunk/SKChainedUndoManager.m
trunk/SKColorCell.m
trunk/SKColorList.m
trunk/SKColorMenuView.m
trunk/SKColorPicker.m
trunk/SKColorSwatch.m
trunk/SKControlTableCellView.m
trunk/SKConversionProgressController.m
trunk/SKDisplayPreferences.m
trunk/SKDisplayPrefs.m
trunk/SKDocumentController.m
trunk/SKDownload.m
trunk/SKDownloadController.m
trunk/SKDownloadPreferenceController.m
trunk/SKDragImageView.m
trunk/SKExportAccessoryController.m
trunk/SKFDFParser.m
trunk/SKFileShare.h
trunk/SKFileShare.m
trunk/SKFileUpdateChecker.h
trunk/SKFileUpdateChecker.m
trunk/SKFindController.m
trunk/SKFontWell.m
trunk/SKGeneralPreferences.m
trunk/SKGroupedSearchResult.h
trunk/SKGroupedSearchResult.m
trunk/SKHighlightingTableRowView.m
trunk/SKImageToolTipContext.m
trunk/SKImageToolTipWindow.m
trunk/SKInfoWindowController.h
trunk/SKInfoWindowController.m
trunk/SKKeychain.m
trunk/SKLeftSideViewController.m
trunk/SKLine.m
trunk/SKLineInspector.m
trunk/SKLineWell.m
trunk/SKLoupeController.h
trunk/SKLoupeController.m
trunk/SKMainDocument.m
trunk/SKMainToolbarController.m
trunk/SKMainTouchBarController.m
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_Actions.m
trunk/SKMainWindowController_FullScreen.m
trunk/SKMainWindowController_UI.m
trunk/SKNPDFAnnotationNote_SKExtensions.m
trunk/SKNavigationWindow.m
trunk/SKNotePrefs.m
trunk/SKNoteTableRowView.m
trunk/SKNoteText.h
trunk/SKNoteText.m
trunk/SKNoteTextView.m
trunk/SKNoteTypeSheetController.m
trunk/SKNoteWindowController.m
trunk/SKNotesDocument.m
trunk/SKNotesPreferences.m
trunk/SKNumberArrayFormatter.m
trunk/SKObtainCommand.m
trunk/SKOutlineView.m
trunk/SKOverviewView.m
trunk/SKPDFDocument.m
trunk/SKPDFSyncRecord.m
trunk/SKPDFSynchronizer.m
trunk/SKPDFView.m
trunk/SKPreferenceController.m
trunk/SKPreferencesCommand.m
trunk/SKPresentationOptionsSheetController.h
trunk/SKPresentationOptionsSheetController.m
trunk/SKProgressController.m
trunk/SKProgressTableCellView.m
trunk/SKReadingBar.h
trunk/SKReadingBar.m
trunk/SKRecentDocumentInfo.m
trunk/SKReleaseNotesController.m
trunk/SKRightSideViewController.m
trunk/SKScriptMenu.m
trunk/SKSecondaryPDFView.m
trunk/SKShareMenuController.m
trunk/SKSideViewController.h
trunk/SKSideViewController.m
trunk/SKSideWindow.m
trunk/SKSnapshotPDFView.m
trunk/SKSnapshotWindow.m
trunk/SKSnapshotWindowController.h
trunk/SKSnapshotWindowController.m
trunk/SKSplitView.m
trunk/SKStatusBar.m
trunk/SKSyncDot.m
trunk/SKSyncPreferences.m
trunk/SKTableView.m
trunk/SKTemplateManager.m
trunk/SKTemplateParser.m
trunk/SKTemplateTag.m
trunk/SKTemporaryData.m
trunk/SKTextFieldSheetController.m
trunk/SKTextNoteEditor.h
trunk/SKTextNoteEditor.m
trunk/SKThumbnail.m
trunk/SKThumbnailImageView.m
trunk/SKThumbnailItem.m
trunk/SKThumbnailView.m
trunk/SKTopBarView.m
trunk/SKTransitionController.m
trunk/SKTransitionInfo.m
trunk/SKTypeSelectHelper.m
trunk/SKVersionNumber.h
trunk/SKVersionNumber.m
trunk/SKViewSettingsController.m
trunk/Skim_Prefix.pch
trunk/vendorsrc/iospirit/HIDRemote/HIDRemote.m
Modified: trunk/Configurations/Skim-Common.xcconfig
===================================================================
--- trunk/Configurations/Skim-Common.xcconfig 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/Configurations/Skim-Common.xcconfig 2023-12-15 15:49:35 UTC (rev
13904)
@@ -16,7 +16,7 @@
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
-CLANG_ENABLE_OBJC_WEAK = YES
+CLANG_ENABLE_OBJC_ARC = YES
GCC_ENABLE_CPP_EXCEPTIONS = NO
Modified: trunk/NSArray_SKExtensions.m
===================================================================
--- trunk/NSArray_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSArray_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -48,43 +48,43 @@
#pragma mark Templating support
- (NSArray *)arraySortedByPageIndex {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES]]];
}
- (NSArray *)arraySortedByBounds {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKPDFAnnotationBoundsOrderKey ascending:YES
selector:@selector(compare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKPDFAnnotationBoundsOrderKey ascending:YES
selector:@selector(compare:)]]];
}
- (NSArray *)arraySortedByPageIndexAndBounds {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES] autorelease],
[[[NSSortDescriptor alloc] initWithKey:SKPDFAnnotationBoundsOrderKey
ascending:YES selector:@selector(compare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES], [[NSSortDescriptor
alloc] initWithKey:SKPDFAnnotationBoundsOrderKey ascending:YES
selector:@selector(compare:)]]];
}
- (NSArray *)arraySortedByType {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)]]];
}
- (NSArray *)arraySortedByContents {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationStringKey ascending:YES
selector:@selector(localizedCaseInsensitiveNumericCompare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationStringKey ascending:YES
selector:@selector(localizedCaseInsensitiveNumericCompare:)]]];
}
- (NSArray *)arraySortedByTypeAndContents {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)] autorelease], [[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationStringKey ascending:YES
selector:@selector(caseInsensitiveCompare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)], [[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationStringKey ascending:YES
selector:@selector(caseInsensitiveCompare:)]]];
}
- (NSArray *)arraySortedByTypeAndPageIndex {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)] autorelease], [[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationTypeKey ascending:YES
selector:@selector(noteTypeCompare:)], [[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES]]];
}
- (NSArray *)arraySortedByColor {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationColorKey ascending:YES
selector:@selector(colorCompare:)] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationColorKey ascending:YES
selector:@selector(colorCompare:)]]];
}
- (NSArray *)arraySortedByColorAndPageIndex {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationColorKey ascending:YES
selector:@selector(colorCompare:)] autorelease], [[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationColorKey ascending:YES
selector:@selector(colorCompare:)], [[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationPageIndexKey ascending:YES]]];
}
- (NSArray *)arraySortedByModificationDate {
- return [self sortedArrayUsingDescriptors:@[[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationModificationDateKey ascending:YES] autorelease]]];
+ return [self sortedArrayUsingDescriptors:@[[[NSSortDescriptor alloc]
initWithKey:SKNPDFAnnotationModificationDateKey ascending:YES]]];
}
@end
Modified: trunk/NSAttributedString_SKExtensions.m
===================================================================
--- trunk/NSAttributedString_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/NSAttributedString_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -46,8 +46,7 @@
- (NSAttributedString *)attributedStringByAddingTextColorAttribute {
NSMutableAttributedString *attrString = [self mutableCopy];
if ([attrString addTextColorAttribute])
- return [attrString autorelease];
- [attrString release];
+ return attrString;
return self;
}
@@ -54,8 +53,7 @@
- (NSAttributedString *)attributedStringByRemovingTextColorAttribute {
NSMutableAttributedString *attrString = [self mutableCopy];
if ([attrString removeTextColorAttribute])
- return [attrString autorelease];
- [attrString release];
+ return attrString;
return self;
}
@@ -62,8 +60,7 @@
- (NSAttributedString *)attributedStringByAddingControlTextColorAttribute {
NSMutableAttributedString *attrString = [self mutableCopy];
if ([attrString addControlTextColorAttribute])
- return [attrString autorelease];
- [attrString release];
+ return attrString;
return self;
}
@@ -92,17 +89,17 @@
}
- (NSTextStorage *)scriptingRichText {
- return [[[NSTextStorage alloc] initWithAttributedString:self] autorelease];
+ return [[NSTextStorage alloc] initWithAttributedString:self];
}
- (NSScriptObjectSpecifier *)objectSpecifier {
NSScriptClassDescription *containerClassDescription =
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
- return [[[NSNameSpecifier alloc]
initWithContainerClassDescription:containerClassDescription
containerSpecifier:nil key:@"richTextFormat" name:[self scriptingName]]
autorelease];
+ return [[NSNameSpecifier alloc]
initWithContainerClassDescription:containerClassDescription
containerSpecifier:nil key:@"richTextFormat" name:[self scriptingName]];
}
- (NSScriptObjectSpecifier *)richTextSpecifier {
NSScriptObjectSpecifier *rtfSpecifier = [self objectSpecifier];
- return [[[NSPropertySpecifier alloc]
initWithContainerClassDescription:[rtfSpecifier keyClassDescription]
containerSpecifier:rtfSpecifier key:@"scriptingRichText"] autorelease];
+ return [[NSPropertySpecifier alloc]
initWithContainerClassDescription:[rtfSpecifier keyClassDescription]
containerSpecifier:rtfSpecifier key:@"scriptingRichText"];
}
@end
@@ -158,7 +155,6 @@
NSAttributedString *attrString = [[NSAttributedString alloc]
initWithData:data options:@{} documentAttributes:NULL error:NULL];
if (attrString)
[self setAttributedString:attrString];
- [attrString release];
}
}
Modified: trunk/NSBitmapImageRep_SKExtensions.m
===================================================================
--- trunk/NSBitmapImageRep_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/NSBitmapImageRep_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -231,11 +231,11 @@
}
+ (instancetype)imageRepWithSize:(NSSize)size scale:(CGFloat)scale
drawingHandler:(void (^)(NSRect dstRect))drawingHandler {
- NSBitmapImageRep *bmpImageRep = [[[self alloc]
initWithBitmapDataPlanes:NULL
+ NSBitmapImageRep *bmpImageRep = [[self alloc] initWithBitmapDataPlanes:NULL
pixelsWide:(NSInteger)(size.width * scale)
pixelsHigh:(NSInteger)(size.height * scale)
bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
- bytesPerRow:0 bitsPerPixel:0] autorelease];
+ bytesPerRow:0 bitsPerPixel:0];
bmpImageRep = [bmpImageRep
bitmapImageRepByRetaggingWithColorSpace:[NSColorSpace sRGBColorSpace]];
[bmpImageRep setSize:size];
if (drawingHandler) {
Modified: trunk/NSCharacterSet_SKExtensions.m
===================================================================
--- trunk/NSCharacterSet_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSCharacterSet_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -54,7 +54,6 @@
NSMutableCharacterSet *tmpSet = [[self URLPathAllowedCharacterSet]
mutableCopy];
[tmpSet removeCharactersInString:@"/"];
URLBookmarkNameAllowedCharacterSet = [tmpSet copy];
- [tmpSet release];
}
return URLBookmarkNameAllowedCharacterSet;
}
@@ -65,7 +64,6 @@
NSMutableCharacterSet *tmpSet = [[self URLPathAllowedCharacterSet]
mutableCopy];
[tmpSet addCharactersInString:@":;?#%"];
URLGenericAllowedCharacterSet = [tmpSet copy];
- [tmpSet release];
}
return URLGenericAllowedCharacterSet;
}
Modified: trunk/NSColor_SKExtensions.m
===================================================================
--- trunk/NSColor_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSColor_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -58,7 +58,7 @@
NSColor *inactiveIn = nil;
if (@available(macOS 10.14, *)) {
NSColorSpace *colorSpace = [NSColorSpace sRGBColorSpace];
- NSAppearance *appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
+ NSAppearance *appearance = [NSAppearance currentAppearance];
[NSAppearance setCurrentAppearance:[NSAppearance
appearanceNamed:NSAppearanceNameAqua]];
activeOut = [[NSColor alternateSelectedControlColor]
colorUsingColorSpace:colorSpace];
inactiveOut = [[NSColor grayColor] colorUsingColorSpace:colorSpace];
@@ -73,14 +73,10 @@
inactiveIn = [[[NSColor secondarySelectedControlColor]
colorUsingColorSpace:colorSpace] colorWithAlphaComponent:0.8];
}
@synchronized (self) {
- [activeSelectionHighlightColor release];
- activeSelectionHighlightColor = [activeOut retain];
- [inactiveSelectionHighlightColor release];
- inactiveSelectionHighlightColor = [inactiveOut retain];
- [activeSelectionHighlightInteriorColor release];
- activeSelectionHighlightInteriorColor = [activeIn retain];
- [inactiveSelectionHighlightInteriorColor release];
- inactiveSelectionHighlightInteriorColor = [inactiveIn retain];
+ activeSelectionHighlightColor = activeOut;
+ inactiveSelectionHighlightColor = inactiveOut;
+ activeSelectionHighlightInteriorColor = activeIn;
+ inactiveSelectionHighlightInteriorColor = inactiveIn;
}
}
@@ -92,17 +88,17 @@
+ (NSColor *)selectionHighlightColor:(BOOL)active {
NSColor *color = nil;
@synchronized (self) {
- color = [active ? activeSelectionHighlightColor :
inactiveSelectionHighlightColor retain];
+ color = active ? activeSelectionHighlightColor :
inactiveSelectionHighlightColor;
}
- return [color autorelease];
+ return color;
}
+ (NSColor *)selectionHighlightInteriorColor:(BOOL)active {
NSColor *color = nil;
@synchronized (self) {
- color = [active ? activeSelectionHighlightInteriorColor :
inactiveSelectionHighlightInteriorColor retain];
+ color = active ? activeSelectionHighlightInteriorColor :
inactiveSelectionHighlightInteriorColor;
}
- return [color autorelease];
+ return color;
}
#pragma mark Favorite Colors
Modified: trunk/NSCursor_SKExtensions.m
===================================================================
--- trunk/NSCursor_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSCursor_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -72,7 +72,7 @@
+ (NSCursor *)zoomInCursor {
static NSCursor *zoomInCursor = nil;
if (nil == zoomInCursor) {
- NSImage *cursorImage = [[[NSImage imageNamed:SKImageNameZoomInCursor]
copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameZoomInCursor]
copy];
zoomInCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(7.0, 6.0)];
}
return zoomInCursor;
@@ -81,7 +81,7 @@
+ (NSCursor *)zoomOutCursor {
static NSCursor *zoomOutCursor = nil;
if (nil == zoomOutCursor) {
- NSImage *cursorImage = [[[NSImage imageNamed:SKImageNameZoomOutCursor]
copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameZoomOutCursor]
copy];
zoomOutCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(7.0, 6.0)];
}
return zoomOutCursor;
@@ -90,7 +90,7 @@
+ (NSCursor *)resizeDiagonal45Cursor {
static NSCursor *resizeDiagonal45Cursor = nil;
if (nil == resizeDiagonal45Cursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameResizeDiagonal45Cursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameResizeDiagonal45Cursor] copy];
resizeDiagonal45Cursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(8.0, 8.0)];
}
return resizeDiagonal45Cursor;
@@ -99,7 +99,7 @@
+ (NSCursor *)resizeDiagonal135Cursor {
static NSCursor *resizeDiagonal135Cursor = nil;
if (nil == resizeDiagonal135Cursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameResizeDiagonal135Cursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameResizeDiagonal135Cursor] copy];
resizeDiagonal135Cursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(8.0, 8.0)];
}
return resizeDiagonal135Cursor;
@@ -108,7 +108,7 @@
+ (NSCursor *)cameraCursor {
static NSCursor *cameraCursor = nil;
if (nil == cameraCursor) {
- NSImage *cursorImage = [[[NSImage imageNamed:SKImageNameCameraCursor]
copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameCameraCursor]
copy];
cameraCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(9.0, 8.0)];
}
return cameraCursor;
@@ -117,7 +117,7 @@
+ (NSCursor *)openHandBarCursor {
static NSCursor *openHandBarCursor = nil;
if (nil == openHandBarCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameOpenHandBarCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameOpenHandBarCursor] copy];
openHandBarCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self openHandCursor] hotSpot]];
}
return openHandBarCursor;
@@ -126,7 +126,7 @@
+ (NSCursor *)closedHandBarCursor {
static NSCursor *closedHandBarCursor = nil;
if (nil == closedHandBarCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameClosedHandBarCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameClosedHandBarCursor] copy];
closedHandBarCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self closedHandCursor] hotSpot]];
}
return closedHandBarCursor;
@@ -135,7 +135,7 @@
+ (NSCursor *)textNoteCursor {
static NSCursor *textNoteCursor = nil;
if (nil == textNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameTextNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameTextNoteCursor]
copy];
textNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return textNoteCursor;
@@ -144,7 +144,7 @@
+ (NSCursor *)anchoredNoteCursor {
static NSCursor *anchoredNoteCursor = nil;
if (nil == anchoredNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameAnchoredNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameAnchoredNoteCursor] copy];
anchoredNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return anchoredNoteCursor;
@@ -153,7 +153,7 @@
+ (NSCursor *)circleNoteCursor {
static NSCursor *circleNoteCursor = nil;
if (nil == circleNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameCircleNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameCircleNoteCursor] copy];
circleNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return circleNoteCursor;
@@ -162,7 +162,7 @@
+ (NSCursor *)squareNoteCursor {
static NSCursor *squareNoteCursor = nil;
if (nil == squareNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameSquareNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameSquareNoteCursor] copy];
squareNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return squareNoteCursor;
@@ -171,7 +171,7 @@
+ (NSCursor *)highlightNoteCursor {
static NSCursor *highlightNoteCursor = nil;
if (nil == highlightNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameHighlightNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameHighlightNoteCursor] copy];
highlightNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return highlightNoteCursor;
@@ -180,7 +180,7 @@
+ (NSCursor *)underlineNoteCursor {
static NSCursor *underlineNoteCursor = nil;
if (nil == underlineNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameUnderlineNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameUnderlineNoteCursor] copy];
underlineNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return underlineNoteCursor;
@@ -189,7 +189,7 @@
+ (NSCursor *)strikeOutNoteCursor {
static NSCursor *strikeOutNoteCursor = nil;
if (nil == strikeOutNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameStrikeOutNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage
imageNamed:SKImageNameStrikeOutNoteCursor] copy];
strikeOutNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return strikeOutNoteCursor;
@@ -198,7 +198,7 @@
+ (NSCursor *)lineNoteCursor {
static NSCursor *lineNoteCursor = nil;
if (nil == lineNoteCursor) {
- NSImage *cursorImage = [[[NSImage
imageNamed:SKImageNameLineNoteCursor] copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameLineNoteCursor]
copy];
lineNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return lineNoteCursor;
@@ -207,7 +207,7 @@
+ (NSCursor *)inkNoteCursor {
static NSCursor *inkNoteCursor = nil;
if (nil == inkNoteCursor) {
- NSImage *cursorImage = [[[NSImage imageNamed:SKImageNameInkNoteCursor]
copy] autorelease];
+ NSImage *cursorImage = [[NSImage imageNamed:SKImageNameInkNoteCursor]
copy];
inkNoteCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:[[self arrowCursor] hotSpot]];
}
return inkNoteCursor;
@@ -216,7 +216,7 @@
+ (NSCursor *)emptyCursor {
static NSCursor *emptyCursor = nil;
if (nil == emptyCursor) {
- NSImage *cursorImage = [[[NSImage alloc] initWithSize:NSMakeSize(16.0,
16.0)] autorelease];
+ NSImage *cursorImage = [[NSImage alloc] initWithSize:NSMakeSize(16.0,
16.0)];
emptyCursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(8.0, 8.0)];
}
return emptyCursor;
@@ -225,14 +225,14 @@
+ (NSCursor *)laserPointerCursorWithColor:(NSInteger)color {
static NSPointerArray *laserPointerCursors = nil;
if (laserPointerCursors == nil) {
- laserPointerCursors = [[NSPointerArray strongObjectsPointerArray]
retain];
+ laserPointerCursors = [NSPointerArray strongObjectsPointerArray];
[laserPointerCursors setCount:7];
}
- NSCursor *cursor = (id)[laserPointerCursors pointerAtIndex:color % 7];
+ NSCursor *cursor = (__bridge id)[laserPointerCursors pointerAtIndex:color
% 7];
if (nil == cursor) {
NSImage *cursorImage = [NSImage laserPointerImageWithColor:color % 7];
- cursor = [[[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage
size].height)] autorelease];
- [laserPointerCursors replacePointerAtIndex:color % 7
withPointer:cursor];
+ cursor = [[NSCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage
size].height)];
+ [laserPointerCursors replacePointerAtIndex:color % 7
withPointer:(__bridge void *)cursor];
}
return cursor;
}
@@ -240,14 +240,14 @@
+ (NSCursor *)safeLaserPointerCursorWithColor:(NSInteger)color {
static NSPointerArray *laserPointerCursors = nil;
if (laserPointerCursors == nil) {
- laserPointerCursors = [[NSPointerArray strongObjectsPointerArray]
retain];
+ laserPointerCursors = [NSPointerArray strongObjectsPointerArray];
[laserPointerCursors setCount:7];
}
- NSCursor *cursor = (id)[laserPointerCursors pointerAtIndex:color % 7];
+ NSCursor *cursor = (__bridge id)[laserPointerCursors pointerAtIndex:color
% 7];
if (nil == cursor) {
NSImage *cursorImage = [NSImage laserPointerImageWithColor:color % 7];
- cursor = [[[SKLaserPointerCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage
size].height)] autorelease];
- [laserPointerCursors replacePointerAtIndex:color % 7
withPointer:cursor];
+ cursor = [[SKLaserPointerCursor alloc] initWithImage:cursorImage
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage
size].height)];
+ [laserPointerCursors replacePointerAtIndex:color % 7
withPointer:(__bridge void *)cursor];
}
return cursor;
}
@@ -261,7 +261,7 @@
static inline void hideLaserPointer(void) {
if (laserPointerWindow) {
[laserPointerWindow close];
- SKDESTROY(laserPointerWindow);
+ laserPointerWindow = nil;
}
}
Modified: trunk/NSData_SKExtensions.m
===================================================================
--- trunk/NSData_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSData_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -130,7 +130,7 @@
outputBuffer[j++] = hexEncodeTable[(inputBuffer[i] & 0x0F)];
}
- NSString *result = [[[NSString alloc] initWithBytes:outputBuffer length:j
encoding:NSASCIIStringEncoding] autorelease];
+ NSString *result = [[NSString alloc] initWithBytes:outputBuffer length:j
encoding:NSASCIIStringEncoding];
free(outputBuffer);
@@ -164,7 +164,7 @@
}
hexSignature[j] = 0;
- return [[[NSString alloc] initWithBytes:hexSignature length:j
encoding:NSASCIIStringEncoding] autorelease];
+ return [[NSString alloc] initWithBytes:hexSignature length:j
encoding:NSASCIIStringEncoding];
}
#pragma mark Templating support
Modified: trunk/NSDate_SKExtensions.m
===================================================================
--- trunk/NSDate_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSDate_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -54,35 +54,35 @@
@dynamic fullDateFormat, longDateFormat, mediumDateFormat, shortDateFormat,
fullTimeFormat, longTimeFormat, mediumTimeFormat, shortTimeFormat,
standardDescription, PDFDescription;
- (NSDate *)fullDateFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
fullDateFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] fullDateFormat];
}
- (NSDate *)longDateFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
longDateFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] longDateFormat];
}
- (NSDate *)mediumDateFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
mediumDateFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] mediumDateFormat];
}
- (NSDate *)shortDateFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
shortDateFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] shortDateFormat];
}
- (NSDate *)fullTimeFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
fullTimeFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] fullTimeFormat];
}
- (NSDate *)longTimeFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
longTimeFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] longTimeFormat];
}
- (NSDate *)mediumTimeFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
mediumTimeFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] mediumTimeFormat];
}
- (NSDate *)shortTimeFormat {
- return [[[[SKFormattedDate alloc] initWithDate:self] autorelease]
shortTimeFormat];
+ return [[[SKFormattedDate alloc] initWithDate:self] shortTimeFormat];
}
- (NSString *)standardDescription {
@@ -125,12 +125,12 @@
- (instancetype)initWithDate:(NSDate *)aDate {
if (aDate == nil) {
- [self release];
+ self = nil;
return nil;
}
self = [super init];
if (self) {
- date = [aDate retain];
+ date = aDate;
formatter = [[NSDateFormatter alloc] init];
[formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[formatter setDateStyle:NSDateFormatterNoStyle];
@@ -140,16 +140,10 @@
}
-
(instancetype)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)timeInterval
{
- return [self initWithDate:[[[NSDate alloc]
initWithTimeIntervalSinceReferenceDate:timeInterval
- ] autorelease]];
+ return [self initWithDate:[[NSDate alloc]
initWithTimeIntervalSinceReferenceDate:timeInterval
+ ]];
}
-- (void)dealloc {
- SKDESTROY(date);
- SKDESTROY(formatter);
- [super dealloc];
-}
-
- (NSString *)description {
return [formatter stringFromDate:date];
}
Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSDocument_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -78,7 +78,6 @@
NSURLComponents *components = [[NSURLComponents alloc]
initWithURL:fileURL resolvingAgainstBaseURL:NO];
[components setScheme:@"skim"];
NSURL *skimURL = [components URL];
- [components release];
if (skimURL) {
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard clearContents];
@@ -113,7 +112,6 @@
NSData *data = [alias data];
if (data)
[setup setObject:data forKey:[alias isBookmark] ?
SKDocumentSetupBookmarkKey : SKDocumentSetupAliasKey];
- [alias release];
}
NSWindow *window = [self mainWindow];
@@ -134,7 +132,7 @@
- (IBAction)addBookmark:(id)sender {
NSInteger addBookmarkType = [sender tag];
- SKBookmarkSheetController *bookmarkSheetController =
[[[SKBookmarkSheetController alloc] init] autorelease];
+ SKBookmarkSheetController *bookmarkSheetController =
[[SKBookmarkSheetController alloc] init];
[bookmarkSheetController setStringValue:[self displayName]];
[bookmarkSheetController beginSheetModalForWindow:[self windowForSheet]
completionHandler:^(NSModalResponse result) {
if (result == NSModalResponseOK) {
@@ -169,7 +167,7 @@
NSUInteger i = [[[folder children] valueForKey:@"label"]
indexOfObject:[bookmark label]];
if (i != NSNotFound) {
[[bookmarkSheetController window] orderOut:nil];
- NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:[NSString
stringWithFormat:NSLocalizedString(@"\"%@\" already exists", @"Message text in
alert dialog when getting duplicate bookmark label"), [bookmark label]]];
[alert setInformativeText:[NSString
stringWithFormat:NSLocalizedString(@"An item named \"%@\" already exists in
this location. Do you want to replace it with this bookmark?", @"Informative
text in alert dialog when getting duplicate bookmark label"), [bookmark
label]]];
[alert
addButtonWithTitle:NSLocalizedString(@"Replace", @"button title")];
@@ -227,7 +225,6 @@
NSError *error = nil;
NSString *templateString = [[NSString alloc]
initWithContentsOfURL:templateURL encoding:NSUTF8StringEncoding error:&error];
string = [SKTemplateParser
stringByParsingTemplateString:templateString usingObject:self];
- [templateString release];
}
return string;
}
@@ -241,12 +238,11 @@
NSAttributedString *templateAttrString = [[NSAttributedString alloc]
initWithURL:templateURL options:@{} documentAttributes:&docAttributes
error:NULL];
NSAttributedString *attrString = [SKTemplateParser
attributedStringByParsingTemplateAttributedString:templateAttrString
usingObject:self];
if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableExportAttributesKey] == NO) {
- NSMutableDictionary *mutableAttributes = [[docAttributes
mutableCopy] autorelease];
+ NSMutableDictionary *mutableAttributes = [docAttributes
mutableCopy];
[mutableAttributes addEntriesFromDictionary:[NSDictionary
dictionaryWithObjectsAndKeys:NSFullUserName(), NSAuthorDocumentAttribute,
[NSDate date], NSCreationTimeDocumentAttribute, [[[[self fileURL] path]
lastPathComponent] stringByDeletingPathExtension], NSTitleDocumentAttribute,
nil]];
docAttributes = mutableAttributes;
}
data = [attrString dataFromRange:NSMakeRange(0, [attrString length])
documentAttributes:docAttributes error:&error];
- [templateAttrString release];
} else {
data = [[self notesStringForTemplateType:typeName]
dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
}
@@ -261,12 +257,11 @@
NSAttributedString *templateAttrString = [[NSAttributedString alloc]
initWithURL:templateURL options:@{} documentAttributes:&docAttributes
error:NULL];
NSAttributedString *attrString = [SKTemplateParser
attributedStringByParsingTemplateAttributedString:templateAttrString
usingObject:self];
if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableExportAttributesKey] == NO) {
- NSMutableDictionary *mutableAttributes = [[docAttributes
mutableCopy] autorelease];
+ NSMutableDictionary *mutableAttributes = [docAttributes
mutableCopy];
[mutableAttributes addEntriesFromDictionary:[NSDictionary
dictionaryWithObjectsAndKeys:NSFullUserName(), NSAuthorDocumentAttribute,
[NSDate date], NSCreationTimeDocumentAttribute, [[[[self fileURL] path]
lastPathComponent] stringByDeletingPathExtension], NSTitleDocumentAttribute,
nil]];
docAttributes = mutableAttributes;
}
fileWrapper = [attrString RTFDFileWrapperFromRange:NSMakeRange(0,
[attrString length]) documentAttributes:docAttributes];
- [templateAttrString release];
}
return fileWrapper;
}
Modified: trunk/NSError_SKExtensions.m
===================================================================
--- trunk/NSError_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSError_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -85,7 +85,6 @@
description = [descriptions componentsJoinedByString:@"\n"];
[userInfo setObject:description forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:[error domain] code:[error code]
userInfo:userInfo];
- [userInfo release];
}
return error;
}
Modified: trunk/NSFileManager_SKExtensions.m
===================================================================
--- trunk/NSFileManager_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSFileManager_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -61,11 +61,10 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (noErr == FSFindFolder(kUserDomain, kChewableItemsFolderType, TRUE,
&chewableRef)) {
- NSURL *chewableURL = (NSURL
*)CFURLCreateFromFSRef(kCFAllocatorDefault, &chewableRef);
+ NSURL *chewableURL =
CFBridgingRelease(CFURLCreateFromFSRef(kCFAllocatorDefault, &chewableRef));
#pragma clang diagnostic pop
NSString *appName = [[NSBundle mainBundle]
objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey];
chewableItemsDirectoryURL = [[chewableURL
URLByAppendingPathComponent:appName isDirectory:YES] copy];
- [chewableURL release];
} else {
char *template = strdup([[NSTemporaryDirectory()
stringByAppendingPathComponent:@"Skim.XXXXXX"] fileSystemRepresentation]);
const char *tempPath = mkdtemp(template);
@@ -81,7 +80,7 @@
do {
CFUUIDRef uuid = CFUUIDCreate(NULL);
- uniqueURL = [chewableItemsDirectoryURL
URLByAppendingPathComponent:[(NSString *)CFUUIDCreateString(NULL, uuid)
autorelease] isDirectory:YES];
+ uniqueURL = [chewableItemsDirectoryURL
URLByAppendingPathComponent:CFBridgingRelease(CFUUIDCreateString(NULL, uuid))
isDirectory:YES];
CFRelease(uuid);
} while ([uniqueURL checkResourceIsReachableAndReturnError:NULL]);
Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSGraphics_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -65,7 +65,7 @@
if (@available(macOS 10.14, *)) {
NSAppearance *appearance = nil;
if ([object respondsToSelector:@selector(effectiveAppearance)]) {
- appearance = [[[NSAppearance currentAppearance] retain]
autorelease];
+ appearance = [NSAppearance currentAppearance];
[NSAppearance
setCurrentAppearance:[(id<NSAppearanceCustomization>)object
effectiveAppearance]];
}
code();
@@ -173,7 +173,7 @@
}
NSColor *white = [[NSUserDefaults standardUserDefaults]
colorForKey:SKWhitePointKey];
if (white) {
- if ((filter = [CIFilter filterWithName:@"CIWhitePointAdjust"
keysAndValues:@"inputColor", [[[CIColor alloc] initWithColor:white]
autorelease], nil]))
+ if ((filter = [CIFilter filterWithName:@"CIWhitePointAdjust"
keysAndValues:@"inputColor", [[CIColor alloc] initWithColor:white], nil]))
[filters addObject:filter];
}
if (SKHasDarkAppearance() && [[NSUserDefaults standardUserDefaults]
boolForKey:SKInvertColorsInDarkModeKey]) {
Modified: trunk/NSImage_SKExtensions.m
===================================================================
--- trunk/NSImage_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSImage_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -266,7 +266,7 @@
@implementation NSImage (SKExtensions)
+ (NSImage *)bitmapImageWithSize:(NSSize)size scale:(CGFloat)scale
drawingHandler:(void (^)(NSRect dstRect))drawingHandler {
- NSImage *image = [[[NSImage alloc] initWithSize:size] autorelease];
+ NSImage *image = [[NSImage alloc] initWithSize:size];
[image addRepresentation:[NSBitmapImageRep imageRepWithSize:size
scale:scale drawingHandler:drawingHandler]];
return image;
}
@@ -285,8 +285,7 @@
CGPDFContextEndPage(context);
CGPDFContextClose(context);
CGContextRelease(context);
- self = [self initWithData:(NSData *)pdfData];
- CFRelease(pdfData);
+ self = [self initWithData:CFBridgingRelease(pdfData)];
return self;
}
@@ -305,7 +304,7 @@
CGShadingRef shading = CGShadingCreateRadial(colorspace, center, 0.0,
center, 12.0, function, false, false);
CGColorSpaceRelease(colorspace);
CGFunctionRelease(function);
- NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(24.0, 24.0)]
autorelease];;
+ NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(24.0, 24.0)];;
NSSize size = NSMakeSize(24.0, 24.0);
CGFloat scale;
void (^drawingHandler)(NSRect) = ^(NSRect rect){
@@ -323,9 +322,9 @@
if (stamp == nil) {
stamp = [[self alloc] initPDFWithSize:NSMakeSize(256.0, 256.0)
drawingHandler:^(NSRect rect){
NSFont *font = [NSFont fontWithName:@"Times-Bold" size:120.0] ?:
[NSFont boldSystemFontOfSize:120.0];
- NSTextStorage *storage = [[[NSTextStorage alloc]
initWithString:type attributes:@{NSFontAttributeName:font}] autorelease];
- NSLayoutManager *manager = [[[NSLayoutManager alloc] init]
autorelease];
- NSTextContainer *container = [[[NSTextContainer alloc] init]
autorelease];
+ NSTextStorage *storage = [[NSTextStorage alloc]
initWithString:type attributes:@{NSFontAttributeName:font}];
+ NSLayoutManager *manager = [[NSLayoutManager alloc] init];
+ NSTextContainer *container = [[NSTextContainer alloc] init];
[storage addLayoutManager:manager];
[manager addTextContainer:container];
@@ -350,7 +349,6 @@
if (stamps == nil)
stamps = [[NSMutableDictionary alloc] init];
[stamps setObject:stamp forKey:type];
- [stamp release];
}
return stamp;
}
@@ -357,7 +355,7 @@
+ (NSImage *)maskImageWithSize:(NSSize)size cornerRadius:(CGFloat)radius {
NSBezierPath *path = [NSBezierPath
bezierPathWithRoundedRect:(NSRect){NSZeroPoint, size} xRadius:radius
yRadius:radius];
- NSImage *mask = [[[self alloc] initWithSize:size] autorelease];
+ NSImage *mask = [[self alloc] initWithSize:size];
[mask lockFocus];
[[NSColor blackColor] set];
[path fill];
@@ -369,7 +367,7 @@
+ (NSImage *)markImage {
static NSImage *markImage = nil;
if (markImage == nil) {
- markImage = [[self imageWithSize:NSMakeSize(6.0, 10.0) flipped:NO
drawingHandler:^(NSRect rect){
+ markImage = [self imageWithSize:NSMakeSize(6.0, 10.0) flipped:NO
drawingHandler:^(NSRect rect){
[[NSColor colorWithSRGBRed:0.654 green:0.166 blue:0.392
alpha:1.0] setFill];
NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(NSMinX(rect), NSMinY(rect))];
@@ -380,7 +378,7 @@
[path closePath];
[path fill];
return YES;
- }] retain];
+ }];
[markImage setAccessibilityDescription:NSLocalizedString(@"marked
page", @"Accessibility description")];
}
return markImage;
@@ -1374,7 +1372,7 @@
MAKE_IMAGE(SKImageNameNotesPreferences, NO, 32.0, 32.0,
NSImage *clippingImage = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kClippingTextType)];
- NSGradient *gradient = [[[NSGradient alloc]
initWithStartingColor:[NSColor colorWithSRGBRed:1.0 green:0.939 blue:0.495
alpha:1.0] endingColor:[NSColor colorWithSRGBRed:1.0 green:0.976 blue:0.810
alpha:1.0]] autorelease];
+ NSGradient *gradient = [[NSGradient alloc]
initWithStartingColor:[NSColor colorWithSRGBRed:1.0 green:0.939 blue:0.495
alpha:1.0] endingColor:[NSColor colorWithSRGBRed:1.0 green:0.976 blue:0.810
alpha:1.0]];
[[NSColor blackColor] setFill];
[NSBezierPath fillRect:NSMakeRect(2.0, 0.0, 28.0, 32.0)];
[clippingImage drawInRect:NSMakeRect(2.0, 0.0, 28.0, 32.0)
fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0];
@@ -1858,7 +1856,7 @@
[arrow relativeLineToPoint:NSMakePoint(-2.0, 2.0)];
[arrow closePath];
- NSAffineTransform *transform = [[[NSAffineTransform alloc] init]
autorelease];
+ NSAffineTransform *transform = [[NSAffineTransform alloc] init];
[transform translateXBy:center.x yBy:center.y];
[transform rotateByDegrees:90.0];
[transform translateXBy:-center.x yBy:-center.y];
@@ -1902,7 +1900,7 @@
[arrow relativeLineToPoint:NSMakePoint(-14.0, 0.0)];
[arrow closePath];
- NSAffineTransform *transform = [[[NSAffineTransform alloc] init]
autorelease];
+ NSAffineTransform *transform = [[NSAffineTransform alloc] init];
[transform translateXBy:center.x yBy:center.y];
[transform rotateByDegrees:90.0];
[transform translateXBy:-center.x yBy:-center.y];
Modified: trunk/NSMenu_SKExtensions.m
===================================================================
--- trunk/NSMenu_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSMenu_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -43,13 +43,12 @@
@implementation NSMenu (SKExtensions)
+ (NSMenu *)menu {
- return [[[NSMenu alloc] initWithTitle:@""] autorelease];
+ return [[NSMenu alloc] initWithTitle:@""];
}
- (NSMenuItem *)insertItemWithTitle:(NSString *)aString action:(SEL)aSelector
target:(id)aTarget atIndex:(NSInteger)anIndex {
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:aString
action:aSelector target:aTarget];
[self insertItem:item atIndex:anIndex];
- [item release];
return item;
}
@@ -60,7 +59,6 @@
- (NSMenuItem *)insertItemWithTitle:(NSString *)aString action:(SEL)aSelector
target:(id)aTarget tag:(NSInteger)aTag atIndex:(NSInteger)anIndex {
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:aString
action:aSelector target:aTarget tag:aTag];
[self insertItem:item atIndex:anIndex];
- [item release];
return item;
}
@@ -71,7 +69,6 @@
- (NSMenuItem *)insertItemWithTitle:(NSString *)aString imageNamed:(NSString
*)anImageName action:(SEL)aSelector target:(id)aTarget tag:(NSInteger)aTag
atIndex:(NSInteger)anIndex {
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:aString
imageNamed:anImageName action:aSelector target:aTarget tag:aTag];
[self insertItem:item atIndex:anIndex];
- [item release];
return item;
}
@@ -82,7 +79,6 @@
- (NSMenuItem *)insertItemWithSubmenuAndTitle:(NSString *)aString
atIndex:(NSInteger)anIndex {
NSMenuItem *item = [[NSMenuItem alloc] initWithSubmenuAndTitle:aString];
[self insertItem:item atIndex:anIndex];
- [item release];
return item;
}
@@ -96,15 +92,15 @@
@implementation NSMenuItem (SKExtensions)
+ (NSMenuItem *)menuItemWithTitle:(NSString *)aString action:(SEL)aSelector
target:(id)aTarget {
- return [[[NSMenuItem alloc] initWithTitle:aString action:aSelector
target:aTarget] autorelease];
+ return [[NSMenuItem alloc] initWithTitle:aString action:aSelector
target:aTarget];
}
+ (NSMenuItem *)menuItemWithTitle:(NSString *)aString action:(SEL)aSelector
target:(id)aTarget tag:(NSInteger)aTag {
- return [[[NSMenuItem alloc] initWithTitle:aString action:aSelector
target:aTarget tag:aTag] autorelease];
+ return [[NSMenuItem alloc] initWithTitle:aString action:aSelector
target:aTarget tag:aTag];
}
+ (NSMenuItem *)menuItemWithSubmenuAndTitle:(NSString *)aString {
- return [[[NSMenuItem alloc] initWithSubmenuAndTitle:aString] autorelease];
+ return [[NSMenuItem alloc] initWithSubmenuAndTitle:aString];
}
- (instancetype)initWithTitle:(NSString *)aString action:(SEL)aSelector
target:(id)aTarget {
@@ -131,7 +127,6 @@
if (self) {
NSMenu *menu = [[NSMenu alloc] initWithTitle:aString];
[self setSubmenu:menu];
- [menu release];
}
return self;
}
@@ -147,7 +142,6 @@
[image drawInRect:(NSRect){NSZeroPoint, dstSize} fromRect:NSZeroRect
operation:NSCompositingOperationCopy fraction:1.0];
[newImage unlockFocus];
[self setImage:newImage];
- [newImage release];
}
}
Modified: trunk/NSNumber_SKExtensions.m
===================================================================
--- trunk/NSNumber_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSNumber_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -121,7 +121,7 @@
- (NSAppleEventDescriptor *)scriptingTexLineDescriptor {
NSScriptClassDescription *containerClassDescription =
[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
- return [[[[NSIndexSpecifier alloc]
initWithContainerClassDescription:containerClassDescription
containerSpecifier:nil key:@"texLines" index:[self integerValue]] autorelease]
descriptor];
+ return [[[NSIndexSpecifier alloc]
initWithContainerClassDescription:containerClassDescription
containerSpecifier:nil key:@"texLines" index:[self integerValue]] descriptor];
}
@end
Modified: trunk/NSObject_SKExtensions.m
===================================================================
--- trunk/NSObject_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSObject_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -75,7 +75,7 @@
else if ([template isKindOfClass:[NSURL class]] == NO)
[comand setScriptErrorNumber:NSArgumentsWrongScriptError];
else if ([[SKTemplateManager sharedManager]
isRichTextTemplateType:[template path]])
- attrString = [[[NSAttributedString alloc] initWithURL:template
options:@{} documentAttributes:&docAttrs error:NULL] autorelease];
+ attrString = [[NSAttributedString alloc] initWithURL:template
options:@{} documentAttributes:&docAttrs error:NULL];
else
string = [NSString stringWithContentsOfURL:template
encoding:NSUTF8StringEncoding error:NULL];
Modified: trunk/NSParagraphStyle_SKExtensions.m
===================================================================
--- trunk/NSParagraphStyle_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/NSParagraphStyle_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -47,7 +47,6 @@
NSMutableParagraphStyle *tmpParagraphStyle = [[NSParagraphStyle
defaultParagraphStyle] mutableCopy];
[tmpParagraphStyle setLineBreakMode:NSLineBreakByClipping];
defaultClippingParagraphStyle = [tmpParagraphStyle copy];
- [tmpParagraphStyle release];
}
return defaultClippingParagraphStyle;
}
@@ -58,7 +57,6 @@
NSMutableParagraphStyle *tmpParagraphStyle = [[NSParagraphStyle
defaultParagraphStyle] mutableCopy];
[tmpParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
defaultTruncatingTailParagraphStyle = [tmpParagraphStyle copy];
- [tmpParagraphStyle release];
}
return defaultTruncatingTailParagraphStyle;
}
Modified: trunk/NSPasteboard_SKExtensions.h
===================================================================
--- trunk/NSPasteboard_SKExtensions.h 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSPasteboard_SKExtensions.h 2023-12-15 15:49:35 UTC (rev 13904)
@@ -41,8 +41,6 @@
@interface NSPasteboard (SKExtensions)
-@property (nonatomic, readonly) NSURL *pasteLocationURL;
-
- (BOOL)writeURLs:(NSArray *)URLs names:(NSArray *)names;
@end
Modified: trunk/NSPasteboard_SKExtensions.m
===================================================================
--- trunk/NSPasteboard_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSPasteboard_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -42,24 +42,6 @@
@implementation NSPasteboard (SKExtensions)
-- (NSURL *)pasteLocationURL; {
- NSURL *pasteLocationURL = nil;
- NSString *pasteLocation = [self stringForType:@"com.apple.pastelocation"];
- if (pasteLocation) {
- pasteLocationURL = [NSURL URLWithString:pasteLocation];
- } else {
- PasteboardRef pboardRef = NULL;
- if (noErr == PasteboardCreate((CFStringRef)[self name], &pboardRef)) {
- PasteboardSynchronize(pboardRef);
- CFURLRef urlRef = NULL;
- if (noErr == PasteboardCopyPasteLocation(pboardRef, &urlRef))
- pasteLocationURL = [(NSURL *)urlRef autorelease];
- CFRelease(pboardRef);
- }
- }
- return pasteLocationURL;
-}
-
- (BOOL)writeURLs:(NSArray *)URLs names:(NSArray *)names {
NSMutableArray *items = [NSMutableArray array];
NSUInteger i, urlCount = [URLs count], namesCount = [names count];
@@ -67,7 +49,7 @@
for (i = 0; i < urlCount; i++) {
NSURL *theURL = [URLs objectAtIndex:i];
- NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] autorelease];
+ NSPasteboardItem *item = [[NSPasteboardItem alloc] init];
[item setString:[theURL absoluteString] forType:(NSString *)([theURL
isFileURL] ? kUTTypeFileURL : kUTTypeURL)];
[item setString:[theURL absoluteString]
forType:NSPasteboardTypeString];
Modified: trunk/NSPointerArray_SKExtensions.m
===================================================================
--- trunk/NSPointerArray_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSPointerArray_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -42,9 +42,9 @@
@implementation NSPointerArray (SKExtensions)
-+ (instancetype)rectPointerArray { return [[[self alloc] initForRectPointers]
autorelease]; }
++ (instancetype)rectPointerArray { return [[self alloc] initForRectPointers]; }
-+ (instancetype)rangePointerArray { return [[[self alloc]
initForRangePointers] autorelease]; }
++ (instancetype)rangePointerArray { return [[self alloc]
initForRangePointers]; }
- (instancetype)initForRectPointers {
return [self initWithPointerFunctions:[NSPointerFunctions
rectPointerFunctions]];
Modified: trunk/NSShadow_SKExtensions.m
===================================================================
--- trunk/NSShadow_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSShadow_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -47,7 +47,6 @@
[aShadow setShadowBlurRadius:blurRadius];
[aShadow setShadowOffset:offset];
[aShadow set];
- [aShadow release];
}
+ (void)setShadowWithWhite:(CGFloat)white alpha:(CGFloat)alpha
blurRadius:(CGFloat)blurRadius yOffset:(CGFloat)yOffset {
Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSString_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -52,27 +52,56 @@
#define EM_DASH_CHARACTER (unichar)0x2014
-static inline
-CFStringRef
__SKStringCreateByCollapsingAndTrimmingWhitespaceAndNewlines(CFAllocatorRef
allocator, CFStringRef aString)
+#pragma mark NSString category
+
+@implementation NSString (SKExtensions)
+
+- (NSNumber *)noteTypeOrder {
+ NSInteger order = 10;
+ if ([self isEqualToString:SKNFreeTextString])
+ order = 0;
+ else if ([self isEqualToString:SKNNoteString] || [self
isEqualToString:SKNTextString])
+ order = 1;
+ else if ([self isEqualToString:SKNCircleString])
+ order = 2;
+ else if ([self isEqualToString:SKNSquareString])
+ order = 3;
+ else if ([self isEqualToString:SKNHighlightString] || [self
isEqualToString:SKNMarkUpString])
+ order = 4;
+ else if ([self isEqualToString:SKNUnderlineString])
+ order = 5;
+ else if ([self isEqualToString:SKNStrikeOutString])
+ order = 6;
+ else if ([self isEqualToString:SKNLineString])
+ order = 7;
+ else if ([self isEqualToString:SKNInkString])
+ order = 8;
+ else if ([self isEqualToString:SKNWidgetString])
+ order = 9;
+ return [NSNumber numberWithInteger:order];
+}
+
+- (NSComparisonResult)noteTypeCompare:(id)other {
+ return [[self noteTypeOrder] compare:[other noteTypeOrder]];
+}
+
+- (NSString
*)stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines;
{
+ CFIndex length = [self length];
- CFIndex length = CFStringGetLength(aString);
-
if(length == 0)
- return CFRetain(CFSTR(""));
+ return @"";
// set up the buffer to fetch the characters
CFIndex cnt = 0;
CFStringInlineBuffer inlineBuffer;
- CFStringInitInlineBuffer(aString, &inlineBuffer, CFRangeMake(0, length));
+ CFStringInitInlineBuffer((__bridge CFStringRef)self, &inlineBuffer,
CFRangeMake(0, length));
UniChar ch;
UniChar *buffer, stackBuffer[STACK_BUFFER_SIZE];
- CFStringRef retStr;
+ NSString *retStr;
- allocator = (allocator == NULL) ? CFGetAllocator(aString) : allocator;
-
if(length >= STACK_BUFFER_SIZE) {
- buffer = (UniChar *)CFAllocatorAllocate(allocator, length *
sizeof(UniChar), 0);
+ buffer = (UniChar *)CFAllocatorAllocate(NULL, length *
sizeof(UniChar), 0);
} else {
bzero(stackBuffer, length * sizeof(UniChar));
buffer = stackBuffer;
@@ -101,56 +130,16 @@
if (buffer[(bufCnt-1)] == ' ') // we've collapsed any trailing
whitespace, so disregard it
bufCnt--;
- retStr = CFStringCreateWithCharacters(allocator, buffer, bufCnt);
+ retStr = [NSString stringWithCharacters:buffer length:bufCnt];
} else {
- retStr = CFRetain(aString);
+ retStr = self;
}
- if(buffer != stackBuffer) CFAllocatorDeallocate(allocator, buffer);
+ if(buffer != stackBuffer) CFAllocatorDeallocate(NULL, buffer);
return retStr;
}
-CFStringRef
SKStringCreateByCollapsingAndTrimmingWhitespaceAndNewlines(CFAllocatorRef
allocator, CFStringRef string){ return
__SKStringCreateByCollapsingAndTrimmingWhitespaceAndNewlines(allocator,
string); }
-
-#pragma mark NSString category
-
-@implementation NSString (SKExtensions)
-
-- (NSNumber *)noteTypeOrder {
- NSInteger order = 10;
- if ([self isEqualToString:SKNFreeTextString])
- order = 0;
- else if ([self isEqualToString:SKNNoteString] || [self
isEqualToString:SKNTextString])
- order = 1;
- else if ([self isEqualToString:SKNCircleString])
- order = 2;
- else if ([self isEqualToString:SKNSquareString])
- order = 3;
- else if ([self isEqualToString:SKNHighlightString] || [self
isEqualToString:SKNMarkUpString])
- order = 4;
- else if ([self isEqualToString:SKNUnderlineString])
- order = 5;
- else if ([self isEqualToString:SKNStrikeOutString])
- order = 6;
- else if ([self isEqualToString:SKNLineString])
- order = 7;
- else if ([self isEqualToString:SKNInkString])
- order = 8;
- else if ([self isEqualToString:SKNWidgetString])
- order = 9;
- return [NSNumber numberWithInteger:order];
-}
-
-- (NSComparisonResult)noteTypeCompare:(id)other {
- return [[self noteTypeOrder] compare:[other noteTypeOrder]];
-}
-
-- (NSString
*)stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines;
-{
- return
[(id)SKStringCreateByCollapsingAndTrimmingWhitespaceAndNewlines(CFAllocatorGetDefault(),
(CFStringRef)self) autorelease];
-}
-
// NS and CF character sets won't find these, due to the way CFString handles
surrogate pairs. The surrogate pair inlines were borrowed from
CFCharacterSetPriv.h in CF-lite-476.13.
static inline bool __SKIsSurrogateHighCharacter(const UniChar character) {
return ((character >= 0xD800UL) && (character <= 0xDBFFUL) ? true : false);
@@ -180,16 +169,14 @@
// make a mutable copy only if needed
CFMutableStringRef theString = NULL;
- CFStringRef cfSelf = (CFStringRef)self;
-
CFStringInlineBuffer inlineBuffer;
- CFIndex length = CFStringGetLength(cfSelf);
+ CFIndex length = [self length];
// use the current mutable string with the inline buffer, but make a new
mutable copy if needed
- CFStringInitInlineBuffer(cfSelf, &inlineBuffer, CFRangeMake(0, length));
+ CFStringInitInlineBuffer((__bridge CFStringRef)self, &inlineBuffer,
CFRangeMake(0, length));
UniChar ch;
-#define DELETE_CHARACTERS(n)
do{if(NULL==theString){theString=CFStringCreateMutable(NULL,
cfSelf);};CFStringDelete(theString, CFRangeMake(delIdx, n));} while(0)
+#define DELETE_CHARACTERS(n)
do{if(NULL==theString){theString=CFStringCreateMutable(NULL, (__bridge
CFStringRef)self);};CFStringDelete(theString, CFRangeMake(delIdx, n));} while(0)
// idx is current index into the inline buffer, and delIdx is current
index in the mutable string
CFIndex idx = 0, delIdx = 0;
@@ -230,7 +217,7 @@
idx++;
}
- return [(NSString *)theString autorelease] ?: self;
+ return CFBridgingRelease(theString) ?: self;
}
- (NSString *)stringByAppendingEllipsis;
@@ -259,7 +246,7 @@
range = NSMakeRange(location + 2, [string length] - location - 2);
location = [string rangeOfCharacterFromSet:charSet options:0
range:range].location;
}
- return [string autorelease];
+ return string;
}
// Escape those characters that are special, to the shell, inside a "quoted"
string
@@ -266,7 +253,7 @@
- (NSString *)stringByEscapingShellChars {
static NSCharacterSet *shellSpecialChars = nil;
if (shellSpecialChars == nil)
- shellSpecialChars = [[NSCharacterSet
characterSetWithCharactersInString:@"$\"`\\"] retain];
+ shellSpecialChars = [NSCharacterSet
characterSetWithCharactersInString:@"$\"`\\"];
return [self stringByBackslashEscapingCharactersFromSet:shellSpecialChars];
}
@@ -274,7 +261,7 @@
- (NSString *)stringByEscapingDoubleQuotes {
static NSCharacterSet *doubleQuoteChars = nil;
if (doubleQuoteChars == nil)
- doubleQuoteChars = [[NSCharacterSet
characterSetWithCharactersInString:@"$\"\\"] retain];
+ doubleQuoteChars = [NSCharacterSet
characterSetWithCharactersInString:@"$\"\\"];
return [self stringByBackslashEscapingCharactersFromSet:doubleQuoteChars];
}
@@ -281,7 +268,7 @@
- (NSString *)stringByEscapingParenthesis {
static NSCharacterSet *parenAndBackslashCharSet = nil;
if (parenAndBackslashCharSet == nil)
- parenAndBackslashCharSet = [[NSCharacterSet
characterSetWithCharactersInString:@"()\\"] retain];
+ parenAndBackslashCharSet = [NSCharacterSet
characterSetWithCharactersInString:@"()\\"];
return [self
stringByBackslashEscapingCharactersFromSet:parenAndBackslashCharSet];
}
@@ -297,7 +284,7 @@
}
- (NSString *)lossyStringUsingEncoding:(NSStringEncoding)encoding {
- return [[[NSString alloc] initWithData:[self dataUsingEncoding:encoding
allowLossyConversion:YES] encoding:encoding] autorelease];
+ return [[NSString alloc] initWithData:[self dataUsingEncoding:encoding
allowLossyConversion:YES] encoding:encoding];
}
#pragma mark Templating support
@@ -450,7 +437,6 @@
[wrapper setFilename:name];
[wrapper setPreferredFilename:name];
[typeIconWrappers setObject:wrapper forKey:self];
- [wrapper release];
}
}
@@ -458,7 +444,6 @@
if (wrapper) {
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
attrString = [NSAttributedString
attributedStringWithAttachment:attachment];
- [attachment release];
}
return attrString;
@@ -466,7 +451,7 @@
- (NSString *)xmlString {
NSData *data = [NSPropertyListSerialization dataWithPropertyList:self
format:NSPropertyListXMLFormat_v1_0 options:0 error:NULL];
- NSMutableString *string = [[[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
+ NSMutableString *string = [[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSInteger loc = NSMaxRange([string rangeOfString:@"<string>"]);
if (loc == NSNotFound)
return self;
Modified: trunk/NSURL_SKExtensions.m
===================================================================
--- trunk/NSURL_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSURL_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -175,7 +175,7 @@
} else {
type = [url pathExtension];
if ([type length]) {
- type = [(NSString
*)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(CFStringRef)type, NULL) autorelease];
+ type =
CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(__bridge CFStringRef)type, NULL));
} else {
NSString *scheme = [[url scheme] lowercaseString];
if ([scheme isEqualToString:@"http"] || [scheme
isEqualToString:@"https"])
@@ -207,7 +207,6 @@
[wrapper setFilename:name];
[wrapper setPreferredFilename:name];
[typeIconWrappers setObject:wrapper forKey:type];
- [wrapper release];
}
return wrapper;
}
@@ -230,8 +229,6 @@
[wrapper setFilename:name];
[wrapper setPreferredFilename:name];
[typeIconWrappers setObject:wrapper forKey:type];
- [wrapper release];
- [image release];
}
return wrapper;
}
@@ -241,9 +238,7 @@
NSFileWrapper *wrapper = fileWrapperForFileType(fileTypeOfURL(self));
if (wrapper) {
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
- [wrapper release];
attrString = [NSAttributedString
attributedStringWithAttachment:attachment];
- [attachment release];
}
return attrString;
@@ -254,9 +249,7 @@
NSFileWrapper *wrapper = smallFileWrapperForFileType(fileTypeOfURL(self));
if (wrapper) {
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
- [wrapper release];
attrString = [NSAttributedString
attributedStringWithAttachment:attachment];
- [attachment release];
}
return attrString;
@@ -267,12 +260,10 @@
NSFileWrapper *wrapper = fileWrapperForFileType(fileTypeOfURL(self));
if (wrapper) {
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
- [wrapper release];
attrString = [[NSAttributedString
attributedStringWithAttachment:attachment] mutableCopy];
- [attachment release];
[attrString addAttribute:NSLinkAttributeName value:self
range:NSMakeRange(0, [attrString length])];
}
- return [attrString autorelease];
+ return attrString;
}
- (NSAttributedString *)linkedSmallIcon {
@@ -280,16 +271,14 @@
NSFileWrapper *wrapper = smallFileWrapperForFileType(fileTypeOfURL(self));
if (wrapper) {
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
- [wrapper release];
attrString = [[NSAttributedString
attributedStringWithAttachment:attachment] mutableCopy];
- [attachment release];
[attrString addAttribute:NSLinkAttributeName value:self
range:NSMakeRange(0, [attrString length])];
}
- return [attrString autorelease];
+ return attrString;
}
- (NSAttributedString *)linkedText {
- return [[[NSAttributedString alloc] initWithString:[self absoluteString]
attributes:@{NSLinkAttributeName:self}] autorelease];
+ return [[NSAttributedString alloc] initWithString:[self absoluteString]
attributes:@{NSLinkAttributeName:self}];
}
- (NSAttributedString *)linkedFileName {
@@ -303,7 +292,7 @@
else
fileName = [[NSFileManager defaultManager]
displayNameAtPath:fileName];
}
- return [[[NSAttributedString alloc] initWithString:([self isFileURL] ?
[[NSFileManager defaultManager] displayNameAtPath:[self path]] : [self
absoluteString]) attributes:@{NSLinkAttributeName:self}] autorelease];
+ return [[NSAttributedString alloc] initWithString:([self isFileURL] ?
[[NSFileManager defaultManager] displayNameAtPath:[self path]] : [self
absoluteString]) attributes:@{NSLinkAttributeName:self}];
}
@end
@@ -323,7 +312,6 @@
}
- (instancetype)initWithPasteboardPropertyList:(id)propertyList
ofType:(NSString *)type {
- [self release];
self = nil;
if ([propertyList isKindOfClass:[NSString class]]) {
NSString *string = propertyList;
Modified: trunk/NSValueTransformer_SKExtensions.m
===================================================================
--- trunk/NSValueTransformer_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/NSValueTransformer_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -79,13 +79,13 @@
@implementation NSValueTransformer (SKExtensions)
+ (void)registerCustomTransformers {
- [NSValueTransformer setValueTransformer:[[[SKUnarchiveColorTransformer
alloc] init] autorelease] forName:SKUnarchiveColorTransformerName];
- [NSValueTransformer
setValueTransformer:[[[SKUnarchiveColorArrayTransformer alloc] init]
autorelease] forName:SKUnarchiveColorArrayTransformerName];
- [NSValueTransformer setValueTransformer:[[[SKTypeImageTransformer alloc]
init] autorelease] forName:SKTypeImageTransformerName];
- [NSValueTransformer setValueTransformer:[[[SKHasWindowImageTransformer
alloc] init] autorelease] forName:SKHasWindowImageTransformerName];
- [NSValueTransformer setValueTransformer:[[[SKRadioTransformer alloc]
initWithTargetValue:0] autorelease] forName:SKIsZeroTransformerName];
- [NSValueTransformer setValueTransformer:[[[SKRadioTransformer alloc]
initWithTargetValue:1] autorelease] forName:SKIsOneTransformerName];
- [NSValueTransformer setValueTransformer:[[[SKRadioTransformer alloc]
initWithTargetValue:2] autorelease] forName:SKIsTwoTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKUnarchiveColorTransformer
alloc] init] forName:SKUnarchiveColorTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKUnarchiveColorArrayTransformer
alloc] init] forName:SKUnarchiveColorArrayTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKTypeImageTransformer alloc]
init] forName:SKTypeImageTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKHasWindowImageTransformer
alloc] init] forName:SKHasWindowImageTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKRadioTransformer alloc]
initWithTargetValue:0] forName:SKIsZeroTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKRadioTransformer alloc]
initWithTargetValue:1] forName:SKIsOneTransformerName];
+ [NSValueTransformer setValueTransformer:[[SKRadioTransformer alloc]
initWithTargetValue:2] forName:SKIsTwoTransformerName];
}
@end
@@ -213,7 +213,7 @@
if ([hasWindow boolValue]) {
static NSImage *windowImage = nil;
if (windowImage == nil) {
- windowImage = [[NSImage imageWithSize:NSMakeSize(12.0, 12.0)
flipped:NO drawingHandler:^(NSRect dstRect){
+ windowImage = [NSImage imageWithSize:NSMakeSize(12.0, 12.0)
flipped:NO drawingHandler:^(NSRect dstRect){
NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(1.0, 2.0)];
[path appendBezierPathWithArcWithCenter:NSMakePoint(3.0, 10.0)
radius:2.0 startAngle:180.0 endAngle:90.0 clockwise:YES];
@@ -225,7 +225,7 @@
[[NSColor blackColor] setFill];
[path fill];
return YES;
- }] retain];
+ }];
[windowImage setTemplate:YES];
[windowImage
setAccessibilityDescription:NSLocalizedString(@"window", @"Accessibility
description")];
}
Modified: trunk/NSWindowController_SKExtensions.m
===================================================================
--- trunk/NSWindowController_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/NSWindowController_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -49,7 +49,7 @@
if (nextWindowLocations == nil)
nextWindowLocations = [[NSMapTable alloc]
initWithKeyPointerFunctions:[NSPointerFunctions strongPointerFunctions]
valuePointerFunctions:[NSPointerFunctions pointPointerFunctions] capacity:0];
- NSPointPointer pointPtr = (NSPointPointer)NSMapGet(nextWindowLocations,
(void *)name);
+ NSPointPointer pointPtr = (NSPointPointer)NSMapGet(nextWindowLocations,
(__bridge void *)name);
NSPoint point;
[[self window] setFrameUsingName:name];
@@ -61,17 +61,17 @@
point = *pointPtr;
}
point = [[self window] cascadeTopLeftFromPoint:point];
- NSMapInsert(nextWindowLocations, (void *)name, &point);
+ NSMapInsert(nextWindowLocations, (__bridge void *)name, &point);
}
- (BOOL)isNoteWindowController { return NO; }
- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void
(^)(NSModalResponse result))handler {
- __block id strongSelf = [self retain];
+ __block id strongSelf = self;
[window beginSheet:[self window] completionHandler:^(NSModalResponse
result){
if (handler)
handler(result);
- SKDESTROY(strongSelf);
+ strongSelf = nil;
}];
}
Modified: trunk/NSWindow_SKExtensions.m
===================================================================
--- trunk/NSWindow_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/NSWindow_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -86,22 +86,22 @@
lowestOrder = order;
lowestIndex = [tabbedWindows count];
}
- [tabbedWindows addPointer:window];
+ [tabbedWindows addPointer:(__bridge void *)window];
}
if (frontWindow == nil && frontIndex != NSNotFound) {
frontIndex = lowestIndex;
- frontWindow = (id)[tabbedWindows pointerAtIndex:frontIndex];
+ frontWindow = (__bridge id)[tabbedWindows
pointerAtIndex:frontIndex];
}
if (frontWindow) {
NSUInteger i;
for (i = 0; i < frontIndex; i++) {
- if ((window = (id)[tabbedWindows pointerAtIndex:i]))
+ if ((window = (__bridge id)[tabbedWindows pointerAtIndex:i]))
[frontWindow addTabbedWindow:window ordered:NSWindowBelow];
}
for (i = [tabbedWindows count] - 1; i > frontIndex; i--) {
- if ((window = (id)[tabbedWindows pointerAtIndex:i]))
+ if ((window = (__bridge id)[tabbedWindows pointerAtIndex:i]))
[frontWindow addTabbedWindow:window ordered:NSWindowAbove];
}
// make sure we select the frontWindow, addTabbedWindow:ordered:
sometimes changes it
Modified: trunk/PDFAnnotationButtonWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationButtonWidget_SKExtensions.m 2023-12-14 10:13:14 UTC
(rev 13903)
+++ trunk/PDFAnnotationButtonWidget_SKExtensions.m 2023-12-15 15:49:35 UTC
(rev 13904)
@@ -45,7 +45,7 @@
@implementation PDFAnnotationButtonWidget (SKExtensions)
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
[fdfString appendFDFName:SKFDFAnnotationFieldTypeKey];
[fdfString appendFDFName:SKFDFFieldTypeButton];
[fdfString appendFDFName:SKFDFAnnotationFieldNameKey];
Modified: trunk/PDFAnnotationChoiceWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationChoiceWidget_SKExtensions.m 2023-12-14 10:13:14 UTC
(rev 13903)
+++ trunk/PDFAnnotationChoiceWidget_SKExtensions.m 2023-12-15 15:49:35 UTC
(rev 13904)
@@ -45,7 +45,7 @@
@implementation PDFAnnotationChoiceWidget (SKExtensions)
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
[fdfString appendFDFName:SKFDFAnnotationFieldTypeKey];
[fdfString appendFDFName:SKFDFFieldTypeChoice];
[fdfString appendFDFName:SKFDFAnnotationFieldNameKey];
Modified: trunk/PDFAnnotationCircle_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationCircle_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationCircle_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -58,7 +58,7 @@
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
CGFloat r, g, b, a = 0.0;
[[[self interiorColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]
getRed:&r green:&g blue:&b alpha:&a];
if (a > 0.0) {
@@ -128,7 +128,6 @@
NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo]
mutableCopy];
[mutableKeys addObject:SKNPDFAnnotationInteriorColorKey];
circleKeys = [mutableKeys copy];
- [mutableKeys release];
}
return circleKeys;
}
@@ -141,7 +140,6 @@
NSMutableSet *customKeys = [[super customScriptingKeys] mutableCopy];
[customKeys addObject:SKPDFAnnotationScriptingInteriorColorKey];
customCircleScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customCircleScriptingKeys;
}
Modified: trunk/PDFAnnotationFreeText_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationFreeText_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationFreeText_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -77,7 +77,6 @@
// on 10.12 you can't set the border to nil, so set its lineWidth to 0
[[self border] setLineWidth:0.0];
}
- [border release];
}
static inline NSString *alignmentStyleKeyword(NSTextAlignment alignment) {
@@ -90,7 +89,7 @@
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
CGFloat r = 0.0, g = 0.0, b = 0.0, a;
[[[self fontColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]
getRed:&r green:&g blue:&b alpha:&a];
[fdfString appendFDFName:SKFDFDefaultAppearanceKey];
@@ -127,7 +126,6 @@
[mutableKeys addObject:SKNPDFAnnotationFontColorKey];
[mutableKeys addObject:SKNPDFAnnotationAlignmentKey];
freeTextKeys = [mutableKeys copy];
- [mutableKeys release];
}
return freeTextKeys;
}
@@ -143,7 +141,6 @@
[customKeys addObject:SKPDFAnnotationScriptingFontColorKey];
[customKeys addObject:SKPDFAnnotationScriptingAlignmentKey];
customFreeTextScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customFreeTextScriptingKeys;
}
Modified: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationInk_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -70,11 +70,10 @@
[border setDashPattern:[[NSUserDefaults standardUserDefaults]
arrayForKey:SKInkNoteDashPatternKey]];
[border setStyle:[[NSUserDefaults standardUserDefaults]
floatForKey:SKInkNoteLineStyleKey]];
[self setBorder:[border lineWidth] > 0.0 ? border : nil];
- [border release];
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
NSPoint point;
NSInteger i, iMax;
NSRect bounds = [self bounds];
@@ -257,7 +256,6 @@
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithCGContext:context flipped:NO]];
[image drawInRect:rect fromRect:imgRect
operation:NSCompositingOperationSourceOver fraction:[[self color]
alphaComponent]];
[NSGraphicsContext restoreGraphicsState];
- [image release];
}
}
@@ -279,7 +277,6 @@
NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo]
mutableCopy];
[mutableKeys addObject:SKPDFAnnotationBezierPathsKey];
inkKeys = [mutableKeys copy];
- [mutableKeys release];
}
return inkKeys;
}
@@ -292,7 +289,6 @@
NSMutableSet *customKeys = [[super customScriptingKeys] mutableCopy];
[customKeys addObject:SKPDFAnnotationScriptingPointListsKey];
customInkScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customInkScriptingKeys;
}
@@ -311,7 +307,6 @@
[pointValues addObject:[NSData
dataWithPointAsQDPoint:SKAddPoints(point, origin)]];
}
[pointLists addObject:pointValues];
- [pointValues release];
}
return pointLists;
}
Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationLine_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -92,11 +92,10 @@
[border setDashPattern:[[NSUserDefaults standardUserDefaults]
arrayForKey:SKLineNoteDashPatternKey]];
[border setStyle:[[NSUserDefaults standardUserDefaults]
floatForKey:SKLineNoteLineStyleKey]];
[self setBorder:[border lineWidth] > 0.0 ? border : nil];
- [border release];
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
[fdfString appendFDFName:SKFDFAnnotationLineStylesKey];
[fdfString appendString:@"["];
[fdfString appendFDFName:SKFDFLineStyleFromPDFLineStyle([self
startLineStyle])];
@@ -187,7 +186,6 @@
[mutableKeys addObject:SKPDFAnnotationObservedEndPointKey];
[mutableKeys addObject:SKNPDFAnnotationInteriorColorKey];
lineKeys = [mutableKeys copy];
- [mutableKeys release];
}
return lineKeys;
}
@@ -204,7 +202,6 @@
[customKeys addObject:SKPDFAnnotationScriptingEndLineStyleKey];
[customKeys addObject:SKPDFAnnotationScriptingInteriorColorKey];
customLineScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customLineScriptingKeys;
}
Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -116,7 +116,7 @@
}
}
if (lines == nil) {
- [[self init] release];
+ self = [self init];
self = nil;
} else {
self = [self initSkimNoteWithBounds:bounds forType:type];
@@ -128,8 +128,6 @@
addQuadPointsWithBounds(quadPoints, [lines rectAtIndex:i],
bounds.origin, lineAngle);
[self setQuadrilateralPoints:quadPoints];
objc_setAssociatedObject(self, &SKLineRectsKey, lines,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- [quadPoints release];
- [lines release];
}
}
return self;
@@ -136,7 +134,7 @@
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
NSPoint point;
NSRect bounds = [self bounds];
[fdfString appendFDFName:SKFDFAnnotationQuadrilateralPointsKey];
@@ -185,7 +183,6 @@
}
objc_setAssociatedObject(self, &SKLineRectsKey, lineRects,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- [lineRects release];
}
return lineRects;
}
@@ -270,7 +267,6 @@
if (noteText == nil) {
noteText = [[SKNoteText alloc] initWithNote:self];
objc_setAssociatedObject(self, &SKNoteTextKey, noteText,
OBJC_ASSOCIATION_RETAIN);
- [noteText release];
}
return noteText;
}
@@ -310,7 +306,6 @@
NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo]
mutableCopy];
[mutableKeys removeObject:SKNPDFAnnotationBorderKey];
markupKeys = [mutableKeys copy];
- [mutableKeys release];
}
return markupKeys;
}
@@ -327,7 +322,6 @@
[customKeys removeObject:SKNPDFAnnotationBorderStyleKey];
[customKeys removeObject:SKNPDFAnnotationDashPatternKey];
customMarkupScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customMarkupScriptingKeys;
}
@@ -350,7 +344,6 @@
[pointValues addObject:[NSData
dataWithPointAsQDPoint:SKAddPoints(point, origin)]];
}
[pointLists addObject:pointValues];
- [pointValues release];
}
return pointLists;
}
Modified: trunk/PDFAnnotationSquare_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationSquare_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationSquare_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -59,7 +59,7 @@
}
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
CGFloat r, g, b, a = 0.0;
[[[self interiorColor] colorUsingColorSpaceName:NSDeviceRGBColorSpace]
getRed:&r green:&g blue:&b alpha:&a];
if (a > 0.0) {
@@ -114,7 +114,6 @@
NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo]
mutableCopy];
[mutableKeys addObject:SKNPDFAnnotationInteriorColorKey];
squareKeys = [mutableKeys copy];
- [mutableKeys release];
}
return squareKeys;
}
@@ -127,7 +126,6 @@
NSMutableSet *customKeys = [[super customScriptingKeys] mutableCopy];
[customKeys addObject:SKPDFAnnotationScriptingInteriorColorKey];
customSquareScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customSquareScriptingKeys;
}
Modified: trunk/PDFAnnotationTextWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationTextWidget_SKExtensions.m 2023-12-14 10:13:14 UTC
(rev 13903)
+++ trunk/PDFAnnotationTextWidget_SKExtensions.m 2023-12-15 15:49:35 UTC
(rev 13904)
@@ -45,7 +45,7 @@
@implementation PDFAnnotationTextWidget (SKExtensions)
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
[fdfString appendFDFName:SKFDFAnnotationFieldTypeKey];
[fdfString appendFDFName:SKFDFFieldTypeText];
[fdfString appendFDFName:SKFDFAnnotationFieldNameKey];
Modified: trunk/PDFAnnotationText_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationText_SKExtensions.m 2023-12-14 10:13:14 UTC (rev
13903)
+++ trunk/PDFAnnotationText_SKExtensions.m 2023-12-15 15:49:35 UTC (rev
13904)
@@ -47,7 +47,7 @@
@implementation PDFAnnotationText (SKExtensions)
- (NSString *)fdfString {
- NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+ NSMutableString *fdfString = [[super fdfString] mutableCopy];
[fdfString appendFDFName:SKFDFAnnotationIconTypeKey];
[fdfString
appendFDFName:SKFDFTextAnnotationIconTypeFromPDFTextAnnotationIconType([self
iconType])];
return fdfString;
@@ -68,7 +68,6 @@
[mutableKeys addObject:SKNPDFAnnotationIconTypeKey];
[mutableKeys removeObject:SKNPDFAnnotationBorderKey];
textKeys = [mutableKeys copy];
- [mutableKeys release];
}
return textKeys;
}
@@ -84,7 +83,6 @@
[customKeys removeObject:SKNPDFAnnotationBorderStyleKey];
[customKeys removeObject:SKNPDFAnnotationDashPatternKey];
customTextScriptingKeys = [customKeys copy];
- [customKeys release];
}
return customTextScriptingKeys;
}
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFAnnotation_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -108,7 +108,7 @@
[propertyList isKindOfClass:[NSData class]]) {
self = [self initSkimNoteWithProperties:[NSKeyedUnarchiver
unarchiveObjectWithData:propertyList]];
} else {
- [[self init] release];
+ self = [self init];
self = nil;
}
return self;
@@ -170,7 +170,6 @@
#pragma clang diagnostic pop
if (annotation) {
[annotations addObject:@[annotation, page]];
- [annotation release];
}
}
return [annotations count] > 0 ? annotations : nil;
@@ -197,7 +196,7 @@
+ (NSDictionary *)textToNoteSkimNoteProperties:(NSDictionary *)properties {
if ([[properties objectForKey:SKNPDFAnnotationTypeKey]
isEqualToString:SKNTextString]) {
- NSMutableDictionary *mutableProperties = [[properties mutableCopy]
autorelease];
+ NSMutableDictionary *mutableProperties = [properties mutableCopy];
NSRect bounds = NSRectFromString([properties
objectForKey:SKNPDFAnnotationBoundsKey]);
NSString *contents = [properties
objectForKey:SKNPDFAnnotationContentsKey];
[mutableProperties setObject:SKNNoteString
forKey:SKNPDFAnnotationTypeKey];
@@ -211,8 +210,8 @@
r = r1;
if (NSMaxRange(r) < [contents length]) {
NSFont *font = [[NSUserDefaults standardUserDefaults]
fontForNameKey:SKAnchoredNoteFontNameKey sizeKey:SKAnchoredNoteFontSizeKey];
- NSAttributedString *attrString = [[[NSAttributedString alloc]
initWithString:[contents substringFromIndex:NSMaxRange(r)]
- attributes:[NSDictionary
dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]] autorelease];
+ NSAttributedString *attrString = [[NSAttributedString alloc]
initWithString:[contents substringFromIndex:NSMaxRange(r)]
+ attributes:[NSDictionary
dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]];
[mutableProperties setObject:attrString
forKey:SKNPDFAnnotationTextKey];
[mutableProperties setObject:[contents
substringToIndex:r.location] forKey:SKNPDFAnnotationContentsKey];
}
@@ -300,7 +299,6 @@
if (border)
[border setStyle:style];
[self setBorder:border];
- [border release];
}
}
@@ -329,7 +327,6 @@
[self setBorder:border];
}
}
- [border release];
}
}
@@ -350,7 +347,6 @@
if (border)
[border setDashPattern:pattern];
[self setBorder:border];
- [border release];
}
}
@@ -380,7 +376,7 @@
// use a copy of the paths so to ensure different old and new values for undo
- (NSArray *)bezierPaths {
- return [[[self paths] copy] autorelease];
+ return [[self paths] copy];
}
- (void)setBezierPaths:(NSArray *)newPaths {
@@ -388,13 +384,12 @@
NSBezierPath *path;
for (path in paths)
[self removeBezierPath:path];
- [paths release];
for (path in newPaths)
[self addBezierPath:path];
}
- (NSArray *)pagePaths {
- NSMutableArray *paths = [[[NSMutableArray alloc] initWithArray:[self
paths] copyItems:YES] autorelease];
+ NSMutableArray *paths = [[NSMutableArray alloc] initWithArray:[self paths]
copyItems:YES];
NSRect bounds = [self bounds];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:NSMinX(bounds) yBy:NSMinY(bounds)];
@@ -573,8 +568,8 @@
- (NSScriptObjectSpecifier *)objectSpecifier {
NSScriptObjectSpecifier *containerRef = [[self page] objectSpecifier];
- return [[[NSUniqueIDSpecifier alloc
- ] initWithContainerClassDescription:[containerRef
keyClassDescription] containerSpecifier:containerRef key:@"notes"
uniqueID:[self uniqueID]] autorelease];
+ return [[NSUniqueIDSpecifier alloc
+ ] initWithContainerClassDescription:[containerRef
keyClassDescription] containerSpecifier:containerRef key:@"notes"
uniqueID:[self uniqueID]];
}
- (NSString *)uniqueID {
@@ -606,11 +601,10 @@
#pragma clang diagnostic pop
}
// remove all custom properties that are not valid for this class
- NSMutableDictionary *properties = [[[super scriptingProperties]
mutableCopy] autorelease];
+ NSMutableDictionary *properties = [[super scriptingProperties]
mutableCopy];
NSMutableSet *customKeys = [allCustomScriptingKeys mutableCopy];
[customKeys minusSet:[[self class] customScriptingKeys]];
[properties removeObjectsForKeys:[customKeys allObjects]];
- [customKeys release];
return properties;
}
@@ -662,7 +656,7 @@
- (id)textContents;
{
- return [[[NSTextStorage alloc] initWithString:[self string] ?: @""]
autorelease];
+ return [[NSTextStorage alloc] initWithString:[self string] ?: @""];
}
- (void)setTextContents:(id)text;
Modified: trunk/PDFDestination_SKExtensions.m
===================================================================
--- trunk/PDFDestination_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFDestination_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -152,7 +152,7 @@
point.x = rotation < 180 ? NSMinX(bounds) : NSMaxX(bounds);
if (point.y >= kPDFDestinationUnspecifiedValue)
point.y = (rotation + 90) % 360 < 180 ? NSMaxY(bounds) :
NSMinY(bounds);
- PDFDestination *destination = [[[PDFDestination alloc]
initWithPage:page atPoint:point] autorelease];
+ PDFDestination *destination = [[PDFDestination alloc]
initWithPage:page atPoint:point];
if (zoomX < kPDFDestinationUnspecifiedValue)
[destination setZoom:fmin(zoomX, zoomY)];
return destination;
Modified: trunk/PDFDocument_SKExtensions.m
===================================================================
--- trunk/PDFDocument_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFDocument_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -56,7 +56,7 @@
@implementation PDFDocument (SKExtensions)
-- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf count:(NSUInteger)len {
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id __unsafe_unretained *)stackbuf count:(NSUInteger)len {
NSUInteger start = state->state;
NSUInteger end = [self pageCount];
if (start == 0)
@@ -104,7 +104,7 @@
if (false == CGPDFDictionaryGetName(labelDict, "S",
&labelStyle))
labelStyle = NULL;
if (CGPDFDictionaryGetString(labelDict, "P",
&labelPDFPrefix))
- labelPrefix = [(NSString
*)CGPDFStringCopyTextString(labelPDFPrefix) autorelease];
+ labelPrefix =
CFBridgingRelease(CGPDFStringCopyTextString(labelPDFPrefix));
else
labelPrefix = nil;
if (false == CGPDFDictionaryGetInteger(labelDict, "St",
&labelStart))
@@ -166,7 +166,6 @@
NSString *fileID = [[NSString alloc] initWithBytes:outputBuffer
length:k encoding:NSASCIIStringEncoding];
[fileIDStrings addObject:fileID];
- [fileID release];
}
}
@@ -243,10 +242,9 @@
CGPDFDictionaryRef viewerPrefs = NULL;
const char *direction = NULL;
if (CGPDFDictionaryGetString(catalog, "Lang", &lang)) {
- NSString *language = (NSString *)CGPDFStringCopyTextString(lang);
+ NSString *language =
CFBridgingRelease(CGPDFStringCopyTextString(lang));
NSLocaleLanguageDirection characterDirection = [NSLocale
characterDirectionForLanguage:language];
NSLocaleLanguageDirection lineDirection = [NSLocale
lineDirectionForLanguage:language];
- [language release];
if (lineDirection == NSLocaleLanguageDirectionUnknown) {
if (characterDirection < NSLocaleLanguageDirectionTopToBottom)
lineDirection = NSLocaleLanguageDirectionTopToBottom;
Modified: trunk/PDFOutline_SKExtensions.m
===================================================================
--- trunk/PDFOutline_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFOutline_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -95,7 +95,7 @@
containerRef = [parent objectSpecifier];
else
containerRef = [[[self document] containingDocument]
objectSpecifier];
- return [[[NSIndexSpecifier alloc]
initWithContainerClassDescription:[containerRef keyClassDescription]
containerSpecifier:containerRef key:@"outlines" index:idx] autorelease];
+ return [[NSIndexSpecifier alloc]
initWithContainerClassDescription:[containerRef keyClassDescription]
containerSpecifier:containerRef key:@"outlines" index:idx];
} else {
return nil;
}
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFPage_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -133,7 +133,6 @@
} else {
foregroundRect.origin = SKAddPoints(foregroundRect.origin,
bounds.origin);
}
- [imageRep release];
return foregroundRect;
}
@@ -191,7 +190,7 @@
pageRect.origin.y -= shadowOffset;
}
- image = [[[NSImage alloc] initWithSize:thumbnailSize] autorelease];
+ image = [[NSImage alloc] initWithSize:thumbnailSize];
[image lockFocus];
@@ -236,9 +235,7 @@
[wrapper setPreferredFilename:filename];
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper:wrapper];
- [wrapper release];
NSAttributedString *attrString = [NSAttributedString
attributedStringWithAttachment:attachment];
- [attachment release];
return attrString;
}
@@ -270,7 +267,6 @@
[page setBounds:NSZeroRect forBox:kPDFDisplayBoxTrimBox];
[page setBounds:NSZeroRect forBox:kPDFDisplayBoxArtBox];
data = [page dataRepresentation];
- [page release];
return data;
}
@@ -290,7 +286,7 @@
NSRect destRect = sourceRect;
destRect.origin = NSZeroPoint;
- NSImage *image = [[[NSImage alloc] initWithSize:destRect.size]
autorelease];
+ NSImage *image = [[NSImage alloc] initWithSize:destRect.size];
[image lockFocus];
[pageImage drawInRect:destRect fromRect:sourceRect
operation:NSCompositingOperationCopy fraction:1.0];
[image unlockFocus];
@@ -305,10 +301,8 @@
[pageIndexes enumerateIndexesUsingBlock:^(NSUInteger i, BOOL *stop){
PDFPage *aPage = [[[self document] pageAtIndex:i] copy];
[pdfDoc insertPage:aPage atIndex:[pdfDoc pageCount]];
- [aPage release];
}];
data = [pdfDoc dataRepresentation];
- [pdfDoc release];
} else {
data = [self dataRepresentation];
}
@@ -348,7 +342,7 @@
- (id<NSPasteboardWriting>)filePromiseForPageIndexes:(NSIndexSet *)pageIndexes
{
if ([[self document] isLocked] == NO) {
NSString *fileUTI = [[self document] allowsPrinting] ? (NSString
*)kUTTypePDF : (NSString *)kUTTypeTIFF;
- NSFilePromiseProvider *item = [[[NSFilePromiseProvider alloc]
initWithFileType:fileUTI delegate:self] autorelease];
+ NSFilePromiseProvider *item = [[NSFilePromiseProvider alloc]
initWithFileType:fileUTI delegate:self];
if (pageIndexes)
[item setUserInfo:pageIndexes];
return item;
@@ -359,7 +353,7 @@
- (void)writeToClipboardForPageIndexes:(NSIndexSet *)pageIndexes {
if ([[self document] isLocked] == NO) {
NSData *tiffData = [self TIFFDataForRect:[self
boundsForBox:kPDFDisplayBoxCropBox]];
- NSPasteboardItem *pboardItem = [[[NSPasteboardItem alloc] init]
autorelease];
+ NSPasteboardItem *pboardItem = [[NSPasteboardItem alloc] init];
if ([[self document] allowsPrinting])
[pboardItem setData:[self
dataRepresentationForPageIndexes:pageIndexes] forType:NSPasteboardTypePDF];
[pboardItem setData:tiffData forType:NSPasteboardTypeTIFF];
@@ -377,7 +371,6 @@
[components setScheme:@"skim"];
[components setFragment:[NSString stringWithFormat:@"page=%lu", (unsigned
long)([self pageIndex] + 1)]];
NSURL *skimURL = [components URL];
- [components release];
return skimURL;
}
@@ -549,7 +542,7 @@
if (document && idx != NSNotFound) {
NSScriptObjectSpecifier *containerRef = [document objectSpecifier];
- return [[[NSIndexSpecifier alloc]
initWithContainerClassDescription:[containerRef keyClassDescription]
containerSpecifier:containerRef key:@"pages" index:idx] autorelease];
+ return [[NSIndexSpecifier alloc]
initWithContainerClassDescription:[containerRef keyClassDescription]
containerSpecifier:containerRef key:@"pages" index:idx];
} else {
return nil;
}
@@ -648,12 +641,12 @@
}
- (SKLine *)objectInLinesAtIndex:(NSUInteger)anIndex {
- return [[[SKLine alloc] initWithPage:self index:anIndex] autorelease];
+ return [[SKLine alloc] initWithPage:self index:anIndex];
}
- (NSTextStorage *)richText {
NSAttributedString *attrString = [self attributedString];
- return attrString ? [[[NSTextStorage alloc]
initWithAttributedString:attrString] autorelease] : [[[NSTextStorage alloc]
init] autorelease];
+ return attrString ? [[NSTextStorage alloc]
initWithAttributedString:attrString] : [[NSTextStorage alloc] init];
}
- (NSArray *)notes {
@@ -701,7 +694,7 @@
if ([key isEqualToString:@"notes"]) {
PDFAnnotation *annotation = nil;
- NSMutableDictionary *props = [[properties mutableCopy] autorelease];
+ NSMutableDictionary *props = [properties mutableCopy];
NSString *type = [properties objectForKey:SKNPDFAnnotationTypeKey];
[props removeObjectForKey:SKNPDFAnnotationTypeKey];
if (type == nil && contentsValue)
@@ -722,7 +715,7 @@
[props setValue:[selection cleanedString]
forKey:SKPDFAnnotationScriptingTextContentsKey];
}
} else if ([type isEqualToString:SKNInkString]) {
- NSArray *pointLists = [[[properties
objectForKey:SKPDFAnnotationScriptingPointListsKey] retain] autorelease];
+ NSArray *pointLists = [properties
objectForKey:SKPDFAnnotationScriptingPointListsKey];
[props removeObjectForKey:SKPDFAnnotationScriptingPointListsKey];
if ([pointLists isKindOfClass:[NSArray class]] == NO) {
[[NSScriptCommand currentCommand]
setScriptErrorNumber:NSRequiredArgumentsMissingScriptError];
@@ -746,11 +739,9 @@
}
if ([path elementCount] > 1)
[paths addObject:path];
- [path release];
}
}
annotation = [PDFAnnotation newSkimNoteWithPaths:paths];
- [paths release];
}
} else {
NSRect bounds = NSZeroRect;
@@ -788,13 +779,12 @@
if ([properties count])
[copiedAnnotation setScriptingProperties:[copiedAnnotation
coerceValue:properties forKey:@"scriptingProperties"]];
[copiedValue addObject:copiedAnnotation];
- [copiedAnnotation release];
} else {
// we don't want to duplicate markup
NSScriptCommand *cmd = [NSScriptCommand currentCommand];
[cmd
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
[cmd setScriptErrorString:@"Cannot duplicate markup note."];
- SKDESTROY(copiedValue);
+ copiedValue = nil;
}
}
return copiedValue;
Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m 2023-12-14 10:13:14 UTC (rev 13903)
+++ trunk/PDFSelection_SKExtensions.m 2023-12-15 15:49:35 UTC (rev 13904)
@@ -67,7 +67,7 @@
PDFSelection *selection = nil;
NSUInteger count = [selections count];
if (count > 0) {
- selection = [[[selections objectAtIndex:0] copy] autorelease];
+ selection = [[selections objectAtIndex:0] copy];
if (count > 1)
[selection addSelections:[selections
subarrayWithRange:NSMakeRange(1, count - 1)]];
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit