Title: [224779] trunk/Source/WebKit
Revision
224779
Author
[email protected]
Date
2017-11-13 14:05:27 -0800 (Mon, 13 Nov 2017)

Log Message

Use the real mach type instead of reinterpret_casting in MachMessage
https://bugs.webkit.org/show_bug.cgi?id=179629

Reviewed by Dan Bernstein.

* Platform/IPC/mac/MachMessage.cpp:
(IPC::MachMessage::header):
* Platform/IPC/mac/MachMessage.h:
Just use mach_msg_header_t proper, and avoid the reinterpret_cast.
This also corrects the alignment of the struct on platforms where
alignof(mach_msg_header_t) != alignof(uint8_t).

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (224778 => 224779)


--- trunk/Source/WebKit/ChangeLog	2017-11-13 21:45:42 UTC (rev 224778)
+++ trunk/Source/WebKit/ChangeLog	2017-11-13 22:05:27 UTC (rev 224779)
@@ -1,3 +1,17 @@
+2017-11-13  Tim Horton  <[email protected]>
+
+        Use the real mach type instead of reinterpret_casting in MachMessage
+        https://bugs.webkit.org/show_bug.cgi?id=179629
+
+        Reviewed by Dan Bernstein.
+
+        * Platform/IPC/mac/MachMessage.cpp:
+        (IPC::MachMessage::header):
+        * Platform/IPC/mac/MachMessage.h:
+        Just use mach_msg_header_t proper, and avoid the reinterpret_cast.
+        This also corrects the alignment of the struct on platforms where
+        alignof(mach_msg_header_t) != alignof(uint8_t).
+
 2017-11-13  Gabriel Ivascu  <[email protected]>
 
         [GTK] Automatically adjust font size when gtk-xft-dpi changes

Modified: trunk/Source/WebKit/Platform/IPC/mac/MachMessage.cpp (224778 => 224779)


--- trunk/Source/WebKit/Platform/IPC/mac/MachMessage.cpp	2017-11-13 21:45:42 UTC (rev 224778)
+++ trunk/Source/WebKit/Platform/IPC/mac/MachMessage.cpp	2017-11-13 22:05:27 UTC (rev 224779)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "MachMessage.h"
 
+#if PLATFORM(COCOA)
+
 #include <mach/mach.h>
 
 namespace IPC {
@@ -66,7 +68,7 @@
 
 mach_msg_header_t* MachMessage::header()
 {
-    return reinterpret_cast<mach_msg_header_t*>(m_buffer);
+    return m_messageHeader;
 }
 
 void MachMessage::leakDescriptors()
@@ -75,3 +77,5 @@
 }
 
 }
+
+#endif // PLATFORM(COCOA)

Modified: trunk/Source/WebKit/Platform/IPC/mac/MachMessage.h (224778 => 224779)


--- trunk/Source/WebKit/Platform/IPC/mac/MachMessage.h	2017-11-13 21:45:42 UTC (rev 224778)
+++ trunk/Source/WebKit/Platform/IPC/mac/MachMessage.h	2017-11-13 22:05:27 UTC (rev 224779)
@@ -25,6 +25,9 @@
 
 #pragma once
 
+#if PLATFORM(COCOA)
+
+#include <mach/message.h>
 #include <memory>
 #include <wtf/text/CString.h>
 
@@ -56,7 +59,9 @@
     CString m_messageName;
     size_t m_size;
     bool m_shouldFreeDescriptors;
-    uint8_t m_buffer[0];
+    mach_msg_header_t m_messageHeader[0];
 };
 
 }
+
+#endif // PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to