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
|
Description: Fix some issues on big-endian architectures.
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2025-10-12
---
--- 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)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/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;
|