11/*
2- * Copyright 2023 Google Inc. All rights reserved.
2+ * Copyright 2024 Google Inc. All rights reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -121,37 +121,37 @@ public struct ByteBuffer {
121121 public let allowReadingUnalignedBuffers : Bool
122122
123123 /// Constructor that creates a Flatbuffer object from a UInt8
124- /// - Parameter
124+ /// - Parameter
125125 /// - bytes: Array of UInt8
126126 /// - allowReadingUnalignedBuffers: allow reading from unaligned buffer
127127 public init (
128- bytes: [ UInt8 ] ,
128+ bytes: [ UInt8 ] ,
129129 allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
130130 {
131131 var b = bytes
132132 _storage = Storage ( count: bytes. count, alignment: alignment)
133133 _writerSize = _storage. capacity
134134 allowReadingUnalignedBuffers = allowUnalignedBuffers
135135 b. withUnsafeMutableBytes { bufferPointer in
136- self . _storage. copy ( from: bufferPointer. baseAddress!, count: bytes. count)
136+ _storage. copy ( from: bufferPointer. baseAddress!, count: bytes. count)
137137 }
138138 }
139139
140140 #if !os(WASI)
141141 /// Constructor that creates a Flatbuffer from the Swift Data type object
142- /// - Parameter
142+ /// - Parameter
143143 /// - data: Swift data Object
144144 /// - allowReadingUnalignedBuffers: allow reading from unaligned buffer
145145 public init (
146- data: Data ,
146+ data: Data ,
147147 allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
148148 {
149149 var b = data
150150 _storage = Storage ( count: data. count, alignment: alignment)
151151 _writerSize = _storage. capacity
152152 allowReadingUnalignedBuffers = allowUnalignedBuffers
153153 b. withUnsafeMutableBytes { bufferPointer in
154- self . _storage. copy ( from: bufferPointer. baseAddress!, count: data. count)
154+ _storage. copy ( from: bufferPointer. baseAddress!, count: data. count)
155155 }
156156 }
157157 #endif
@@ -175,7 +175,7 @@ public struct ByteBuffer {
175175 /// - allowReadingUnalignedBuffers: allow reading from unaligned buffer
176176 public init < Bytes: ContiguousBytes > (
177177 contiguousBytes: Bytes ,
178- count: Int ,
178+ count: Int ,
179179 allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
180180 {
181181 _storage = Storage ( count: count, alignment: alignment)
@@ -208,7 +208,7 @@ public struct ByteBuffer {
208208 /// - count: count of bytes
209209 /// - allowReadingUnalignedBuffers: allow reading from unaligned buffer
210210 init (
211- memory: UnsafeMutableRawPointer ,
211+ memory: UnsafeMutableRawPointer ,
212212 count: Int ,
213213 allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
214214 {
@@ -228,7 +228,7 @@ public struct ByteBuffer {
228228 memory: UnsafeMutableRawPointer ,
229229 count: Int ,
230230 removing removeBytes: Int ,
231- allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
231+ allowReadingUnalignedBuffers allowUnalignedBuffers: Bool = false )
232232 {
233233 _storage = Storage ( count: count, alignment: alignment)
234234 _storage. copy ( from: memory, count: count)
@@ -257,7 +257,7 @@ public struct ByteBuffer {
257257 _storage. memory. advanced ( by: writerIndex &- ptr. count) ,
258258 UnsafeRawPointer ( ptr. baseAddress!) ,
259259 ptr. count)
260- self . _writerSize = self . _writerSize &+ ptr. count
260+ _writerSize = _writerSize &+ ptr. count
261261 }
262262 }
263263
@@ -271,7 +271,7 @@ public struct ByteBuffer {
271271 _storage. memory
272272 . advanced ( by: writerIndex &- ptr. count)
273273 . copyMemory ( from: ptr. baseAddress!, byteCount: ptr. count)
274- self . _writerSize = self . _writerSize &+ ptr. count
274+ _writerSize = _writerSize &+ ptr. count
275275 }
276276 }
277277
@@ -287,7 +287,7 @@ public struct ByteBuffer {
287287 _storage. memory. advanced ( by: writerIndex &- ptr. count) ,
288288 UnsafeRawPointer ( ptr. baseAddress!) ,
289289 ptr. count)
290- self . _writerSize = self . _writerSize &+ ptr. count
290+ _writerSize = _writerSize &+ ptr. count
291291 }
292292 }
293293 #endif
@@ -306,7 +306,7 @@ public struct ByteBuffer {
306306 _storage. memory. advanced ( by: writerIndex &- size) ,
307307 $0. baseAddress!,
308308 size)
309- self . _writerSize = self . _writerSize &+ size
309+ _writerSize = _writerSize &+ size
310310 }
311311 }
312312
@@ -324,7 +324,7 @@ public struct ByteBuffer {
324324 _storage. memory. advanced ( by: writerIndex &- len) ,
325325 $0. baseAddress!,
326326 len)
327- self . _writerSize = self . _writerSize &+ len
327+ _writerSize = _writerSize &+ len
328328 }
329329 }
330330
@@ -538,7 +538,8 @@ extension ByteBuffer: CustomDebugStringConvertible {
538538 public var debugDescription : String {
539539 """
540540 buffer located at: \( _storage. memory) , with capacity of \( _storage. capacity)
541- { writerSize: \( _writerSize) , readerSize: \( reader) , writerIndex: \( writerIndex) }
541+ { writerSize: \( _writerSize) , readerSize: \( reader) , writerIndex: \(
542+ writerIndex) }
542543 """
543544 }
544545}
0 commit comments