File: big-endian.patch

package info (click to toggle)
dbuskit 0.1.1-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,948 kB
  • sloc: objc: 10,544; sh: 9,464; ansic: 200; makefile: 33
file content (151 lines) | stat: -rw-r--r-- 4,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Description: Fix some issues on big-endian architectures.
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2025-04-09
---

--- dbuskit.orig/Source/DKArgument.m
+++ dbuskit/Source/DKArgument.m
@@ -623,7 +623,9 @@
 
 - (NSString*) DBusTypeSignature
 {
-  return [NSString stringWithCharacters: (unichar*)&DBusType length: 1];
+  unichar type = (unichar)DBusType;
+
+  return [NSString stringWithCharacters: (unichar*)&type length: 1];
 
 }
 
@@ -884,6 +886,7 @@
 {
   // All basic types are guaranteed to fit into 64bit.
   uint64_t buffer = 0;
+  dbus_bool_t buf = (dbus_bool_t)buffer;
 
   // Type checking:
   const char *invType;
@@ -917,7 +920,15 @@
   NSAssert((0 == strcmp(invType, expectedType)),
     @"Type mismatch between introspection data and invocation.");
 
-  dbus_message_iter_get_basic(iter, (void*)&buffer);
+  if (iterType == DBUS_TYPE_BOOLEAN)
+  {
+    dbus_message_iter_get_basic(iter, (void*)&buf);
+    buffer = buf;
+  }
+  else
+  {
+    dbus_message_iter_get_basic(iter, (void*)&buffer);
+  }
 
   if (doBox)
   {
@@ -936,7 +947,15 @@
   {
     if (index == -1)
     {
-      [inv setReturnValue: (void*)&buffer];
+      if (iterType == DBUS_TYPE_BOOLEAN)
+      {
+        char bool_val = (char)(dbus_bool_t)buffer;
+        [inv setReturnValue: (void*)&bool_val];
+      }
+      else
+      {
+        [inv setReturnValue: (void*)&buffer];
+      }
     }
     else
     {
@@ -993,6 +1012,7 @@
                           boxing: (BOOL)doBox
 {
   uint64_t buffer = 0;
+  char* buf = NULL;
   const char* invType;
   const char* expectedType;
 
@@ -1046,12 +1066,33 @@
     }
     else
     {
-      [inv getArgument: (void*)&buffer
-               atIndex: index];
+      if (DBusType == DBUS_TYPE_STRING)
+      {
+        buf = (char*)(uintptr_t)buffer;
+        [inv getArgument: (void*)&buf
+                 atIndex: index];
+      }
+      else
+      {
+        [inv getArgument: (void*)&buffer
+                 atIndex: index];
+      }
     }
   }
 
-  DK_ITER_APPEND(iter, DBusType, &buffer);
+  if (DBusType == DBUS_TYPE_STRING)
+  {
+    if (!buf)
+    {
+      buf = (char*)(uintptr_t)buffer;
+    }
+
+    DK_ITER_APPEND(iter, DBusType, &buf);
+  }
+  else
+  {
+    DK_ITER_APPEND(iter, DBusType, &buffer);
+  }
 }
 
 - (void) marshallObject: (id)object
@@ -1814,9 +1855,11 @@
     // Simple types are quite straightforward, if we can find an appropriate
     // deserialization selector.
     int type = DKDBusTypeForUnboxingObject(object);
+    char c = type;
+    char array[] = {c, 0};
     if ((DBUS_TYPE_INVALID != type) && (DBUS_TYPE_OBJECT_PATH != type))
     {
-      return [[[DKArgument alloc] initWithDBusSignature: (char*)&type
+      return [[[DKArgument alloc] initWithDBusSignature: array
                                                    name: nil
                                                  parent: self] autorelease];
     }
--- dbuskit.orig/Source/DKMethodCall.m
+++ dbuskit/Source/DKMethodCall.m
@@ -347,7 +347,7 @@
       // Otherwise, we need to the runloop to complete our request.
       [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
     }
-  } while (NO == (BOOL)dbus_pending_call_get_completed(pending));
+  } while (pending && NO == (BOOL)dbus_pending_call_get_completed(pending));
 
   //Now we are sure that we don't need the message any more.
   if (NULL != msg)
--- dbuskit.orig/Source/DKPort.m
+++ dbuskit/Source/DKPort.m
@@ -396,7 +396,7 @@
  * Required for NSPort compatibility. Will make NSRunLoop leave us alone because
  * we don't have any file descriptors to watch.
  */
-- (void) getFds: (int*)fds count: (int*)count
+- (void) getFds: (NSInteger*)fds count: (NSInteger*)count
 {
   *fds=0;
   *count=0;
--- dbuskit.orig/Tests/TestDKProxy.m
+++ dbuskit/Tests/TestDKProxy.m
@@ -244,6 +244,7 @@
   }
   NSLog(@"Sleeping 6 seconds to allow threads to terminate:");
   sleep(6);
+  testHopeful = YES;
   for (count = 0;count < 5; count++)
   {
     PASS([(NSThread*)[threads objectAtIndex: count] isFinished],