Skip to content

Commit f3a2364

Browse files
committed
HRESULT and DWORD vary on 32-bit Windows
1 parent e8cc3c8 commit f3a2364

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extension _AttachableImageWrapper: Attachable, AttachableWrapper where Image: At
9393
guard rCommit == S_OK else {
9494
throw ImageAttachmentError.imageWritingFailed(rCommit)
9595
}
96-
rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(bitPattern: STGC_DEFAULT.rawValue))
96+
rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(STGC_DEFAULT.rawValue))
9797
guard rCommit == S_OK else {
9898
throw ImageAttachmentError.imageWritingFailed(rCommit)
9999
}

Sources/Testing/Attachments/Images/ImageAttachmentError.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
//
1010

11-
private import _TestingInternals
11+
#if os(Windows)
12+
package import _TestingInternals // for HRESULT
13+
#endif
1214

1315
/// A type representing an error that can occur when attaching an image.
1416
package enum ImageAttachmentError: Error {
@@ -23,19 +25,19 @@ package enum ImageAttachmentError: Error {
2325
case couldNotConvertImage
2426
#elseif os(Windows)
2527
/// A call to `QueryInterface()` failed.
26-
case queryInterfaceFailed(Any.Type, Int32)
28+
case queryInterfaceFailed(Any.Type, HRESULT)
2729

2830
/// The testing library failed to create a COM object.
29-
case comObjectCreationFailed(Any.Type, Int32)
31+
case comObjectCreationFailed(Any.Type, HRESULT)
3032

3133
/// An image could not be written.
32-
case imageWritingFailed(Int32)
34+
case imageWritingFailed(HRESULT)
3335

3436
/// The testing library failed to get an in-memory stream's underlying buffer.
35-
case globalFromStreamFailed(Int32)
37+
case globalFromStreamFailed(HRESULT)
3638

3739
/// A property could not be written to a property bag.
38-
case propertyBagWritingFailed(String, Int32)
40+
case propertyBagWritingFailed(String, HRESULT)
3941
#endif
4042
}
4143

Sources/Testing/Support/CError.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
//
1010

11+
#if os(Windows)
12+
package import _TestingInternals // for DWORD
13+
#else
1114
internal import _TestingInternals
15+
#endif
1216

1317
/// A type representing an error from a C function such as `fopen()`.
1418
///
@@ -28,9 +32,9 @@ struct CError: Error, RawRepresentable {
2832
///
2933
/// This type is not part of the public interface of the testing library.
3034
package struct Win32Error: Error, RawRepresentable {
31-
package var rawValue: CUnsignedLong
35+
package var rawValue: DWORD
3236

33-
package init(rawValue: CUnsignedLong) {
37+
package init(rawValue: DWORD) {
3438
self.rawValue = rawValue
3539
}
3640
}

0 commit comments

Comments
 (0)