Merge branch 'develop'

This commit is contained in:
John Estropia
2019-04-05 08:36:30 +09:00
4 changed files with 69 additions and 7 deletions

View File

@@ -922,11 +922,11 @@ extension VersionLock: CustomStringConvertible, CustomDebugStringConvertible, Co
for (index, keyValue) in self.hashesByEntityName.sorted(by: { $0.key < $1.key }).enumerated() {
let data = keyValue.value
let count = data.count
let bytes = data.withUnsafeBytes { (pointer) in
return (0 ..< (count / MemoryLayout<HashElement>.size))
.map({ "\("0x\(String(pointer[$0], radix: 16, uppercase: false))")" })
return pointer
.bindMemory(to: VersionLock.HashElement.self)
.map({ "\("0x\(String($0, radix: 16, uppercase: false))")" })
}
string.append("\(index == 0 ? "\n" : ",\n")\"\(keyValue.key)\": [\(bytes.joined(separator: ", "))]")
}

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: ", "))])"
}