Skip to content

Commit bd2091f

Browse files
authored
Merge pull request #3098 from austinzheng/az-gardening
2 parents 67edb44 + 6d385b8 commit bd2091f

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
@@ -141,7 +141,7 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
141141
///
142142
/// - parameter buffer: A buffer pointer to copy. The size is calculated from `SourceType` and `buffer.count`.
143143
public init<SourceType>(buffer: UnsafeBufferPointer<SourceType>) {
144-
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: strideof(SourceType) * buffer.count))
144+
_wrapped = _SwiftNSData(immutableObject: NSData(bytes: buffer.baseAddress, length: strideof(SourceType.self) * buffer.count))
145145
}
146146

147147
/// Initialize a `Data` with copied memory content.
@@ -370,9 +370,9 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
370370
precondition(r.upperBound >= 0)
371371
precondition(r.upperBound <= cnt, "The range is outside the bounds of the data")
372372

373-
copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * strideof(DestinationType), r.count))
373+
copyRange = r.lowerBound..<(r.lowerBound + Swift.min(buffer.count * strideof(DestinationType.self), r.count))
374374
} else {
375-
copyRange = 0..<Swift.min(buffer.count * strideof(DestinationType), cnt)
375+
copyRange = 0..<Swift.min(buffer.count * strideof(DestinationType.self), cnt)
376376
}
377377

378378
guard !copyRange.isEmpty else { return 0 }
@@ -459,7 +459,7 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
459459
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
460460
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
461461
_applyUnmanagedMutation {
462-
$0.append(buffer.baseAddress!, length: buffer.count * strideof(SourceType))
462+
$0.append(buffer.baseAddress!, length: buffer.count * strideof(SourceType.self))
463463
}
464464
}
465465

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)