aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src/dbusbind.c
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7e5104026cd..2c8de20a4d4 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -325,7 +325,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
325 if ((subtype == DBUS_TYPE_SIGNATURE) 325 if ((subtype == DBUS_TYPE_SIGNATURE)
326 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) 326 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt)))
327 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) 327 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
328 strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); 328 strcpy (x, SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt))));
329 329
330 while (!NILP (elt)) 330 while (!NILP (elt))
331 { 331 {
@@ -531,7 +531,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
531 but by not encoding it, we guarantee it's valid utf-8, even if 531 but by not encoding it, we guarantee it's valid utf-8, even if
532 it contains eight-bit-bytes. Of course, you can still send 532 it contains eight-bit-bytes. Of course, you can still send
533 manually-crafted junk by passing a unibyte string. */ 533 manually-crafted junk by passing a unibyte string. */
534 char *val = SDATA (object); 534 char *val = SSDATA (object);
535 XD_DEBUG_MESSAGE ("%c %s", dtype, val); 535 XD_DEBUG_MESSAGE ("%c %s", dtype, val);
536 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 536 if (!dbus_message_iter_append_basic (iter, dtype, &val))
537 XD_SIGNAL2 (build_string ("Unable to append argument"), object); 537 XD_SIGNAL2 (build_string ("Unable to append argument"), object);
@@ -569,7 +569,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
569 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) 569 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object)))
570 && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) 570 && NILP (CDR_SAFE (XD_NEXT_VALUE (object))))
571 { 571 {
572 strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); 572 strcpy (signature, SSDATA (CAR_SAFE (XD_NEXT_VALUE (object))));
573 object = CDR_SAFE (XD_NEXT_VALUE (object)); 573 object = CDR_SAFE (XD_NEXT_VALUE (object));
574 } 574 }
575 575
@@ -789,7 +789,7 @@ xd_initialize (Lisp_Object bus, int raise_error)
789 dbus_error_init (&derror); 789 dbus_error_init (&derror);
790 790
791 if (STRINGP (bus)) 791 if (STRINGP (bus))
792 connection = dbus_connection_open (SDATA (bus), &derror); 792 connection = dbus_connection_open (SSDATA (bus), &derror);
793 else 793 else
794 if (EQ (bus, QCdbus_system_bus)) 794 if (EQ (bus, QCdbus_system_bus))
795 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); 795 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
@@ -936,7 +936,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
936 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); 936 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses);
937 937
938 /* We do not want to abort. */ 938 /* We do not want to abort. */
939 putenv ("DBUS_FATAL_WARNINGS=0"); 939 putenv ((char *) "DBUS_FATAL_WARNINGS=0");
940 940
941 /* Return. */ 941 /* Return. */
942 return Qnil; 942 return Qnil;
@@ -1089,10 +1089,10 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
1089 connection = xd_initialize (bus, TRUE); 1089 connection = xd_initialize (bus, TRUE);
1090 1090
1091 /* Create the message. */ 1091 /* Create the message. */
1092 dmessage = dbus_message_new_method_call (SDATA (service), 1092 dmessage = dbus_message_new_method_call (SSDATA (service),
1093 SDATA (path), 1093 SSDATA (path),
1094 SDATA (interface), 1094 SSDATA (interface),
1095 SDATA (method)); 1095 SSDATA (method));
1096 UNGCPRO; 1096 UNGCPRO;
1097 if (dmessage == NULL) 1097 if (dmessage == NULL)
1098 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1098 XD_SIGNAL1 (build_string ("Unable to create a new message"));
@@ -1272,10 +1272,10 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1272 connection = xd_initialize (bus, TRUE); 1272 connection = xd_initialize (bus, TRUE);
1273 1273
1274 /* Create the message. */ 1274 /* Create the message. */
1275 dmessage = dbus_message_new_method_call (SDATA (service), 1275 dmessage = dbus_message_new_method_call (SSDATA (service),
1276 SDATA (path), 1276 SSDATA (path),
1277 SDATA (interface), 1277 SSDATA (interface),
1278 SDATA (method)); 1278 SSDATA (method));
1279 if (dmessage == NULL) 1279 if (dmessage == NULL)
1280 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1280 XD_SIGNAL1 (build_string ("Unable to create a new message"));
1281 1281
@@ -1386,7 +1386,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1386 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); 1386 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
1387 if ((dmessage == NULL) 1387 if ((dmessage == NULL)
1388 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) 1388 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial)))
1389 || (!dbus_message_set_destination (dmessage, SDATA (service)))) 1389 || (!dbus_message_set_destination (dmessage, SSDATA (service))))
1390 { 1390 {
1391 UNGCPRO; 1391 UNGCPRO;
1392 XD_SIGNAL1 (build_string ("Unable to create a return message")); 1392 XD_SIGNAL1 (build_string ("Unable to create a return message"));
@@ -1475,7 +1475,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1475 if ((dmessage == NULL) 1475 if ((dmessage == NULL)
1476 || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)) 1476 || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED))
1477 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) 1477 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial)))
1478 || (!dbus_message_set_destination (dmessage, SDATA (service)))) 1478 || (!dbus_message_set_destination (dmessage, SSDATA (service))))
1479 { 1479 {
1480 UNGCPRO; 1480 UNGCPRO;
1481 XD_SIGNAL1 (build_string ("Unable to create a error message")); 1481 XD_SIGNAL1 (build_string ("Unable to create a error message"));
@@ -1591,9 +1591,9 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1591 connection = xd_initialize (bus, TRUE); 1591 connection = xd_initialize (bus, TRUE);
1592 1592
1593 /* Create the message. */ 1593 /* Create the message. */
1594 dmessage = dbus_message_new_signal (SDATA (path), 1594 dmessage = dbus_message_new_signal (SSDATA (path),
1595 SDATA (interface), 1595 SSDATA (interface),
1596 SDATA (signal)); 1596 SSDATA (signal));
1597 UNGCPRO; 1597 UNGCPRO;
1598 if (dmessage == NULL) 1598 if (dmessage == NULL)
1599 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1599 XD_SIGNAL1 (build_string ("Unable to create a new message"));
@@ -1745,11 +1745,11 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
1745 /* key has the structure (UNAME SERVICE PATH HANDLER). */ 1745 /* key has the structure (UNAME SERVICE PATH HANDLER). */
1746 if (((uname == NULL) 1746 if (((uname == NULL)
1747 || (NILP (CAR_SAFE (key))) 1747 || (NILP (CAR_SAFE (key)))
1748 || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) 1748 || (strcmp (uname, SSDATA (CAR_SAFE (key))) == 0))
1749 && ((path == NULL) 1749 && ((path == NULL)
1750 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1750 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key)))))
1751 || (strcmp (path, 1751 || (strcmp (path,
1752 SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1752 SSDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key)))))
1753 == 0)) 1753 == 0))
1754 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) 1754 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key)))))))
1755 { 1755 {
@@ -1888,7 +1888,6 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1888 (int nargs, register Lisp_Object *args) 1888 (int nargs, register Lisp_Object *args)
1889{ 1889{
1890 Lisp_Object bus, service; 1890 Lisp_Object bus, service;
1891 struct gcpro gcpro1, gcpro2;
1892 DBusConnection *connection; 1891 DBusConnection *connection;
1893 unsigned int i; 1892 unsigned int i;
1894 unsigned int value; 1893 unsigned int value;
@@ -1921,7 +1920,7 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1921 1920
1922 /* Request the known name from the bus. */ 1921 /* Request the known name from the bus. */
1923 dbus_error_init (&derror); 1922 dbus_error_init (&derror);
1924 result = dbus_bus_request_name (connection, SDATA (service), flags, 1923 result = dbus_bus_request_name (connection, SSDATA (service), flags,
1925 &derror); 1924 &derror);
1926 if (dbus_error_is_set (&derror)) 1925 if (dbus_error_is_set (&derror))
1927 XD_ERROR (derror); 1926 XD_ERROR (derror);
@@ -2019,8 +2018,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
2019 name of "org.freedesktop.DBus" is that string itself. */ 2018 name of "org.freedesktop.DBus" is that string itself. */
2020 if ((STRINGP (service)) 2019 if ((STRINGP (service))
2021 && (SBYTES (service) > 0) 2020 && (SBYTES (service) > 0)
2022 && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) 2021 && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0)
2023 && (strncmp (SDATA (service), ":", 1) != 0)) 2022 && (strncmp (SSDATA (service), ":", 1) != 0))
2024 { 2023 {
2025 uname = call2 (intern ("dbus-get-name-owner"), bus, service); 2024 uname = call2 (intern ("dbus-get-name-owner"), bus, service);
2026 /* When there is no unique name, we mark it with an empty 2025 /* When there is no unique name, we mark it with an empty
@@ -2122,7 +2121,6 @@ discovering the still incomplete interface.*/)
2122 Lisp_Object dont_register_service) 2121 Lisp_Object dont_register_service)
2123{ 2122{
2124 Lisp_Object key, key1, value; 2123 Lisp_Object key, key1, value;
2125 DBusError derror;
2126 Lisp_Object args[2] = { bus, service }; 2124 Lisp_Object args[2] = { bus, service };
2127 2125
2128 /* Check parameters. */ 2126 /* Check parameters. */
@@ -2350,4 +2348,3 @@ be called when the D-Bus reply message arrives. */);
2350} 2348}
2351 2349
2352#endif /* HAVE_DBUS */ 2350#endif /* HAVE_DBUS */
2353