Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26430b6

Browse files
committed
Modern syntax
1 parent c92a326 commit 26430b6

36 files changed

Lines changed: 81 additions & 61 deletions

File tree

advpng/advpng.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@
523523
5A984B2211238282007622D7 /* Debug */ = {
524524
isa = XCBuildConfiguration;
525525
buildSettings = {
526+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
526527
PRODUCT_NAME = download;
527528
SDKROOT = macosx;
528529
};
@@ -531,6 +532,7 @@
531532
5A984B2311238282007622D7 /* Release */ = {
532533
isa = XCBuildConfiguration;
533534
buildSettings = {
535+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
534536
COPY_PHASE_STRIP = YES;
535537
PRODUCT_NAME = download;
536538
SDKROOT = macosx;

gifsicle/gifsicle.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@
243243
5A20CD00112395FB0000400D /* Debug */ = {
244244
isa = XCBuildConfiguration;
245245
buildSettings = {
246+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
246247
GCC_DYNAMIC_NO_PIC = NO;
247248
PRODUCT_NAME = download;
248249
SDKROOT = macosx;
@@ -252,6 +253,7 @@
252253
5A20CD01112395FB0000400D /* Release */ = {
253254
isa = XCBuildConfiguration;
254255
buildSettings = {
256+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
255257
COPY_PHASE_STRIP = YES;
256258
PRODUCT_NAME = download;
257259
SDKROOT = macosx;

imageoptim/DragDropImageView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@implementation DragDropImageView
1313

1414
- (void)awakeFromNib {
15-
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
15+
[self registerForDraggedTypes:@[NSFilenamesPboardType]];
1616
[self setAlphaValue:1.0];
1717
}
1818

imageoptim/File.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ enum IOFileType {
5555
-(BOOL)isDone;
5656

5757
-(BOOL)revert;
58-
-(BOOL)canRevert;
58+
@property (readonly) BOOL canRevert;
5959

6060
-(void)enqueueWorkersInCPUQueue:(NSOperationQueue *)queue fileIOQueue:(NSOperationQueue *)fileIOQueue;
6161

6262
-(BOOL)setFilePathOptimized:(NSURL *)f size:(NSUInteger)s toolName:(NSString*)s;
6363

64-
-(id)initWithFilePath:(NSURL *)aPath resultsDatabase:(ResultsDb*)aDb;
64+
-(instancetype)initWithFilePath:(NSURL *)aPath resultsDatabase:(ResultsDb*)aDb;
6565
-(id)copyWithZone:(NSZone *)zone;
6666
-(void)resetToOriginalByteSize:(NSUInteger)size;
6767
-(void)setByteSizeOptimized:(NSUInteger)size;
@@ -73,8 +73,8 @@ enum IOFileType {
7373

7474
-(void)setFilePath:(NSURL *)s;
7575

76-
-(NSString *)fileName;
77-
-(NSString *)mimeType;
76+
@property (readonly, copy) NSString *fileName;
77+
@property (readonly, copy) NSString *mimeType;
7878

7979
@property (strong) NSString *statusText, *displayName, *bestToolName;
8080
@property (strong,nonatomic) NSURL *filePath;

imageoptim/File.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ @implementation File
4242

4343
@synthesize workersPreviousResults, byteSizeOriginal, byteSizeOptimized, filePath, displayName, statusText, statusOrder, statusImage, percentDone, bestToolName;
4444

45-
-(id)initWithFilePath:(NSURL *)aPath resultsDatabase:(ResultsDb*)aDb
45+
-(instancetype)initWithFilePath:(NSURL *)aPath resultsDatabase:(ResultsDb*)aDb
4646
{
4747
if (self = [self init]) {
4848
workersPreviousResults = [NSMutableDictionary new];
@@ -200,8 +200,8 @@ -(BOOL)removeExtendedAttrAtURL:(NSURL *)path
200200
char *utf8name = &nameBuf[i];
201201
i += strlen(utf8name)+1; // attrs are 0-terminated one after another
202202

203-
NSString *name = [NSString stringWithUTF8String:utf8name];
204-
if ([extAttrToRemove objectForKey:name]) {
203+
NSString *name = @(utf8name);
204+
if (extAttrToRemove[name]) {
205205
if (removexattr(fileSystemPath, utf8name, 0) == 0) {
206206
IODebug("Removed %s from %s", utf8name, fileSystemPath);
207207
} else {

imageoptim/FilesQueue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ extern NSString *const kFilesQueueFinished;
4040
-(void)startAgainOptimized:(BOOL)optimized;
4141
-(BOOL)canStartAgainOptimized:(BOOL)optimized;
4242
-(void)clearComplete;
43-
-(BOOL)canClearComplete;
43+
@property (readonly) BOOL canClearComplete;
4444
-(void)revert;
45-
-(BOOL)canRevert;
45+
@property (readonly) BOOL canRevert;
4646
-(void)cleanup;
4747
-(void)setRow:(NSInteger)row;
4848

49-
-(NSArray *)fileTypes;
49+
@property (readonly, copy) NSArray *fileTypes;
5050

5151
@property (unsafe_unretained, readonly, nonatomic) NSNumber *queueCount;
5252
@property (readonly) BOOL isBusy;

imageoptim/FilesQueue.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
@interface FilesQueue()
1414

15-
-(NSArray *)extensions;
1615
-(BOOL)isAnyQueueBusy;
16+
@property (readonly, copy) NSArray *extensions;
1717
-(void)updateBusyState;
1818
@end
1919

@@ -51,7 +51,7 @@ -(void)configureWithTableView:(NSTableView *)inTableView {
5151
}
5252

5353
-(NSNumber *)queueCount {
54-
return [NSNumber numberWithInteger:cpuQueue.operationCount + dirWorkerQueue.operationCount + fileIOQueue.operationCount];
54+
return @(cpuQueue.operationCount + dirWorkerQueue.operationCount + fileIOQueue.operationCount);
5555
}
5656

5757
-(BOOL)isAnyQueueBusy {
@@ -125,7 +125,7 @@ -(void)removeObjects:(NSArray *)objects {
125125
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(int)row mouseLocation:(NSPoint)mouseLocation {
126126
NSArray *objs = [self arrangedObjects];
127127
if (row < (signed)[objs count]) {
128-
File *f = [objs objectAtIndex:row];
128+
File *f = objs[row];
129129

130130
if ([aCell isKindOfClass:[RevealButtonCell class]]) {
131131
NSRect infoButtonRect = [((RevealButtonCell *)aCell) infoButtonRectForBounds:*rect];
@@ -175,7 +175,7 @@ -(void) moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet
175175
removeIndex = idx;
176176
insertIndex -= 1;
177177
}
178-
object = [objects objectAtIndex:removeIndex];
178+
object = objects[removeIndex];
179179
[self removeObjectAtArrangedObjectIndex:removeIndex];
180180
[self insertObject:object atArrangedObjectIndex:insertIndex];
181181

@@ -380,7 +380,7 @@ -(void)startAgainOptimized:(BOOL)optimized {
380380
// UI doesn't give a way to deselect all, so here's a substitute
381381
// when selecting "again" on file that doesn't need it, deselect
382382
if (1 == selectionCount) {
383-
File *file = [files objectAtIndex:0];
383+
File *file = files[0];
384384
if (file.isBusy || !file.isOptimized) {
385385
files = [files copy];
386386
[self setSelectedObjects:@[]];
@@ -459,7 +459,7 @@ -(NSArray *)extensions {
459459
[extensions addObject:@"PNG"];
460460
}
461461
if (types & JPEG_ENABLED) {
462-
[extensions addObjectsFromArray:[NSArray arrayWithObjects:@"jpg",@"JPG",@"jpeg",@"JPEG",nil]];
462+
[extensions addObjectsFromArray:@[@"jpg",@"JPG",@"jpeg",@"JPEG"]];
463463
}
464464
if (types & GIF_ENABLED) {
465465
[extensions addObject:@"gif"];
@@ -476,13 +476,13 @@ -(NSArray *)fileTypes {
476476
NSMutableArray *fileTypes = [NSMutableArray array];
477477

478478
if (types & PNG_ENABLED) {
479-
[fileTypes addObjectsFromArray:[NSArray arrayWithObjects:@"png",@"PNG",NSFileTypeForHFSTypeCode('PNGf'),@"public.png",@"image/png",nil]];
479+
[fileTypes addObjectsFromArray:@[@"png",@"PNG",NSFileTypeForHFSTypeCode('PNGf'),@"public.png",@"image/png"]];
480480
}
481481
if (types & JPEG_ENABLED) {
482-
[fileTypes addObjectsFromArray:[NSArray arrayWithObjects:@"jpg",@"jpeg",@"JPG",@"JPEG",NSFileTypeForHFSTypeCode('JPEG'),@"public.jpeg",@"image/jpeg",nil]];
482+
[fileTypes addObjectsFromArray:@[@"jpg",@"jpeg",@"JPG",@"JPEG",NSFileTypeForHFSTypeCode('JPEG'),@"public.jpeg",@"image/jpeg"]];
483483
}
484484
if (types & GIF_ENABLED) {
485-
[fileTypes addObjectsFromArray:[NSArray arrayWithObjects:@"gif",@"GIF",NSFileTypeForHFSTypeCode('GIFf'),@"public.gif",@"image/gif",nil]];
485+
[fileTypes addObjectsFromArray:@[@"gif",@"GIF",NSFileTypeForHFSTypeCode('GIFf'),@"public.gif",@"image/gif"]];
486486
}
487487
return fileTypes;
488488
}

imageoptim/ImageOptim.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@
13521352
C01FCF4B08A954540054247B /* Debug */ = {
13531353
isa = XCBuildConfiguration;
13541354
buildSettings = {
1355+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
13551356
CLANG_ENABLE_OBJC_ARC = YES;
13561357
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
13571358
INFOPLIST_FILE = Info.plist;
@@ -1363,6 +1364,7 @@
13631364
C01FCF4C08A954540054247B /* Release */ = {
13641365
isa = XCBuildConfiguration;
13651366
buildSettings = {
1367+
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
13661368
CLANG_ENABLE_OBJC_ARC = YES;
13671369
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
13681370
INFOPLIST_FILE = Info.plist;

imageoptim/ImageOptimController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern NSDictionary *statusImages;
3636
-(IBAction)openDonationPage:(id)sender;
3737
-(IBAction)browseForFiles:(id)sender;
3838

39-
-(int)numberOfCPUs;
39+
@property (readonly) int numberOfCPUs;
4040
-(void)loadCreditsHTML;
4141

4242
@property (unsafe_unretained, readonly) FilesQueue *filesQueue;

imageoptim/ImageOptimController.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ - (void)applicationWillFinishLaunching:(NSNotification *)unused {
2727

2828
int maxTasks = [self numberOfCPUs];
2929

30-
[defs setObject:[NSNumber numberWithInt:maxTasks] forKey:@"RunConcurrentTasks"];
31-
[defs setObject:[NSNumber numberWithInt:(int)ceil((double)maxTasks/3.9)] forKey:@"RunConcurrentDirscans"];
30+
defs[@"RunConcurrentTasks"] = @(maxTasks);
31+
defs[@"RunConcurrentDirscans"] = @((int)ceil((double)maxTasks/3.9));
3232

3333
// Use lighter defaults on slower machines
3434
if (maxTasks <= 2) {
@@ -72,7 +72,7 @@ - (void)handleServices:(NSPasteboard *)pboard
7272
unit = NSLocalizedString(@"KB", "kilobytes suffix");
7373
}
7474

75-
return [[formatter stringFromNumber:[NSNumber numberWithDouble:size]] stringByAppendingString:unit];
75+
return [[formatter stringFromNumber:@(size)] stringByAppendingString:unit];
7676
};
7777

7878

@@ -142,8 +142,8 @@ -(void)initStatusbar {
142142
str = [NSString stringWithFormat:fmtStr,
143143
formatSize(bytesSaved, formatter),
144144
formatSize(bytesTotal, formatter),
145-
[percFormatter stringFromNumber: [NSNumber numberWithDouble:avgNum]],
146-
[percFormatter stringFromNumber: [NSNumber numberWithDouble:maxOptimizedFraction]]];
145+
[percFormatter stringFromNumber: @(avgNum)],
146+
[percFormatter stringFromNumber: @(maxOptimizedFraction)]];
147147
}
148148
}
149149
}
@@ -313,7 +313,7 @@ -(void)applicationWillTerminate:(NSNotification *)n {
313313
}
314314

315315
-(NSString *)version {
316-
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
316+
return [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"];
317317
}
318318

319319
// Quick Look panel support
@@ -343,7 +343,7 @@ - (NSInteger)numberOfPreviewItemsInPreviewPanel:(QLPreviewPanel *)panel {
343343
}
344344

345345
- (id <QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
346-
return [[filesController selectedObjects] objectAtIndex:index];
346+
return [filesController selectedObjects][index];
347347
}
348348

349349
// Quick Look panel delegate

0 commit comments

Comments
 (0)