Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Foundation/NSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,9 @@ open class NSCalendar : NSObject, NSCopying, NSSecureCoding {
var at: CFAbsoluteTime = date.timeIntervalSinceReferenceDate

let res: Bool = withUnsafeMutablePointer(to: &at) { t in
let count = Int32(vector.count)
return vector.withUnsafeMutableBufferPointer { (vectorBuffer: inout UnsafeMutableBufferPointer<Int32>) in
return _CFCalendarAddComponentsV(_cfObject, t, CFOptionFlags(opts.rawValue), compDesc, vectorBuffer.baseAddress!, Int32(vector.count))
return _CFCalendarAddComponentsV(_cfObject, t, CFOptionFlags(opts.rawValue), compDesc, vectorBuffer.baseAddress!, count)
}
}

Expand All @@ -603,8 +604,9 @@ open class NSCalendar : NSObject, NSCopying, NSSecureCoding {
return intArrayBuffer.baseAddress!.advanced(by: idx)
}

let count = Int32(vector.count)
return vector.withUnsafeMutableBufferPointer { (vecBuffer: inout UnsafeMutableBufferPointer<UnsafeMutablePointer<Int32>>) in
return _CFCalendarGetComponentDifferenceV(_cfObject, startingDate.timeIntervalSinceReferenceDate, resultDate.timeIntervalSinceReferenceDate, CFOptionFlags(opts.rawValue), compDesc, vecBuffer.baseAddress!, Int32(vector.count))
return _CFCalendarGetComponentDifferenceV(_cfObject, startingDate.timeIntervalSinceReferenceDate, resultDate.timeIntervalSinceReferenceDate, CFOptionFlags(opts.rawValue), compDesc, vecBuffer.baseAddress!, count)
}
}
if res {
Expand Down
8 changes: 4 additions & 4 deletions TestFoundation/TestNSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -930,11 +930,11 @@ extension TestNSData {
// Mutate it
bytes.pointee = 0x67
XCTAssertEqual(bytes.pointee, 0x67, "First byte should be 0x67")
XCTAssertEqual(mutatingHello[0], 0x67, "First byte accessed via other method should still be 0x67")

// Verify that the first data is still correct
XCTAssertEqual(hello[0], 0x68, "The first byte should still be 0x68")
}
XCTAssertEqual(mutatingHello[0], 0x67, "First byte accessed via other method should still be 0x67")

// Verify that the first data is still correct
XCTAssertEqual(hello[0], 0x68, "The first byte should still be 0x68")
}


Expand Down