Skip to content

Commit

Permalink
Fix usage of unsafe pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
yaslab committed Aug 16, 2024
1 parent 70a7837 commit 8c33828
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Sources/Hex/Data+Hex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ extension Data {
var bytes = Data(count: capacity)
let count = bytes.withUnsafeMutableBytes { raw in
raw.withMemoryRebound(to: UInt8.self) { buffer in
buffer.deinitialize()

var i = 0
var it = input.makeIterator()
let output = buffer.baseAddress.unsafelyUnwrapped
Expand All @@ -46,7 +44,7 @@ extension Data {
case .error:
return -1
case .byteValue(let byte):
output.advanced(by: i).initialize(to: byte)
output.advanced(by: i).pointee = byte
i += 1
}
}
Expand Down

0 comments on commit 8c33828

Please sign in to comment.