Skip to content

Commit

Permalink
Merge pull request #122 from Tatsh/fix-warnings
Browse files Browse the repository at this point in the history
Fix warnings during compilation
  • Loading branch information
iT0ny committed Feb 17, 2016
2 parents 30bab89 + bf469b2 commit cfe2633
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
7 changes: 3 additions & 4 deletions Clutch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
324EA61B1A89258000844540 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0640;
LastUpgradeCheck = 0720;
TargetAttributes = {
329B80701C5B6745007DD817 = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -517,8 +517,8 @@
324EA6351A89258000844540 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
Expand All @@ -532,7 +532,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = NO;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -542,7 +542,6 @@
324EA6361A89258000844540 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = YES;
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.gch (*) .DS_Store CVS .svn .git .hg *.xcodeproj *.xcode *.pbproj *.pbxproj";
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down
21 changes: 12 additions & 9 deletions Clutch.xcodeproj/xcshareddata/xcschemes/Clutch.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "324EA6221A89258000844540"
BlueprintIdentifier = "329B80701C5B6745007DD817"
BuildableName = "Clutch"
BlueprintName = "Clutch"
ReferencedContainer = "container:Clutch.xcodeproj">
Expand All @@ -23,36 +23,39 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "324EA6221A89258000844540"
BlueprintIdentifier = "329B80701C5B6745007DD817"
BuildableName = "Clutch"
BlueprintName = "Clutch"
ReferencedContainer = "container:Clutch.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "324EA6221A89258000844540"
BlueprintIdentifier = "329B80701C5B6745007DD817"
BuildableName = "Clutch"
BlueprintName = "Clutch"
ReferencedContainer = "container:Clutch.xcodeproj">
Expand All @@ -62,16 +65,16 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "324EA6221A89258000844540"
BlueprintIdentifier = "329B80701C5B6745007DD817"
BuildableName = "Clutch"
BlueprintName = "Clutch"
ReferencedContainer = "container:Clutch.xcodeproj">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Clutch/ApplicationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ @implementation ApplicationsManager

- (instancetype)init
{
if (self = [super init])
if ((self = [super init]))
{
if ([[NSFileManager defaultManager] fileExistsAtPath:applistCachePath])
{
Expand All @@ -39,9 +39,9 @@ - (instancetype)init
{
_cachedApps = [NSMutableArray new];
}

return self;
}

return self;
}


Expand Down
9 changes: 5 additions & 4 deletions Clutch/FinalizeDumpOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ - (void)start {
return;
}

NSString __weak *bundleIdentifier = _application.bundleIdentifier;
self.completionBlock = ^{
gettimeofday(&end, NULL);
int dif = diff_ms(end,start);
float sec = ((dif + 500.0f) / 1000.0f);
[[ClutchPrint sharedInstance] printColor:ClutchPrinterColorPink format:@"Finished dumping %@ in %0.1f seconds", _application.bundleIdentifier, sec];
[[ClutchPrint sharedInstance] printColor:ClutchPrinterColorPink format:@"Finished dumping %@ in %0.1f seconds", bundleIdentifier, sec];
exit(0);
};

Expand Down Expand Up @@ -99,7 +100,7 @@ - (void)main {

if (dict)
[plists addObject:theURL.path];

[[NSFileManager defaultManager] removeItemAtURL:theURL error:nil];
}
}
Expand Down Expand Up @@ -197,7 +198,7 @@ - (void)main {
toURL:[NSURL fileURLWithPath:currentFile]
error:&anError]) {
[[ClutchPrint sharedInstance] printDeveloper:@"Failed to move from %@ to %@ with error %@", ipaSrcURL,
[NSURL fileURLWithPath:currentFile], anError];
[NSURL fileURLWithPath:currentFile], anError];
}
break;
}
Expand All @@ -208,7 +209,7 @@ - (void)main {
toURL:[NSURL fileURLWithPath:_ipaPath]
error:&anError]) {
[[ClutchPrint sharedInstance] printDeveloper:@"Failed to move from %@ to %@ with error %@", ipaSrcURL,
[NSURL fileURLWithPath:_ipaPath], anError];
[NSURL fileURLWithPath:_ipaPath], anError];
}
}
}
Expand Down
21 changes: 12 additions & 9 deletions Clutch/Framework64Dumper.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ - (cpu_type_t)supportedCPUType

