More secure coding work.

This commit is contained in:
Damiano Galassi committed 2016-08-31 12:20:49 +02:00
1 parent fba0ca3d3a
commit 0f2057c64d
9 files changed
+49 -65

No files matched your search

+7 -18
View File
@@ -8,12 +8,7 @@
#import "MP42TextSample.h"
@implementation MP42TextSample {
@private
MP42Duration _timestamp;
MP42Image *_image;
NSString *_title;
}
@implementation MP42TextSample
- (NSComparisonResult)compare:(MP42TextSample *)otherObject
{
@@ -27,17 +22,6 @@
return NSOrderedSame;
}
- (void)dealloc
{
[_image release];
[_title release];
[super dealloc];
}
@synthesize timestamp = _timestamp;
@synthesize title = _title;
@synthesize image = _image;
- (void)setTitle:(NSString *)title
{
if (title == nil) {
@@ -47,6 +31,11 @@
}
}
+ (BOOL)supportsSecureCoding
{
return YES;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeInt64:_timestamp forKey:@"timestamp"];
@@ -58,7 +47,7 @@
self = [super init];
_timestamp = [decoder decodeInt64ForKey:@"timestamp"];
_title = [[decoder decodeObjectForKey:@"title"] retain];
_title = [decoder decodeObjectOfClass:[NSString class] forKey:@"title"];
return self;
}