/* Check whether a Lisp symbol is a predefined D-Bus type symbol. */
#define XD_DBUS_TYPE_P(object) \
- (SYMBOLP (object) && ((xd_symbol_to_dbus_type (object) != DBUS_TYPE_INVALID)))
+ Fkeywordp (object) && ((xd_symbol_to_dbus_type (object) != DBUS_TYPE_INVALID))
/* Determine the DBusType of a given Lisp OBJECT. It is used to
convert Lisp objects, being arguments of `dbus-call-method' or
CHECK_CONS (object);
elt = XD_NEXT_VALUE (elt);
+ CHECK_CONS (elt);
subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt));
xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
break;
case DBUS_TYPE_STRUCT:
- /* A struct list might contain any number of elements with
- different types. No further check needed. */
+ /* A struct list might contain any (but zero) number of elements
+ with different types. No further check needed. */
CHECK_CONS (object);
elt = XD_NEXT_VALUE (elt);
+ CHECK_CONS (elt);
/* Compose the signature from the elements. It is enclosed by
parentheses. */
/* First element. */
elt = XD_NEXT_VALUE (elt);
+ CHECK_CONS (elt);
subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt));
xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
xd_signature_cat (signature, x);
/* Second element. */
elt = CDR_SAFE (XD_NEXT_VALUE (elt));
+ CHECK_CONS (elt);
subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt));
xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt)));
xd_signature_cat (signature, x);
xd_add_watch,
xd_remove_watch,
xd_toggle_watch,
- SYMBOLP (bus)
+ Fkeywordp (bus)
? (void *) XSYMBOL (bus)
: (void *) XSTRING (bus),
NULL))
while (!NILP (busp))
{
key = CAR_SAFE (CAR_SAFE (busp));
- if ((SYMBOLP (key) && XSYMBOL (key) == data)
+ if ((Fkeywordp (key) && XSYMBOL (key) == data)
|| (STRINGP (key) && XSTRING (key) == data))
bus = key;
busp = CDR_SAFE (busp);
(should
(dbus-check-arguments
:session dbus--test-service '(:variant (:array "string"))))
- ;; No or more than one element.
- ;; FIXME.
- ;; (should-error
- ;; (dbus-check-arguments :session dbus--test-service '(:variant))
- ;; :type 'wrong-type-argument)
+ ;; Empty variant.
+ (should-error
+ (dbus-check-arguments :session dbus--test-service '(:variant))
+ :type 'wrong-type-argument)
+ ;; More than one element.
(should-error
(dbus-check-arguments
:session dbus--test-service
(should
(dbus-check-arguments
:session dbus--test-service
- '(:array (:dict-entry :string "string" :boolean t))))
+ '(:array (:dict-entry :string "string" :boolean nil))))
;; This is an alternative syntax. FIXME: Shall this be supported?
(should
(dbus-check-arguments
:session dbus--test-service
'(:array :dict-entry (:string "string" :boolean t))))
- ;; FIXME: Must be errors.
- ;; (should
- ;; (dbus-check-arguments
- ;; :session dbus--test-service '(:array (:dict-entry))))
- ;; (should
- ;; (dbus-check-arguments
- ;; :session dbus--test-service '(:array (:dict-entry :string "string"))))
- ;; Not two elements.
+ ;; Empty dict-entry.
+ (should-error
+ (dbus-check-arguments
+ :session dbus--test-service '(:array (:dict-entry)))
+ :type 'wrong-type-argument)
+ ;; One element.
+ (should-error
+ (dbus-check-arguments
+ :session dbus--test-service '(:array (:dict-entry :string "string")))
+ :type 'wrong-type-argument)
(should-error
(dbus-check-arguments
:session dbus--test-service
(dbus-check-arguments
:session dbus--test-service '(:dict-entry :string "string" :boolean t))
:type 'wrong-type-argument)
- ;; FIXME:! This doesn't look right.
- ;; Different dict entry types can be part of an array ???
- (should
- (dbus-check-arguments
- :session dbus--test-service
- '(:array
- (:dict-entry :string "string1" :boolean t)
- (:dict-entry :string "string2" :object-path "/object/path"))))
+ ;; Different dict entry types are not ched. FIXME: Add check.
+ ;; (should-error
+ ;; (dbus-check-arguments
+ ;; :session dbus--test-service
+ ;; '(:array
+ ;; (:dict-entry :string "string1" :boolean t)
+ ;; (:dict-entry :string "string2" :object-path "/object/path")))
+ ;; :type 'wrong-type-argument)
;; `:struct'. There is no restriction what could be an element of a struct.
- ;; Empty struct. FIXME: Is this right?
- ;; (should (dbus-check-arguments :session dbus--test-service '(:struct)))
(should
(dbus-check-arguments
:session dbus--test-service
'(:struct
:string "string"
:object-path "/object/path"
- (:variant (:array :unix-fd 1 :unix-fd 2 :unix-fd 3 :unix-fd 4))))))
+ (:variant (:array :unix-fd 1 :unix-fd 2 :unix-fd 3 :unix-fd 4)))))
+ ;; Empty struct.
+ (should-error
+ (dbus-check-arguments :session dbus--test-service '(:struct))
+ :type 'wrong-type-argument))
(defun dbus--test-register-service (bus)
"Check service registration at BUS."