- (BOOL)dumpBinary
{

ClutchBundle *bundle = [_originalBinary valueForKey:@"_bundle"];


NSString *binaryDumpPath = [_originalBinary.workingPath stringByAppendingPathComponent:_originalBinary.binaryPath.lastPathComponent];

Expand All @@ -40,7 +40,7 @@ - (BOOL)dumpBinary

[self swapArch];
}

NSFileHandle *newFileHandle = [[NSFileHandle alloc]initWithFileDescriptor:fileno(fopen(binaryDumpPath.UTF8String, "r+"))];

[newFileHandle seekToFileOffset:_thinHeader.offset + _thinHeader.size];
Expand Down Expand Up @@ -137,9 +137,9 @@ - (BOOL)dumpBinary
[[ClutchPrint sharedInstance] printColor:ClutchPrinterColorPurple format:@"pages == 0"];
return NO;
}

[newFileHandle closeFile];

extern char **environ;
posix_spawnattr_t attr;

Expand All @@ -154,7 +154,7 @@ - (BOOL)dumpBinary
}

[[NSFileManager defaultManager] createDirectoryAtPath:workingPath withIntermediateDirectories:YES attributes:nil error:nil];


if (![[NSFileManager defaultManager] copyItemAtPath:[NSProcessInfo processInfo].arguments[0] toPath:[workingPath stringByAppendingPathComponent:@"clutch"] error:nil]) {
[[ClutchPrint sharedInstance] printError:@"Failed to copy clutch to %@", workingPath];
Expand Down Expand Up @@ -185,8 +185,11 @@ - (BOOL)dumpBinary
[NSString stringWithFormat:@"%u", cryptlc_offset].UTF8String,
NULL};


[[ClutchPrint sharedInstance] printDeveloper: @"hello potato posix_spawn %@", [[NSString alloc] initWithUTF8String:argv]];
NSString *ns_argv = @"";
for (size_t i = 0; argv[i] != NULL; i++) {
ns_argv = [ns_argv stringByAppendingFormat:@"%s", argv[i]];
}
[[ClutchPrint sharedInstance] printDeveloper: @"hello potato posix_spawn %@", ns_argv];

posix_spawnattr_init (&attr);

Expand All @@ -209,7 +212,7 @@ - (BOOL)dumpBinary
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);

dispatch_sync(queue, ^{
int dumpResult = 0;
int dumpResult = 0;
kill(pid, SIGCONT);
if (waitpid(pid, &dumpResult, 0) != -1) {
[[ClutchPrint sharedInstance] printColor:ClutchPrinterColorPurple format:@"Success! Child exited with status %u", dumpResult];
Expand Down
7 changes: 4 additions & 3 deletions Clutch/ZipArchive.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ -(void) dealloc
// close any open file operations
[self CloseZipFile2];
[self UnzipCloseFile];

}

/**
Expand Down Expand Up @@ -134,8 +134,9 @@ -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname;
// some application does use dosDate, but tmz_date instead
// zipInfo.dosDate = [fileDate timeIntervalSinceDate:[self Date1980] ];
NSCalendar* currCalendar = [NSCalendar currentCalendar];
uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit |
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ;
// Use CF constants to avoid deprecation warnings and stay compatible with < iOS 8
uint flags = kCFCalendarUnitYear | kCFCalendarUnitMonth | kCFCalendarUnitDay |
kCFCalendarUnitHour | kCFCalendarUnitMinute | kCFCalendarUnitSecond;
NSDateComponents* dc = [currCalendar components:flags fromDate:fileDate];
zipInfo.tmz_date.tm_sec = (uInt)[dc second];
zipInfo.tmz_date.tm_min = (uInt)[dc minute];
Expand Down

0 comments on commit cfe2633

Please sign in to comment.