Skip to content

Commit 7360121

Browse files
committed
Updates copyright from 2023 to 2024 & formats code - updates formatting rules
1 parent 129ef42 commit 7360121

37 files changed

+58
-55
lines changed

benchmarks/swift/Benchmarks/FlatbuffersBenchmarks/FlatbuffersBenchmarks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

grpc/examples/swift/Greeter/Sources/client/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

grpc/examples/swift/Greeter/Sources/server/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

samples/sample_binary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

swift.swiftformat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# options
88
--self remove # redundantSelf
9-
--importgrouping testable-bottom # sortedImports
9+
--importgrouping testable-bottom # sortImports
1010
--trimwhitespace always
1111
--indentcase false
1212
--ifdef no-indent #indent
@@ -17,7 +17,7 @@
1717
--typeattributes prev-line # wrapAttributes
1818

1919
# rules
20-
--rules wrap,todos,anyObjectProtocol,redundantParens,redundantReturn,redundantSelf,sortedImports,strongifiedSelf,trailingCommas,trailingSpace,wrapArguments,wrapMultilineStatementBraces,indent,wrapAttributes,void,fileHeader
20+
--rules wrap,todos,anyObjectProtocol,redundantParens,redundantReturn,redundantSelf,sortImports,strongifiedSelf,trailingCommas,trailingSpace,wrapArguments,wrapMultilineStatementBraces,indent,wrapAttributes,void,fileHeader
2121
--disable trailingclosures
2222

2323
--exclude **/*_generated.swift

swift/Sources/FlatBuffers/ByteBuffer.swift

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
}

swift/Sources/FlatBuffers/Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

swift/Sources/FlatBuffers/Enum.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

swift/Sources/FlatBuffers/FlatBufferBuilder.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.
@@ -836,7 +836,8 @@ extension FlatBufferBuilder: CustomDebugStringConvertible {
836836
buffer debug:
837837
\(_bb)
838838
builder debug:
839-
{ finished: \(finished), serializeDefaults: \(serializeDefaults), isNested: \(isNested) }
839+
{ finished: \(finished), serializeDefaults: \(
840+
serializeDefaults), isNested: \(isNested) }
840841
"""
841842
}
842843

swift/Sources/FlatBuffers/FlatBufferObject.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

0 commit comments

Comments
 (0)