diff --git a/ChooseGroupViewController.h b/ChooseGroupViewController.h index 2c58beda..a4bdb97f 100644 --- a/ChooseGroupViewController.h +++ b/ChooseGroupViewController.h @@ -22,8 +22,8 @@ @interface ChooseGroupViewController : AutorotatingTableViewController -@property (nonatomic, retain) KdbGroup *group; -@property (nonatomic, assign) id delegate; +@property (nonatomic, strong) KdbGroup *group; +@property (nonatomic, unsafe_unretained) id delegate; @end diff --git a/ChooseGroupViewController.m b/ChooseGroupViewController.m index ba666109..d590165a 100644 --- a/ChooseGroupViewController.m +++ b/ChooseGroupViewController.m @@ -42,18 +42,12 @@ - (id)initWithStyle:(UITableViewStyle)style { UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismissModalViewControllerAnimated:)]; self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; appDelegate = (MiniKeePassAppDelegate *)[[UIApplication sharedApplication] delegate]; } return self; } -- (void)dealloc { - [allGroups release]; - [super dealloc]; -} - - (void)viewDidLoad { // Get parameters for the root KdbGroup *rootGroup = appDelegate.databaseDocument.kdbTree.root; @@ -103,7 +97,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSDictionary *dict = [allGroups objectAtIndex:indexPath.row]; diff --git a/IOStream/AesInputStream.m b/IOStream/AesInputStream.m index 1c685b0d..35be4e9d 100644 --- a/IOStream/AesInputStream.m +++ b/IOStream/AesInputStream.m @@ -25,7 +25,7 @@ @implementation AesInputStream - (id)initWithInputStream:(InputStream*)stream key:(NSData*)key iv:(NSData*)iv { self = [super init]; if (self) { - inputStream = [stream retain]; + inputStream = stream; CCCryptorCreate(kCCDecrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, key.bytes, kCCKeySizeAES256, iv.bytes, &cryptorRef); @@ -37,9 +37,7 @@ - (id)initWithInputStream:(InputStream*)stream key:(NSData*)key iv:(NSData*)iv { } - (void)dealloc { - [inputStream release]; CCCryptorRelease(cryptorRef); - [super dealloc]; } - (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/AesOutputStream.m b/IOStream/AesOutputStream.m index c28b3a69..8209cdf5 100644 --- a/IOStream/AesOutputStream.m +++ b/IOStream/AesOutputStream.m @@ -25,7 +25,7 @@ @implementation AesOutputStream - (id)initWithOutputStream:(OutputStream*)stream key:(NSData*)key iv:(NSData*)iv { self = [super init]; if (self) { - outputStream = [stream retain]; + outputStream = stream; CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, key.bytes, kCCKeySizeAES256, iv.bytes, &cryptorRef); @@ -36,10 +36,8 @@ - (id)initWithOutputStream:(OutputStream*)stream key:(NSData*)key iv:(NSData*)iv } - (void)dealloc { - [outputStream release]; CCCryptorRelease(cryptorRef); free(buffer); - [super dealloc]; } - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/Arc4RandomStream.m b/IOStream/Arc4RandomStream.m index 2d0f277b..293f9b51 100644 --- a/IOStream/Arc4RandomStream.m +++ b/IOStream/Arc4RandomStream.m @@ -60,10 +60,6 @@ - (id)init:(NSData*)key { return self; } -- (void)dealloc { - [super dealloc]; -} - - (void)updateState { uint8_t t = 0; for (uint32_t w = 0; w < ARC_BUFFER_SIZE; w++) { diff --git a/IOStream/DataInputStream.m b/IOStream/DataInputStream.m index a48abfcb..e230dcac 100644 --- a/IOStream/DataInputStream.m +++ b/IOStream/DataInputStream.m @@ -22,17 +22,12 @@ @implementation DataInputStream - (id)initWithData:(NSData*)d { self = [super init]; if (self) { - data = [d retain]; + data = d; dataOffset = 0; } return self; } -- (void)dealloc { - [data release]; - [super dealloc]; -} - - (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength { NSRange range; range.location = dataOffset; diff --git a/IOStream/DataOutputStream.m b/IOStream/DataOutputStream.m index 024e6ef6..c1bd1f03 100644 --- a/IOStream/DataOutputStream.m +++ b/IOStream/DataOutputStream.m @@ -29,11 +29,6 @@ - (id)init { return self; } -- (void)dealloc { - [data release]; - [super dealloc]; -} - - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { [data appendBytes:bytes length:bytesLength]; return bytesLength; diff --git a/IOStream/FileInputStream.m b/IOStream/FileInputStream.m index e7c5198a..ef4836b7 100644 --- a/IOStream/FileInputStream.m +++ b/IOStream/FileInputStream.m @@ -34,7 +34,6 @@ - (id)initWithFilename:(NSString*)filename { - (void)dealloc { [self close]; - [super dealloc]; } - (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/FileOutputStream.m b/IOStream/FileOutputStream.m index 335298e3..2713b921 100644 --- a/IOStream/FileOutputStream.m +++ b/IOStream/FileOutputStream.m @@ -32,7 +32,6 @@ - (id)initWithFilename:(NSString*)filename flags:(NSUInteger)flags mode:(NSUInte - (void)dealloc { [self close]; - [super dealloc]; } - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/GZipInputStream.m b/IOStream/GZipInputStream.m index 4885e97e..457b0873 100644 --- a/IOStream/GZipInputStream.m +++ b/IOStream/GZipInputStream.m @@ -26,7 +26,7 @@ @implementation GZipInputStream - (id)initWithInputStream:(InputStream*)stream { self = [super init]; if (self) { - inputStream = [stream retain]; + inputStream = stream; zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; @@ -42,11 +42,6 @@ - (id)initWithInputStream:(InputStream*)stream { return self; } -- (void)dealloc { - [inputStream release]; - [super dealloc]; -} - - (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength { NSUInteger remaining = bytesLength; NSUInteger offset = 0; diff --git a/IOStream/GZipOutputStream.m b/IOStream/GZipOutputStream.m index 2f9498c7..c928d4b2 100644 --- a/IOStream/GZipOutputStream.m +++ b/IOStream/GZipOutputStream.m @@ -22,7 +22,7 @@ @implementation GZipOutputStream - (id)initWithOutputStream:(OutputStream*)stream { self = [super init]; if (self) { - outputStream = [stream retain]; + outputStream = stream; zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; @@ -38,11 +38,6 @@ - (id)initWithOutputStream:(OutputStream*)stream { return self; } -- (void)dealloc { - [outputStream release]; - [super dealloc]; -} - - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { int n; diff --git a/IOStream/HashedInputStream.m b/IOStream/HashedInputStream.m index 2b98238a..f55d28e9 100644 --- a/IOStream/HashedInputStream.m +++ b/IOStream/HashedInputStream.m @@ -27,7 +27,7 @@ @implementation HashedInputStream - (id)initWithInputStream:(InputStream*)stream { self = [super init]; if (self) { - inputStream = [stream retain]; + inputStream = stream; buffer = NULL; bufferOffset = 0; @@ -37,13 +37,9 @@ - (id)initWithInputStream:(InputStream*)stream { } - (void)dealloc { - [inputStream release]; - if (buffer != NULL) { free(buffer); } - - [super dealloc]; } - (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/HashedOutputStream.m b/IOStream/HashedOutputStream.m index 769641c4..f342b961 100644 --- a/IOStream/HashedOutputStream.m +++ b/IOStream/HashedOutputStream.m @@ -27,7 +27,7 @@ @implementation HashedOutputStream - (id)initWithOutputStream:(OutputStream*)stream blockSize:(uint32_t)blockSize { self = [super init]; if (self) { - outputStream = [stream retain]; + outputStream = stream; blockIndex = 0; @@ -39,9 +39,7 @@ - (id)initWithOutputStream:(OutputStream*)stream blockSize:(uint32_t)blockSize { } - (void)dealloc { - [outputStream release]; free(buffer); - [super dealloc]; } - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { diff --git a/IOStream/InputStream.m b/IOStream/InputStream.m index ee9103a5..a8bc771f 100644 --- a/IOStream/InputStream.m +++ b/IOStream/InputStream.m @@ -71,7 +71,7 @@ - (NSString*)readString:(NSUInteger)length encoding:(NSStringEncoding)encoding { [self read:bytes length:length]; - return [[[NSString alloc] initWithBytes:bytes length:length encoding:encoding] autorelease]; + return [[NSString alloc] initWithBytes:bytes length:length encoding:encoding]; } - (NSString*)readCString:(NSUInteger)length encoding:(NSStringEncoding)encoding { diff --git a/IOStream/Sha256OutputStream.m b/IOStream/Sha256OutputStream.m index 7409e9fb..37991e33 100644 --- a/IOStream/Sha256OutputStream.m +++ b/IOStream/Sha256OutputStream.m @@ -22,18 +22,13 @@ @implementation Sha256OutputStream - (id)initWithOutputStream:(OutputStream *)stream { self = [super init]; if (self) { - outputStream = [stream retain]; + outputStream = stream; CC_SHA256_Init(&shaCtx); } return self; } -- (void)dealloc { - [outputStream release]; - [super dealloc]; -} - - (NSUInteger)write:(const void *)bytes length:(NSUInteger)bytesLength { CC_SHA256_Update(&shaCtx, bytes, bytesLength); diff --git a/KeePassLib/Kdb.h b/KeePassLib/Kdb.h index a549daf5..eb2053ca 100644 --- a/KeePassLib/Kdb.h +++ b/KeePassLib/Kdb.h @@ -13,7 +13,7 @@ @class KdbEntry; @interface KdbGroup : NSObject { - KdbGroup *parent; + KdbGroup *__unsafe_unretained parent; NSInteger image; NSString *name; @@ -28,17 +28,17 @@ BOOL canAddEntries; } -@property(nonatomic, assign) KdbGroup *parent; +@property(nonatomic, unsafe_unretained) KdbGroup *parent; @property(nonatomic, assign) NSInteger image; @property(nonatomic, copy) NSString *name; @property(nonatomic, readonly) NSArray *groups; @property(nonatomic, readonly) NSArray *entries; -@property(nonatomic, retain) NSDate *creationTime; -@property(nonatomic, retain) NSDate *lastModificationTime; -@property(nonatomic, retain) NSDate *lastAccessTime; -@property(nonatomic, retain) NSDate *expiryTime; +@property(nonatomic, strong) NSDate *creationTime; +@property(nonatomic, strong) NSDate *lastModificationTime; +@property(nonatomic, strong) NSDate *lastAccessTime; +@property(nonatomic, strong) NSDate *expiryTime; @property(nonatomic, assign) BOOL canAddEntries; @@ -55,7 +55,7 @@ @end @interface KdbEntry : NSObject { - KdbGroup *parent; + KdbGroup *__unsafe_unretained parent; NSInteger image; @@ -65,7 +65,7 @@ NSDate *expiryTime; } -@property(nonatomic, assign) KdbGroup *parent; +@property(nonatomic, unsafe_unretained) KdbGroup *parent; @property(nonatomic, assign) NSInteger image; @@ -84,10 +84,10 @@ - (NSString *)notes; - (void)setNotes:(NSString *)notes; -@property(nonatomic, retain) NSDate *creationTime; -@property(nonatomic, retain) NSDate *lastModificationTime; -@property(nonatomic, retain) NSDate *lastAccessTime; -@property(nonatomic, retain) NSDate *expiryTime; +@property(nonatomic, strong) NSDate *creationTime; +@property(nonatomic, strong) NSDate *lastModificationTime; +@property(nonatomic, strong) NSDate *lastAccessTime; +@property(nonatomic, strong) NSDate *expiryTime; @end @@ -95,7 +95,7 @@ KdbGroup *root; } -@property(nonatomic, retain) KdbGroup *root; +@property(nonatomic, strong) KdbGroup *root; - (KdbGroup*)createGroup:(KdbGroup*)parent; - (KdbEntry*)createEntry:(KdbGroup*)parent; diff --git a/KeePassLib/Kdb.m b/KeePassLib/Kdb.m index 9401d260..84417f09 100644 --- a/KeePassLib/Kdb.m +++ b/KeePassLib/Kdb.m @@ -31,17 +31,6 @@ - (id)init { return self; } -- (void)dealloc { - [name release]; - [groups release]; - [entries release]; - [creationTime release]; - [lastModificationTime release]; - [lastAccessTime release]; - [expiryTime release]; - [super dealloc]; -} - - (void)addGroup:(KdbGroup *)group { group.parent = self; [groups addObject:group]; @@ -103,14 +92,6 @@ @implementation KdbEntry @synthesize lastAccessTime; @synthesize expiryTime; -- (void)dealloc { - [creationTime release]; - [lastModificationTime release]; - [lastAccessTime release]; - [expiryTime release]; - [super dealloc]; -} - - (NSString *)title { [self doesNotRecognizeSelector:_cmd]; return nil; @@ -167,11 +148,6 @@ @implementation KdbTree @synthesize root; -- (void)dealloc { - [root release]; - [super dealloc]; -} - - (KdbGroup*)createGroup:(KdbGroup*)parent { [self doesNotRecognizeSelector:_cmd]; return nil; diff --git a/KeePassLib/Kdb3Date.m b/KeePassLib/Kdb3Date.m index 39abe5a2..6293b7fb 100644 --- a/KeePassLib/Kdb3Date.m +++ b/KeePassLib/Kdb3Date.m @@ -36,9 +36,6 @@ + (NSDate*)fromPacked:(uint8_t*)buffer { NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *date = [calendar dateFromComponents:dateComponents]; - [calendar release]; - [dateComponents release]; - return date; } @@ -53,7 +50,6 @@ + (void)toPacked:(NSDate*)date bytes:(uint8_t*)bytes { if (date != nil) { NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *dateComponents = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:date]; - [calendar release]; y = [dateComponents year]; mon = [dateComponents month]; diff --git a/KeePassLib/Kdb3Node.h b/KeePassLib/Kdb3Node.h index e6368ad5..5df59726 100644 --- a/KeePassLib/Kdb3Node.h +++ b/KeePassLib/Kdb3Node.h @@ -50,14 +50,14 @@ typedef struct { @interface Kdb3Entry : KdbEntry -@property(nonatomic, retain) UUID *uuid; +@property(nonatomic, strong) UUID *uuid; @property(nonatomic, copy) NSString *title; @property(nonatomic, copy) NSString *username; @property(nonatomic, copy) NSString *password; @property(nonatomic, copy) NSString *url; @property(nonatomic, copy) NSString *notes; @property(nonatomic, copy) NSString *binaryDesc; -@property(nonatomic, retain) NSData *binary; +@property(nonatomic, strong) NSData *binary; - (BOOL)isMeta; diff --git a/KeePassLib/Kdb3Node.m b/KeePassLib/Kdb3Node.m index 4948af71..f20eac72 100644 --- a/KeePassLib/Kdb3Node.m +++ b/KeePassLib/Kdb3Node.m @@ -19,11 +19,6 @@ - (id)init { return self; } -- (void)dealloc { - [_metaEntries release]; - [super dealloc]; -} - - (void)addEntry:(KdbEntry *)entry { entry.parent = self; @@ -49,18 +44,6 @@ - (void)removeEntry:(KdbEntry *)entry { @implementation Kdb3Entry -- (void)dealloc { - [_uuid release]; - [_title release]; - [_username release]; - [_password release]; - [_url release]; - [_notes release]; - [_binaryDesc release]; - [_binary release]; - [super dealloc]; -} - - (BOOL)isMeta { if (!_binary || _binary.length == 0) { return NO; @@ -120,14 +103,14 @@ - (KdbGroup*)createGroup:(KdbGroup*)parent { group.groupId = random(); } while (![self isGroupIdUnique:(Kdb3Group*)root groupId:group.groupId]); - return [group autorelease]; + return group; } - (KdbEntry*)createEntry:(KdbGroup*)parent { Kdb3Entry *entry = [[Kdb3Entry alloc] init]; entry.uuid = [UUID uuid]; - return [entry autorelease]; + return entry; } @end diff --git a/KeePassLib/Kdb3Reader.m b/KeePassLib/Kdb3Reader.m index cd981bfc..7f363134 100644 --- a/KeePassLib/Kdb3Reader.m +++ b/KeePassLib/Kdb3Reader.m @@ -42,18 +42,6 @@ - (id)init { return self; } -- (void)dealloc { - [masterSeed release]; - [encryptionIv release]; - [contentsHash release]; - [masterSeed2 release]; - [headerHash release]; - [levels release]; - [groups release]; - [entries release]; - [super dealloc]; -} - - (KdbTree*)load:(InputStream *)inputStream withPassword:(KdbPassword *)kdbPassword { [self readHeader:inputStream]; @@ -75,7 +63,7 @@ - (KdbTree*)load:(InputStream *)inputStream withPassword:(KdbPassword *)kdbPassw // Build the tree return [self buildTree]; } @finally { - [aesInputStream release]; + aesInputStream = nil; } return nil; @@ -120,7 +108,7 @@ - (void)readHeader:(InputStream *)inputStream { keyEncRounds = CFSwapInt32LittleToHost(header.keyEncRounds); // Compute a sha256 hash of the header up to but not including the contentsHash - headerHash = [[Kdb3Utils hashHeader:&header] retain]; + headerHash = [Kdb3Utils hashHeader:&header]; } - (void)readGroups:(InputStream *)inputStream { @@ -197,7 +185,6 @@ - (void)readGroups:(InputStream *)inputStream { case 0xFFFF: if (fieldSize != 0) { - [group release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } @@ -207,12 +194,9 @@ - (void)readGroups:(InputStream *)inputStream { break; default: - [group release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field type" userInfo:nil]; } } - - [group release]; } } @@ -245,14 +229,12 @@ - (void)readEntries:(InputStream*)inputStream { case 0x0001: if (fieldSize != 16) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } if ([inputStream read:buffer length:fieldSize] != fieldSize) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Failed to read UUID" userInfo:nil]; } - entry.uuid = [[[UUID alloc] initWithBytes:buffer] autorelease]; + entry.uuid = [[UUID alloc] initWithBytes:buffer]; break; case 0x0002: @@ -287,7 +269,6 @@ - (void)readEntries:(InputStream*)inputStream { case 0x0009: if (fieldSize != 5) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } [inputStream read:buffer length:fieldSize]; @@ -296,7 +277,6 @@ - (void)readEntries:(InputStream*)inputStream { case 0x000A: if (fieldSize != 5) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } [inputStream read:buffer length:fieldSize]; @@ -305,7 +285,6 @@ - (void)readEntries:(InputStream*)inputStream { case 0x000B: if (fieldSize != 5) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } [inputStream read:buffer length:fieldSize]; @@ -314,7 +293,6 @@ - (void)readEntries:(InputStream*)inputStream { case 0x000C: if (fieldSize != 5) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } [inputStream read:buffer length:fieldSize]; @@ -333,7 +311,6 @@ - (void)readEntries:(InputStream*)inputStream { case 0xFFFF: if (fieldSize != 0) { - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } @@ -351,12 +328,9 @@ - (void)readEntries:(InputStream*)inputStream { break; default: - [entry release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field type" userInfo:nil]; } } - - [entry release]; } } @@ -438,16 +412,12 @@ - (Kdb3Tree*)buildTree { level2 = [[levels objectAtIndex:j] unsignedIntValue]; if (level2 < level1) { if (level1 - level2 != 1) { - [tree release]; - [root release]; @throw [NSException exceptionWithName:@"InvalidData" reason:@"InvalidTree" userInfo:nil]; } else { break; } } if (j == 0) { - [tree release]; - [root release]; @throw [NSException exceptionWithName:@"InvalidData" reason:@"InvalidTree" userInfo:nil]; } } @@ -456,9 +426,7 @@ - (Kdb3Tree*)buildTree { [parent addGroup:group]; } - [root release]; - - return [tree autorelease]; + return tree; } @end diff --git a/KeePassLib/Kdb3Writer.m b/KeePassLib/Kdb3Writer.m index 86153743..a405d9e4 100644 --- a/KeePassLib/Kdb3Writer.m +++ b/KeePassLib/Kdb3Writer.m @@ -36,21 +36,14 @@ @implementation Kdb3Writer - init { self = [super init]; if (self) { - masterSeed = [[Utils randomBytes:16] retain]; - encryptionIv = [[Utils randomBytes:16] retain]; - transformSeed = [[Utils randomBytes:32] retain]; + masterSeed = [Utils randomBytes:16]; + encryptionIv = [Utils randomBytes:16]; + transformSeed = [Utils randomBytes:32]; firstGroup = YES; } return self; } -- (void)dealloc { - [masterSeed release]; - [encryptionIv release]; - [transformSeed release]; - [super dealloc]; -} - /** * Get the number of groups in the KDB tree */ @@ -106,7 +99,6 @@ - (void)persist:(Kdb3Tree *)tree file:(NSString *)filename withPassword:(KdbPass [shaOutputStream close]; // Release and reopen the file back up and write the content hash - [fileOutputStream release]; fileOutputStream = [[FileOutputStream alloc] initWithFilename:filename flags:O_WRONLY mode:0644]; [fileOutputStream seek:56]; [fileOutputStream write:[shaOutputStream getHash] length:32]; @@ -117,9 +109,9 @@ - (void)persist:(Kdb3Tree *)tree file:(NSString *)filename withPassword:(KdbPass ofItemAtPath:filename error:nil]; } @finally { - [shaOutputStream release]; - [aesOutputStream release]; - [fileOutputStream release]; + shaOutputStream = nil; + aesOutputStream = nil; + fileOutputStream = nil; } } @@ -197,7 +189,6 @@ - (void)writeGroup:(Kdb3Group *)group withOutputStream:(OutputStream *)outputStr // Write the extra data to a field with id 0 [self appendField:0 size:dataOutputStream.data.length bytes:dataOutputStream.data.bytes withOutputStream:outputStream]; - [dataOutputStream release]; firstGroup = NO; } @@ -370,8 +361,6 @@ - (void)newFile:(NSString*)fileName withPassword:(KdbPassword *)kdbPassword { [self persist:tree file:fileName withPassword:kdbPassword]; - [tree release]; - [rootGroup release]; } @end diff --git a/KeePassLib/Kdb4Node.h b/KeePassLib/Kdb4Node.h index 6f3f40bc..5ed68539 100644 --- a/KeePassLib/Kdb4Node.h +++ b/KeePassLib/Kdb4Node.h @@ -52,16 +52,16 @@ @interface Kdb4Group : KdbGroup -@property(nonatomic, retain) UUID *uuid; +@property(nonatomic, strong) UUID *uuid; @property(nonatomic, copy) NSString *notes; @property(nonatomic, assign) BOOL isExpanded; @property(nonatomic, copy) NSString *defaultAutoTypeSequence; @property(nonatomic, copy) NSString *enableAutoType; @property(nonatomic, copy) NSString *enableSearching; -@property(nonatomic, retain) UUID *lastTopVisibleEntry; +@property(nonatomic, strong) UUID *lastTopVisibleEntry; @property(nonatomic, assign) BOOL expires; @property(nonatomic, assign) NSInteger usageCount; -@property(nonatomic, retain) NSDate *locationChanged; +@property(nonatomic, strong) NSDate *locationChanged; @end @@ -82,7 +82,7 @@ @interface CustomIcon : NSObject -@property(nonatomic, retain) UUID *uuid; +@property(nonatomic, strong) UUID *uuid; @property(nonatomic, copy) NSString *data; @end @@ -100,14 +100,14 @@ @property(nonatomic, assign) NSInteger binaryId; @property(nonatomic, assign) BOOL compressed; -@property(nonatomic, retain) NSString *data; +@property(nonatomic, strong) NSString *data; @end @interface BinaryRef : NSObject -@property(nonatomic, retain) NSString *key; +@property(nonatomic, strong) NSString *key; @property(nonatomic, assign) NSInteger ref; @end @@ -133,23 +133,23 @@ @interface Kdb4Entry : KdbEntry -@property(nonatomic, retain) UUID *uuid; -@property(nonatomic, retain) StringField *titleStringField; -@property(nonatomic, retain) StringField *usernameStringField; -@property(nonatomic, retain) StringField *passwordStringField; -@property(nonatomic, retain) StringField *urlStringField; -@property(nonatomic, retain) StringField *notesStringField; -@property(nonatomic, retain) UUID *customIconUuid; +@property(nonatomic, strong) UUID *uuid; +@property(nonatomic, strong) StringField *titleStringField; +@property(nonatomic, strong) StringField *usernameStringField; +@property(nonatomic, strong) StringField *passwordStringField; +@property(nonatomic, strong) StringField *urlStringField; +@property(nonatomic, strong) StringField *notesStringField; +@property(nonatomic, strong) UUID *customIconUuid; @property(nonatomic, copy) NSString *foregroundColor; @property(nonatomic, copy) NSString *backgroundColor; @property(nonatomic, copy) NSString *overrideUrl; @property(nonatomic, copy) NSString *tags; @property(nonatomic, assign) BOOL expires; @property(nonatomic, assign) NSInteger usageCount; -@property(nonatomic, retain) NSDate *locationChanged; +@property(nonatomic, strong) NSDate *locationChanged; @property(nonatomic, readonly) NSMutableArray *stringFields; @property(nonatomic, readonly) NSMutableArray *binaries; -@property(nonatomic, retain) AutoType *autoType; +@property(nonatomic, strong) AutoType *autoType; @property(nonatomic, readonly) NSMutableArray *history; @end @@ -162,14 +162,14 @@ @property(nonatomic, copy) NSString *generator; @property(nonatomic, copy) NSString *databaseName; -@property(nonatomic, retain) NSDate *databaseNameChanged; +@property(nonatomic, strong) NSDate *databaseNameChanged; @property(nonatomic, copy) NSString *databaseDescription; -@property(nonatomic, retain) NSDate *databaseDescriptionChanged; +@property(nonatomic, strong) NSDate *databaseDescriptionChanged; @property(nonatomic, copy) NSString *defaultUserName; -@property(nonatomic, retain) NSDate *defaultUserNameChanged; +@property(nonatomic, strong) NSDate *defaultUserNameChanged; @property(nonatomic, assign) NSInteger maintenanceHistoryDays; @property(nonatomic, copy) NSString *color; -@property(nonatomic, retain) NSDate *masterKeyChanged; +@property(nonatomic, strong) NSDate *masterKeyChanged; @property(nonatomic, assign) NSInteger masterKeyChangeRec; @property(nonatomic, assign) NSInteger masterKeyChangeForce; @property(nonatomic, assign) BOOL protectTitle; @@ -179,14 +179,14 @@ @property(nonatomic, assign) BOOL protectNotes; @property(nonatomic, readonly) NSMutableArray *customIcons; @property(nonatomic, assign) BOOL recycleBinEnabled; -@property(nonatomic, retain) UUID *recycleBinUuid; -@property(nonatomic, retain) NSDate *recycleBinChanged; -@property(nonatomic, retain) UUID *entryTemplatesGroup; -@property(nonatomic, retain) NSDate *entryTemplatesGroupChanged; +@property(nonatomic, strong) UUID *recycleBinUuid; +@property(nonatomic, strong) NSDate *recycleBinChanged; +@property(nonatomic, strong) UUID *entryTemplatesGroup; +@property(nonatomic, strong) NSDate *entryTemplatesGroupChanged; @property(nonatomic, assign) NSInteger historyMaxItems; @property(nonatomic, assign) NSInteger historyMaxSize; -@property(nonatomic, retain) UUID *lastSelectedGroup; -@property(nonatomic, retain) UUID *lastTopVisibleGroup; +@property(nonatomic, strong) UUID *lastSelectedGroup; +@property(nonatomic, strong) UUID *lastTopVisibleGroup; @property(nonatomic, readonly) NSMutableArray *binaries; @property(nonatomic, readonly) NSMutableArray *customData; diff --git a/KeePassLib/Kdb4Node.m b/KeePassLib/Kdb4Node.m index e54c7c20..78f1c8b9 100644 --- a/KeePassLib/Kdb4Node.m +++ b/KeePassLib/Kdb4Node.m @@ -18,21 +18,8 @@ #import "Kdb4Node.h" @implementation Kdb4Group - -- (void)dealloc { - [_uuid release]; - [_notes release]; - [_defaultAutoTypeSequence release]; - [_enableAutoType release]; - [_enableSearching release]; - [_lastTopVisibleEntry release]; - [_locationChanged release]; - [super dealloc]; -} - @end - @implementation StringField - (id)initWithKey:(NSString *)key andValue:(NSString *)value { @@ -50,13 +37,7 @@ - (id)initWithKey:(NSString *)key andValue:(NSString *)value andProtected:(BOOL) } + (id)stringFieldWithKey:(NSString *)key andValue:(NSString *)value { - return [[[StringField alloc] initWithKey:key andValue:value] autorelease]; -} - -- (void)dealloc { - [_key release]; - [_value release]; - [super dealloc]; + return [[StringField alloc] initWithKey:key andValue:value]; } - (id)copyWithZone:(NSZone *)zone { @@ -65,60 +46,21 @@ - (id)copyWithZone:(NSZone *)zone { @end - @implementation CustomIcon - -- (void)dealloc { - [_uuid release]; - [_data release]; - [super dealloc]; -} - @end - @implementation CustomItem - -- (void)dealloc { - [_key release]; - [_value release]; - [super dealloc]; -} - @end - @implementation Binary - -- (void)dealloc { - [_data release]; - [super dealloc]; -} - @end - @implementation BinaryRef - -- (void)dealloc { - [_key release]; - [super dealloc]; -} - @end - @implementation Association - -- (void)dealloc { - [_window release]; - [_keystrokeSequence release]; - [super dealloc]; -} - @end - @implementation AutoType - (id)init { @@ -129,12 +71,6 @@ - (id)init { return self; } -- (void)dealloc { - [_defaultSequence release]; - [_associations release]; - [super dealloc]; -} - @end @@ -150,26 +86,6 @@ - (id)init { return self; } -- (void)dealloc { - [_uuid release]; - [_titleStringField release]; - [_usernameStringField release]; - [_passwordStringField release]; - [_urlStringField release]; - [_notesStringField release]; - [_customIconUuid release]; - [_foregroundColor release]; - [_backgroundColor release]; - [_overrideUrl release]; - [_tags release]; - [_locationChanged release]; - [_stringFields release]; - [_binaries release]; - [_autoType release]; - [_history release]; - [super dealloc]; -} - - (NSString *)title { return _titleStringField.value; } @@ -227,28 +143,6 @@ - (id)init { return self; } -- (void)dealloc { - [_generator release]; - [_databaseName release]; - [_databaseNameChanged release]; - [_databaseDescription release]; - [_databaseDescriptionChanged release]; - [_defaultUserName release]; - [_defaultUserNameChanged release]; - [_color release]; - [_masterKeyChanged release]; - [_customIcons release]; - [_recycleBinUuid release]; - [_recycleBinChanged release]; - [_entryTemplatesGroup release]; - [_entryTemplatesGroupChanged release]; - [_lastSelectedGroup release]; - [_lastTopVisibleGroup release]; - [_binaries release]; - [_customData release]; - [super dealloc]; -} - - (KdbGroup*)createGroup:(KdbGroup*)parent { Kdb4Group *group = [[Kdb4Group alloc] init]; @@ -270,7 +164,7 @@ - (KdbGroup*)createGroup:(KdbGroup*)parent { group.usageCount = 0; group.locationChanged = currentTime; - return [group autorelease]; + return group; } - (KdbEntry*)createEntry:(KdbGroup*)parent { @@ -278,11 +172,11 @@ - (KdbEntry*)createEntry:(KdbGroup*)parent { entry.uuid = [UUID uuid]; entry.image = 0; - entry.titleStringField = [[[StringField alloc] initWithKey:FIELD_TITLE andValue:@"New Entry"] autorelease]; - entry.usernameStringField = [[[StringField alloc] initWithKey:FIELD_USER_NAME andValue:@""] autorelease]; - entry.passwordStringField = [[[StringField alloc] initWithKey:FIELD_PASSWORD andValue:@"" andProtected:YES] autorelease]; - entry.urlStringField = [[[StringField alloc] initWithKey:FIELD_URL andValue:@""] autorelease]; - entry.notesStringField = [[[StringField alloc] initWithKey:FIELD_NOTES andValue:@""] autorelease]; + entry.titleStringField = [[StringField alloc] initWithKey:FIELD_TITLE andValue:@"New Entry"]; + entry.usernameStringField = [[StringField alloc] initWithKey:FIELD_USER_NAME andValue:@""]; + entry.passwordStringField = [[StringField alloc] initWithKey:FIELD_PASSWORD andValue:@"" andProtected:YES]; + entry.urlStringField = [[StringField alloc] initWithKey:FIELD_URL andValue:@""]; + entry.notesStringField = [[StringField alloc] initWithKey:FIELD_NOTES andValue:@""]; entry.foregroundColor = @""; entry.backgroundColor = @""; entry.overrideUrl = @""; @@ -298,16 +192,16 @@ - (KdbEntry*)createEntry:(KdbGroup*)parent { entry.locationChanged = currentTime; // Add a default AutoType object - entry.autoType = [[[AutoType alloc] init] autorelease]; + entry.autoType = [[AutoType alloc] init]; entry.autoType.enabled = YES; entry.autoType.dataTransferObfuscation = 1; - Association *association = [[[Association alloc] init] autorelease]; + Association *association = [[Association alloc] init]; association.window = @"Target Window"; association.keystrokeSequence = @"{USERNAME}{TAB}{PASSWORD}{TAB}{ENTER}"; [entry.autoType.associations addObject:association]; - return [entry autorelease]; + return entry; } @end diff --git a/KeePassLib/Kdb4Parser.m b/KeePassLib/Kdb4Parser.m index c5af5ecb..2b114c17 100644 --- a/KeePassLib/Kdb4Parser.m +++ b/KeePassLib/Kdb4Parser.m @@ -40,7 +40,7 @@ @implementation Kdb4Parser - (id)initWithRandomStream:(RandomStream *)cryptoRandomStream { self = [super init]; if (self) { - randomStream = [cryptoRandomStream retain]; + randomStream = cryptoRandomStream; dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; @@ -49,14 +49,8 @@ - (id)initWithRandomStream:(RandomStream *)cryptoRandomStream { return self; } -- (void)dealloc { - [randomStream release]; - [dateFormatter release]; - [super dealloc]; -} - int readCallback(void *context, char *buffer, int len) { - InputStream *inputStream = (InputStream*)context; + InputStream *inputStream = (__bridge InputStream*)context; return [inputStream read:buffer length:len]; } @@ -65,11 +59,11 @@ int closeCallback(void *context) { } - (Kdb4Tree *)parse:(InputStream *)inputStream { - DDXMLDocument *document = [[[DDXMLDocument alloc] initWithReadIO:readCallback + DDXMLDocument *document = [[DDXMLDocument alloc] initWithReadIO:readCallback closeIO:closeCallback - context:inputStream + context:(__bridge void *)(inputStream) options:0 - error:nil] autorelease]; + error:nil]; if (document == nil) { @throw [NSException exceptionWithName:@"ParseError" reason:@"Failed to parse database" userInfo:nil]; } @@ -80,7 +74,7 @@ - (Kdb4Tree *)parse:(InputStream *)inputStream { // Decode all the protected entries [self decodeProtected:rootElement]; - Kdb4Tree *tree = [[[Kdb4Tree alloc] init] autorelease]; + Kdb4Tree *tree = [[Kdb4Tree alloc] init]; DDXMLElement *meta = [rootElement elementForName:@"Meta"]; if (meta != nil) { @@ -115,7 +109,6 @@ - (void)decodeProtected:(DDXMLElement *)root { NSString *unprotected = [[NSString alloc] initWithBytes:data.bytes length:data.length encoding:NSUTF8StringEncoding]; [root setStringValue:unprotected]; - [unprotected release]; } for (DDXMLNode *node in [root children]) { @@ -173,7 +166,7 @@ - (void)parseMeta:(DDXMLElement *)root tree:(Kdb4Tree *)tree { } - (CustomIcon *)parseCustomIcon:(DDXMLElement *)root { - CustomIcon *customIcon = [[[CustomIcon alloc] init] autorelease]; + CustomIcon *customIcon = [[CustomIcon alloc] init]; customIcon.uuid = [self parseUuidString:[[root elementForName:@"UUID"] stringValue]]; customIcon.data = [[root elementForName:@"Data"] stringValue]; @@ -182,7 +175,7 @@ - (CustomIcon *)parseCustomIcon:(DDXMLElement *)root { } - (Binary *)parseBinary:(DDXMLElement *)root { - Binary *binary = [[[Binary alloc] init] autorelease]; + Binary *binary = [[Binary alloc] init]; binary.binaryId = [[[root attributeForName:@"ID"] stringValue] integerValue]; binary.compressed = [[[root attributeForName:@"Compressed"] stringValue] boolValue]; @@ -192,7 +185,7 @@ - (Binary *)parseBinary:(DDXMLElement *)root { } - (CustomItem *)parseCustomItem:(DDXMLElement *)root { - CustomItem *customItem = [[[CustomItem alloc] init] autorelease]; + CustomItem *customItem = [[CustomItem alloc] init]; customItem.key = [[root attributeForName:@"ID"] stringValue]; customItem.value = [[root attributeForName:@"Compressed"] stringValue]; @@ -201,7 +194,7 @@ - (CustomItem *)parseCustomItem:(DDXMLElement *)root { } - (Kdb4Group *)parseGroup:(DDXMLElement *)root { - Kdb4Group *group = [[[Kdb4Group alloc] init] autorelease]; + Kdb4Group *group = [[Kdb4Group alloc] init]; group.uuid = [self parseUuidString:[[root elementForName:@"UUID"] stringValue]]; if (group.uuid == nil) { @@ -245,7 +238,7 @@ - (Kdb4Group *)parseGroup:(DDXMLElement *)root { } - (Kdb4Entry *)parseEntry:(DDXMLElement *)root { - Kdb4Entry *entry = [[[Kdb4Entry alloc] init] autorelease]; + Kdb4Entry *entry = [[Kdb4Entry alloc] init]; entry.uuid = [self parseUuidString:[[root elementForName:@"UUID"] stringValue]]; if (entry.uuid == nil) { @@ -308,7 +301,7 @@ - (Kdb4Entry *)parseEntry:(DDXMLElement *)root { } - (StringField *)parseStringField:(DDXMLElement *)root { - StringField *stringField = [[[StringField alloc] init] autorelease]; + StringField *stringField = [[StringField alloc] init]; stringField.key = [[root elementForName:@"Key"] stringValue]; @@ -320,7 +313,7 @@ - (StringField *)parseStringField:(DDXMLElement *)root { } - (BinaryRef *)parseBinaryRef:(DDXMLElement *)root { - BinaryRef *binaryRef = [[[BinaryRef alloc] init] autorelease]; + BinaryRef *binaryRef = [[BinaryRef alloc] init]; binaryRef.key = [[root elementForName:@"Key"] stringValue]; binaryRef.ref = [[[[root elementForName:@"Value"] attributeForName:@"Ref"] stringValue] integerValue]; @@ -329,7 +322,7 @@ - (BinaryRef *)parseBinaryRef:(DDXMLElement *)root { } - (AutoType *)parseAutoType:(DDXMLElement *)root { - AutoType *autoType = [[[AutoType alloc] init] autorelease]; + AutoType *autoType = [[AutoType alloc] init]; autoType.enabled = [[[root elementForName:@"Enabled"] stringValue] boolValue]; autoType.dataTransferObfuscation = [[[root elementForName:@"DataTransferObfuscation"] stringValue] integerValue]; @@ -340,7 +333,7 @@ - (AutoType *)parseAutoType:(DDXMLElement *)root { } for (DDXMLElement *element in [root elementsForName:@"Association"]) { - Association *association = [[[Association alloc] init] autorelease]; + Association *association = [[Association alloc] init]; association.window = [[element elementForName:@"Window"] stringValue]; association.keystrokeSequence = [[element elementForName:@"KeystrokeSequence"] stringValue]; @@ -357,7 +350,7 @@ - (UUID *)parseUuidString:(NSString *)uuidString { } NSData *data = [Base64 decode:[uuidString dataUsingEncoding:NSUTF8StringEncoding]]; - return [[[UUID alloc] initWithData:data] autorelease]; + return [[UUID alloc] initWithData:data]; } @end diff --git a/KeePassLib/Kdb4Persist.m b/KeePassLib/Kdb4Persist.m index a2c29c18..dafdb47d 100644 --- a/KeePassLib/Kdb4Persist.m +++ b/KeePassLib/Kdb4Persist.m @@ -38,9 +38,9 @@ @implementation Kdb4Persist - (id)initWithTree:(Kdb4Tree*)t outputStream:(OutputStream*)stream randomStream:(RandomStream*)cryptoRandomStream { self = [super init]; if (self) { - tree = [t retain]; - outputStream = [stream retain]; - randomStream = [cryptoRandomStream retain]; + tree = t; + outputStream = stream; + randomStream = cryptoRandomStream; dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; @@ -49,14 +49,6 @@ - (id)initWithTree:(Kdb4Tree*)t outputStream:(OutputStream*)stream randomStream: return self; } -- (void)dealloc { - [tree release]; - [outputStream release]; - [randomStream release]; - [dateFormatter release]; - [super dealloc]; -} - - (void)persist { // Update the DOM model DDXMLDocument *document = [self persistTree]; @@ -157,7 +149,7 @@ - (DDXMLDocument *)persistTree { [element addChild:[self persistGroup:(Kdb4Group *)tree.root]]; [document.rootElement addChild:element]; - return [document autorelease]; + return document; } - (DDXMLElement *)persistCustomIcon:(CustomIcon *)customIcon { @@ -366,7 +358,7 @@ - (DDXMLElement *)persistAutoType:(AutoType *)autoType { - (NSString *)persistUuid:(UUID *)uuid { NSData *data = [Base64 encode:[uuid getData]]; - return [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } - (void)encodeProtected:(DDXMLElement*)root { @@ -381,11 +373,9 @@ - (void)encodeProtected:(DDXMLElement*)root { // Base64 encode the string NSData *data = [Base64 encode:mutableData]; - [mutableData release]; NSString *protected = [[NSString alloc] initWithBytes:data.bytes length:data.length encoding:NSUTF8StringEncoding]; [root setStringValue:protected]; - [protected release]; } for (DDXMLNode *node in [root children]) { diff --git a/KeePassLib/Kdb4Reader.m b/KeePassLib/Kdb4Reader.m index 767cfd5f..6c59f817 100644 --- a/KeePassLib/Kdb4Reader.m +++ b/KeePassLib/Kdb4Reader.m @@ -35,17 +35,6 @@ - (void)readHeader:(InputStream*)inputStream; @implementation Kdb4Reader -- (void)dealloc { - [comment release]; - [cipherUuid release]; - [masterSeed release]; - [transformSeed release]; - [encryptionIv release]; - [protectedStreamKey release]; - [streamStartBytes release]; - [super dealloc]; -} - - (KdbTree*)load:(InputStream*)inputStream withPassword:(KdbPassword*)kdbPassword { // Read the header [self readHeader:inputStream]; @@ -57,7 +46,7 @@ - (KdbTree*)load:(InputStream*)inputStream withPassword:(KdbPassword*)kdbPasswor // Create the AES input stream NSData *key = [kdbPassword createFinalKeyForVersion:4 masterSeed:masterSeed transformSeed:transformSeed rounds:rounds]; - AesInputStream *aesInputStream = [[[AesInputStream alloc] initWithInputStream:inputStream key:key iv:encryptionIv] autorelease]; + AesInputStream *aesInputStream = [[AesInputStream alloc] initWithInputStream:inputStream key:key iv:encryptionIv]; // Verify the stream start bytes match NSData *startBytes = [aesInputStream readData:32]; @@ -66,23 +55,23 @@ - (KdbTree*)load:(InputStream*)inputStream withPassword:(KdbPassword*)kdbPasswor } // Create the hashed input stream and swap in the compression input stream if compressed - InputStream *stream = [[[HashedInputStream alloc] initWithInputStream:aesInputStream] autorelease]; + InputStream *stream = [[HashedInputStream alloc] initWithInputStream:aesInputStream]; if (compressionAlgorithm == COMPRESSION_GZIP) { - stream = [[[GZipInputStream alloc] initWithInputStream:stream] autorelease]; + stream = [[GZipInputStream alloc] initWithInputStream:stream]; } // Create the CRS Algorithm RandomStream *randomStream = nil; if (randomStreamID == CSR_SALSA20) { - randomStream = [[[Salsa20RandomStream alloc] init:protectedStreamKey] autorelease]; + randomStream = [[Salsa20RandomStream alloc] init:protectedStreamKey]; } else if (randomStreamID == CSR_ARC4VARIANT) { - randomStream = [[[Arc4RandomStream alloc] init:protectedStreamKey] autorelease]; + randomStream = [[Arc4RandomStream alloc] init:protectedStreamKey]; } else { @throw [NSException exceptionWithName:@"IOException" reason:@"Unsupported CSR algorithm" userInfo:nil]; } // Parse the tree - Kdb4Parser *parser = [[[Kdb4Parser alloc] initWithRandomStream:randomStream] autorelease]; + Kdb4Parser *parser = [[Kdb4Parser alloc] initWithRandomStream:randomStream]; Kdb4Tree *tree = [parser parse:stream]; // Copy some parameters into the KdbTree @@ -126,7 +115,7 @@ - (void)readHeader:inputStream { case HEADER_COMMENT: // FIXME this should prolly be a string - comment = [[inputStream readData:fieldSize] retain]; + comment = [inputStream readData:fieldSize]; break; case HEADER_CIPHERID: @@ -141,7 +130,7 @@ - (void)readHeader:inputStream { if (fieldSize != 32) { @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } - masterSeed = [[inputStream readData:fieldSize] retain]; + masterSeed = [inputStream readData:fieldSize]; break; case HEADER_TRANSFORMSEED: @@ -149,19 +138,19 @@ - (void)readHeader:inputStream { @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid field size" userInfo:nil]; } - transformSeed = [[inputStream readData:fieldSize] retain]; + transformSeed = [inputStream readData:fieldSize]; break; case HEADER_ENCRYPTIONIV: - encryptionIv = [[inputStream readData:fieldSize] retain]; + encryptionIv = [inputStream readData:fieldSize]; break; case HEADER_PROTECTEDKEY: - protectedStreamKey = [[inputStream readData:fieldSize] retain]; + protectedStreamKey = [inputStream readData:fieldSize]; break; case HEADER_STARTBYTES: - streamStartBytes = [[inputStream readData:fieldSize] retain]; + streamStartBytes = [inputStream readData:fieldSize]; break; case HEADER_TRANSFORMROUNDS: diff --git a/KeePassLib/Kdb4Writer.m b/KeePassLib/Kdb4Writer.m index b3598a02..7bf4b195 100644 --- a/KeePassLib/Kdb4Writer.m +++ b/KeePassLib/Kdb4Writer.m @@ -39,51 +39,42 @@ @implementation Kdb4Writer - init { self = [super init]; if (self) { - masterSeed = [[Utils randomBytes:32] retain]; - transformSeed = [[Utils randomBytes:32] retain]; - encryptionIv = [[Utils randomBytes:16] retain]; - protectedStreamKey = [[Utils randomBytes:32] retain]; - streamStartBytes = [[Utils randomBytes:32] retain]; + masterSeed = [Utils randomBytes:32]; + transformSeed = [Utils randomBytes:32]; + encryptionIv = [Utils randomBytes:16]; + protectedStreamKey = [Utils randomBytes:32]; + streamStartBytes = [Utils randomBytes:32]; } return self; } -- (void)dealloc { - [masterSeed release]; - [transformSeed release]; - [encryptionIv release]; - [protectedStreamKey release]; - [streamStartBytes release]; - [super dealloc]; -} - - (void)persist:(Kdb4Tree*)tree file:(NSString*)filename withPassword:(KdbPassword*)kdbPassword { // Configure the output stream - DataOutputStream *outputStream = [[[DataOutputStream alloc] init] autorelease]; + DataOutputStream *outputStream = [[DataOutputStream alloc] init]; // Write the header [self writeHeader:outputStream withTree:tree]; // Create the encryption output stream NSData *key = [kdbPassword createFinalKeyForVersion:4 masterSeed:masterSeed transformSeed:transformSeed rounds:tree.rounds]; - AesOutputStream *aesOutputStream = [[[AesOutputStream alloc] initWithOutputStream:outputStream key:key iv:encryptionIv] autorelease]; + AesOutputStream *aesOutputStream = [[AesOutputStream alloc] initWithOutputStream:outputStream key:key iv:encryptionIv]; // Write the stream start bytes [aesOutputStream write:streamStartBytes]; // Create the hashed output stream - OutputStream *stream = [[[HashedOutputStream alloc] initWithOutputStream:aesOutputStream blockSize:1024*1024] autorelease]; + OutputStream *stream = [[HashedOutputStream alloc] initWithOutputStream:aesOutputStream blockSize:1024*1024]; // Create the gzip output stream if (tree.compressionAlgorithm == COMPRESSION_GZIP) { - stream = [[[GZipOutputStream alloc] initWithOutputStream:stream] autorelease]; + stream = [[GZipOutputStream alloc] initWithOutputStream:stream]; } // Create the random stream - RandomStream *randomStream = [[[Salsa20RandomStream alloc] init:protectedStreamKey] autorelease]; + RandomStream *randomStream = [[Salsa20RandomStream alloc] init:protectedStreamKey]; // Serialize the XML - Kdb4Persist *persist = [[[Kdb4Persist alloc] initWithTree:tree outputStream:stream randomStream:randomStream] autorelease]; + Kdb4Persist *persist = [[Kdb4Persist alloc] initWithTree:tree outputStream:stream randomStream:randomStream]; [persist persist]; // Close the output stream @@ -208,7 +199,6 @@ - (void)newFile:(NSString*)fileName withPassword:(KdbPassword*)kdbPassword { [self persist:tree file:fileName withPassword:kdbPassword]; - [tree release]; } @end diff --git a/KeePassLib/KdbPassword.m b/KeePassLib/KdbPassword.m index 52dc5edf..a09b6c80 100644 --- a/KeePassLib/KdbPassword.m +++ b/KeePassLib/KdbPassword.m @@ -48,12 +48,6 @@ - (id)initWithPassword:(NSString*)inPassword return self; } -- (void)dealloc { - [password release]; - [keyFile release]; - [super dealloc]; -} - - (NSData*)createFinalKeyForVersion:(uint8_t)version masterSeed:(NSData*)masterSeed transformSeed:(NSData*)transformSeed @@ -223,24 +217,19 @@ - (NSData*)loadXmlKeyFile:(NSString*)filename { DDXMLElement *keyElement = [rootElement elementForName:@"Key"]; if (keyElement == nil) { - [document release]; @throw [NSException exceptionWithName:@"ParseError" reason:@"Failed to parse keyfile" userInfo:nil]; } DDXMLElement *dataElement = [keyElement elementForName:@"Data"]; if (dataElement == nil) { - [document release]; @throw [NSException exceptionWithName:@"ParseError" reason:@"Failed to parse keyfile" userInfo:nil]; } NSString *dataString = [dataElement stringValue]; if (dataString == nil) { - [document release]; @throw [NSException exceptionWithName:@"ParseError" reason:@"Failed to parse keyfile" userInfo:nil]; } - [document release]; - return [Base64 decode:[dataString dataUsingEncoding:NSASCIIStringEncoding]]; } diff --git a/KeePassLib/KdbReaderFactory.m b/KeePassLib/KdbReaderFactory.m index 0967f96d..6571fa65 100644 --- a/KeePassLib/KdbReaderFactory.m +++ b/KeePassLib/KdbReaderFactory.m @@ -28,7 +28,6 @@ + (KdbTree*)load:(NSString*)filename withPassword:(KdbPassword*)kdbPassword { } else if (sig1 == KDB4_SIG1 && sig2 == KDB4_SIG2) { reader = [[Kdb4Reader alloc] init]; } else { - [inputStream release]; @throw [NSException exceptionWithName:@"IOException" reason:@"Invalid file signature" userInfo:nil]; } @@ -36,9 +35,6 @@ + (KdbTree*)load:(NSString*)filename withPassword:(KdbPassword*)kdbPassword { [inputStream seek:0]; KdbTree *tree = [reader load:inputStream withPassword:kdbPassword]; - [reader release]; - - [inputStream release]; return tree; } diff --git a/KeePassLib/KdbWriterFactory.m b/KeePassLib/KdbWriterFactory.m index 45370d55..63242840 100644 --- a/KeePassLib/KdbWriterFactory.m +++ b/KeePassLib/KdbWriterFactory.m @@ -33,7 +33,6 @@ + (void)persist:(KdbTree*)tree file:(NSString*)filename withPassword:(KdbPasswor } [writer persist:tree file:filename withPassword:kdbPassword]; - [writer release]; } @end diff --git a/KeePassLib/Salsa20RandomStream.m b/KeePassLib/Salsa20RandomStream.m index adc12845..e0190487 100644 --- a/KeePassLib/Salsa20RandomStream.m +++ b/KeePassLib/Salsa20RandomStream.m @@ -45,10 +45,6 @@ - (id)init:(NSData*)key { return self; } -- (void)dealloc { - [super dealloc]; -} - - (uint)uint8To32Little:(uint8_t*)buffer offset:(uint32_t)offset { return ((uint)buffer[offset] | ((uint)buffer[offset + 1] << 8) | ((uint)buffer[offset + 2] << 16) | ((uint)buffer[offset + 3] << 24)); diff --git a/KeePassLib/UUID.m b/KeePassLib/UUID.m index af2a8e89..917a88ee 100644 --- a/KeePassLib/UUID.m +++ b/KeePassLib/UUID.m @@ -60,7 +60,6 @@ - (id)initWithString:(NSString *)string { - (void)dealloc { CFRelease(uuid); - [super dealloc]; } - (void)getBytes:(uint8_t*)bytes length:(NSUInteger)length { @@ -96,17 +95,17 @@ - (BOOL)isEqual:(id)object { } - (NSString*)description { - NSString *uuidString = (NSString *)CFUUIDCreateString(NULL, uuid); - return [uuidString autorelease]; + NSString *uuidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(NULL, uuid)); // FIXME Double check CFBridgingRelease + return uuidString; } + (UUID *)uuid { - return [[[UUID alloc] init] autorelease]; + return [[UUID alloc] init]; } + (UUID *)nullUuid { uint8_t bytes[16] = {0}; - return [[[UUID alloc] initWithBytes:bytes] autorelease]; + return [[UUID alloc] initWithBytes:bytes]; } + (UUID*)getAESUUID { diff --git a/KeePassLib/Utils.m b/KeePassLib/Utils.m index e85fbafb..ef9abe13 100644 --- a/KeePassLib/Utils.m +++ b/KeePassLib/Utils.m @@ -77,7 +77,7 @@ + (NSString*)hexDumpBytes:(const void *)buffer length:(ssize_t)length { [string appendString:@"|\n"]; } - return [string autorelease]; + return string; } @end diff --git a/MiniKeePass.xcodeproj/project.pbxproj b/MiniKeePass.xcodeproj/project.pbxproj index e243218e..210312af 100644 --- a/MiniKeePass.xcodeproj/project.pbxproj +++ b/MiniKeePass.xcodeproj/project.pbxproj @@ -249,7 +249,7 @@ 689D03EB13A42B63005EBD36 /* DDXMLDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D02FC13A42B63005EBD36 /* DDXMLDocument.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; 689D03EC13A42B63005EBD36 /* DDXMLElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D02FE13A42B63005EBD36 /* DDXMLElement.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; 689D03ED13A42B63005EBD36 /* DDXMLNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D030013A42B63005EBD36 /* DDXMLNode.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; - 689D041313A42B63005EBD36 /* KeychainUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D032B13A42B63005EBD36 /* KeychainUtils.m */; }; + 689D041313A42B63005EBD36 /* KeychainUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D032B13A42B63005EBD36 /* KeychainUtils.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 689D044E13A42C82005EBD36 /* ChoiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D042513A42C81005EBD36 /* ChoiceCell.m */; }; 689D044F13A42C82005EBD36 /* DatabaseDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D042713A42C81005EBD36 /* DatabaseDocument.m */; }; 689D045013A42C82005EBD36 /* DatabaseManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D042913A42C81005EBD36 /* DatabaseManager.m */; }; @@ -277,7 +277,7 @@ 68A3E1AF13A8C9D1006881CA /* FormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 68A3E1AE13A8C9D1006881CA /* FormViewController.m */; }; 68B0A70314ECBC1E005CFE31 /* reload.png in Resources */ = {isa = PBXBuildFile; fileRef = 68B0A70014ECBC1E005CFE31 /* reload.png */; }; 68B0A70514ECBC1E005CFE31 /* reload@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 68B0A70214ECBC1E005CFE31 /* reload@2x.png */; }; - 68CE37F214049BC900E4A5E1 /* HelpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 68CE37F114049BC900E4A5E1 /* HelpViewController.m */; }; + 68CE37F214049BC900E4A5E1 /* HelpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 68CE37F114049BC900E4A5E1 /* HelpViewController.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 68CE37F51404A86600E4A5E1 /* safariemail.html in Resources */ = {isa = PBXBuildFile; fileRef = 68CE37F41404A86600E4A5E1 /* safariemail.html */; }; 68CE868F14EDF4C300D34A61 /* LengthCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 68CE868E14EDF4C300D34A61 /* LengthCell.m */; }; 68D991E613F3EAAE00F6ED1F /* PasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 68D991E513F3EAAE00F6ED1F /* PasswordViewController.m */; }; @@ -1752,6 +1752,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; @@ -1833,6 +1834,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; @@ -1862,6 +1864,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/MiniKeePass/AppSettings.m b/MiniKeePass/AppSettings.m index 72f6f7e7..9212a268 100644 --- a/MiniKeePass/AppSettings.m +++ b/MiniKeePass/AppSettings.m @@ -100,7 +100,7 @@ + (AppSettings *)sharedInstance { - (id)init { self = [super init]; if (self) { - userDefaults = [[NSUserDefaults standardUserDefaults] retain]; + userDefaults = [NSUserDefaults standardUserDefaults]; // Register the default values NSMutableDictionary *defaultsDict = [NSMutableDictionary dictionary]; @@ -123,11 +123,6 @@ - (id)init { return self; } -- (void)dealloc { - [userDefaults release]; - [super dealloc]; -} - - (NSDate *)exitTime { return [userDefaults valueForKey:EXIT_TIME]; } diff --git a/MiniKeePass/CharacterSetsViewController.m b/MiniKeePass/CharacterSetsViewController.m index aab28581..af0833bc 100644 --- a/MiniKeePass/CharacterSetsViewController.m +++ b/MiniKeePass/CharacterSetsViewController.m @@ -56,18 +56,6 @@ - (id)init { return self; } -- (void)dealloc { - [upperCaseSwitchCell release]; - [lowerCaseSwitchCell release]; - [digitsSwitchCell release]; - [minusSwitchCell release]; - [underlineSwitchCell release]; - [spaceSwitchCell release]; - [specialSwitchCell release]; - [bracketsSwitchCell release]; - [super dealloc]; -} - - (void)viewWillDisappear:(BOOL)animated { NSInteger charSets = 0; if (upperCaseSwitchCell.switchControl.on) { diff --git a/MiniKeePass/ChoiceCell.h b/MiniKeePass/ChoiceCell.h index f102309a..4226032c 100644 --- a/MiniKeePass/ChoiceCell.h +++ b/MiniKeePass/ChoiceCell.h @@ -25,7 +25,7 @@ @property (nonatomic, copy) NSString *prefix; @property (nonatomic, assign) NSInteger selectedIndex; -@property (nonatomic, retain) NSArray *choices; +@property (nonatomic, strong) NSArray *choices; - (id)initWithLabel:(NSString*)labelText choices:(NSArray*)newChoices selectedIndex:(NSInteger)selectedIndex; - (void)setEnabled:(BOOL)enabled; diff --git a/MiniKeePass/ChoiceCell.m b/MiniKeePass/ChoiceCell.m index 7cf510df..c057efe3 100644 --- a/MiniKeePass/ChoiceCell.m +++ b/MiniKeePass/ChoiceCell.m @@ -36,12 +36,6 @@ - (id)initWithLabel:(NSString*)labelText choices:(NSArray*)newChoices selectedIn return self; } -- (void)dealloc { - [prefix release]; - [choices release]; - [super dealloc]; -} - - (void)setEnabled:(BOOL)enabled { self.selectionStyle = enabled ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone; self.textLabel.enabled = enabled; diff --git a/MiniKeePass/DatabaseDocument.h b/MiniKeePass/DatabaseDocument.h index 8956ed12..228f2905 100644 --- a/MiniKeePass/DatabaseDocument.h +++ b/MiniKeePass/DatabaseDocument.h @@ -28,7 +28,7 @@ UIDocumentInteractionController *documentInteractionController; } -@property (nonatomic, retain) KdbTree *kdbTree; +@property (nonatomic, strong) KdbTree *kdbTree; @property (nonatomic, copy) NSString *filename; @property (nonatomic) BOOL dirty; @property (nonatomic, readonly) UIDocumentInteractionController *documentInteractionController; diff --git a/MiniKeePass/DatabaseDocument.m b/MiniKeePass/DatabaseDocument.m index 469d5d96..2619f32a 100644 --- a/MiniKeePass/DatabaseDocument.m +++ b/MiniKeePass/DatabaseDocument.m @@ -40,19 +40,10 @@ - (id)init { return self; } - -- (void)dealloc { - [kdbTree release]; - [filename release]; - [kdbPassword release]; - [documentInteractionController release]; - [super dealloc]; -} - - (UIDocumentInteractionController *)documentInteractionController { if (documentInteractionController == nil) { NSURL *url = [NSURL fileURLWithPath:filename]; - documentInteractionController = [[UIDocumentInteractionController interactionControllerWithURL:url] retain]; + documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url]; } return documentInteractionController; } @@ -61,10 +52,6 @@ - (void)open:(NSString *)newFilename password:(NSString *)password keyFile:(NSSt if (password == nil && keyFile == nil) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"No password or keyfile specified" userInfo:nil]; } - - [kdbTree release]; - [filename release]; - [kdbPassword release]; filename = [newFilename copy]; dirty = NO; diff --git a/MiniKeePass/DatabaseManager.m b/MiniKeePass/DatabaseManager.m index 9f29ca9e..7a04f710 100644 --- a/MiniKeePass/DatabaseManager.m +++ b/MiniKeePass/DatabaseManager.m @@ -40,11 +40,6 @@ + (DatabaseManager*)sharedInstance { return sharedInstance; } -- (void)dealloc { - [selectedFilename release]; - [super dealloc]; -} - - (void)openDatabaseDocument:(NSString*)filename animated:(BOOL)newAnimated { BOOL databaseLoaded = NO; @@ -85,8 +80,6 @@ - (void)openDatabaseDocument:(NSString*)filename animated:(BOOL)newAnimated { } @catch (NSException * exception) { // Ignore } - - [dd release]; } // Prompt the user for the password if we haven't loaded the database yet @@ -109,9 +102,6 @@ - (void)openDatabaseDocument:(NSString*)filename animated:(BOOL)newAnimated { UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:passwordViewController]; [appDelegate.window.rootViewController presentModalViewController:navigationController animated:animated]; - - [navigationController release]; - [passwordViewController release]; } } @@ -119,8 +109,6 @@ - (void)loadDatabaseDocument:(DatabaseDocument*)databaseDocument { // Set the database document in the application delegate MiniKeePassAppDelegate *appDelegate = (MiniKeePassAppDelegate*)[[UIApplication sharedApplication] delegate]; appDelegate.databaseDocument = databaseDocument; - - [databaseDocument release]; } - (void)formViewController:(FormViewController *)controller button:(FormViewControllerButton)button { @@ -171,7 +159,6 @@ - (void)formViewController:(FormViewController *)controller button:(FormViewCont NSLog(@"%@", exception); shouldDismiss = NO; [passwordViewController showErrorMessage:exception.reason]; - [dd release]; } } diff --git a/MiniKeePass/EditGroupViewController.m b/MiniKeePass/EditGroupViewController.m index fa4eeb69..cf73330d 100644 --- a/MiniKeePass/EditGroupViewController.m +++ b/MiniKeePass/EditGroupViewController.m @@ -46,11 +46,6 @@ - (id)initWithStyle:(UITableViewStyle)style { return self; } -- (void)dealloc { - [_nameTextField release]; - [super dealloc]; -} - - (void)setSelectedImageIndex:(NSUInteger)selectedImageIndex { _selectedImageIndex = selectedImageIndex; @@ -63,7 +58,6 @@ - (void)imageButtonPressed { imageSelectionViewController.imageSelectionView.delegate = self; imageSelectionViewController.imageSelectionView.selectedImageIndex = _selectedImageIndex; [self.navigationController pushViewController:imageSelectionViewController animated:YES]; - [imageSelectionViewController release]; } - (void)imageSelectionView:(ImageSelectionView *)imageSelectionView selectedImageIndex:(NSUInteger)imageIndex { diff --git a/MiniKeePass/EntryViewController.h b/MiniKeePass/EntryViewController.h index 2a1705c2..2a104ae9 100644 --- a/MiniKeePass/EntryViewController.h +++ b/MiniKeePass/EntryViewController.h @@ -32,7 +32,7 @@ @interface EntryViewController : AutorotatingTableViewController @property (nonatomic, assign) NSUInteger selectedImageIndex; -@property (nonatomic, retain) KdbEntry *entry; +@property (nonatomic, strong) KdbEntry *entry; @property (nonatomic) BOOL isNewEntry; @end diff --git a/MiniKeePass/EntryViewController.m b/MiniKeePass/EntryViewController.m index 24dff3bd..11bbc9a9 100644 --- a/MiniKeePass/EntryViewController.m +++ b/MiniKeePass/EntryViewController.m @@ -36,9 +36,9 @@ @interface EntryViewController() { } @property (nonatomic) BOOL isKdb4; -@property (nonatomic, retain) NSMutableArray *editingStringFields; +@property (nonatomic, strong) NSMutableArray *editingStringFields; @property (nonatomic, readonly) NSArray *currentStringFields; -@property (nonatomic, retain) NSMutableArray *filledCells; +@property (nonatomic, strong) NSMutableArray *filledCells; @end @@ -57,7 +57,6 @@ - (id)initWithStyle:(UITableViewStyle)style { target:nil action:nil]; self.navigationItem.backBarButtonItem = backBarButtonItem; - [backBarButtonItem release]; appDelegate = (MiniKeePassAppDelegate*)[[UIApplication sharedApplication] delegate]; @@ -93,7 +92,7 @@ - (id)initWithStyle:(UITableViewStyle)style { urlCell.textField.returnKeyType = UIReturnKeyDone; [urlCell.accessoryButton addTarget:self action:@selector(openUrlPressed) forControlEvents:UIControlEventTouchUpInside]; - defaultCells = [@[titleCell, usernameCell, passwordCell, urlCell] retain]; + defaultCells = @[titleCell, usernameCell, passwordCell, urlCell]; commentsCell = [[TextViewCell alloc] init]; commentsCell.textView.editable = NO; @@ -103,19 +102,6 @@ - (id)initWithStyle:(UITableViewStyle)style { return self; } -- (void)dealloc { - [titleCell release]; - [usernameCell release]; - [passwordCell release]; - [urlCell release]; - [commentsCell release]; - [defaultCells release]; - [_entry release]; - [_filledCells release]; - - [super dealloc]; -} - - (void)viewDidLoad { self.tableView.sectionHeaderHeight = 0.0f; self.tableView.sectionFooterHeight = 0.0f; @@ -157,9 +143,7 @@ - (void)applicationWillResignActive:(id)sender { } - (void)setEntry:(KdbEntry *)e { - [_entry release]; - - _entry = [e retain]; + _entry = e; self.isKdb4 = [self.entry isKindOfClass:[Kdb4Entry class]]; // Update the fields @@ -262,7 +246,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated { NSArray *stringFields = ((Kdb4Entry *)self.entry).stringFields; int count = stringFields.count; if (editing) { - self.editingStringFields = [[[NSMutableArray alloc] initWithArray:stringFields copyItems:YES] autorelease]; + self.editingStringFields = [[NSMutableArray alloc] initWithArray:stringFields copyItems:YES]; } if (count == 0) { @@ -323,7 +307,6 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated { if (editing) { UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]; self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; titleCell.selectionStyle = UITableViewCellSelectionStyleNone; usernameCell.selectionStyle = UITableViewCellSelectionStyleNone; @@ -459,10 +442,8 @@ - (void)addPressed { stringFieldViewController.stringFieldViewDelegate = self; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:stringFieldViewController]; - [stringFieldViewController release]; [self.navigationController presentViewController:navController animated:YES completion:nil]; - [navController release]; } # pragma mark - Table view delegate @@ -557,22 +538,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // Return "Add new..." cell UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:AddFieldCellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 - reuseIdentifier:AddFieldCellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 + reuseIdentifier:AddFieldCellIdentifier]; cell.textLabel.textAlignment = NSTextAlignmentLeft; cell.textLabel.text = NSLocalizedString(@"Add new...", nil); // Add new cell when this cell is tapped - [cell addGestureRecognizer:[[[UITapGestureRecognizer alloc] initWithTarget:self - action:@selector(addPressed)] autorelease]]; + [cell addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self + action:@selector(addPressed)]]; } return cell; } else { TextFieldCell *cell = [tableView dequeueReusableCellWithIdentifier:TextFieldCellIdentifier]; if (cell == nil) { - cell = [[[TextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:TextFieldCellIdentifier] autorelease]; + cell = [[TextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:TextFieldCellIdentifier]; cell.textFieldCellDelegate = self; cell.textField.returnKeyType = UIReturnKeyDone; } @@ -648,7 +629,6 @@ - (void)copyCellContents:(NSIndexPath *)indexPath { } completion:^(BOOL finished) { cell.accessoryView.hidden = NO; [copiedLabel removeFromSuperview]; - [copiedLabel release]; self.tableView.allowsSelection = YES; }]; }); @@ -664,10 +644,8 @@ - (void)editStringField:(NSIndexPath *)indexPath { stringFieldViewController.stringFieldViewDelegate = self; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:stringFieldViewController]; - [stringFieldViewController release]; [self.navigationController presentViewController:navController animated:YES completion:nil]; - [navController release]; } @@ -696,7 +674,6 @@ - (void)imageButtonPressed { imageSelectionViewController.imageSelectionView.delegate = self; imageSelectionViewController.imageSelectionView.selectedImageIndex = _selectedImageIndex; [self.navigationController pushViewController:imageSelectionViewController animated:YES]; - [imageSelectionViewController release]; } } @@ -714,7 +691,7 @@ - (void)showPasswordPressed { hud.detailsLabelFont = [UIFont fontWithName:@"Andale Mono" size:24]; hud.margin = 10.f; hud.removeFromSuperViewOnHide = YES; - [hud addGestureRecognizer:[[[UITapGestureRecognizer alloc] initWithTarget:hud action:@selector(hide:)] autorelease]]; + [hud addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:hud action:@selector(hide:)]]; } #pragma mark - Password Generation @@ -726,9 +703,6 @@ - (void)generatePasswordPressed { UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:passwordGeneratorViewController]; [self presentModalViewController:navigationController animated:YES]; - - [navigationController release]; - [passwordGeneratorViewController release]; } - (void)passwordGeneratorViewController:(PasswordGeneratorViewController *)controller password:(NSString *)password { diff --git a/MiniKeePass/FilesInfoView.m b/MiniKeePass/FilesInfoView.m index 4eb14048..3e0d318b 100644 --- a/MiniKeePass/FilesInfoView.m +++ b/MiniKeePass/FilesInfoView.m @@ -65,8 +65,6 @@ - (id)initWithFrame:(CGRect)frame { containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; [containerView addSubview:imageView]; [containerView addSubview:label]; - [imageView release]; - [label release]; [self addSubview:containerView]; } @@ -91,9 +89,4 @@ - (void)layoutSubviews { containerView.frame = newFrame; } -- (void)dealloc { - [containerView dealloc]; - [super dealloc]; -} - @end diff --git a/MiniKeePass/FilesViewController.m b/MiniKeePass/FilesViewController.m index 5725b3ed..afe5c148 100644 --- a/MiniKeePass/FilesViewController.m +++ b/MiniKeePass/FilesViewController.m @@ -52,11 +52,6 @@ - (void)viewDidLoad { self.toolbarItems = [NSArray arrayWithObjects:settingsButton, spacer, helpButton, spacer, addButton, nil]; self.navigationItem.rightBarButtonItem = self.editButtonItem; - - [settingsButton release]; - [helpButton release]; - [addButton release]; - [spacer release]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -67,14 +62,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil return self; } -- (void)dealloc { - [filesInfoView release]; - [databaseFiles release]; - [keyFiles release]; - [selectedFile release]; - [super dealloc]; -} - - (void)displayInfoPage { if (filesInfoView == nil) { filesInfoView = [[FilesInfoView alloc] initWithFrame:self.view.frame]; @@ -115,9 +102,6 @@ - (void)viewWillAppear:(BOOL)animated { } - (void)updateFiles { - [databaseFiles release]; - [keyFiles release]; - // Get the document's directory NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; @@ -149,10 +133,8 @@ - (void)updateFiles { // Filter the list of files into everything not ending with .kdb or .kdbx NSArray *keyFilenames = [files filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"!((self ENDSWITH[c] '.kdb') OR (self ENDSWITH[c] '.kdbx'))"]]; - databaseFiles = [[NSMutableArray arrayWithArray:databaseFilenames] retain]; - keyFiles = [[NSMutableArray arrayWithArray:keyFilenames] retain]; - - [files release]; + databaseFiles = [NSMutableArray arrayWithArray:databaseFilenames]; + keyFiles = [NSMutableArray arrayWithArray:keyFilenames]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -209,7 +191,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } // Configure the cell @@ -246,7 +228,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.detailTextLabel.text = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Last Modified", nil), [dateFormatter stringFromDate:modificationDate]]; - [dateFormatter release]; return cell; } @@ -272,9 +253,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:textEntryController]; [appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES]; - - [navigationController release]; - [textEntryController release]; } break; default: @@ -322,8 +300,6 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd // Update the table [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; - - [filename release]; } - (void)textEntryController:(TextEntryController *)controller textEntered:(NSString *)string { @@ -333,7 +309,7 @@ - (void)textEntryController:(TextEntryController *)controller textEntered:(NSStr } NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; - NSString *oldFilename = [[databaseFiles objectAtIndex:indexPath.row] retain]; + NSString *oldFilename = [databaseFiles objectAtIndex:indexPath.row]; NSString *newFilename = [string stringByAppendingPathExtension:[oldFilename pathExtension]]; // Get the full path of where we're going to move the file @@ -347,7 +323,6 @@ - (void)textEntryController:(TextEntryController *)controller textEntered:(NSStr NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:newPath]) { [controller showErrorMessage:NSLocalizedString(@"A file already exists with this name", nil)]; - [oldFilename release]; return; } @@ -369,8 +344,6 @@ - (void)textEntryController:(TextEntryController *)controller textEntered:(NSStr [KeychainUtils deleteStringForKey:oldFilename andServiceName:@"com.jflan.MiniKeePass.passwords"]; [KeychainUtils deleteStringForKey:oldFilename andServiceName:@"com.jflan.MiniKeePass.keyfiles"]; - [oldFilename release]; - // Reload the table row [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; @@ -388,17 +361,12 @@ - (void)addPressed { UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:newKdbViewController]; [appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES]; - - [navigationController release]; - [newKdbViewController release]; } - (void)helpPressed { HelpViewController *helpViewController = [[HelpViewController alloc] init]; [self.navigationController pushViewController:helpViewController animated:YES]; - - [helpViewController release]; } - (void)formViewController:(FormViewController *)controller button:(FormViewControllerButton)button { @@ -458,9 +426,6 @@ - (void)formViewController:(FormViewController *)controller button:(FormViewCont // Create the new database [writer newFile:path withPassword:kdbPassword]; - [writer release]; - - [kdbPassword release]; // Store the password in the keychain if ([[AppSettings sharedInstance] rememberPasswordsEnabled]) { diff --git a/MiniKeePass/FormViewController.h b/MiniKeePass/FormViewController.h index 7ab604fa..5ea41d70 100644 --- a/MiniKeePass/FormViewController.h +++ b/MiniKeePass/FormViewController.h @@ -32,11 +32,11 @@ id delegate; } -@property (nonatomic, retain) NSArray *controls; +@property (nonatomic, strong) NSArray *controls; @property (nonatomic, copy) NSString *headerTitle; @property (nonatomic, copy) NSString *footerTitle; -@property (nonatomic, retain) id delegate; +@property (nonatomic, strong) id delegate; - (void)showErrorMessage:(NSString*)message; - (void)okPressed:(id)sender; diff --git a/MiniKeePass/FormViewController.m b/MiniKeePass/FormViewController.m index cd1809f1..38e00824 100644 --- a/MiniKeePass/FormViewController.m +++ b/MiniKeePass/FormViewController.m @@ -35,11 +35,9 @@ - (id)initWithStyle:(UITableViewStyle)style { UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(okPressed:)]; self.navigationItem.rightBarButtonItem = doneButton; - [doneButton release]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelPressed:)]; self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; infoBar = [[InfoBar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 20)]; infoBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; @@ -62,15 +60,6 @@ - (void)viewDidUnload { [notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil]; } -- (void)dealloc { - [controls release]; - [cells release]; - [infoBar release]; - [headerTitle release]; - [footerTitle release]; - [super dealloc]; -} - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; UITextField *textField = [controls objectAtIndex:0]; @@ -122,8 +111,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInte // Create a local array of pre-generated cells. // This has potential memory issues if a large number of cells are created, but it solves a probem with scrolling the form - (void)setControls:(NSArray *)newControls { - [controls release]; - controls = [newControls retain]; + controls = newControls; if (cells == nil) { cells = [[NSMutableArray alloc] initWithCapacity:[controls count]]; @@ -136,7 +124,7 @@ - (void)setControls:(NSArray *)newControls { if ([controlView isKindOfClass:[UITableViewCell class]]) { cell = (UITableViewCell*)controlView; } else { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil]; cell.selectionStyle = UITableViewCellSelectionStyleNone; controlView.frame = [self calculateNewFrameForView:controlView inOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; diff --git a/MiniKeePass/GroupViewController.h b/MiniKeePass/GroupViewController.h index 2caec5ce..689c2a46 100644 --- a/MiniKeePass/GroupViewController.h +++ b/MiniKeePass/GroupViewController.h @@ -35,6 +35,6 @@ NSComparisonResult (^entryComparator) (id obj1, id obj2); } -@property (nonatomic, assign) KdbGroup *group; +@property (nonatomic, weak) KdbGroup *group; @end diff --git a/MiniKeePass/GroupViewController.m b/MiniKeePass/GroupViewController.m index 11c935df..216fc7c3 100644 --- a/MiniKeePass/GroupViewController.m +++ b/MiniKeePass/GroupViewController.m @@ -37,19 +37,19 @@ - (NSUInteger)updatePositionOfObjectAtIndex:(NSUInteger)index inArray:(NSMutable - (NSUInteger)updatePositionOfObject:object inArray:array; @property (nonatomic, assign) BOOL selectMultipleWhileEditing; -@property (nonatomic, retain) NSArray *standardToolbarItems; +@property (nonatomic, strong) NSArray *standardToolbarItems; -@property (nonatomic, retain) UIBarButtonItem *deleteButton; +@property (nonatomic, strong) UIBarButtonItem *deleteButton; @property (nonatomic, copy) NSString *deleteButtonTitle; -@property (nonatomic, retain) UIBarButtonItem *moveButton; +@property (nonatomic, strong) UIBarButtonItem *moveButton; @property (nonatomic, copy) NSString *moveButtonTitle; -@property (nonatomic, retain) UIBarButtonItem *renameButton; +@property (nonatomic, strong) UIBarButtonItem *renameButton; @property (nonatomic, copy) NSString *renameButtonTitle; @property (nonatomic, assign) CGFloat currentButtonWidth; -@property (nonatomic, retain) UIBarButtonItem *settingsButton; -@property (nonatomic, retain) UIBarButtonItem *actionButton; -@property (nonatomic, retain) UIBarButtonItem *addButton; +@property (nonatomic, strong) UIBarButtonItem *settingsButton; +@property (nonatomic, strong) UIBarButtonItem *actionButton; +@property (nonatomic, strong) UIBarButtonItem *addButton; @end @@ -76,14 +76,12 @@ - (id)init { searchDisplayController.searchResultsDelegate = self; searchDisplayController.delegate = self; - [searchBar release]; - - self.settingsButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear"] style:UIBarButtonItemStylePlain target:appDelegate action:@selector(showSettingsView)] autorelease]; + self.settingsButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear"] style:UIBarButtonItemStylePlain target:appDelegate action:@selector(showSettingsView)]; self.settingsButton.imageInsets = UIEdgeInsetsMake(2, 0, -2, 0); - self.actionButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(exportFilePressed)] autorelease]; + self.actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(exportFilePressed)]; - self.addButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPressed)] autorelease]; + self.addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPressed)]; UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; @@ -91,8 +89,6 @@ - (id)init { self.toolbarItems = self.standardToolbarItems; self.navigationItem.rightBarButtonItem = self.editButtonItem; - [spacer release]; - results = [[NSMutableArray alloc] init]; sortingEnabled = [[AppSettings sharedInstance] sortAlphabetically]; @@ -113,26 +109,6 @@ - (id)init { return self; } -- (void)dealloc { - [searchDisplayController release]; - [groupsArray release]; - [enteriesArray release]; - [pushedKdbTitle release]; - [results release]; - [group release]; - [_standardToolbarItems release]; - [_deleteButton release]; - [_deleteButtonTitle release]; - [_moveButton release]; - [_moveButtonTitle release]; - [_renameButton release]; - [_renameButtonTitle release]; - [_settingsButton release]; - [_actionButton release]; - [_addButton release]; - [super dealloc]; -} - - (void)viewWillAppear:(BOOL)animated { NSArray *selectedIndexPaths = [self.tableView indexPathsForSelectedRows]; if ([selectedIndexPaths count] > 1) { @@ -267,9 +243,9 @@ - (void)deleteSelectedItems { } - (void)moveSelectedItems { - ChooseGroupViewController *chooseGroupViewController = [[[ChooseGroupViewController alloc] initWithStyle:UITableViewStylePlain] autorelease]; + ChooseGroupViewController *chooseGroupViewController = [[ChooseGroupViewController alloc] initWithStyle:UITableViewStylePlain]; chooseGroupViewController.delegate = self; - UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:chooseGroupViewController] autorelease]; + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:chooseGroupViewController]; [appDelegate.window.rootViewController presentModalViewController:navController animated:YES]; } @@ -385,7 +361,6 @@ - (void)setSeachBar:(UISearchBar *)searchBar enabled:(BOOL)enabled { overlayView.alpha = 0.0; } completion:^(BOOL finished) { [overlayView removeFromSuperview]; - [overlayView release]; overlayView = nil; }]; } else { @@ -416,22 +391,22 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated { [self setSeachBar:self.searchDisplayController.searchBar enabled:NO]; self.deleteButtonTitle = NSLocalizedString(@"Delete", nil); - self.deleteButton = [[[UIBarButtonItem alloc] initWithTitle:self.deleteButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(deleteSelectedItems)] autorelease]; + self.deleteButton = [[UIBarButtonItem alloc] initWithTitle:self.deleteButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(deleteSelectedItems)]; self.deleteButton.tintColor = [UIColor colorWithRed:0.8 green:0.15 blue:0.15 alpha:1]; self.deleteButton.width = self.currentButtonWidth; self.deleteButton.enabled = NO; self.moveButtonTitle = NSLocalizedString(@"Move", nil); - self.moveButton = [[[UIBarButtonItem alloc] initWithTitle:self.moveButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(moveSelectedItems)] autorelease]; + self.moveButton = [[UIBarButtonItem alloc] initWithTitle:self.moveButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(moveSelectedItems)]; self.moveButton.width = self.currentButtonWidth; self.moveButton.enabled = NO; self.renameButtonTitle = NSLocalizedString(@"Rename", nil); - self.renameButton = [[[UIBarButtonItem alloc] initWithTitle:self.renameButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(renameSelectedItem)] autorelease]; + self.renameButton = [[UIBarButtonItem alloc] initWithTitle:self.renameButtonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(renameSelectedItem)]; self.renameButton.width = self.currentButtonWidth; self.renameButton.enabled = NO; - UIBarButtonItem *spacer = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease]; + UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; self.toolbarItems = @[self.deleteButton, spacer, self.moveButton, spacer, self.renameButton]; } else { @@ -473,8 +448,7 @@ - (KdbGroup *)group { - (void)setGroup:(KdbGroup *)newGroup { if (group != newGroup) { - [group release]; - group = [newGroup retain]; + group = newGroup; [self updateLocalArrays]; @@ -483,9 +457,6 @@ - (void)setGroup:(KdbGroup *)newGroup { } - (void)updateLocalArrays { - [groupsArray release]; - [enteriesArray release]; - groupsArray = [[NSMutableArray alloc] initWithArray:group.groups]; enteriesArray = [[NSMutableArray alloc] initWithArray:group.entries]; @@ -574,7 +545,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } @@ -627,9 +598,6 @@ - (void)renameItemAtIndexPath:(NSIndexPath *)indexPath { UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:renameItemViewController]; [appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES]; - - [navigationController release]; - [renameItemViewController release]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -641,7 +609,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath entryViewController.entry = e; entryViewController.title = e.title; [self.navigationController pushViewController:entryViewController animated:YES]; - [entryViewController release]; } else { if (self.editing == NO) { if (indexPath.section == GROUPS_SECTION) { @@ -651,11 +618,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath groupViewController.group = g; groupViewController.title = g.name; - [pushedKdbTitle release]; pushedKdbTitle = [g.name copy]; [self.navigationController pushViewController:groupViewController animated:YES]; - [groupViewController release]; } else if (indexPath.section == ENTRIES_SECTION) { KdbEntry *e = [enteriesArray objectAtIndex:indexPath.row]; @@ -663,11 +628,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath entryViewController.entry = e; entryViewController.title = e.title; - [pushedKdbTitle release]; pushedKdbTitle = [e.title copy]; [self.navigationController pushViewController:entryViewController animated:YES]; - [entryViewController release]; } } else if (indexPath.section == GROUPS_SECTION && !self.selectMultipleWhileEditing) { [self renameItemAtIndexPath:indexPath]; @@ -764,7 +727,6 @@ - (void)exportFilePressed { NSString *prompt = NSLocalizedString(@"There are no applications installed capable of importing KeePass files", nil); UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:prompt delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) destructiveButtonTitle:nil otherButtonTitles:nil]; [appDelegate showActionSheet:actionSheet]; - [actionSheet release]; } } @@ -778,7 +740,6 @@ - (void)addPressed { actionSheet.delegate = self; [appDelegate showActionSheet:actionSheet]; - [actionSheet release]; } - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { @@ -807,9 +768,6 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger [appDelegate.window.rootViewController presentModalViewController:navigationController animated:YES]; - [navigationController release]; - [editGroupViewController release]; - // Notify the table of the new row NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:GROUPS_SECTION]; if ([groupsArray count] == 1) { @@ -838,7 +796,6 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger entryViewController.title = e.title; entryViewController.isNewEntry = YES; [self.navigationController pushViewController:entryViewController animated:YES]; - [entryViewController release]; // Notify the table of the new row NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:ENTRIES_SECTION]; @@ -887,7 +844,7 @@ - (NSUInteger)updatePositionOfObjectAtIndex:(NSUInteger)index inArray:(NSMutable return index; } - id object = [[array objectAtIndex:index] retain]; + id object = [array objectAtIndex:index]; [array removeObjectAtIndex:index]; NSUInteger newIndex = [self addObject:object toArray:array]; @@ -897,7 +854,6 @@ - (NSUInteger)updatePositionOfObjectAtIndex:(NSUInteger)index inArray:(NSMutable [array insertObject:object atIndex:index]; } - [object release]; return newIndex; } diff --git a/MiniKeePass/ImageButtonCell.h b/MiniKeePass/ImageButtonCell.h index 40167410..c6e372c3 100644 --- a/MiniKeePass/ImageButtonCell.h +++ b/MiniKeePass/ImageButtonCell.h @@ -21,7 +21,7 @@ UIButton *imageButton; } -@property (nonatomic, retain) UIButton *imageButton; +@property (nonatomic, strong) UIButton *imageButton; - (id)initWithLabel:(NSString*)labelText; diff --git a/MiniKeePass/ImageButtonCell.m b/MiniKeePass/ImageButtonCell.m index 370ae41e..088676ba 100644 --- a/MiniKeePass/ImageButtonCell.m +++ b/MiniKeePass/ImageButtonCell.m @@ -36,9 +36,4 @@ - (id)initWithLabel:(NSString*)labelText { return self; } -- (void)dealloc { - [imageButton release]; - [super dealloc]; -} - @end diff --git a/MiniKeePass/ImageSelectionView.h b/MiniKeePass/ImageSelectionView.h index 2a8e3762..ba593dfb 100644 --- a/MiniKeePass/ImageSelectionView.h +++ b/MiniKeePass/ImageSelectionView.h @@ -22,7 +22,7 @@ @interface ImageSelectionView : UIView @property (nonatomic, assign) NSUInteger selectedImageIndex; -@property (nonatomic, assign) id delegate; +@property (nonatomic, unsafe_unretained) id delegate; @end diff --git a/MiniKeePass/ImageSelectionView.m b/MiniKeePass/ImageSelectionView.m index 64287fbc..649926fb 100644 --- a/MiniKeePass/ImageSelectionView.m +++ b/MiniKeePass/ImageSelectionView.m @@ -46,7 +46,6 @@ - (id)init { UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [self addSubview:imageView]; [imageViews addObject:imageView]; - [imageView release]; } UIImage *selectedImage = [UIImage imageNamed:@"checkmark"]; @@ -56,17 +55,10 @@ - (id)init { UITapGestureRecognizer *tapGestureRecgonizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; [self addGestureRecognizer:tapGestureRecgonizer]; - [tapGestureRecgonizer release]; } return self; } -- (void)dealloc { - [imageViews release]; - [selectedImageView release]; - [super dealloc]; -} - - (void)layoutSubviews { UIScrollView *scrollView = (UIScrollView *)self.superview; diff --git a/MiniKeePass/ImageSelectionViewController.m b/MiniKeePass/ImageSelectionViewController.m index 32c41fb1..6de46687 100644 --- a/MiniKeePass/ImageSelectionViewController.m +++ b/MiniKeePass/ImageSelectionViewController.m @@ -34,16 +34,10 @@ - (id)init { scrollView.alwaysBounceHorizontal = NO; [scrollView addSubview:_imageSelectionView]; self.view = scrollView; - [scrollView release]; } return self; } -- (void)dealloc { - [_imageSelectionView release]; - [super dealloc]; -} - - (ImageSelectionView *)imageSelectionView { return _imageSelectionView; } diff --git a/MiniKeePass/InfoBar.m b/MiniKeePass/InfoBar.m index 9e608cb5..1f2b535b 100644 --- a/MiniKeePass/InfoBar.m +++ b/MiniKeePass/InfoBar.m @@ -43,11 +43,6 @@ - (id)initWithFrame:(CGRect)frame { return self; } -- (void)dealloc { - [label release]; - [super dealloc]; -} - - (void)showBar { if (self.hidden) { self.hidden = NO; diff --git a/MiniKeePass/LengthCell.h b/MiniKeePass/LengthCell.h index 6456cc1b..564e66cf 100644 --- a/MiniKeePass/LengthCell.h +++ b/MiniKeePass/LengthCell.h @@ -24,9 +24,9 @@ id delegate; } -@property (nonatomic, retain) id delegate; -@property (nonatomic, retain) UIView *inputView; -@property (nonatomic, retain) UIView *inputAccessoryView; +@property (nonatomic, strong) id delegate; +@property (nonatomic, strong) UIView *inputView; +@property (nonatomic, strong) UIView *inputAccessoryView; - (void)setLength:(NSInteger)length; diff --git a/MiniKeePass/LengthCell.m b/MiniKeePass/LengthCell.m index f23da547..bd18f75c 100644 --- a/MiniKeePass/LengthCell.m +++ b/MiniKeePass/LengthCell.m @@ -45,23 +45,12 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(resignFirstResponder)]; toolbar.items = [NSArray arrayWithObjects:flexibleSpace, doneButton, nil]; - [flexibleSpace release]; - [doneButton release]; self.inputAccessoryView = toolbar; - [toolbar release]; } return self; } -- (void)dealloc { - [pickerView release]; - [delegate release]; - [inputView release]; - [inputAccessoryView release]; - [super dealloc]; -} - - (void)setLength:(NSInteger)length { self.detailTextLabel.text = [[NSNumber numberWithInteger:length] stringValue]; diff --git a/MiniKeePass/LockScreenController.m b/MiniKeePass/LockScreenController.m index 0cfd754b..a1f68b4a 100644 --- a/MiniKeePass/LockScreenController.m +++ b/MiniKeePass/LockScreenController.m @@ -44,7 +44,6 @@ - (id)init { UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.frame]; imageView.image = [[UIImage imageNamed:@"stretchme"] stretchableImageWithLeftCapWidth:0 topCapHeight:44]; self.view = imageView; - [imageView release]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self @@ -57,8 +56,6 @@ - (id)init { - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [pinViewController release]; - [super dealloc]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { @@ -86,7 +83,6 @@ - (void)show { + (void)present { LockScreenController *pinScreen = [[LockScreenController alloc] init]; [pinScreen show]; - [pinScreen release]; } - (void)hide { diff --git a/MiniKeePass/MiniKeePassAppDelegate.h b/MiniKeePass/MiniKeePassAppDelegate.h index b66f03ba..d4559d40 100644 --- a/MiniKeePass/MiniKeePassAppDelegate.h +++ b/MiniKeePass/MiniKeePassAppDelegate.h @@ -23,8 +23,8 @@ @interface MiniKeePassAppDelegate : NSObject -@property (nonatomic, retain) UIWindow *window; -@property (nonatomic, retain) DatabaseDocument *databaseDocument; +@property (nonatomic, strong) UIWindow *window; +@property (nonatomic, strong) DatabaseDocument *databaseDocument; @property (nonatomic, assign) BOOL locked; @property (nonatomic, readonly) BOOL backgroundSupported; diff --git a/MiniKeePass/MiniKeePassAppDelegate.m b/MiniKeePass/MiniKeePassAppDelegate.m index b0c9df8a..de2d8054 100644 --- a/MiniKeePass/MiniKeePassAppDelegate.m +++ b/MiniKeePass/MiniKeePassAppDelegate.m @@ -48,7 +48,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( _databaseDocument = nil; // Create the files view - FilesViewController *filesViewController = [[[FilesViewController alloc] initWithStyle:UITableViewStylePlain] autorelease]; + FilesViewController *filesViewController = [[FilesViewController alloc] initWithStyle:UITableViewStylePlain]; navigationController = [[UINavigationController alloc] initWithRootViewController:filesViewController]; navigationController.toolbarHidden = NO; @@ -77,13 +77,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( - (void)dealloc { int i; for (i = 0; i < NUM_IMAGES; i++) { - [images[i] release]; + images[i] = nil; // FIXME ARC converter recommened deleting this logic, but it seemed unsafe to me -JFF } - [_databaseDocument release]; - [_fileToOpen release]; - [_window release]; - [navigationController release]; - [super dealloc]; } - (void)applicationDidEnterBackground:(UIApplication *)application { @@ -180,21 +175,19 @@ - (void)setDatabaseDocument:(DatabaseDocument *)newDatabaseDocument { [self closeDatabase]; } - _databaseDocument = [newDatabaseDocument retain]; + _databaseDocument = newDatabaseDocument; // Create and push on the root group view controller GroupViewController *groupViewController = [[GroupViewController alloc] init]; groupViewController.title = [[_databaseDocument.filename lastPathComponent] stringByDeletingPathExtension]; groupViewController.group = _databaseDocument.kdbTree.root; [navigationController pushViewController:groupViewController animated:YES]; - [groupViewController release]; } - (void)closeDatabase { // Close any open database views [navigationController popToRootViewControllerAnimated:NO]; - [_databaseDocument release]; _databaseDocument = nil; } @@ -260,7 +253,7 @@ - (UIImage *)loadImage:(NSUInteger)index { } if (images[index] == nil) { - images[index] = [[UIImage imageNamed:[NSString stringWithFormat:@"%d", index]] retain]; + images[index] = [UIImage imageNamed:[NSString stringWithFormat:@"%d", index]]; } return images[index]; @@ -311,15 +304,11 @@ - (void)showSettingsView { UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissSettingsView)]; settingsViewController.navigationItem.rightBarButtonItem = doneButton; - [doneButton release]; UINavigationController *settingsNavController = [[UINavigationController alloc] initWithRootViewController:settingsViewController]; settingsNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self.window.rootViewController presentModalViewController:settingsNavController animated:YES]; - - [settingsViewController release]; - [settingsNavController release]; } - (void)dismissSettingsView { @@ -331,12 +320,11 @@ - (void)showActionSheet:(UIActionSheet *)actionSheet { [myActionSheet dismissWithClickedButtonIndex:myActionSheet.cancelButtonIndex animated:NO]; } - myActionSheet = [actionSheet retain]; + myActionSheet = actionSheet; myActionSheetDelegate = actionSheet.delegate; actionSheet.delegate = self; [actionSheet showInView:self.window.rootViewController.view]; - [actionSheet release]; } - (void)dismissActionSheet { diff --git a/MiniKeePass/NewKdbViewController.m b/MiniKeePass/NewKdbViewController.m index 3ef52234..74d62847 100644 --- a/MiniKeePass/NewKdbViewController.m +++ b/MiniKeePass/NewKdbViewController.m @@ -71,14 +71,6 @@ - (id)initWithStyle:(UITableViewStyle)style { return self; } -- (void)dealloc { - [nameTextField release]; - [passwordTextField1 release]; - [passwordTextField2 release]; - [versionSegmentedControl release]; - [super dealloc]; -} - - (void)textFieldDidBeginEditing:(UITextField *)textField { CGPoint point = [self.tableView convertPoint:CGPointZero fromView:textField]; UITableViewCell *cell =[self.tableView cellForRowAtIndexPath:[self.tableView indexPathForRowAtPoint:point]]; diff --git a/MiniKeePass/PasswordGeneratorViewController.h b/MiniKeePass/PasswordGeneratorViewController.h index f186cfcf..5c27d079 100644 --- a/MiniKeePass/PasswordGeneratorViewController.h +++ b/MiniKeePass/PasswordGeneratorViewController.h @@ -33,7 +33,7 @@ NSInteger charSets; } -@property (nonatomic, retain) id delegate; +@property (nonatomic, strong) id delegate; - (id)init; - (void)generatePassword; diff --git a/MiniKeePass/PasswordGeneratorViewController.m b/MiniKeePass/PasswordGeneratorViewController.m index 2fc7fb77..7f08115e 100644 --- a/MiniKeePass/PasswordGeneratorViewController.m +++ b/MiniKeePass/PasswordGeneratorViewController.m @@ -57,11 +57,9 @@ - (id)init { UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(donePressed)]; self.navigationItem.rightBarButtonItem = doneButton; - [doneButton release]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]; self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; lengthCell = [[LengthCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; lengthCell.delegate = self; @@ -85,13 +83,6 @@ - (id)init { return self; } -- (void)dealloc { - [lengthCell release]; - [characterSetsCell release]; - [passwordCell release]; - [super dealloc]; -} - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; @@ -162,8 +153,6 @@ - (void)generatePassword { [password appendString:[charSet substringWithRange:NSMakeRange(idx, 1)]]; } - [cryptoRandomStream release]; - passwordCell.textLabel.text = password; [passwordCell setNeedsLayout]; } @@ -240,7 +229,7 @@ - (NSString *)createCharSetsDescription { [str appendString:NSLocalizedString(@"None Selected", nil)]; } - return [str autorelease]; + return str; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { @@ -295,7 +284,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if (indexPath.section == SECTION_SETTINGS && indexPath.row == ROW_SETTINGS_CHARSET) { CharacterSetsViewController *characterSetViewController = [[CharacterSetsViewController alloc] init]; [self.navigationController pushViewController:characterSetViewController animated:YES]; - [characterSetViewController release]; } } diff --git a/MiniKeePass/PasswordViewController.m b/MiniKeePass/PasswordViewController.m index 2f84ffc3..dd6732ce 100644 --- a/MiniKeePass/PasswordViewController.m +++ b/MiniKeePass/PasswordViewController.m @@ -57,12 +57,6 @@ - (id)initWithFilename:(NSString*)filename { return self; } -- (void)dealloc { - [passwordTextField release]; - [keyFileCell release]; - [super dealloc]; -} - - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; @@ -77,7 +71,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.selectedIndex = keyFileCell.selectedIndex; selectionListViewController.delegate = self; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } } diff --git a/MiniKeePass/PinTextField.h b/MiniKeePass/PinTextField.h index 4a34fd2f..128ef045 100644 --- a/MiniKeePass/PinTextField.h +++ b/MiniKeePass/PinTextField.h @@ -21,6 +21,6 @@ UILabel *label; } -@property (nonatomic, retain) UILabel *label; +@property (nonatomic, strong) UILabel *label; @end diff --git a/MiniKeePass/PinTextField.m b/MiniKeePass/PinTextField.m index 8f4e6c78..a0c7630a 100644 --- a/MiniKeePass/PinTextField.m +++ b/MiniKeePass/PinTextField.m @@ -36,9 +36,4 @@ - (id)initWithFrame:(CGRect)frame { return self; } -- (void)dealloc { - [label release]; - [super dealloc]; -} - @end diff --git a/MiniKeePass/PinViewController.h b/MiniKeePass/PinViewController.h index 09601aa6..ba310492 100644 --- a/MiniKeePass/PinViewController.h +++ b/MiniKeePass/PinViewController.h @@ -27,7 +27,7 @@ - (void)keyboardDidHide; @property (nonatomic, copy) UILabel *textLabel; -@property (nonatomic, assign) id delegate; +@property (nonatomic, unsafe_unretained) id delegate; @end diff --git a/MiniKeePass/PinViewController.m b/MiniKeePass/PinViewController.m index 11975d61..714653b4 100644 --- a/MiniKeePass/PinViewController.m +++ b/MiniKeePass/PinViewController.m @@ -95,18 +95,12 @@ - (id)initWithText:(NSString*)text { PinTextField *pinTextField4 = [[PinTextField alloc] initWithFrame:CGRectMake(xOrigin, 0, PINTEXTFIELDWIDTH, PINTEXTFIELDHEIGHT)]; [textFieldsView addSubview:pinTextField4]; - pinTextFields = [[NSArray arrayWithObjects:pinTextField1, pinTextField2, pinTextField3, pinTextField4, nil] retain]; - - [pinTextField1 release]; - [pinTextField2 release]; - [pinTextField3 release]; - [pinTextField4 release]; + pinTextFields = [NSArray arrayWithObjects:pinTextField1, pinTextField2, pinTextField3, pinTextField4, nil]; pinBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, frameWidth, 95)]; pinBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; [pinBar setBarStyle:UIBarStyleBlackTranslucent]; [pinBar addSubview:textFieldsView]; - [textFieldsView release]; textField.inputAccessoryView = pinBar; @@ -120,15 +114,6 @@ - (id)initWithText:(NSString*)text { return self; } -- (void)dealloc { - [topBar release]; - [pinBar release]; - [textField release]; - [pinTextFields release]; - [_textLabel release]; - [super dealloc]; -} - - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { if ([self.delegate respondsToSelector:@selector(pinViewControllerShouldAutorotateToInterfaceOrientation:)]) { return [self.delegate pinViewControllerShouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; diff --git a/MiniKeePass/SelectionListViewController.h b/MiniKeePass/SelectionListViewController.h index df56502d..b9794972 100644 --- a/MiniKeePass/SelectionListViewController.h +++ b/MiniKeePass/SelectionListViewController.h @@ -27,10 +27,10 @@ id reference; } -@property (nonatomic, retain) NSArray *items; +@property (nonatomic, strong) NSArray *items; @property (nonatomic) NSInteger selectedIndex; -@property (nonatomic, retain) id delegate; -@property (nonatomic, retain) id reference; +@property (nonatomic, strong) id delegate; +@property (nonatomic, strong) id reference; @end diff --git a/MiniKeePass/SelectionListViewController.m b/MiniKeePass/SelectionListViewController.m index ec1f0245..7237a703 100644 --- a/MiniKeePass/SelectionListViewController.m +++ b/MiniKeePass/SelectionListViewController.m @@ -24,13 +24,6 @@ @implementation SelectionListViewController @synthesize delegate; @synthesize reference; -- (void)dealloc { - [items release]; - [delegate release]; - [reference release]; - [super dealloc]; -} - - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } @@ -44,7 +37,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell diff --git a/MiniKeePass/SettingsViewController.m b/MiniKeePass/SettingsViewController.m index c944f4d9..8d6dea24 100644 --- a/MiniKeePass/SettingsViewController.m +++ b/MiniKeePass/SettingsViewController.m @@ -187,32 +187,14 @@ - (void)viewDidLoad { versionLabel.shadowOffset = CGSizeMake(0.0, 1.0); [tableFooterView addSubview:versionLabel]; - [versionLabel release]; self.tableView.tableFooterView = tableFooterView; - [tableFooterView release]; -} - -- (void)dealloc { - [pinEnabledCell release]; - [pinLockTimeoutCell release]; - [deleteOnFailureEnabledCell release]; - [deleteOnFailureAttemptsCell release]; - [closeEnabledCell release]; - [closeTimeoutCell release]; - [rememberPasswordsEnabledCell release]; - [hidePasswordsCell release]; - [passwordEncodingCell release]; - [clearClipboardEnabledCell release]; - [clearClipboardTimeoutCell release]; - [super dealloc]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Delete the temp pin - [tempPin release]; tempPin = nil; // Initialize all the controls with their settings @@ -429,7 +411,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.delegate = self; selectionListViewController.reference = indexPath; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } else if (indexPath.section == SECTION_DELETE_ON_FAILURE && indexPath.row == ROW_DELETE_ON_FAILURE_ATTEMPTS && deleteOnFailureEnabledCell.switchControl.on) { SelectionListViewController *selectionListViewController = [[SelectionListViewController alloc] initWithStyle:UITableViewStyleGrouped]; selectionListViewController.title = NSLocalizedString(@"Attempts", nil); @@ -438,7 +419,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.delegate = self; selectionListViewController.reference = indexPath; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } else if (indexPath.section == SECTION_CLOSE && indexPath.row == ROW_CLOSE_TIMEOUT && closeEnabledCell.switchControl.on) { SelectionListViewController *selectionListViewController = [[SelectionListViewController alloc] initWithStyle:UITableViewStyleGrouped]; selectionListViewController.title = NSLocalizedString(@"Close Timeout", nil); @@ -447,7 +427,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.delegate = self; selectionListViewController.reference = indexPath; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } else if (indexPath.section == SECTION_PASSWORD_ENCODING && indexPath.row == ROW_PASSWORD_ENCODING_VALUE) { SelectionListViewController *selectionListViewController = [[SelectionListViewController alloc] initWithStyle:UITableViewStyleGrouped]; selectionListViewController.title = NSLocalizedString(@"Password Encoding", nil); @@ -456,7 +435,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.delegate = self; selectionListViewController.reference = indexPath; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } else if (indexPath.section == SECTION_CLEAR_CLIPBOARD && indexPath.row == ROW_CLEAR_CLIPBOARD_TIMEOUT && clearClipboardEnabledCell.switchControl.on) { SelectionListViewController *selectionListViewController = [[SelectionListViewController alloc] initWithStyle:UITableViewStyleGrouped]; selectionListViewController.title = NSLocalizedString(@"Clear Clipboard Timeout", nil); @@ -465,7 +443,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath selectionListViewController.delegate = self; selectionListViewController.reference = indexPath; [self.navigationController pushViewController:selectionListViewController animated:YES]; - [selectionListViewController release]; } } @@ -510,7 +487,6 @@ - (void)togglePinEnabled:(id)sender { [pinViewController becomeFirstResponder]; pinViewController.delegate = self; [self presentModalViewController:pinViewController animated:YES]; - [pinViewController release]; } else { // Delete the PIN and disable the PIN enabled setting [KeychainUtils deleteStringForKey:@"PIN" andServiceName:@"com.jflan.MiniKeePass.pin"]; @@ -573,7 +549,6 @@ - (void)pinViewController:(PinViewController *)controller pinEntered:(NSString * // Clear the PIN entry for confirmation [controller clearEntry]; } else if ([tempPin isEqualToString:pin]) { - [tempPin release]; tempPin = nil; // Set the PIN and enable the PIN enabled setting @@ -586,7 +561,6 @@ - (void)pinViewController:(PinViewController *)controller pinEntered:(NSString * // Remove the PIN view [self dismissModalViewControllerAnimated:YES]; } else { - [tempPin release]; tempPin = nil; // Notify the user the PINs they entered did not match diff --git a/MiniKeePass/StringFieldViewController.h b/MiniKeePass/StringFieldViewController.h index e5cf02bc..d6009ba8 100644 --- a/MiniKeePass/StringFieldViewController.h +++ b/MiniKeePass/StringFieldViewController.h @@ -23,13 +23,13 @@ @interface StringFieldViewController : FormViewController -@property (nonatomic, retain) StringField *stringField; +@property (nonatomic, strong) StringField *stringField; @property (nonatomic, readonly) UITextField *keyTextField; @property (nonatomic, readonly) UITextField *valueTextField; @property (nonatomic, readonly) SwitchCell *protectedSwitchCell; -@property (nonatomic, retain) id object; -@property (nonatomic, retain) id stringFieldViewDelegate; +@property (nonatomic, strong) id object; +@property (nonatomic, strong) id stringFieldViewDelegate; // FIXME should this be weak / unretained_whatever? - (id)initWithStringField:(StringField *)stringField; diff --git a/MiniKeePass/StringFieldViewController.m b/MiniKeePass/StringFieldViewController.m index 027314b2..8e0d43eb 100644 --- a/MiniKeePass/StringFieldViewController.m +++ b/MiniKeePass/StringFieldViewController.m @@ -22,7 +22,7 @@ @implementation StringFieldViewController - (id)initWithStringField:(StringField *)stringField { self = [super initWithStyle:UITableViewStyleGrouped]; if (self) { - _stringField = [stringField retain]; + _stringField = stringField; self.title = NSLocalizedString(@"Custom Field", nil); @@ -49,16 +49,6 @@ - (id)initWithStringField:(StringField *)stringField { return self; } -- (void)dealloc { - [_stringField release]; - [_keyTextField release]; - [_valueTextField release]; - [_protectedSwitchCell release]; - [_object release]; - [_stringFieldViewDelegate release]; - [super dealloc]; -} - - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == _keyTextField) { [_valueTextField becomeFirstResponder]; @@ -75,7 +65,6 @@ - (void)okPressed:(id)sender { NSString *ok = NSLocalizedString(@"OK", nil); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:ok otherButtonTitles:nil]; [alert show]; - [alert release]; return; } diff --git a/MiniKeePass/SwitchCell.h b/MiniKeePass/SwitchCell.h index fbc18226..6c9c5518 100644 --- a/MiniKeePass/SwitchCell.h +++ b/MiniKeePass/SwitchCell.h @@ -21,7 +21,7 @@ UISwitch *switchControl; } -@property (nonatomic, retain) UISwitch *switchControl; +@property (nonatomic, strong) UISwitch *switchControl; - (id)initWithLabel:(NSString*)labelText; - (void)setEnabled:(BOOL)enabled; diff --git a/MiniKeePass/SwitchCell.m b/MiniKeePass/SwitchCell.m index f4ddb497..df9d86c7 100644 --- a/MiniKeePass/SwitchCell.m +++ b/MiniKeePass/SwitchCell.m @@ -36,11 +36,6 @@ - (id)initWithLabel:(NSString*)labelText { return self; } -- (void)dealloc { - [switchControl release]; - [super dealloc]; -} - - (void)setEnabled:(BOOL)enabled { self.textLabel.enabled = enabled; self.switchControl.enabled = enabled; diff --git a/MiniKeePass/TextEntryController.h b/MiniKeePass/TextEntryController.h index f2d8e0d4..4aa0c8c1 100644 --- a/MiniKeePass/TextEntryController.h +++ b/MiniKeePass/TextEntryController.h @@ -26,7 +26,7 @@ } @property (nonatomic, readonly) UITextField *textField; -@property (nonatomic, retain) id textEntryDelegate; +@property (nonatomic, strong) id textEntryDelegate; @end diff --git a/MiniKeePass/TextEntryController.m b/MiniKeePass/TextEntryController.m index 1e6680de..d04a05eb 100644 --- a/MiniKeePass/TextEntryController.m +++ b/MiniKeePass/TextEntryController.m @@ -37,12 +37,6 @@ - (id)initWithStyle:(UITableViewStyle)style { return self; } -- (void)dealloc { - [textField release]; - [textEntryDelegate release]; - [super dealloc]; -} - - (void)formViewController:(FormViewController *)controller button:(FormViewControllerButton)button { if (button == FormViewControllerButtonOk) { if ([textEntryDelegate respondsToSelector:@selector(textEntryController:textEntered:)]) { diff --git a/MiniKeePass/TextFieldCell.h b/MiniKeePass/TextFieldCell.h index f4666880..d10fe7e7 100644 --- a/MiniKeePass/TextFieldCell.h +++ b/MiniKeePass/TextFieldCell.h @@ -23,11 +23,11 @@ @interface TextFieldCell : UITableViewCell @property (nonatomic, copy) NSString *title; -@property (nonatomic, retain) UITextField *textField; -@property (nonatomic, assign) id textFieldCellDelegate; +@property (nonatomic, strong) UITextField *textField; +@property (nonatomic, unsafe_unretained) id textFieldCellDelegate; -@property (nonatomic, retain) UIButton *accessoryButton; -@property (nonatomic, retain) UIButton *editAccessoryButton; +@property (nonatomic, strong) UIButton *accessoryButton; +@property (nonatomic, strong) UIButton *editAccessoryButton; @property (nonatomic, assign) BOOL showGrayBar; diff --git a/MiniKeePass/TextFieldCell.m b/MiniKeePass/TextFieldCell.m index a9e8c22d..41b081e6 100644 --- a/MiniKeePass/TextFieldCell.m +++ b/MiniKeePass/TextFieldCell.m @@ -21,7 +21,7 @@ #define INSET 83 @interface TextFieldCell() -@property (nonatomic, retain) UIView *grayBar; +@property (nonatomic, strong) UIView *grayBar; @end @implementation TextFieldCell @@ -58,16 +58,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus return self; } -- (void)dealloc { - [_textField release]; - [_grayBar release]; - _textFieldCellDelegate = nil; - - [_accessoryButton release]; - [_editAccessoryButton release]; - [super dealloc]; -} - - (BOOL)showGrayBar { return !self.grayBar.hidden; } @@ -77,18 +67,12 @@ - (void)setShowGrayBar:(BOOL)showGrayBar { } - (void)setAccessoryButton:(UIButton *)accessoryButton { - if (self.accessoryButton != nil) { - [_accessoryButton release]; - } - _accessoryButton = [accessoryButton retain]; + _accessoryButton = accessoryButton; self.accessoryView = accessoryButton; } - (void)setEditAccessoryButton:(UIButton *)editAccessoryButton { - if (self.editAccessoryButton != nil) { - [_editAccessoryButton release]; - } - _editAccessoryButton = [editAccessoryButton retain]; + _editAccessoryButton = editAccessoryButton; self.editingAccessoryView = editAccessoryButton; } diff --git a/MiniKeePass/TextViewCell.h b/MiniKeePass/TextViewCell.h index bfab6320..ca9af71e 100644 --- a/MiniKeePass/TextViewCell.h +++ b/MiniKeePass/TextViewCell.h @@ -21,6 +21,6 @@ UITextView *textView; } -@property (nonatomic, retain) UITextView *textView; +@property (nonatomic, strong) UITextView *textView; @end diff --git a/MiniKeePass/TextViewCell.m b/MiniKeePass/TextViewCell.m index e594dd13..3f8575e1 100644 --- a/MiniKeePass/TextViewCell.m +++ b/MiniKeePass/TextViewCell.m @@ -35,11 +35,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus return self; } -- (void)dealloc { - [textView release]; - [super dealloc]; -} - - (void)layoutSubviews { [super layoutSubviews]; diff --git a/MiniKeePass/TitleFieldCell.m b/MiniKeePass/TitleFieldCell.m index d83bfd67..ce6ad950 100644 --- a/MiniKeePass/TitleFieldCell.m +++ b/MiniKeePass/TitleFieldCell.m @@ -31,11 +31,6 @@ - (id)initWithFrame:(CGRect)frame { return self; } -- (void)dealloc { - [_imageButton release]; - [super dealloc]; -} - - (void)textFieldDidEndEditing:(UITextField *)inTextField { [super textFieldDidEndEditing:inTextField]; diff --git a/MiniKeePass/main.m b/MiniKeePass/main.m index fa9aae13..2c6279e6 100644 --- a/MiniKeePass/main.m +++ b/MiniKeePass/main.m @@ -18,8 +18,8 @@ #import int main(int argc, char *argv[]) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, @"MiniKeePassAppDelegate"); - [pool release]; - return retVal; + @autoreleasepool { + int retVal = UIApplicationMain(argc, argv, nil, @"MiniKeePassAppDelegate"); + return retVal; + } }