Skip to content

Commit

Permalink
Convert to ARC
Browse files Browse the repository at this point in the history
  • Loading branch information
tallerthenyou committed Jun 25, 2013
1 parent db8bc6d commit 80f208f
Show file tree
Hide file tree
Showing 85 changed files with 212 additions and 867 deletions.
4 changes: 2 additions & 2 deletions ChooseGroupViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

@interface ChooseGroupViewController : AutorotatingTableViewController

@property (nonatomic, retain) KdbGroup *group;
@property (nonatomic, assign) id<ChooseGroupDelegate> delegate;
@property (nonatomic, strong) KdbGroup *group;
@property (nonatomic, unsafe_unretained) id<ChooseGroupDelegate> delegate;

@end

Expand Down
8 changes: 1 addition & 7 deletions ChooseGroupViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 1 addition & 3 deletions IOStream/AesInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions IOStream/AesOutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions IOStream/Arc4RandomStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
7 changes: 1 addition & 6 deletions IOStream/DataInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions IOStream/DataOutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion IOStream/FileInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ - (id)initWithFilename:(NSString*)filename {

- (void)dealloc {
[self close];
[super dealloc];
}

- (NSUInteger)read:(void*)bytes length:(NSUInteger)bytesLength {
Expand Down
1 change: 0 additions & 1 deletion IOStream/FileOutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions IOStream/GZipInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions IOStream/GZipOutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
6 changes: 1 addition & 5 deletions IOStream/HashedInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ @implementation HashedInputStream
- (id)initWithInputStream:(InputStream*)stream {
self = [super init];
if (self) {
inputStream = [stream retain];
inputStream = stream;

buffer = NULL;
bufferOffset = 0;
Expand All @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions IOStream/HashedOutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion IOStream/InputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions IOStream/Sha256OutputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
26 changes: 13 additions & 13 deletions KeePassLib/Kdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@class KdbEntry;

@interface KdbGroup : NSObject {
KdbGroup *parent;
KdbGroup *__unsafe_unretained parent;

NSInteger image;
NSString *name;
Expand All @@ -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;

Expand All @@ -55,7 +55,7 @@
@end

@interface KdbEntry : NSObject {
KdbGroup *parent;
KdbGroup *__unsafe_unretained parent;

NSInteger image;

Expand All @@ -65,7 +65,7 @@
NSDate *expiryTime;
}

@property(nonatomic, assign) KdbGroup *parent;
@property(nonatomic, unsafe_unretained) KdbGroup *parent;

@property(nonatomic, assign) NSInteger image;

Expand All @@ -84,18 +84,18 @@
- (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

@interface KdbTree : NSObject {
KdbGroup *root;
}

@property(nonatomic, retain) KdbGroup *root;
@property(nonatomic, strong) KdbGroup *root;

- (KdbGroup*)createGroup:(KdbGroup*)parent;
- (KdbEntry*)createEntry:(KdbGroup*)parent;
Expand Down
24 changes: 0 additions & 24 deletions KeePassLib/Kdb.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -167,11 +148,6 @@ @implementation KdbTree

@synthesize root;

- (void)dealloc {
[root release];
[super dealloc];
}

- (KdbGroup*)createGroup:(KdbGroup*)parent {
[self doesNotRecognizeSelector:_cmd];
return nil;
Expand Down
4 changes: 0 additions & 4 deletions KeePassLib/Kdb3Date.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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];
Expand Down
Loading

0 comments on commit 80f208f

Please sign in to comment.