Skip to content

Commit

Permalink
Merge pull request #4 from sketch-hq/feature/52301-xc15-silence-submo…
Browse files Browse the repository at this point in the history
…dule-warnings

Code Review: [xc15] Silence submodule warnings (#52301)
  • Loading branch information
jnozzi authored Aug 10, 2023
2 parents 7dbb80a + 8749345 commit f4b8625
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions swift/Sources/FlatBuffers/ByteBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ public struct ByteBuffer {
mutating func push<T: NativeStruct>(struct value: T, size: Int) {
ensureSpace(size: size)
var v = value
memcpy(_storage.memory.advanced(by: writerIndex &- size), &v, size)
_ = withUnsafeMutablePointer(to: &v) { pointer in
memcpy(_storage.memory.advanced(by: writerIndex &- size), pointer, size)
}
_writerSize = _writerSize &+ size
}

Expand All @@ -247,7 +249,9 @@ public struct ByteBuffer {
mutating func push<T: Scalar>(value: T, len: Int) {
ensureSpace(size: len)
var v = value
memcpy(_storage.memory.advanced(by: writerIndex &- len), &v, len)
_ = withUnsafeMutablePointer(to: &v) { pointer in
memcpy(_storage.memory.advanced(by: writerIndex &- len), pointer, len)
}
_writerSize = _writerSize &+ len
}

Expand Down

0 comments on commit f4b8625

Please sign in to comment.