From f011dd38bbc30f697d16519da1415c0440cd6ae4 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Sun, 30 Oct 2011 06:15:36 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- Classes/ZipFileModule.h | 4 ++-- Classes/ZipFileModule.m | 20 ++++++++--------- ZipArchive.h | 6 +++--- ZipArchive.mm | 48 ++++++++++++++++++++--------------------- example/app.js | 4 ++-- minizip/mztools.c | 30 +++++++++++++------------- minizip/mztools.h | 8 +++---- module.xcconfig | 6 +++--- titanium.xcconfig | 2 +- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Classes/ZipFileModule.h b/Classes/ZipFileModule.h index 1cff5f6..212532a 100755 --- a/Classes/ZipFileModule.h +++ b/Classes/ZipFileModule.h @@ -1,6 +1,6 @@ /** * Originally by TermiT from https://github.com/TermiT/ZipFile - * Updated for Ti SDK 1.7.0 and fixed deprecated functions in minizip + * Updated for Ti SDK 1.7.0 and fixed deprecated functions in minizip * by Kosso : http://kosso.co.uk * * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. @@ -9,7 +9,7 @@ #import "TiModule.h" #import "ZipArchive.h" -@interface ZipfileModule : TiModule +@interface ZipfileModule : TiModule { } diff --git a/Classes/ZipFileModule.m b/Classes/ZipFileModule.m index cd85b07..6c43404 100644 --- a/Classes/ZipFileModule.m +++ b/Classes/ZipFileModule.m @@ -32,7 +32,7 @@ -(void)startup // this method is called when the module is first loaded // you *must* call the superclass [super startup]; - + NSLog(@"[INFO] %@ loaded",self); } @@ -41,12 +41,12 @@ -(void)shutdown:(id)sender // this method is called when the module is being unloaded // typically this is during shutdown. make sure you don't do too // much processing here or the app will be quit forcibly - + // you *must* call the superclass [super shutdown:sender]; } -#pragma mark Cleanup +#pragma mark Cleanup -(void)dealloc { @@ -69,7 +69,7 @@ -(void)_listenerAdded:(NSString *)type count:(int)count { //if (count == 1 && [type isEqualToString:@"my_event"]) //{ - // the first (of potentially many) listener is being added + // the first (of potentially many) listener is being added // for event named 'my_event' //} } @@ -92,11 +92,11 @@ -(void)extract:(id)args NSString *path = [args objectAtIndex:1]; NSFileManager *fileManager = [NSFileManager defaultManager]; - + if(![fileManager fileExistsAtPath:file]) { NSLog(@"[DEBUG] Can't find zip file"); } - + ZipArchive *zipArchive = [[ZipArchive alloc] init]; if([zipArchive UnzipOpenFile:file]) { NSLog(@"[DEBUG] zip opened"); @@ -113,7 +113,7 @@ -(void)extract:(id)args } else { NSLog(@"[DEBUG] can't open zip"); } - [zipArchive release]; + [zipArchive release]; } @@ -156,7 +156,7 @@ -(id)initWithFile:(NSString*)path [zipArchive release]; zipArchive = nil; return nil; - } + } } return self; } @@ -173,7 +173,7 @@ -(id)initWithExistingFile:(NSString*)path [zipArchive release]; zipArchive = nil; return nil; - } + } } return self; } @@ -183,7 +183,7 @@ -(id)addFile:(id)args { NSString *path = [args objectAtIndex:0]; NSString *newName = [args objectAtIndex:1]; - + //NSLog(@"[DEBUG] add %@ to zip as %@", path, newName); return NUMBOOL([zipArchive addFileToZip:path newname:newName]); } diff --git a/ZipArchive.h b/ZipArchive.h index e5586b5..9961892 100755 --- a/ZipArchive.h +++ b/ZipArchive.h @@ -1,12 +1,12 @@ // // ZipArchive.h -// +// // // Created by aish on 08-9-11. // acsolu@gmail.com // Copyright 2008 Inc. All rights reserved. // -// History: +// History: // 09-11-2008 version 1.0 release // 10-18-2009 version 1.1 support password protected zip files // 10-21-2009 version 1.2 fix date bug @@ -29,7 +29,7 @@ @private zipFile _zipFile; unzFile _unzFile; - + NSString* _password; id _delegate; } diff --git a/ZipArchive.mm b/ZipArchive.mm index 82d6f9d..2b8be57 100755 --- a/ZipArchive.mm +++ b/ZipArchive.mm @@ -1,6 +1,6 @@ // // ZipArchive.mm -// +// // // Created by aish on 08-9-11. // acsolu@gmail.com @@ -43,7 +43,7 @@ -(void) dealloc -(BOOL) CreateZipFile2:(NSString*) zipFile { _zipFile = zipOpen( (const char*)[zipFile UTF8String], 0 ); - if( !_zipFile ) + if( !_zipFile ) return NO; return YES; } @@ -53,7 +53,7 @@ -(BOOL) CreateZipFile2:(NSString*) zipFile -(BOOL) OpenZipFile2:(NSString*) zipFile { _zipFile = zipOpen( (const char*)[zipFile UTF8String], 2 ); - if( !_zipFile ) + if( !_zipFile ) return NO; return YES; } @@ -72,7 +72,7 @@ -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; // tm_zip filetime; time_t current; time( ¤t ); - + zip_fileinfo zipInfo = {0}; // zipInfo.dosDate = (unsigned long) current; NSError * error; @@ -86,7 +86,7 @@ -(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 | + uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ; NSDateComponents* dc = [currCalendar components:flags fromDate:fileDate]; zipInfo.tmz_date.tm_sec = [dc second]; @@ -97,7 +97,7 @@ -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; zipInfo.tmz_date.tm_year = [dc year]; } } - + int ret ; NSData* data = nil; if( [_password length] == 0 ) @@ -191,7 +191,7 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite { [self OutputErrorMessage:@"Failed"]; } - + do{ if( [_password length]==0 ) ret = unzOpenCurrentFile( _unzFile ); @@ -217,7 +217,7 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite char* filename = (char*) malloc( fileInfo.size_filename +1 ); unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); filename[fileInfo.size_filename] = '\0'; - + // check if it contains directory NSString * strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding]; BOOL isDirectory = NO; @@ -229,7 +229,7 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; } NSString* fullPath = [path stringByAppendingPathComponent:strPath]; - + if( isDirectory ) [fman createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil]; else @@ -256,48 +256,48 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite [self OutputErrorMessage:@"Failed to reading zip file"]; break; } - else - break; + else + break; } if( fp ) { fclose( fp ); // set the orignal datetime property NSDate* orgDate = nil; - + //{{ thanks to brad.eaton for the solution NSDateComponents *dc = [[NSDateComponents alloc] init]; - + dc.second = fileInfo.tmu_date.tm_sec; dc.minute = fileInfo.tmu_date.tm_min; dc.hour = fileInfo.tmu_date.tm_hour; dc.day = fileInfo.tmu_date.tm_mday; dc.month = fileInfo.tmu_date.tm_mon+1; dc.year = fileInfo.tmu_date.tm_year; - - NSCalendar *gregorian = [[NSCalendar alloc] + + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; - + orgDate = [gregorian dateFromComponents:dc] ; [dc release]; [gregorian release]; //}} - - + + NSDictionary* attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; //[[NSFileManager defaultManager] fileAttributesAtPath:fullPath traverseLink:YES]; if( attr ) { // [attr setValue:orgDate forKey:NSFileCreationDate]; if( ![[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:fullPath error:nil] ) { - // cann't set attributes + // cann't set attributes NSLog(@"Failed to set attributes"); } - + } - - - + + + } unzCloseCurrentFile( _unzFile ); ret = unzGoToNextFile( _unzFile ); @@ -337,7 +337,7 @@ -(NSDate*) Date1980 NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *date = [gregorian dateFromComponents:comps]; - + [comps release]; [gregorian release]; return date; diff --git a/example/app.js b/example/app.js index 9c3d869..0edf65b 100755 --- a/example/app.js +++ b/example/app.js @@ -1,8 +1,8 @@ Titanium.UI.setBackgroundColor('#000'); -var zipfile = require("zipfile"); +var zipfile = require("zipfile"); -var win1 = Titanium.UI.createWindow({ +var win1 = Titanium.UI.createWindow({ title:'ZipFile test', backgroundColor:'#fff' }); diff --git a/minizip/mztools.c b/minizip/mztools.c index 8a50ee4..f9092e6 100755 --- a/minizip/mztools.c +++ b/minizip/mztools.c @@ -62,7 +62,7 @@ uLong* bytesRecovered; unsigned int fnsize = READ_16(header + 26); /* file name length */ unsigned int extsize = READ_16(header + 28); /* extra field length */ filename[0] = extra[0] = '\0'; - + /* Header */ if (fwrite(header, 1, 30, fpOut) == 30) { offset += 30; @@ -70,7 +70,7 @@ uLong* bytesRecovered; err = Z_ERRNO; break; } - + /* Filename */ if (fnsize > 0) { if (fread(filename, 1, fnsize, fpZip) == fnsize) { @@ -103,7 +103,7 @@ uLong* bytesRecovered; break; } } - + /* Data */ { int dataSize = cpsize; @@ -133,7 +133,7 @@ uLong* bytesRecovered; } } } - + /* Central directory entry */ { char header[46]; @@ -159,7 +159,7 @@ uLong* bytesRecovered; /* Header */ if (fwrite(header, 1, 46, fpOutCD) == 46) { offsetCD += 46; - + /* Filename */ if (fnsize > 0) { if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { @@ -172,7 +172,7 @@ uLong* bytesRecovered; err = Z_STREAM_ERROR; break; } - + /* Extra field */ if (extsize > 0) { if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { @@ -182,7 +182,7 @@ uLong* bytesRecovered; break; } } - + /* Comment field */ if (comsize > 0) { if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { @@ -192,8 +192,8 @@ uLong* bytesRecovered; break; } } - - + + } else { err = Z_ERRNO; break; @@ -225,17 +225,17 @@ uLong* bytesRecovered; WRITE_32(header + 12, offsetCD); /* size of CD */ WRITE_32(header + 16, offset); /* offset to CD */ WRITE_16(header + 20, comsize); /* comment */ - + /* Header */ if (fwrite(header, 1, 22, fpOutCD) == 22) { - + /* Comment field */ if (comsize > 0) { if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { err = Z_ERRNO; } } - + } else { err = Z_ERRNO; } @@ -257,14 +257,14 @@ uLong* bytesRecovered; fclose(fpOutCD); } } - + /* Close */ fclose(fpZip); fclose(fpOut); - + /* Wipe temporary file */ (void)remove(fileOutTmp); - + /* Number of recovered entries */ if (err == Z_OK) { if (nRecovered != NULL) { diff --git a/minizip/mztools.h b/minizip/mztools.h index eee78dc..88b3459 100755 --- a/minizip/mztools.h +++ b/minizip/mztools.h @@ -17,14 +17,14 @@ extern "C" { #include "unzip.h" -/* Repair a ZIP file (missing central directory) +/* Repair a ZIP file (missing central directory) file: file to recover fileOut: output file after recovery fileOutTmp: temporary file name used for recovery */ -extern int ZEXPORT unzRepair(const char* file, - const char* fileOut, - const char* fileOutTmp, +extern int ZEXPORT unzRepair(const char* file, + const char* fileOut, + const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered); diff --git a/module.xcconfig b/module.xcconfig index 80ca884..9e68341 100755 --- a/module.xcconfig +++ b/module.xcconfig @@ -1,11 +1,11 @@ // -// PLACE ANY BUILD DEFINITIONS IN THIS FILE AND THEY WILL BE +// PLACE ANY BUILD DEFINITIONS IN THIS FILE AND THEY WILL BE // PICKED UP DURING THE APP BUILD FOR YOUR MODULE // // see the following webpage for instructions on the settings // for this file: // http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html -// +// // // How to add a Framework (example) @@ -24,4 +24,4 @@ // // // IMPORTANT NOTE: always use $(inherited) in your overrides -// +// diff --git a/titanium.xcconfig b/titanium.xcconfig index f94916e..47a49f1 100644 --- a/titanium.xcconfig +++ b/titanium.xcconfig @@ -7,7 +7,7 @@ TITANIUM_SDK_VERSION = 1.6.3 -// +// // THESE SHOULD BE OK GENERALLY AS-IS // TITANIUM_SDK = /Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)