Skip to content

Commit

Permalink
Fix remaining warnings (except for MainMenu.xib)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Nov 14, 2011
1 parent 55abe1d commit 7e51826
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 1,308 deletions.
623 changes: 57 additions & 566 deletions English.lproj/Autocomplete.xib

Large diffs are not rendered by default.

705 changes: 60 additions & 645 deletions English.lproj/FindView.xib

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions PSMTabBarControl/source/PSMAdiumTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
NSImage *closeButton = nil;

if ([cell hasIcon]) {
closeButton = [[[cell representedObject] identifier] icon];
closeButton = [(id)[[cell representedObject] identifier] icon];
closeButtonRect.origin.y += 1;
} else {
closeButton = _closeButton;
Expand All @@ -390,7 +390,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
labelPosition += [_closeButton size].width + kPSMTabBarCellPadding;
} else if ([cell hasIcon]) {
NSRect iconRect = [self iconRectForTabCell:cell];
NSImage *icon = [[[cell representedObject] identifier] icon];
NSImage *icon = [(id)[[cell representedObject] identifier] icon];
if ([controlView isFlipped]) {
iconRect.origin.y += iconRect.size.height;
}
Expand Down
2 changes: 1 addition & 1 deletion PSMTabBarControl/source/PSMAquaTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
NSImage *icon = [[[cell representedObject] identifier] icon];
NSImage *icon = [(id)[[cell representedObject] identifier] icon];
if ([controlView isFlipped]) {
iconRect.origin.y += iconRect.size.height;
}
Expand Down
2 changes: 1 addition & 1 deletion PSMTabBarControl/source/PSMMetalTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
NSImage *icon = [[[cell representedObject] identifier] icon];
NSImage *icon = [(id)[[cell representedObject] identifier] icon];

if ([controlView isFlipped]) {
iconRect.origin.y += iconRect.size.height;
Expand Down
4 changes: 2 additions & 2 deletions PSMTabBarControl/source/PSMTabBarControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ - (void)disconnectItem:(NSObjectController*)item fromCell:(PSMTabBarCell*)cell

- (void)removeTabForCell:(PSMTabBarCell *)cell
{
NSObjectController *item = [[cell representedObject] identifier];
NSObjectController *item = (NSObjectController *)[[cell representedObject] identifier];

// unbind
[[cell indicator] unbind:@"animate"];
Expand Down Expand Up @@ -1287,7 +1287,7 @@ - (NSMenu *)_setupCells:(NSArray *)newWidths
}

if ([cell hasIcon]) {
[menuItem setImage:[[[cell representedObject] identifier] icon]];
[menuItem setImage:[(id)[[cell representedObject] identifier] icon]];
}

if ([cell count] > 0) {
Expand Down
2 changes: 1 addition & 1 deletion PSMTabBarControl/source/PSMUnifiedTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlVie
// icon
if([cell hasIcon]){
NSRect iconRect = [self iconRectForTabCell:cell];
NSImage *icon = [[[cell representedObject] identifier] icon];
NSImage *icon = [(id)[[cell representedObject] identifier] icon];
if ([controlView isFlipped]) {
iconRect.origin.y += iconRect.size.height;
}
Expand Down
2 changes: 1 addition & 1 deletion RegexKitLite/RegexKitLite.m
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ static void rkl_handleDelayedAssert(id self, SEL _cmd, id exception) {
else {
id functionString = [exception objectForKey:@"function"], fileString = [exception objectForKey:@"file"], descriptionString = [exception objectForKey:@"description"], lineNumber = [exception objectForKey:@"line"];
RKLCHardAbortAssert((functionString != NULL) && (fileString != NULL) && (descriptionString != NULL) && (lineNumber != NULL));
[[NSAssertionHandler currentHandler] handleFailureInFunction:functionString file:fileString lineNumber:(NSInteger)[lineNumber longValue] description:descriptionString];
[[NSAssertionHandler currentHandler] handleFailureInFunction:functionString file:fileString lineNumber:(NSInteger)[lineNumber longValue] description:@"%@", descriptionString];
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions SessionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ - (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender
{
if ([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
// Dragging a tab handle. Source is a PSMTabBarControl.
PTYTab *theTab = [[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] identifier];
PTYTab *theTab = (PTYTab *)[[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] identifier];
if (theTab == [session_ tab] || [[theTab sessions] count] > 1) {
return NSDragOperationNone;
}
Expand Down Expand Up @@ -460,7 +460,7 @@ - (BOOL)performDragOperation:(id < NSDraggingInfo >)sender
SplitSessionHalf half = [splitSelectionView_ half];
[splitSelectionView_ removeFromSuperview];
splitSelectionView_ = nil;
PTYTab *theTab = [[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] identifier];
PTYTab *theTab = (PTYTab *)[[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] identifier];
return [[MovePaneController sharedInstance] dropTab:theTab
inSession:[self session]
half:half
Expand Down
2 changes: 1 addition & 1 deletion UKCrashReporter/UKCrashReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
URLs for different locales that way, in case a crash is caused by an error
in a localized file.
*/
void UKCrashReporterCheckForCrash();
void UKCrashReporterCheckForCrash(void);


// -----------------------------------------------------------------------------
Expand Down
12 changes: 8 additions & 4 deletions UKCrashReporter/UKCrashReporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// application.
// -----------------------------------------------------------------------------

void UKCrashReporterCheckForCrash()
void UKCrashReporterCheckForCrash(void)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

Expand All @@ -48,7 +48,7 @@ void UKCrashReporterCheckForCrash()
NS_VOIDRETURN;
}

long sysvMajor = 0, sysvMinor = 0, sysvBugfix = 0;
SInt32 sysvMajor = 0, sysvMinor = 0, sysvBugfix = 0;
UKGetSystemVersionComponents( &sysvMajor, &sysvMinor, &sysvBugfix );
BOOL isTenFiveOrBetter = sysvMajor >= 10 && sysvMinor >= 5;

Expand All @@ -61,7 +61,8 @@ void UKCrashReporterCheckForCrash()
crashLogPath = [crashLogsFolder stringByAppendingPathComponent: crashLogName];
else
crashLogPath = UKCrashReporterFindTenFiveCrashReportPath( appName, crashLogsFolder );
NSDictionary* fileAttrs = [[NSFileManager defaultManager] fileAttributesAtPath: crashLogPath traverseLink: YES];
NSDictionary* fileAttrs = [[NSFileManager defaultManager]
attributesOfItemAtPath: crashLogPath error: nil];
NSDate* lastTimeCrashLogged = (fileAttrs == nil) ? nil : [fileAttrs fileModificationDate];
NSTimeInterval lastCrashReportInterval = [[NSUserDefaults standardUserDefaults] floatForKey: @"UKCrashReporterLastCrashReportDate"];
NSDate* lastTimeCrashReported = [NSDate dateWithTimeIntervalSince1970: lastCrashReportInterval];
Expand All @@ -72,7 +73,10 @@ void UKCrashReporterCheckForCrash()
if( [lastTimeCrashReported compare: lastTimeCrashLogged] == NSOrderedAscending )
{
// Fetch the newest report from the log:
NSString* crashLog = [NSString stringWithContentsOfFile: crashLogPath];
NSString* crashLog = [NSString stringWithContentsOfFile:crashLogPath
encoding:NSUTF8StringEncoding
error:nil];

NSArray* separateReports = [crashLog componentsSeparatedByString: @"\n\n**********\n\n"];
NSString* currentReport = [separateReports count] > 0 ? [separateReports objectAtIndex: [separateReports count] -1] : @"*** Couldn't read Report ***"; // 1 since report 0 is empty (file has a delimiter at the top).
unsigned numCores = UKCountCores();
Expand Down
16 changes: 8 additions & 8 deletions UKCrashReporter/UKSystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#import <Cocoa/Cocoa.h>


unsigned UKPhysicalRAMSize(); // RAM Size in MBs.
NSString* UKSystemVersionString(); // System version as a string MM.m.b
unsigned UKClockSpeed(); // CPU speed in MHz.
unsigned UKCountCores(); // Number of CPU cores. This is always >= number of CPUs.
NSString* UKMachineName(); // Name of Mac model, as best as we can determine.
NSString* UKCPUName(); // Same as UKAutoreleasedCPUName( NO );
unsigned UKPhysicalRAMSize(void); // RAM Size in MBs.
NSString* UKSystemVersionString(void); // System version as a string MM.m.b
unsigned UKClockSpeed(void); // CPU speed in MHz.
unsigned UKCountCores(void); // Number of CPU cores. This is always >= number of CPUs.
NSString* UKMachineName(void); // Name of Mac model, as best as we can determine.
NSString* UKCPUName(void); // Same as UKAutoreleasedCPUName( NO );
NSString* UKAutoreleasedCPUName( BOOL releaseIt ); // Returns CPU name, i.e. "G3", "G4" etc. If releaseIt is YES, this will look up the name anew each time, otherwise it will cache the name for subsequent calls. Doesn't support the G5 :-(
//NSString* UKSystemSerialNumber();
void UKGetSystemVersionComponents( long* outMajor, long* outMinor, long* outBugfix ); // System version as the separate components (Major.Minor.Bugfix).
void UKGetSystemVersionComponents( SInt32* outMajor, SInt32* outMinor, SInt32* outBugfix ); // System version as the separate components (Major.Minor.Bugfix).

// Don't use the following for new code:
// (Since the number is in BCD, the maximum for minor and bugfix revisions is 9, so this returns 1049 for 10.4.10)
long UKSystemVersion(); // System version as BCD number, I.e. 0xMMmb
long UKSystemVersion(void); // System version as BCD number, I.e. 0xMMmb
95 changes: 21 additions & 74 deletions UKCrashReporter/UKSystemInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
#include <sys/types.h>
#include <sys/sysctl.h>

unsigned UKPhysicalRAMSize()
unsigned UKPhysicalRAMSize(void)
{
long ramSize;
SInt32 ramSize;

if( Gestalt( gestaltPhysicalRAMSizeInMegabytes, &ramSize ) == noErr )
return ramSize;
return (unsigned)ramSize;
else
return 0;
}


NSString* UKSystemVersionString()
NSString* UKSystemVersionString(void)
{
long vMajor = 10, vMinor = 0, vBugfix = 0;
SInt32 vMajor = 10, vMinor = 0, vBugfix = 0;
UKGetSystemVersionComponents( &vMajor, &vMinor, &vBugfix );

return [NSString stringWithFormat: @"%ld.%ld.%ld", vMajor, vMinor, vBugfix];
}


void UKGetSystemVersionComponents( long* outMajor, long* outMinor, long* outBugfix )
void UKGetSystemVersionComponents( SInt32* outMajor, SInt32* outMinor, SInt32* outBugfix )
{
long sysVersion = UKSystemVersion();
if( sysVersion >= MAC_OS_X_VERSION_10_4 )
Expand All @@ -49,9 +49,9 @@ void UKGetSystemVersionComponents( long* outMajor, long* outMinor, long* outBugf
}


long UKSystemVersion()
long UKSystemVersion(void)
{
long sysVersion = 0;
SInt32 sysVersion = 0;

if( Gestalt( gestaltSystemVersion, &sysVersion ) != noErr )
return 0;
Expand All @@ -60,9 +60,9 @@ long UKSystemVersion()
}


unsigned UKClockSpeed()
unsigned UKClockSpeed(void)
{
long speed;
SInt32 speed;

if( Gestalt( gestaltProcClkSpeed, &speed ) == noErr )
return speed / 1000000;
Expand All @@ -71,7 +71,7 @@ unsigned UKClockSpeed()
}


unsigned UKCountCores()
unsigned UKCountCores(void)
{
unsigned count = 0;
size_t size = sizeof(count);
Expand All @@ -83,18 +83,18 @@ unsigned UKCountCores()
}


NSString* UKMachineName()
NSString* UKMachineName(void)
{
static NSString* cpuName = nil;
if( cpuName )
return cpuName;

char* machineName = NULL;

if( Gestalt( gestaltUserVisibleMachineName, (long*) &machineName ) == noErr )
{
NSString* internalName = [NSString stringWithCString: machineName +1 length: machineName[0]];

char temp[1000];
size_t tempLen = sizeof(temp) - 1;
if (!sysctlbyname("hw.model", temp, &tempLen, 0, 0)) {
temp[tempLen] = 0;
NSString *internalName = [NSString stringWithUTF8String:temp];

NSDictionary* translationDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
@"PowerMac 8500/8600",@"AAPL,8500",
@"PowerMac 9500/9600",@"AAPL,9500",
Expand Down Expand Up @@ -177,7 +177,7 @@ unsigned UKCountCores()
NSEnumerator *e=[[[translationDictionary allKeys]
sortedArrayUsingSelector:@selector(compare:)]
objectEnumerator];
while( aKey = [e nextObject] )
while( (aKey = [e nextObject]) )
{
r = [internalName rangeOfString: aKey];
if( r.location != NSNotFound )
Expand All @@ -204,15 +204,15 @@ unsigned UKCountCores()
}


NSString* UKCPUName()
NSString* UKCPUName(void)
{
return UKAutoreleasedCPUName( NO );
}


NSString* UKAutoreleasedCPUName( BOOL releaseIt )
{
long cpu;
SInt32 cpu;
static NSString* cpuName = nil;

if( Gestalt( gestaltNativeCPUtype, &cpu ) == noErr )
Expand Down Expand Up @@ -263,56 +263,3 @@ unsigned UKCountCores()
return cpuName;
}


/*NSString* UKSystemSerialNumber()
{
mach_port_t masterPort;
kern_return_t kr = noErr;
io_registry_entry_t entry;
CFTypeRef prop;
CFTypeID propID;
NSString* str = nil;

kr = IOMasterPort(MACH_PORT_NULL, &masterPort);
if( kr != noErr )
goto cleanup;
entry = IORegistryGetRootEntry( masterPort );
if( entry == MACH_PORT_NULL )
goto cleanup;
prop = IORegistryEntrySearchCFProperty(entry, kIODeviceTreePlane, CFSTR("serial-number"), nil, kIORegistryIterateRecursively);
if( prop == nil )
goto cleanup;
propID = CFGetTypeID( prop );
if( propID != CFDataGetTypeID() )
goto cleanup;

const char* buf = [(NSData*)prop bytes];
int len = [(NSData*)prop length],
x;

char secondPart[256];
char firstPart[256];
char* currStr = secondPart;
int y = 0;

for( x = 0; x < len; x++ )
{
if( buf[x] > 0 && (y < 255) )
currStr[y++] = buf[x];
else if( currStr == secondPart )
{
currStr[y] = 0; // Terminate string.
currStr = firstPart;
y = 0;
}
}
currStr[y] = 0; // Terminate string.

str = [NSString stringWithFormat: @"%s%s", firstPart, secondPart];

cleanup:
mach_port_deallocate( mach_task_self(), masterPort );

return str;
}*/

0 comments on commit 7e51826

Please sign in to comment.