@@ -64,9 +64,9 @@ class TestNSData: XCTestCase {
64
64
// Copy the data to our new length buffer
65
65
let newBuffer = malloc ( newValue) !
66
66
if newValue <= _length {
67
- memmove ( newBuffer, ptr. baseAddress, newValue)
67
+ memmove ( newBuffer, ptr. baseAddress! , newValue)
68
68
} else if newValue > _length {
69
- memmove ( newBuffer, ptr. baseAddress, _length)
69
+ memmove ( newBuffer, ptr. baseAddress! , _length)
70
70
memset ( newBuffer + _length, 1 , newValue - _length)
71
71
}
72
72
let bytePtr = newBuffer. bindMemory ( to: UInt8 . self, capacity: newValue)
@@ -84,7 +84,7 @@ class TestNSData: XCTestCase {
84
84
// Need to allocate the buffer now.
85
85
// It doesn't matter if the buffer is uniquely referenced or not here.
86
86
let buffer = malloc ( length)
87
- memset ( buffer, 1 , length)
87
+ memset ( buffer! , 1 , length)
88
88
let bytePtr = buffer!. bindMemory ( to: UInt8 . self, capacity: length)
89
89
let result = UnsafeMutableBufferPointer ( start: bytePtr, count: length)
90
90
_pointer = result
@@ -97,10 +97,10 @@ class TestNSData: XCTestCase {
97
97
let newBuffer = malloc ( newBufferLength)
98
98
if let ptr = _pointer {
99
99
// Copy the existing data to the new box, then return its pointer
100
- memmove ( newBuffer, ptr. baseAddress, newBufferLength)
100
+ memmove ( newBuffer! , ptr. baseAddress, newBufferLength)
101
101
} else {
102
102
// Set new data to 1s
103
- memset ( newBuffer, 1 , newBufferLength)
103
+ memset ( newBuffer! , 1 , newBufferLength)
104
104
}
105
105
let bytePtr = newBuffer!. bindMemory ( to: UInt8 . self, capacity: newBufferLength)
106
106
let result = UnsafeMutableBufferPointer ( start: bytePtr, count: newBufferLength)
@@ -112,7 +112,7 @@ class TestNSData: XCTestCase {
112
112
override func getBytes( _ buffer: UnsafeMutableRawPointer , length: Int ) {
113
113
if let d = _pointer {
114
114
// Get the real data from the buffer
115
- memmove ( buffer, d. baseAddress, length)
115
+ memmove ( buffer, d. baseAddress! , length)
116
116
} else {
117
117
// A more efficient implementation of getBytes in the case where no one has asked for our backing bytes
118
118
memset ( buffer, 1 , length)
@@ -663,7 +663,7 @@ extension TestNSData {
663
663
664
664
// Create a home for our test data
665
665
let x = NSString ( )
666
- let dirPath = try ! ( NSTemporaryDirectory ( ) . bridge ( ) ) . stringByAppendingPathComponent ( NSUUID ( ) . uuidString)
666
+ let dirPath = ( NSTemporaryDirectory ( ) . bridge ( ) ) . stringByAppendingPathComponent ( NSUUID ( ) . uuidString)
667
667
try ! FileManager . default. createDirectory ( atPath: dirPath, withIntermediateDirectories: true , attributes: nil )
668
668
let filePath = ( dirPath. bridge ( ) ) . stringByAppendingPathComponent ( " temp_file " )
669
669
guard FileManager . default. createFile ( atPath: filePath, contents: nil , attributes: nil ) else { XCTAssertTrue ( false , " Unable to create temporary file " ) ; return }
0 commit comments