test: fix build and tests

This commit is contained in:
William Casarin
2023-07-21 15:14:07 -07:00
parent 61051ee853
commit ad0e1f28b7
7 changed files with 15 additions and 16 deletions

View File

@@ -30,13 +30,13 @@ struct NdbNote {
var note: UnsafeMutablePointer<ndb_note>?
let len = data.withUnsafeMutableBytes { (bytes: UnsafeMutableRawBufferPointer) -> Int in
return Int(ndb_note_from_json(&json_cstr, Int32(json_cstr.count), &note, bytes.baseAddress, Int32(bufsize)))
let len = data.withUnsafeMutableBytes { (bytes: UnsafeMutableRawBufferPointer) in
return ndb_note_from_json(&json_cstr, Int32(json_cstr.count), &note, bytes.baseAddress, Int32(bufsize))
}
guard let note else { return nil }
// Create new Data with just the valid bytes
let validData = Data(bytes: &note.pointee, count: len)
let validData = Data(bytes: &note.pointee, count: Int(len))
return NdbNote(notePointer: note, data: validData)
}}