NSCoder: implement NSSecureCoding stub

Implement stubs for NSSecureCoding which do not break projects that rely
on it.
This commit is contained in:
Daniel Ferreira 2017-06-25 06:35:23 +10:00 committed by Ivan Vučica
parent be874e5d8f
commit 314f437f43
4 changed files with 60 additions and 0 deletions

View file

@ -35,6 +35,7 @@
#define EXPOSE_NSCoder_IVARS 1
#import "Foundation/NSData.h"
#import "Foundation/NSCoder.h"
#import "Foundation/NSSet.h"
#import "Foundation/NSSerialization.h"
#import "Foundation/NSUserDefaults.h"
@ -331,6 +332,17 @@ static unsigned systemVersion = MAX_SUPPORTED_SYSTEM_VERSION;
// Keyed archiving extensions
- (BOOL) requiresSecureCoding
{
[self subclassResponsibility: _cmd];
return NO;
}
- (void) setRequiresSecureCoding: (BOOL)secure
{
[self subclassResponsibility: _cmd];
}
- (BOOL) allowsKeyedCoding
{
return NO;
@ -397,6 +409,18 @@ static unsigned systemVersion = MAX_SUPPORTED_SYSTEM_VERSION;
return nil;
}
- (id) decodeObjectOfClass: (Class)cls forKey: (NSString *)aKey
{
return [self decodeObjectOfClasses: [NSSet setWithObject:(id)cls]
forKey: aKey];
}
- (id) decodeObjectOfClasses: (NSSet *)classes forKey: (NSString *)aKey
{
[self subclassResponsibility: _cmd];
return nil;
}
- (void) encodeBool: (BOOL) aBool forKey: (NSString*)aKey
{
[self subclassResponsibility: _cmd];

View file

@ -365,6 +365,16 @@ static NSMapTable *globalClassMap = 0;
return YES;
}
- (BOOL)requiresSecureCoding
{
return NO;
}
- (void)setRequiresSecureCoding: (BOOL)secure
{
return;
}
- (Class) classForClassName: (NSString*)aString
{
return _clsMap == 0 ? Nil : (Class)NSMapGet(_clsMap, (void*)aString);
@ -636,6 +646,11 @@ static NSMapTable *globalClassMap = 0;
return nil;
}
- (id) decodeObjectOfClasses: (NSSet *)classes forKey: (NSString *)key
{
return [self decodeObjectForKey: key];
}
- (NSPoint) decodePoint
{
NSPoint p;