* net/dbus.el (dbus-string-to-byte-array): Handle empty array.
This commit is contained in:
parent
a6d46bc12c
commit
d665fff055
1 changed files with 6 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
;;; dbus.el --- Elisp bindings for D-Bus.
|
||||
|
||||
;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Michael Albinus <michael.albinus@gmx.de>
|
||||
;; Keywords: comm, hardware
|
||||
|
@ -247,9 +247,11 @@ usage: (dbus-name-owner-changed-handler service old-owner new-owner)"
|
|||
(defun dbus-string-to-byte-array (string)
|
||||
"Transforms STRING to list (:array :byte c1 :byte c2 ...).
|
||||
STRING shall be UTF8 coded."
|
||||
(let (result)
|
||||
(dolist (elt (string-to-list string) (append '(:array) result))
|
||||
(setq result (append result (list :byte elt))))))
|
||||
(if (zerop (length string))
|
||||
'(:array :signature "y")
|
||||
(let (result)
|
||||
(dolist (elt (string-to-list string) (append '(:array) result))
|
||||
(setq result (append result (list :byte elt)))))))
|
||||
|
||||
(defun dbus-byte-array-to-string (byte-array)
|
||||
"Transforms BYTE-ARRAY into UTF8 coded string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue