Commit b85eff45 authored by Michael Albinus's avatar Michael Albinus
Browse files

Minor changes, detected by test suite.

* net/dbus.el (dbus-unregister-service)
(dbus-escape-as-identifier, dbus-unescape-from-identifier):
Fix docstring.
(dbus-unregister-service): Skip :serial entries in
`dbus-registered-objects-table'.
(dbus-byte-array-to-string): New optional arg MULTIBYTE.
parent 8bea269d
2013-12-05 Michael Albinus <michael.albinus@gmx.de>
* net/dbus.el (dbus-unregister-service)
(dbus-escape-as-identifier, dbus-unescape-from-identifier):
Fix docstring.
(dbus-unregister-service): Skip :serial entries in
`dbus-registered-objects-table'.
(dbus-byte-array-to-string): New optional arg MULTIBYTE.
2013-12-04 Teodor Zlatanov <tzz@lifelogs.com> 2013-12-04 Teodor Zlatanov <tzz@lifelogs.com>
* emacs-lisp/lisp-mnt.el (lm-keywords-list): Trim whitespace * emacs-lisp/lisp-mnt.el (lm-keywords-list): Trim whitespace
......
...@@ -521,7 +521,7 @@ denoting the bus address. SERVICE must be a known service name. ...@@ -521,7 +521,7 @@ denoting the bus address. SERVICE must be a known service name.
The function returns a keyword, indicating the result of the The function returns a keyword, indicating the result of the
operation. One of the following keywords is returned: operation. One of the following keywords is returned:
`:released': Service has become the primary owner of the name. `:released': We successfully released the service.
`:non-existent': Service name does not exist on this bus. `:non-existent': Service name does not exist on this bus.
...@@ -530,12 +530,13 @@ queue of this service." ...@@ -530,12 +530,13 @@ queue of this service."
(maphash (maphash
(lambda (key value) (lambda (key value)
(dolist (elt value) (unless (equal :serial (car key))
(ignore-errors (dolist (elt value)
(when (and (equal bus (cadr key)) (string-equal service (cadr elt))) (ignore-errors
(unless (when (and (equal bus (cadr key)) (string-equal service (cadr elt)))
(puthash key (delete elt value) dbus-registered-objects-table) (unless
(remhash key dbus-registered-objects-table)))))) (puthash key (delete elt value) dbus-registered-objects-table)
(remhash key dbus-registered-objects-table)))))))
dbus-registered-objects-table) dbus-registered-objects-table)
(let ((reply (dbus-call-method (let ((reply (dbus-call-method
bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
...@@ -827,12 +828,13 @@ STRING shall be UTF8 coded." ...@@ -827,12 +828,13 @@ STRING shall be UTF8 coded."
(dolist (elt (string-to-list string) (append '(:array) result)) (dolist (elt (string-to-list string) (append '(:array) result))
(setq result (append result (list :byte elt))))))) (setq result (append result (list :byte elt)))))))
(defun dbus-byte-array-to-string (byte-array) (defun dbus-byte-array-to-string (byte-array &optional multibyte)
"Transforms BYTE-ARRAY into UTF8 coded string. "Transforms BYTE-ARRAY into UTF8 coded string.
BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte
array as produced by `dbus-string-to-byte-array'." array as produced by `dbus-string-to-byte-array'. The resulting
string is unibyte encoded, unless MULTIBYTE is non-nil."
(apply (apply
'string (if multibyte 'string 'unibyte-string)
(if (equal byte-array '(:array :signature "y")) (if (equal byte-array '(:array :signature "y"))
nil nil
(let (result) (let (result)
...@@ -855,7 +857,7 @@ and a smaller allowed set. As a special case, \"\" is escaped to ...@@ -855,7 +857,7 @@ and a smaller allowed set. As a special case, \"\" is escaped to
\"_\". \"_\".
Returns the escaped string. Algorithm taken from Returns the escaped string. Algorithm taken from
telepathy-glib's `tp-escape-as-identifier'." telepathy-glib's `tp_escape_as_identifier'."
(if (zerop (length string)) (if (zerop (length string))
"_" "_"
(replace-regexp-in-string (replace-regexp-in-string
...@@ -864,8 +866,8 @@ telepathy-glib's `tp-escape-as-identifier'." ...@@ -864,8 +866,8 @@ telepathy-glib's `tp-escape-as-identifier'."
string))) string)))
(defun dbus-unescape-from-identifier (string) (defun dbus-unescape-from-identifier (string)
"Retrieve the original string from the encoded STRING. "Retrieve the original string from the encoded STRING as unibyte string.
STRING must have been coded with `dbus-escape-as-identifier'" STRING must have been encoded with `dbus-escape-as-identifier'."
(if (string-equal string "_") (if (string-equal string "_")
"" ""
(replace-regexp-in-string (replace-regexp-in-string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment