fix compiler warning & typo
This commit is contained in:
parent
8ee527ac52
commit
5f21764710
|
@ -28,8 +28,8 @@ private extension timespec {
|
||||||
init(timeAmount amount: TimeAmount) {
|
init(timeAmount amount: TimeAmount) {
|
||||||
let nsecPerSec: Int = 1_000_000_000
|
let nsecPerSec: Int = 1_000_000_000
|
||||||
let ns = amount.nanoseconds
|
let ns = amount.nanoseconds
|
||||||
self.tv_sec = ns / nsecPerSec
|
let sec = ns / nsecPerSec
|
||||||
self.tv_nsec = ns - self.tv_sec * nsecPerSec
|
self = timespec(tv_sec: sec, tv_nsec: ns - sec * nsecPerSec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ extension NIOConcurrencyHelpersTests {
|
||||||
|
|
||||||
static var allTests : [(String, (NIOConcurrencyHelpersTests) -> () throws -> Void)] {
|
static var allTests : [(String, (NIOConcurrencyHelpersTests) -> () throws -> Void)] {
|
||||||
return [
|
return [
|
||||||
("testLargeContentedAtomicSum", testLargeContentedAtomicSum),
|
("testLargeContendedAtomicSum", testLargeContendedAtomicSum),
|
||||||
("testCompareAndExchangeBool", testCompareAndExchangeBool),
|
("testCompareAndExchangeBool", testCompareAndExchangeBool),
|
||||||
("testAllOperationsBool", testAllOperationsBool),
|
("testAllOperationsBool", testAllOperationsBool),
|
||||||
("testCompareAndExchangeUInts", testCompareAndExchangeUInts),
|
("testCompareAndExchangeUInts", testCompareAndExchangeUInts),
|
||||||
|
|
|
@ -25,7 +25,7 @@ class NIOConcurrencyHelpersTests: XCTestCase {
|
||||||
return n*(n+1)/2
|
return n*(n+1)/2
|
||||||
}
|
}
|
||||||
|
|
||||||
func testLargeContentedAtomicSum() {
|
func testLargeContendedAtomicSum() {
|
||||||
let noAsyncs: UInt64 = 64
|
let noAsyncs: UInt64 = 64
|
||||||
let noCounts: UInt64 = 200_000
|
let noCounts: UInt64 = 200_000
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ private extension z_stream {
|
||||||
|
|
||||||
private static func decompress(compressedBytes: inout ByteBuffer, outputBuffer: inout ByteBuffer, windowSize: Int32) {
|
private static func decompress(compressedBytes: inout ByteBuffer, outputBuffer: inout ByteBuffer, windowSize: Int32) {
|
||||||
compressedBytes.withUnsafeMutableReadableUInt8Bytes { inputPointer in
|
compressedBytes.withUnsafeMutableReadableUInt8Bytes { inputPointer in
|
||||||
outputBuffer.withUnsafeMutableWriteableUInt8Bytes { outputPointer in
|
let forwardAmount = outputBuffer.withUnsafeMutableWriteableUInt8Bytes { outputPointer -> Int in
|
||||||
var stream = z_stream()
|
var stream = z_stream()
|
||||||
|
|
||||||
// zlib requires we initialize next_in, avail_in, zalloc, zfree and opaque before calling inflateInit2.
|
// zlib requires we initialize next_in, avail_in, zalloc, zfree and opaque before calling inflateInit2.
|
||||||
|
@ -111,8 +111,9 @@ private extension z_stream {
|
||||||
rc = inflateEnd(&stream)
|
rc = inflateEnd(&stream)
|
||||||
XCTAssertEqual(rc, Z_OK)
|
XCTAssertEqual(rc, Z_OK)
|
||||||
|
|
||||||
outputBuffer.moveWriterIndex(forwardBy: outputPointer.count - Int(stream.avail_out))
|
return outputPointer.count - Int(stream.avail_out)
|
||||||
}
|
}
|
||||||
|
outputBuffer.moveWriterIndex(forwardBy: forwardAmount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue