Skip to content

Commit 8792c86

Browse files
bitst0rmbitst0rm
authored andcommitted
Fix all deprecated warnings
1 parent 776a253 commit 8792c86

File tree

6 files changed

+40
-68
lines changed

6 files changed

+40
-68
lines changed

source/AppController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ CPUID;
113113
NSString* iOutputFileName;
114114
NSString* iOutputFilePath;
115115
NSView** iPrefsViews;
116-
uint32_t iPrefsCurrentViewIndex;
116+
NSUInteger iPrefsCurrentViewIndex;
117117
host_basic_info_data_t iHostInfo;
118118
NSShadow* iTextShadow;
119119
NSTimer* iIndeterminateProgBarMainThreadTimer;

source/AppController.m

Lines changed: 33 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ - (IBAction)openExe: (id)sender
114114

115115
[thePanel setTreatsFilePackagesAsDirectories: YES];
116116

117-
if ([thePanel runModalForTypes: nil] != NSFileHandlingPanelOKButton)
117+
if ([thePanel runModal] != NSFileHandlingPanelOKButton)
118118
return;
119119

120-
NSString* theName = [[thePanel filenames] objectAtIndex: 0];
120+
NSString* theName = [[thePanel URL] path];
121121

122122
[self newOFile: [NSURL fileURLWithPath: theName] needsPath: YES];
123123
}
@@ -203,8 +203,8 @@ - (void)setupMainWindow
203203
if (OS_IS_POST_TIGER)
204204
{ // Adjust main window for Leopard.
205205
// Save the resize masks and apply new ones.
206-
uint32_t origMainViewMask = [iMainView autoresizingMask];
207-
uint32_t origProgViewMask = [iProgView autoresizingMask];
206+
NSUInteger origMainViewMask = [iMainView autoresizingMask];
207+
NSUInteger origProgViewMask = [iProgView autoresizingMask];
208208

209209
[iMainView setAutoresizingMask: NSViewMaxYMargin];
210210
[iProgView setAutoresizingMask: NSViewMaxYMargin];
@@ -367,7 +367,6 @@ - (IBAction)attemptToProcessFile: (id)sender
367367
if (iIndeterminateProgBarMainThreadTimer)
368368
{
369369
[iIndeterminateProgBarMainThreadTimer invalidate];
370-
[iIndeterminateProgBarMainThreadTimer release];
371370
}
372371

373372
iIndeterminateProgBarMainThreadTimer = [NSTimer scheduledTimerWithTimeInterval: interval
@@ -395,16 +394,16 @@ - (IBAction)attemptToProcessFile: (id)sender
395394
{
396395
NSSavePanel* thePanel = [NSSavePanel savePanel];
397396

397+
[thePanel setNameFieldStringValue:iOutputFileName];
398398
[thePanel setTreatsFilePackagesAsDirectories: YES];
399399

400-
if ([thePanel runModalForDirectory: nil
401-
file: iOutputFileName] != NSFileHandlingPanelOKButton)
400+
if ([thePanel runModal] != NSFileHandlingPanelOKButton)
402401
return;
403402

404403
if (iOutputFilePath)
405404
[iOutputFilePath release];
406405

407-
iOutputFilePath = [thePanel filename];
406+
iOutputFilePath = [[thePanel URL] path];
408407
}
409408
else
410409
{
@@ -415,33 +414,8 @@ - (IBAction)attemptToProcessFile: (id)sender
415414

416415
[iOutputFilePath retain];
417416
[theTempOutputFilePath release];
418-
419-
// Check if the output file exists.
420-
if ([[NSFileManager defaultManager] fileExistsAtPath: iOutputFilePath])
421-
{
422-
NSString* fileName = [iOutputFilePath lastPathComponent];
423-
NSString* folderName =
424-
[[iOutputFilePath stringByDeletingLastPathComponent]
425-
lastPathComponent];
426-
NSAlert* alert = [[[NSAlert alloc] init] autorelease];
427-
428-
[alert addButtonWithTitle: @"Replace"];
429-
[alert addButtonWithTitle: @"Cancel"];
430-
[alert setMessageText: [NSString stringWithFormat:
431-
@"\"%@\" already exists. Do you want to replace it?", fileName]];
432-
[alert setInformativeText:
433-
[NSString stringWithFormat: @"A file or folder"
434-
@" with the same name already exists in %@."
435-
@" Replacing it will overwrite its current contents.", folderName]];
436-
[alert beginSheetModalForWindow: iMainWindow
437-
modalDelegate: self
438-
didEndSelector: @selector(dupeFileAlertDidEnd:returnCode:contextInfo:)
439-
contextInfo: nil];
440-
}
441-
else
442-
{
443-
[self processFile];
444-
}
417+
418+
[self processFile];
445419
}
446420

447421
// processFile
@@ -643,8 +617,8 @@ - (void)showProgView
643617
targetWindowFrame.size.height += progViewFrame.size.height;
644618

645619
// Save the resize masks and apply new ones.
646-
uint32_t origMainViewMask = [iMainView autoresizingMask];
647-
uint32_t origProgViewMask = [iProgView autoresizingMask];
620+
NSUInteger origMainViewMask = [iMainView autoresizingMask];
621+
NSUInteger origProgViewMask = [iProgView autoresizingMask];
648622

649623
[iMainView setAutoresizingMask: NSViewMinYMargin];
650624
[iProgView setAutoresizingMask: NSViewMinYMargin];
@@ -663,9 +637,9 @@ - (void)showProgView
663637
(NSXViewAnimationUpdateResizeMasksAtEndEffect |
664638
NSXViewAnimationUpdateWindowMinMaxSizesAtEndEffect |
665639
NSXViewAnimationPerformSelectorAtEndEffect)];
666-
NSNumber* origMainMask = [NSNumber numberWithUnsignedInt:
640+
NSNumber* origMainMask = [NSNumber numberWithUnsignedLong:
667641
origMainViewMask];
668-
NSNumber* origProgMask = [NSNumber numberWithUnsignedInt:
642+
NSNumber* origProgMask = [NSNumber numberWithUnsignedLong:
669643
origProgViewMask];
670644

671645
// Custom keys
@@ -726,12 +700,12 @@ - (void)hideProgView: (BOOL)inAnimate
726700
targetWindowFrame.origin.y += progViewFrame.size.height;
727701
targetWindowFrame.size.height -= progViewFrame.size.height;
728702

729-
uint32_t origMainViewMask = [iMainView autoresizingMask];
730-
uint32_t origProgViewMask = [iProgView autoresizingMask];
703+
NSUInteger origMainViewMask = [iMainView autoresizingMask];
704+
NSUInteger origProgViewMask = [iProgView autoresizingMask];
731705

732-
NSNumber* origMainMask = [NSNumber numberWithUnsignedInt:
706+
NSNumber* origMainMask = [NSNumber numberWithUnsignedLong:
733707
origMainViewMask];
734-
NSNumber* origProgMask = [NSNumber numberWithUnsignedInt:
708+
NSNumber* origProgMask = [NSNumber numberWithUnsignedLong:
735709
origProgViewMask];
736710

737711
[iMainView setAutoresizingMask: NSViewMinYMargin];
@@ -847,13 +821,13 @@ - (IBAction)thinFile: (id)sender
847821
NSString* theFileName =
848822
[iExeName stringByAppendingString: archExt];
849823

824+
[thePanel setNameFieldStringValue:theFileName];
850825
[thePanel setTreatsFilePackagesAsDirectories: YES];
851826

852-
if ([thePanel runModalForDirectory: nil
853-
file: theFileName] != NSFileHandlingPanelOKButton)
827+
if ([thePanel runModal] != NSFileHandlingPanelOKButton)
854828
return;
855829

856-
theThinOutputPath = [thePanel filename];
830+
theThinOutputPath = [[thePanel URL] path];
857831
}
858832
else
859833
{
@@ -1026,8 +1000,7 @@ - (BOOL)validateMenuItem: (NSMenuItem*)menuItem
10261000
NSUserDefaults* theDefaults = [NSUserDefaults standardUserDefaults];
10271001

10281002
if ([theDefaults boolForKey: AskOutputDirKey])
1029-
[menuItem setTitle: [NSString stringWithCString: "SaveÉ"
1030-
encoding: NSMacOSRomanStringEncoding]];
1003+
[menuItem setTitle: [NSString stringWithFormat: @"Save..."]];
10311004
else
10321005
[menuItem setTitle: @"Save"];
10331006

@@ -1118,7 +1091,7 @@ - (void)refreshMainWindow
11181091
{
11191092
fat_header* fhp = (fat_header*)fileBytes;
11201093
fat_arch* fap = (fat_arch*)(fhp + 1);
1121-
uint32_t i;
1094+
NSUInteger i;
11221095

11231096
fat_header fatHeader = *fhp;
11241097
fat_arch fatArch;
@@ -1394,8 +1367,8 @@ - (void)setupPrefsWindow
13941367
[iPrefsWindow setShowsToolbarButton: NO];
13951368

13961369
// Load views.
1397-
uint32_t numViews = [[toolbar items] count];
1398-
uint32_t i;
1370+
NSUInteger numViews = [[toolbar items] count];
1371+
NSUInteger i;
13991372

14001373
iPrefsViews = calloc(numViews, sizeof(NSView*));
14011374
iPrefsViews[0] = iPrefsGeneralView;
@@ -1433,7 +1406,7 @@ - (IBAction)showPrefs: (id)sender
14331406
- (IBAction)switchPrefsViews: (id)sender
14341407
{
14351408
NSToolbarItem* item = (NSToolbarItem*)sender;
1436-
uint32_t newIndex = [item tag];
1409+
NSInteger newIndex = [item tag];
14371410

14381411
if (newIndex == iPrefsCurrentViewIndex)
14391412
return;
@@ -1509,7 +1482,7 @@ - (IBAction)cancel: (id)sender
15091482
- (void)nudgeIndeterminateProgBar: (NSTimer*)timer
15101483
{
15111484
if ([iProgBar isIndeterminate])
1512-
[iProgBar animate: self];
1485+
[iProgBar startAnimation: self];
15131486
}
15141487

15151488
#pragma mark -
@@ -1711,8 +1684,8 @@ - (BOOL)animationShouldStart: (NSAnimation*)animation
17111684
animatingWindow != iPrefsWindow)
17121685
return YES;
17131686

1714-
uint32_t i;
1715-
uint32_t numAnimations = [animatedViews count];
1687+
NSUInteger i;
1688+
NSUInteger numAnimations = [animatedViews count];
17161689
id animObject = nil;
17171690

17181691
for (i = 0; i < numAnimations; i++)
@@ -1801,8 +1774,8 @@ - (void)animationDidEnd: (NSAnimation*)animation
18011774
animatingWindow != iPrefsWindow)
18021775
return;
18031776

1804-
uint32_t i;
1805-
uint32_t numAnimations = [animatedViews count];
1777+
NSUInteger i;
1778+
NSUInteger numAnimations = [animatedViews count];
18061779
id animObject = nil;
18071780

18081781
for (i = 0; i < numAnimations; i++)
@@ -1856,9 +1829,9 @@ - (void)animationDidEnd: (NSAnimation*)animation
18561829

18571830
NSView* view;
18581831
NSNumber* mask;
1859-
uint32_t i;
1860-
uint32_t numMasks = [masks count];
1861-
uint32_t numViews = [views count];
1832+
NSUInteger i;
1833+
NSUInteger numMasks = [masks count];
1834+
NSUInteger numViews = [views count];
18621835

18631836
if (numMasks != numViews)
18641837
continue;

source/DropBox.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ - (void)drawRect: (NSRect)rect
9393

9494
NSBorderType borderType = [self borderType];
9595

96-
if (borderType < 0 || borderType > 3)
96+
if (borderType > 3)
9797
{
98-
fprintf(stderr, "DropBox: invalid NSBorderType: %d\n", borderType);
98+
fprintf(stderr, "DropBox: invalid NSBorderType: %u\n", (unsigned)borderType);
9999
return;
100100
}
101101

source/ObjcTypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ typedef struct {
165165
typedef struct {
166166
uint64_t ivar_name; /* char * */
167167
uint64_t ivar_type; /* char * */
168-
uint32_t ivar_offset;
168+
uint64_t ivar_offset;
169169
uint32_t space;
170170
} objc1_64_ivar;
171171

@@ -186,7 +186,7 @@ typedef struct {
186186

187187
typedef struct {
188188
int64_t obsolete; /* struct objc_method_list * */
189-
int32_t method_count; /* int */
189+
int64_t method_count; /* int */
190190
int32_t space; /* int */
191191
objc1_64_method method_list[1]; /* variable length structure */
192192
} objc1_64_method_list;

source/Processors/X86Processor.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,6 @@ - (void)updateRegisters: (Line*)inLine;
16341634
// pop stack into non-thunk registers. Wipe em.
16351635
case 0x5c: // esp
16361636
case 0x5d: // ebp
1637-
case 0x5f: // edi
16381637
iRegInfos[REG2(opcode)] = (GPRegisterInfo){0};
16391638

16401639
break;

source/SmoothViewAnimation.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ - (id)initWithViewAnimations: (NSArray*)viewAnimations
2424
if ((self = [super initWithViewAnimations: viewAnimations]))
2525
{
2626
// Find the first window object in the array.
27-
uint32_t numAnimations = [viewAnimations count];
28-
uint32_t i;
27+
NSUInteger numAnimations = [viewAnimations count];
28+
NSUInteger i;
2929
id object;
3030
Class windowClass = [NSWindow class];
3131

0 commit comments

Comments
 (0)