Skip to content

Commit 6d385b8

Browse files
committed
[gardening] Adding .self suffixes to suppress warnings
1 parent 3a6a2da commit 6d385b8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
133133
///
134134
/// - parameter buffer: A buffer pointer to copy. The size is calculated from `SourceType` and `buffer.count`.
135135
public init<SourceType>(buffer: UnsafeBufferPointer<SourceType>) {
136-
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: strideof(SourceType) * buffer.count))
136+
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: strideof(SourceType.self) * buffer.count))
137137
}
138138

139139
/// Initialize a `Data` with the contents of an Array.
@@ -319,9 +319,9 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
319319
precondition(r.upperBound >= 0)
320320
precondition(r.upperBound <= cnt, "The range is outside the bounds of the data")
321321

322-
copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * strideof(DestinationType), r.count))
322+
copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * strideof(DestinationType.self), r.count))
323323
} else {
324-
copyRange = 0..<Swift.min(buffer.count * strideof(DestinationType), cnt)
324+
copyRange = 0..<Swift.min(buffer.count * strideof(DestinationType.self), cnt)
325325
}
326326

327327
guard !copyRange.isEmpty else { return 0 }
@@ -408,7 +408,7 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
408408
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
409409
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
410410
_applyUnmanagedMutation {
411-
$0.append(buffer.baseAddress!, length: buffer.count * strideof(SourceType))
411+
$0.append(buffer.baseAddress!, length: buffer.count * strideof(SourceType.self))
412412
}
413413
}
414414

stdlib/public/SDK/Foundation/DateInterval.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public struct DateInterval : ReferenceConvertible, Comparable, Hashable {
157157
public var hashValue: Int {
158158
var buf: (UInt, UInt) = (UInt(start.timeIntervalSinceReferenceDate), UInt(end.timeIntervalSinceReferenceDate))
159159
return withUnsafeMutablePointer(&buf) {
160-
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(UInt) * 2)))
160+
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(UInt.self) * 2)))
161161
}
162162
}
163163

stdlib/public/SDK/Foundation/IndexPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
161161
if count == 0 {
162162
_indexes = []
163163
} else {
164-
var ptr = UnsafeMutablePointer<Element>(malloc(count * sizeof(Element)))
164+
var ptr = UnsafeMutablePointer<Element>(malloc(count * sizeof(Element.self)))
165165
defer { free(ptr) }
166166

167167
nsIndexPath.getIndexes(ptr!, range: NSMakeRange(0, count))

stdlib/public/SDK/Foundation/UUID.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConv
6565
public var hashValue: Int {
6666
var localValue = uuid
6767
return withUnsafeMutablePointer(&localValue) {
68-
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(uuid_t))))
68+
return Int(bitPattern: CFHashBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self), CFIndex(sizeof(uuid_t.self))))
6969
}
7070
}
7171

0 commit comments

Comments
 (0)