mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
SE-0205 withUnsafePointer(to:_:) and withUnsafeBytes(of:_:) for immutable values
This commit is contained in:
1 parent
0dbfe7d9e3
commit
8cd49082ec
2 files changed
+3
-4
No files matched your search
@@ -275,8 +275,8 @@ public final class DatabaseFunction: Hashable {
|
||||
|
||||
// retain and store in SQLite's buffer
|
||||
let aggregateContextU = Unmanaged.passRetained(aggregateContext)
|
||||
var aggregateContextP = aggregateContextU.toOpaque()
|
||||
withUnsafeBytes(of: &aggregateContextP) {
|
||||
let aggregateContextP = aggregateContextU.toOpaque()
|
||||
withUnsafeBytes(of: aggregateContextP) {
|
||||
aggregateContextBufferP.copyMemory(from: $0)
|
||||
}
|
||||
return aggregateContextU
|
||||
|
||||
@@ -45,8 +45,7 @@ extension NSUUID: DatabaseValueConvertible {
|
||||
/// UUID adopts DatabaseValueConvertible
|
||||
extension UUID: DatabaseValueConvertible {
|
||||
public var databaseValue: DatabaseValue {
|
||||
var uuid_t = uuid
|
||||
return withUnsafeBytes(of: &uuid_t) {
|
||||
return withUnsafeBytes(of: uuid) {
|
||||
Data(bytes: $0.baseAddress!, count: $0.count).databaseValue
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user