diff options
| author | Paul Eggert | 2012-05-09 08:07:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-05-09 08:07:46 -0700 |
| commit | 3478ec4554757213e8d2344826110cc0f4ae4f3c (patch) | |
| tree | c1709c3aedde3363152d470c015093657564012a /src | |
| parent | 00fd78ed4f34548d1e7bca6fe28b74decd4bef39 (diff) | |
| download | emacs-3478ec4554757213e8d2344826110cc0f4ae4f3c.tar.gz emacs-3478ec4554757213e8d2344826110cc0f4ae4f3c.zip | |
Port recent dbusbind.c changes to 32-bit --with-wide-int.
* dbusbind.c (xd_append_arg, xd_retrieve_arg, Fdbus_message_internal):
Remove unportable assumptions about print widths of types like
dbus_uint32_t.
(xd_get_connection_address, Fdbus_init_bus): Cast Emacs integer to
intptr_t when converting between pointer and integer, to avoid GCC
warnings about wrong width.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/dbusbind.c | 54 |
2 files changed, 47 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 596133002ea..b6415724b5e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-05-09 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Port recent dbusbind.c changes to 32-bit --with-wide-int. | ||
| 4 | * dbusbind.c (xd_append_arg, xd_retrieve_arg, Fdbus_message_internal): | ||
| 5 | Remove unportable assumptions about print widths of types like | ||
| 6 | dbus_uint32_t. | ||
| 7 | (xd_get_connection_address, Fdbus_init_bus): Cast Emacs integer to | ||
| 8 | intptr_t when converting between pointer and integer, to avoid GCC | ||
| 9 | warnings about wrong width. | ||
| 10 | |||
| 1 | 2012-05-09 Eli Zaretskii <eliz@gnu.org> | 11 | 2012-05-09 Eli Zaretskii <eliz@gnu.org> |
| 2 | 12 | ||
| 3 | * w32proc.c (new_child): Force Windows to reserve only 64KB of | 13 | * w32proc.c (new_child): Force Windows to reserve only 64KB of |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 446d060c89b..87a3b935094 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -551,7 +551,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 551 | CHECK_NATNUM (object); | 551 | CHECK_NATNUM (object); |
| 552 | { | 552 | { |
| 553 | unsigned char val = XFASTINT (object) & 0xFF; | 553 | unsigned char val = XFASTINT (object) & 0xFF; |
| 554 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 554 | XD_DEBUG_MESSAGE ("%c %u", dtype, val); |
| 555 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 555 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 556 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 556 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 557 | return; | 557 | return; |
| @@ -570,7 +570,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 570 | CHECK_NUMBER (object); | 570 | CHECK_NUMBER (object); |
| 571 | { | 571 | { |
| 572 | dbus_int16_t val = XINT (object); | 572 | dbus_int16_t val = XINT (object); |
| 573 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 573 | int pval = val; |
| 574 | XD_DEBUG_MESSAGE ("%c %d", dtype, pval); | ||
| 574 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 575 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 575 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 576 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 576 | return; | 577 | return; |
| @@ -580,7 +581,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 580 | CHECK_NATNUM (object); | 581 | CHECK_NATNUM (object); |
| 581 | { | 582 | { |
| 582 | dbus_uint16_t val = XFASTINT (object); | 583 | dbus_uint16_t val = XFASTINT (object); |
| 583 | XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); | 584 | unsigned int pval = val; |
| 585 | XD_DEBUG_MESSAGE ("%c %u", dtype, pval); | ||
| 584 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 586 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 585 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 587 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 586 | return; | 588 | return; |
| @@ -589,7 +591,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 589 | case DBUS_TYPE_INT32: | 591 | case DBUS_TYPE_INT32: |
| 590 | { | 592 | { |
| 591 | dbus_int32_t val = extract_float (object); | 593 | dbus_int32_t val = extract_float (object); |
| 592 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 594 | int pval = val; |
| 595 | XD_DEBUG_MESSAGE ("%c %d", dtype, pval); | ||
| 593 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 596 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 594 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 597 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 595 | return; | 598 | return; |
| @@ -601,7 +604,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 601 | #endif | 604 | #endif |
| 602 | { | 605 | { |
| 603 | dbus_uint32_t val = extract_float (object); | 606 | dbus_uint32_t val = extract_float (object); |
| 604 | XD_DEBUG_MESSAGE ("%c %u", dtype, val); | 607 | unsigned int pval = val; |
| 608 | XD_DEBUG_MESSAGE ("%c %u", dtype, pval); | ||
| 605 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 609 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 606 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 610 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 607 | return; | 611 | return; |
| @@ -610,7 +614,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 610 | case DBUS_TYPE_INT64: | 614 | case DBUS_TYPE_INT64: |
| 611 | { | 615 | { |
| 612 | dbus_int64_t val = extract_float (object); | 616 | dbus_int64_t val = extract_float (object); |
| 613 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 617 | printmax_t pval = val; |
| 618 | XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); | ||
| 614 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 619 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 615 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 620 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 616 | return; | 621 | return; |
| @@ -619,7 +624,8 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 619 | case DBUS_TYPE_UINT64: | 624 | case DBUS_TYPE_UINT64: |
| 620 | { | 625 | { |
| 621 | dbus_uint64_t val = extract_float (object); | 626 | dbus_uint64_t val = extract_float (object); |
| 622 | XD_DEBUG_MESSAGE ("%c %"pI"d", dtype, val); | 627 | uprintmax_t pval = val; |
| 628 | XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval); | ||
| 623 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) | 629 | if (!dbus_message_iter_append_basic (iter, dtype, &val)) |
| 624 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); | 630 | XD_SIGNAL2 (build_string ("Unable to append argument"), object); |
| 625 | return; | 631 | return; |
| @@ -754,7 +760,7 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) | |||
| 754 | unsigned int val; | 760 | unsigned int val; |
| 755 | dbus_message_iter_get_basic (iter, &val); | 761 | dbus_message_iter_get_basic (iter, &val); |
| 756 | val = val & 0xFF; | 762 | val = val & 0xFF; |
| 757 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 763 | XD_DEBUG_MESSAGE ("%c %u", dtype, val); |
| 758 | return make_number (val); | 764 | return make_number (val); |
| 759 | } | 765 | } |
| 760 | 766 | ||
| @@ -769,24 +775,30 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) | |||
| 769 | case DBUS_TYPE_INT16: | 775 | case DBUS_TYPE_INT16: |
| 770 | { | 776 | { |
| 771 | dbus_int16_t val; | 777 | dbus_int16_t val; |
| 778 | int pval; | ||
| 772 | dbus_message_iter_get_basic (iter, &val); | 779 | dbus_message_iter_get_basic (iter, &val); |
| 773 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 780 | pval = val; |
| 781 | XD_DEBUG_MESSAGE ("%c %d", dtype, pval); | ||
| 774 | return make_number (val); | 782 | return make_number (val); |
| 775 | } | 783 | } |
| 776 | 784 | ||
| 777 | case DBUS_TYPE_UINT16: | 785 | case DBUS_TYPE_UINT16: |
| 778 | { | 786 | { |
| 779 | dbus_uint16_t val; | 787 | dbus_uint16_t val; |
| 788 | int pval; | ||
| 780 | dbus_message_iter_get_basic (iter, &val); | 789 | dbus_message_iter_get_basic (iter, &val); |
| 781 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 790 | pval = val; |
| 791 | XD_DEBUG_MESSAGE ("%c %d", dtype, pval); | ||
| 782 | return make_number (val); | 792 | return make_number (val); |
| 783 | } | 793 | } |
| 784 | 794 | ||
| 785 | case DBUS_TYPE_INT32: | 795 | case DBUS_TYPE_INT32: |
| 786 | { | 796 | { |
| 787 | dbus_int32_t val; | 797 | dbus_int32_t val; |
| 798 | int pval; | ||
| 788 | dbus_message_iter_get_basic (iter, &val); | 799 | dbus_message_iter_get_basic (iter, &val); |
| 789 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 800 | pval = val; |
| 801 | XD_DEBUG_MESSAGE ("%c %d", dtype, pval); | ||
| 790 | return make_fixnum_or_float (val); | 802 | return make_fixnum_or_float (val); |
| 791 | } | 803 | } |
| 792 | 804 | ||
| @@ -796,24 +808,30 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter) | |||
| 796 | #endif | 808 | #endif |
| 797 | { | 809 | { |
| 798 | dbus_uint32_t val; | 810 | dbus_uint32_t val; |
| 811 | unsigned int pval = val; | ||
| 799 | dbus_message_iter_get_basic (iter, &val); | 812 | dbus_message_iter_get_basic (iter, &val); |
| 800 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 813 | pval = val; |
| 814 | XD_DEBUG_MESSAGE ("%c %u", dtype, pval); | ||
| 801 | return make_fixnum_or_float (val); | 815 | return make_fixnum_or_float (val); |
| 802 | } | 816 | } |
| 803 | 817 | ||
| 804 | case DBUS_TYPE_INT64: | 818 | case DBUS_TYPE_INT64: |
| 805 | { | 819 | { |
| 806 | dbus_int64_t val; | 820 | dbus_int64_t val; |
| 821 | printmax_t pval; | ||
| 807 | dbus_message_iter_get_basic (iter, &val); | 822 | dbus_message_iter_get_basic (iter, &val); |
| 808 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 823 | pval = val; |
| 824 | XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); | ||
| 809 | return make_fixnum_or_float (val); | 825 | return make_fixnum_or_float (val); |
| 810 | } | 826 | } |
| 811 | 827 | ||
| 812 | case DBUS_TYPE_UINT64: | 828 | case DBUS_TYPE_UINT64: |
| 813 | { | 829 | { |
| 814 | dbus_uint64_t val; | 830 | dbus_uint64_t val; |
| 831 | uprintmax_t pval; | ||
| 815 | dbus_message_iter_get_basic (iter, &val); | 832 | dbus_message_iter_get_basic (iter, &val); |
| 816 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 833 | pval = val; |
| 834 | XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); | ||
| 817 | return make_fixnum_or_float (val); | 835 | return make_fixnum_or_float (val); |
| 818 | } | 836 | } |
| 819 | 837 | ||
| @@ -889,7 +907,7 @@ xd_get_connection_address (Lisp_Object bus) | |||
| 889 | if (NILP (val)) | 907 | if (NILP (val)) |
| 890 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 908 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| 891 | else | 909 | else |
| 892 | connection = (DBusConnection *) XFASTINT (val); | 910 | connection = (DBusConnection *) (intptr_t) XFASTINT (val); |
| 893 | 911 | ||
| 894 | if (!dbus_connection_get_is_connected (connection)) | 912 | if (!dbus_connection_get_is_connected (connection)) |
| 895 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); | 913 | XD_SIGNAL2 (build_string ("No connection to bus"), bus); |
| @@ -1096,7 +1114,7 @@ this connection to those buses. */) | |||
| 1096 | XD_SIGNAL1 (build_string ("Cannot add watch functions")); | 1114 | XD_SIGNAL1 (build_string ("Cannot add watch functions")); |
| 1097 | 1115 | ||
| 1098 | /* Add bus to list of registered buses. */ | 1116 | /* Add bus to list of registered buses. */ |
| 1099 | XSETFASTINT (val, connection); | 1117 | XSETFASTINT (val, (intptr_t) connection); |
| 1100 | Vdbus_registered_buses = Fcons (Fcons (bus, val), Vdbus_registered_buses); | 1118 | Vdbus_registered_buses = Fcons (Fcons (bus, val), Vdbus_registered_buses); |
| 1101 | 1119 | ||
| 1102 | /* We do not want to abort. */ | 1120 | /* We do not want to abort. */ |
| @@ -1174,6 +1192,7 @@ usage: (dbus-message-internal &rest REST) */) | |||
| 1174 | unsigned int dtype; | 1192 | unsigned int dtype; |
| 1175 | unsigned int mtype; | 1193 | unsigned int mtype; |
| 1176 | dbus_uint32_t serial = 0; | 1194 | dbus_uint32_t serial = 0; |
| 1195 | unsigned int ui_serial; | ||
| 1177 | int timeout = -1; | 1196 | int timeout = -1; |
| 1178 | ptrdiff_t count; | 1197 | ptrdiff_t count; |
| 1179 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; | 1198 | char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH]; |
| @@ -1249,11 +1268,12 @@ usage: (dbus-message-internal &rest REST) */) | |||
| 1249 | XD_OBJECT_TO_STRING (member)); | 1268 | XD_OBJECT_TO_STRING (member)); |
| 1250 | break; | 1269 | break; |
| 1251 | default: /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR */ | 1270 | default: /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR */ |
| 1271 | ui_serial = serial; | ||
| 1252 | XD_DEBUG_MESSAGE ("%s %s %s %u", | 1272 | XD_DEBUG_MESSAGE ("%s %s %s %u", |
| 1253 | XD_MESSAGE_TYPE_TO_STRING (mtype), | 1273 | XD_MESSAGE_TYPE_TO_STRING (mtype), |
| 1254 | XD_OBJECT_TO_STRING (bus), | 1274 | XD_OBJECT_TO_STRING (bus), |
| 1255 | XD_OBJECT_TO_STRING (service), | 1275 | XD_OBJECT_TO_STRING (service), |
| 1256 | serial); | 1276 | ui_serial); |
| 1257 | } | 1277 | } |
| 1258 | 1278 | ||
| 1259 | /* Retrieve bus address. */ | 1279 | /* Retrieve bus address. */ |