File tree 1 file changed +6
-3
lines changed
Sources/Mach/Core/Messaging
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,10 @@ extension Mach {
54
54
)
55
55
56
56
// Write the header.
57
- serializingPointer. bindMemory ( to: mach_msg_header_t. self, capacity: 1 ) . pointee =
57
+ let headerPointer = serializingPointer. bindMemory (
58
+ to: mach_msg_header_t. self, capacity: 1
59
+ )
60
+ headerPointer. pointee =
58
61
self . header // This is pass-by-value, so we don't have to worry about what happens if `self.header` changes later.
59
62
serializingPointer += MemoryLayout< mach_msg_header_t> . size
60
63
@@ -84,10 +87,10 @@ extension Mach {
84
87
// field), we still need to be able to deserialize this raw representation back into a `MachMessage`. Thus, we
85
88
// set it to what the kernel would set it to. The kernel allegedly ignores this field for sent messages, so it
86
89
// should be safe to set it here. If the value is non-zero, we leave it as-is and assume it's purposeful.
87
- if self . header . msgh_size == 0 {
90
+ if headerPointer . pointee . msgh_size == 0 {
88
91
// `serializingPointer` sould be at the end of the payload, so we can calculate the size of the message.
89
92
let payloadEndPointer = serializingPointer
90
- self . header . msgh_size = mach_msg_size_t ( payloadEndPointer - startPointer)
93
+ headerPointer . pointee . msgh_size = mach_msg_size_t ( payloadEndPointer - startPointer)
91
94
}
92
95
93
96
// Realign the pointer after writing an arbitrarily-sized payload.
You can’t perform that action at this time.
0 commit comments