emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115373: * net/dbus.el (dbus-byte-array-to-string):


From: Michael Albinus
Subject: [Emacs-diffs] trunk r115373: * net/dbus.el (dbus-byte-array-to-string): Accept also byte arrays
Date: Wed, 04 Dec 2013 14:10:14 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115373
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Wed 2013-12-04 15:10:09 +0100
message:
  * net/dbus.el (dbus-byte-array-to-string): Accept also byte arrays
  in D-Bus type syntax.
  (dbus-unescape-from-identifier): Use `byte-to-string' in order to
  preserve unibyte strings.  (Bug#16048)
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/dbus.el               dbus.el-20091113204419-o5vbwnq5f7feedwu-7962
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-04 04:42:01 +0000
+++ b/lisp/ChangeLog    2013-12-04 14:10:09 +0000
@@ -1,3 +1,10 @@
+2013-12-04  Michael Albinus  <address@hidden>
+
+       * net/dbus.el (dbus-byte-array-to-string): Accept also byte arrays
+       in D-Bus type syntax.
+       (dbus-unescape-from-identifier): Use `byte-to-string' in order to
+       preserve unibyte strings.  (Bug#16048)
+
 2013-12-04  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/eldoc.el (eldoc-minibuffer-message):
@@ -21,7 +28,7 @@
 2013-12-03  Tom Regner <address@hidden>  (tiny change)
 
        * notifications.el (notifications-close-notification): Call the
-       D-Bus method with `id' being an `:uint32'.  (Bug#16030)
+       D-Bus method with ID being a `:uint32'.  (Bug#16030)
 
 2013-12-03  Katsumi Yamaoka  <address@hidden>
 

=== modified file 'lisp/net/dbus.el'
--- a/lisp/net/dbus.el  2013-09-05 03:30:07 +0000
+++ b/lisp/net/dbus.el  2013-12-04 14:10:09 +0000
@@ -829,8 +829,15 @@
 
 (defun dbus-byte-array-to-string (byte-array)
   "Transforms BYTE-ARRAY into UTF8 coded string.
-BYTE-ARRAY must be a list of structure (c1 c2 ...)."
-  (apply 'string byte-array))
+BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte
+array as produced by `dbus-string-to-byte-array'."
+  (apply
+   'string
+   (if (equal byte-array '(:array :signature "y"))
+       nil
+     (let (result)
+       (dolist (elt byte-array result)
+        (when (characterp elt) (setq result (append result `(,elt)))))))))
 
 (defun dbus-escape-as-identifier (string)
   "Escape an arbitrary STRING so it follows the rules for a C identifier.
@@ -863,7 +870,7 @@
       ""
     (replace-regexp-in-string
      "_.."
-     (lambda (x) (format "%c" (string-to-number (substring x 1) 16)))
+     (lambda (x) (byte-to-string (string-to-number (substring x 1) 16)))
      string)))
 
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]