This was a miss in the previous patch given that mach_msg_type_long_t is
12 bytes long so won't neatly align to 8 bytes.
---
 utils.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/utils.c b/utils.c
index f2f45f6..9af78e9 100644
--- a/utils.c
+++ b/utils.c
@@ -304,10 +304,14 @@ WriteFieldDeclPrim(FILE *file, const argument_t *arg,
 
     fprintf(file, "\t\tmach_msg_type_%st %s;\n",
            arg->argLongForm ? "long_" : "", arg->argTTName);
-    if (!arg->argLongForm && complex_alignof > sizeof_mach_msg_type_t) {
-        /* Pad mach_msg_type_t in case we need alignment by more than its 
size. */
-       fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName, complex_alignof 
- sizeof_mach_msg_type_t);
-    }
+       /* Pad mach_msg_type_t/mach_msg_type_long_t in case we need alignment 
by more than its size. */
+    if (!arg->argLongForm && sizeof_mach_msg_type_t % complex_alignof) {
+        fprintf(file, "\t\tchar %s_pad[%d];\n",
+                arg->argTTName, complex_alignof - sizeof_mach_msg_type_t % 
complex_alignof);
+    } else if (arg->argLongForm && sizeof_mach_msg_type_long_t % 
complex_alignof) {
+           fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName,
+                complex_alignof - sizeof_mach_msg_type_long_t % 
complex_alignof);
+       }
 
     if (it->itInLine && it->itVarArray)
     {
-- 
2.39.1


Reply via email to