summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-04-20 11:35:42 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2020-04-20 13:53:10 +0200
commit57bc36ad279e1363bd049afbe02b3d0a292dc0c8 (patch)
tree7dcbf2d7f1c54ca9575861608382acf651d56bf7
parentcb35ffa24535d781f9cd1089aa4a1b049a75fffa (diff)
downloaddbus-57bc36ad279e1363bd049afbe02b3d0a292dc0c8.tar.gz
dbus-57bc36ad279e1363bd049afbe02b3d0a292dc0c8.tar.bz2
dbus-57bc36ad279e1363bd049afbe02b3d0a292dc0c8.zip
dbus-message: bring back the original layout of DBusMessageItersubmit/tizen/20200420.213220submit/tizen/20200420.123023accepted/tizen/unified/20200421.051607
The layout introduced with GVariant was kind of mimicking the real structure, as opposed to the original layout, which was taking into account only total sizes. Dbus-1.10.8 introduced some static assertions for the properties of DBusMessageIter. These are incompatible with the "GVariant" layout. Moreover, they show that the "GVariant" layout could be prone to the copying, that could omit some fields or parts of fields, due to its not "packed" structure. This commit brings back the original layout, with modifications suited for GVariant-sized DBusMessageRealIter. As an additional feature - this should fix compilation for 64-bit architectures. Change-Id: Ie1cac3748d408c22acf177ede5fb9e4e29818c9b
-rw-r--r--dbus/dbus-message.c82
-rw-r--r--dbus/dbus-message.h113
2 files changed, 96 insertions, 99 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 09e5a877..6952fe4b 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -177,19 +177,73 @@ _dbus_message_toggle_gvariant (DBusMessage *message, dbus_bool_t gvariant)
typedef struct
{
void *dummy1;
- void *dummy2;
- dbus_uint32_t dummy3;
- int dummy4;
- int dummy5;
- int dummy6;
- int dummy7;
- int dummy8;
- int dummy9;
- int dummy10;
- int dummy11;
- int pad1;
- int pad2;
- void *pad3;
+ dbus_uint32_t dummy3a : 21;
+ dbus_uint32_t dummy3b : 3;
+ dbus_uint32_t dummy3c : 8;
+
+ union {
+ struct
+ {
+ dbus_uint32_t dummy1a : 8;
+ dbus_uint32_t dummy1b : 1;
+ dbus_uint32_t dummy1c : 3;
+ dbus_uint32_t dummy1d : 1;
+ dbus_uint32_t dummy1e : 1;
+ dbus_uint32_t dummy1f : 1;
+ void *dummy2;
+ int dummy3;
+ void *dummy4;
+ int dummy5;
+ int dummy6;
+ size_t dummy7;
+ size_t dummy8;
+ int dummy9;
+
+ void *dummy10;
+ union
+ {
+ struct {
+ int dummy11;
+ };
+ } u;
+ } s1;
+
+ struct
+ {
+ dbus_uint32_t dummy1a : 8;
+ dbus_uint32_t dummy1b : 8;
+ dbus_uint32_t dummy1c : 1;
+ dbus_uint32_t dummy1d : 1;
+ dbus_uint32_t dummy1e : 1;
+ dbus_uint32_t dummy1f : 1;
+ dbus_uint32_t dummy1g : 1;
+
+ void *dummy2;
+ int dummy3;
+ void *dummy4;
+ int dummy5;
+ size_t dummy6;
+ void *dummy7;
+ int dummy8;
+ char dummy9;
+
+ union
+ {
+ struct {
+ int dummy10;
+ int dummy11;
+ int dummy12;
+ };
+ struct {
+ size_t dummy13;
+ };
+ struct {
+ size_t *dummy14;
+ size_t *dummy15;
+ };
+ } u;
+ } s2;
+ } u;
} DBusMessageIter_1_10_0;
static void
@@ -2189,7 +2243,7 @@ _dbus_message_iter_init_common (DBusMessage *message,
* is not "packed", which might result in "iter = other_iter" not copying
* every byte. */
_DBUS_STATIC_ASSERT (sizeof (DBusMessageIter) ==
- 4 * sizeof (void *) + sizeof (dbus_uint32_t) + 9 * sizeof (int));
+ 10 * sizeof (void *) + sizeof (dbus_uint32_t) + 3 * sizeof (int));
/* Since the iterator will read or write who-knows-what from the
* message, we need to get in the right byte order
diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
index db66c581..c74ddd13 100644
--- a/dbus/dbus-message.h
+++ b/dbus/dbus-message.h
@@ -60,76 +60,21 @@ typedef struct DBusMessageIter DBusMessageIter;
* DBusMessageIter struct; contains no public fields.
*/
struct DBusMessageIter
-{ /* layout on a standard 64-bit system */
- void *dummy1; /**< Don't use this */ /* message */
- dbus_uint32_t dummy3a : 21; /**< Don't use this */
- dbus_uint32_t dummy3b : 3; /**< Don't use this */
- dbus_uint32_t dummy3c : 8; /**< Don't use this */
-
- /* padding before union */
- union {
- struct
- {
- dbus_uint32_t dummy1a : 8; /**< Don't use this */
- dbus_uint32_t dummy1b : 1; /**< Don't use this */
- dbus_uint32_t dummy1c : 3; /**< Don't use this */
- dbus_uint32_t dummy1d : 1; /**< Don't use this */
- dbus_uint32_t dummy1e : 1; /**< Don't use this */
- dbus_uint32_t dummy1f : 1; /**< Don't use this */
- void *dummy2; /**< Don't use this */
- int dummy3; /**< Don't use this */
- void *dummy4; /**< Don't use this */
- int dummy5; /**< Don't use this */
- int dummy6; /**< Don't use this */
- size_t dummy7; /**< Don't use this */
- size_t dummy8; /**< Don't use this */
- int dummy9; /**< Don't use this */
-
- void *dummy10; /**< Don't use this */
- union
- {
- struct {
- int dummy11; /**< Don't use this */
- };
- } u;
- } s1;
-
- struct
- {
- dbus_uint32_t dummy1a : 8; /**< Don't use this */
- dbus_uint32_t dummy1b : 8; /**< Don't use this */
- dbus_uint32_t dummy1c : 1; /**< Don't use this */
- dbus_uint32_t dummy1d : 1; /**< Don't use this */
- dbus_uint32_t dummy1e : 1; /**< Don't use this */
- dbus_uint32_t dummy1f : 1; /**< Don't use this */
- dbus_uint32_t dummy1g : 1; /**< Don't use this */
-
- void *dummy2; /**< Don't use this */
- int dummy3; /**< Don't use this */
- void *dummy4; /**< Don't use this */
- int dummy5; /**< Don't use this */
- size_t dummy6; /**< Don't use this */
- void *dummy7; /**< Don't use this */
- int dummy8; /**< Don't use this */
- char dummy9; /**< Don't use this */
-
- union
- {
- struct {
- int dummy10; /**< Don't use this */
- int dummy11; /**< Don't use this */
- int dummy12; /**< Don't use this */
- };
- struct {
- size_t dummy13; /**< Don't use this */
- };
- struct {
- size_t *dummy14; /**< Don't use this */
- size_t *dummy15; /**< Don't use this */
- };
- } u;
- } s2;
- } u;
+{
+ void *dummy1; /**< Don't use this */
+ void *dummy2; /**< Don't use this */
+ dbus_uint32_t dummy3; /**< Don't use this */
+ int dummy4; /**< Don't use this */
+ int dummy5; /**< Don't use this */
+ int dummy6; /**< Don't use this */
+ void *dummy7; /**< Don't use this */
+ void *dummy8; /**< Don't use this */
+ void *dummy9; /**< Don't use this */
+ void *dummy10; /**< Don't use this */
+ void *dummy11; /**< Don't use this */
+ void *pad1; /**< Don't use this */
+ void *pad2; /**< Don't use this */
+ void *pad3; /**< Don't use this */
};
/**
@@ -139,21 +84,19 @@ struct DBusMessageIter
#define DBUS_MESSAGE_ITER_INIT_CLOSED \
{ \
NULL, /* dummy1 */ \
- 0, 0, 0, /* dummy3a, dummy3b, dummy3c */ \
- { .s2 = {0, 0, 0, 0, 0, 0, 0, /* dummy1a-1g */ \
- NULL, /* dummy2 */ \
- 0, /* dummy3 */ \
- NULL, /* dummy4 */ \
- 0, /* dummy5 */ \
- 0, /* dummy6 */ \
- 0, /* dummy7 */ \
- 0, /* dummy8 */ \
- 0, /* dummy9 */ \
- {{ .dummy10 = 0, /* dummy10 */ \
- .dummy11 = 0, /* dummy11 */ \
- .dummy12 = 0, /* dummy12 */ \
- }} \
- }} \
+ NULL, /* dummy2 */ \
+ 0, /* dummy3 */ \
+ 0, /* dummy4 */ \
+ 0, /* dummy5 */ \
+ 0, /* dummy6 */ \
+ NULL, /* dummy7 */ \
+ NULL, /* dummy8 */ \
+ NULL, /* dummy9 */ \
+ NULL, /* dummy10 */ \
+ NULL, /* dummy11 */ \
+ NULL, /* pad1 */ \
+ NULL, /* pad2 */ \
+ NULL /* pad3 */ \
}
DBUS_EXPORT