mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-10-05 18:54:49 +00:00
Fix dead stores and other analyzer hits.
This commit is contained in:
parent
ed032720a8
commit
abbced3d0d
@ -25,7 +25,8 @@
|
|||||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification
|
- (void)applicationWillFinishLaunching:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
// instanciate my own subclass of NSDocumentController so I can override the open dialog
|
// instanciate my own subclass of NSDocumentController so I can override the open dialog
|
||||||
[[RKDocumentController alloc] init];
|
// autorelease to fix an analyzer warning; the application already holds onto the document controller
|
||||||
|
[[[RKDocumentController alloc] init] autorelease];
|
||||||
[RKSupportResourceRegistry scanForSupportResources];
|
[RKSupportResourceRegistry scanForSupportResources];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
if( addComma ) [string appendString:@", "];
|
if( addComma ) [string appendString:@", "];
|
||||||
if( attributeCount > 2 ) [string appendString:@"Sys"];
|
if( attributeCount > 2 ) [string appendString:@"Sys"];
|
||||||
else [string appendString:@"SysHeap"];
|
else [string appendString:@"SysHeap"];
|
||||||
addComma = YES;
|
/* addComma = YES; */
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,18 @@
|
|||||||
|
|
||||||
+ (void)scanForSupportResources
|
+ (void)scanForSupportResources
|
||||||
{
|
{
|
||||||
|
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Support Resources"]];
|
||||||
#if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
|
#if MAC_OS_X_VERSION_10_4 <= MAC_OS_X_VERSION_MAX_ALLOWED
|
||||||
NSArray *dirsArray = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSAllDomainsMask, YES);
|
NSArray *dirsArray = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSAllDomainsMask, YES);
|
||||||
dirsArray = [dirsArray arrayByMakingObjectsPerformSelector:@selector(stringByAppendingPathComponent:) withObject:@"ResKnife/Support Resources"];
|
dirsArray = [dirsArray arrayByMakingObjectsPerformSelector:@selector(stringByAppendingPathComponent:) withObject:@"ResKnife/Support Resources"];
|
||||||
// FIXME: log content of dirsArray and merge with the following:
|
// FIXME: log content of dirsArray and merge with the following:
|
||||||
#endif
|
for (NSString *dir in dirsArray)
|
||||||
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Support Resources"]];
|
[RKSupportResourceRegistry scanForSupportResourcesInFolder:dir];
|
||||||
|
#else
|
||||||
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/ResKnife/Support Resources"]];
|
[RKSupportResourceRegistry scanForSupportResourcesInFolder:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/ResKnife/Support Resources"]];
|
||||||
[RKSupportResourceRegistry scanForSupportResourcesInFolder:@"/Library/Application Support/ResKnife/Support Resources"];
|
[RKSupportResourceRegistry scanForSupportResourcesInFolder:@"/Library/Application Support/ResKnife/Support Resources"];
|
||||||
[RKSupportResourceRegistry scanForSupportResourcesInFolder:@"/Network/Library/Application Support/ResKnife/Support Resources"];
|
[RKSupportResourceRegistry scanForSupportResourcesInFolder:@"/Network/Library/Application Support/ResKnife/Support Resources"];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)scanForSupportResourcesInFolder:(NSString *)path
|
+ (void)scanForSupportResourcesInFolder:(NSString *)path
|
||||||
|
@ -325,6 +325,10 @@ extern NSString *RKResourcePboardType;
|
|||||||
unichar *uniname = (unichar *) NewPtrClear(sizeof(unichar) *256);
|
unichar *uniname = (unichar *) NewPtrClear(sizeof(unichar) *256);
|
||||||
[[fileName lastPathComponent] getCharacters:uniname];
|
[[fileName lastPathComponent] getCharacters:uniname];
|
||||||
error = FSPathMakeRef((const UInt8 *)[[fileName stringByDeletingLastPathComponent] UTF8String], parentRef, nil);
|
error = FSPathMakeRef((const UInt8 *)[[fileName stringByDeletingLastPathComponent] UTF8String], parentRef, nil);
|
||||||
|
|
||||||
|
if (error != noErr)
|
||||||
|
NSLog(@"FSPathMakeRef got error %d", error);
|
||||||
|
|
||||||
if(fork)
|
if(fork)
|
||||||
error = FSCreateResourceFile(parentRef, [[fileName lastPathComponent] length], (UniChar *) uniname, kFSCatInfoNone, NULL, fork->length, (UniChar *) &fork->unicode, fileRef, NULL);
|
error = FSCreateResourceFile(parentRef, [[fileName lastPathComponent] length], (UniChar *) uniname, kFSCatInfoNone, NULL, fork->length, (UniChar *) &fork->unicode, fileRef, NULL);
|
||||||
else error = FSCreateResourceFile(parentRef, [[fileName lastPathComponent] length], (UniChar *) uniname, kFSCatInfoNone, NULL, 0, NULL, fileRef, NULL);
|
else error = FSCreateResourceFile(parentRef, [[fileName lastPathComponent] length], (UniChar *) uniname, kFSCatInfoNone, NULL, 0, NULL, fileRef, NULL);
|
||||||
@ -395,6 +399,10 @@ extern NSString *RKResourcePboardType;
|
|||||||
[[resource representedFork] getCharacters:uniname];
|
[[resource representedFork] getCharacters:uniname];
|
||||||
FSIORefNum forkRefNum = 0;
|
FSIORefNum forkRefNum = 0;
|
||||||
error = FSOpenFork(fileRef, [[resource representedFork] length], (UniChar *) uniname, fsWrPerm, &forkRefNum);
|
error = FSOpenFork(fileRef, [[resource representedFork] length], (UniChar *) uniname, fsWrPerm, &forkRefNum);
|
||||||
|
|
||||||
|
if (error != noErr)
|
||||||
|
NSLog(@"FSOpenFork got error %d", error);
|
||||||
|
|
||||||
if(!error && forkRefNum)
|
if(!error && forkRefNum)
|
||||||
error = FSWriteFork(forkRefNum, fsFromStart, 0, [[resource data] length], [[resource data] bytes], NULL);
|
error = FSWriteFork(forkRefNum, fsFromStart, 0, [[resource data] length], [[resource data] bytes], NULL);
|
||||||
if(forkRefNum) FSCloseFork(forkRefNum);
|
if(forkRefNum) FSCloseFork(forkRefNum);
|
||||||
|
Loading…
Reference in New Issue
Block a user