From eaa9dac350670d763e0af674c357d603ec49a90b Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 21 Aug 2024 11:23:01 -0700 Subject: [PATCH] Testing: add some force unwraps for Android Add some force unwraps to address nullability differences on Android from other platforms. (cherry picked from commit d080ee2ff59e4a66109e9823aa91ca67b8dca7e7) --- Sources/Testing/Support/FileHandle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Testing/Support/FileHandle.swift b/Sources/Testing/Support/FileHandle.swift index d38f65f2a..453cedcd0 100644 --- a/Sources/Testing/Support/FileHandle.swift +++ b/Sources/Testing/Support/FileHandle.swift @@ -257,7 +257,7 @@ extension FileHandle { try withUnsafeCFILEHandle { file in try withUnsafeTemporaryAllocation(byteCount: 1024, alignment: 1) { buffer in repeat { - let countRead = fread(buffer.baseAddress, 1, buffer.count, file) + let countRead = fread(buffer.baseAddress!, 1, buffer.count, file) if 0 != ferror(file) { throw CError(rawValue: swt_errno()) } @@ -295,7 +295,7 @@ extension FileHandle { } } - let countWritten = fwrite(bytes.baseAddress, MemoryLayout.stride, bytes.count, file) + let countWritten = fwrite(bytes.baseAddress!, MemoryLayout.stride, bytes.count, file) if countWritten < bytes.count { throw CError(rawValue: swt_errno()) }