Fix wrong VersionLock printing on Swift 5 (fixes #311)

This commit is contained in:
John Estropia
2019-04-05 08:29:14 +09:00
parent b2dba0d6fd
commit fe7e6e7b84
4 changed files with 69 additions and 7 deletions

View File

@@ -153,11 +153,10 @@ extension DynamicSchema {
valueType = Data.self
if let defaultValue = (attribute.defaultValue as! Data.QueryableNativeType?).flatMap(Data.cs_fromQueryableNativeType) {
let count = defaultValue.count
let bytes = defaultValue.withUnsafeBytes { (pointer) in
return (0 ..< (count / MemoryLayout<UInt8>.size))
.map({ "\("0x\(String(pointer[$0], radix: 16, uppercase: false))")" })
return pointer
.bindMemory(to: UInt64.self)
.map({ "\("0x\(String($0, radix: 16, uppercase: false))")" })
}
defaultString = ", initial: Data(bytes: [\(bytes.joined(separator: ", "))])"
}