Skip to content

Commit 662f0d7

Browse files
committed
Fix values for unarchiver flags; ensure we don’t invoke NSUnsupported() functions here.
1 parent 38f68fe commit 662f0d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Foundation/NSKeyedUnarchiver.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ open class NSKeyedUnarchiver : NSCoder {
3030
}
3131

3232
static let none = UnarchiverFlags(rawValue: 0)
33-
static let finishedDecoding = UnarchiverFlags(rawValue : 1)
34-
static let requiresSecureCoding = UnarchiverFlags(rawValue: 2)
35-
static let startedDecoding = UnarchiverFlags(rawValue: 3)
33+
static let finishedDecoding = UnarchiverFlags(rawValue : 1 << 0)
34+
static let requiresSecureCoding = UnarchiverFlags(rawValue: 1 << 1)
35+
static let startedDecoding = UnarchiverFlags(rawValue: 1 << 2)
3636
}
3737

3838
class DecodingContext {
@@ -79,7 +79,7 @@ open class NSKeyedUnarchiver : NSCoder {
7979
unarchiver.requiresSecureCoding = true
8080
unarchiver.decodingFailurePolicy = .setErrorAndReturn
8181

82-
return try unarchiver.decodeTopLevelObject(of: classes, forKey: NSKeyedArchiveRootObjectKey)
82+
return try unarchiver.decodeObject(of: classes, forKey: NSKeyedArchiveRootObjectKey)
8383
}
8484

8585
@available(swift, deprecated: 9999, renamed: "unarchivedObject(ofClass:from:)")

0 commit comments

Comments
 (0)