fix compiler warning & typo

This commit is contained in:
Johannes Weiß 2018-01-08 16:48:44 +00:00
parent 8ee527ac52
commit 5f21764710
4 changed files with 7 additions and 6 deletions

View File

@ -28,8 +28,8 @@ private extension timespec {
init(timeAmount amount: TimeAmount) {
let nsecPerSec: Int = 1_000_000_000
let ns = amount.nanoseconds
self.tv_sec = ns / nsecPerSec
self.tv_nsec = ns - self.tv_sec * nsecPerSec
let sec = ns / nsecPerSec
self = timespec(tv_sec: sec, tv_nsec: ns - sec * nsecPerSec)
}
}

View File

@ -26,7 +26,7 @@ extension NIOConcurrencyHelpersTests {
static var allTests : [(String, (NIOConcurrencyHelpersTests) -> () throws -> Void)] {
return [
("testLargeContentedAtomicSum", testLargeContentedAtomicSum),
("testLargeContendedAtomicSum", testLargeContendedAtomicSum),
("testCompareAndExchangeBool", testCompareAndExchangeBool),
("testAllOperationsBool", testAllOperationsBool),
("testCompareAndExchangeUInts", testCompareAndExchangeUInts),

View File

@ -25,7 +25,7 @@ class NIOConcurrencyHelpersTests: XCTestCase {
return n*(n+1)/2
}
func testLargeContentedAtomicSum() {
func testLargeContendedAtomicSum() {
let noAsyncs: UInt64 = 64
let noCounts: UInt64 = 200_000

View File

@ -89,7 +89,7 @@ private extension z_stream {
private static func decompress(compressedBytes: inout ByteBuffer, outputBuffer: inout ByteBuffer, windowSize: Int32) {
compressedBytes.withUnsafeMutableReadableUInt8Bytes { inputPointer in
outputBuffer.withUnsafeMutableWriteableUInt8Bytes { outputPointer in
let forwardAmount = outputBuffer.withUnsafeMutableWriteableUInt8Bytes { outputPointer -> Int in
var stream = z_stream()
// 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)
XCTAssertEqual(rc, Z_OK)
outputBuffer.moveWriterIndex(forwardBy: outputPointer.count - Int(stream.avail_out))
return outputPointer.count - Int(stream.avail_out)
}
outputBuffer.moveWriterIndex(forwardBy: forwardAmount)
}
}
}