------------------------------------------------------------ revno: 117478 committer: Michael Albinus branch nick: trunk timestamp: Fri 2014-07-04 12:07:45 +0200 message: * automated/dbus-tests.el (dbus-test02-register-service-session) (dbus-test02-register-service-system): Fix docstring. (dbus-test02-register-service-own-bus) (dbus-test03-peer-interface): New tests. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-07-03 06:00:53 +0000 +++ test/ChangeLog 2014-07-04 10:07:45 +0000 @@ -1,3 +1,10 @@ +2014-07-04 Michael Albinus + + * automated/dbus-tests.el (dbus-test02-register-service-session) + (dbus-test02-register-service-system): Fix docstring. + (dbus-test02-register-service-own-bus) + (dbus-test03-peer-interface): New tests. + 2014-07-03 Fabián Ezequiel Gallina * automated/python-tests.el (python-tests-self-insert): New function. === modified file 'test/automated/dbus-tests.el' --- test/automated/dbus-tests.el 2014-06-27 18:20:21 +0000 +++ test/automated/dbus-tests.el 2014-07-04 10:07:45 +0000 @@ -103,7 +103,7 @@ (should-error (dbus-unregister-service bus dbus-service-dbus))) (ert-deftest dbus-test02-register-service-session () - "Check service registration at `:session'." + "Check service registration at `:session' bus." (skip-unless (and dbus--test-enabled-session-bus (dbus-register-service :session dbus-service-emacs))) (dbus--test-register-service :session) @@ -121,11 +121,57 @@ (should (eq (dbus-unregister-service :session service) :not-owner))))) (ert-deftest dbus-test02-register-service-system () - "Check service registration at `:system'." + "Check service registration at `:system' bus." (skip-unless (and dbus--test-enabled-system-bus (dbus-register-service :system dbus-service-emacs))) (dbus--test-register-service :system)) +(ert-deftest dbus-test02-register-service-own-bus () + "Check service registration with an own bus. +This includes initialization and closing the bus." + ;; Start bus. + (let ((output + (ignore-errors + (shell-command-to-string "dbus-launch --sh-syntax"))) + bus pid) + (skip-unless (stringp output)) + (when (string-match "DBUS_SESSION_BUS_ADDRESS='\\(.+\\)';" output) + (setq bus (match-string 1 output))) + (when (string-match "DBUS_SESSION_BUS_PID=\\([[:digit:]]+\\);" output) + (setq pid (match-string 1 output))) + (unwind-protect + (progn + (skip-unless + (dbus-ignore-errors + (and bus pid + (featurep 'dbusbind) + (dbus-init-bus bus) + (dbus-get-unique-name bus) + (dbus-register-service bus dbus-service-emacs)))) + ;; Run the test. + (dbus--test-register-service bus)) + + ;; Save exit. + (when pid (call-process "kill" nil nil nil pid))))) + +(ert-deftest dbus-test03-peer-interface () + "Check `dbus-interface-peer' methods." + (skip-unless + (and dbus--test-enabled-session-bus + (dbus-register-service :session dbus-service-emacs) + ;; "GetMachineId" is not implemented (yet). When it returns a + ;; value, another D-Bus client like dbus-monitor is reacting + ;; on `dbus-interface-peer'. We cannot test then. + (not + (dbus-ignore-errors + (dbus-call-method + :session dbus-service-emacs dbus-path-dbus + dbus-interface-peer "GetMachineId" :timeout 100))))) + + (should (dbus-ping :session dbus-service-emacs 100)) + (dbus-unregister-service :session dbus-service-emacs) + (should-not (dbus-ping :session dbus-service-emacs 100))) + (defun dbus-test-all (&optional interactive) "Run all tests for \\[dbus]." (interactive "p") ------------------------------------------------------------ revno: 117477 committer: Michael Albinus branch nick: trunk timestamp: Fri 2014-07-04 12:03:14 +0200 message: Fix Bug#17858 * net/dbus.el (dbus-peer-handler): New defun. (dbus-register-service): Register it. (dbus-managed-objects-handler): Fix docstring. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-07-04 02:00:54 +0000 +++ lisp/ChangeLog 2014-07-04 10:03:14 +0000 @@ -1,3 +1,9 @@ +2014-07-04 Michael Albinus + + * net/dbus.el (dbus-peer-handler): New defun. + (dbus-register-service): Register it. (Bug#17858) + (dbus-managed-objects-handler): Fix docstring. + 2014-07-04 Phil Sainty (tiny change) * emacs-lisp/lisp.el (narrow-to-defun-include-comments): New var. @@ -1762,7 +1768,7 @@ Remove HISTFILE and HISTSIZE; it's too late to set them here. Add :version entry. (tramp-open-shell): Do not let-bind `tramp-end-of-output'. - Add "HISTSIZE=/dev/null" to the shell's env arguments. Do not send + Add "HISTFILE=/dev/null" to the shell's env arguments. Do not send extra "PSx=..." commands. (tramp-maybe-open-connection): Setenv HISTFILE to /dev/null. (Bug#17295) @@ -3462,7 +3468,7 @@ 2014-03-10 Michael Albinus * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): - Do not add `nil' to the environment, when there's no remote `locale'. + Do not add nil to the environment, when there's no remote `locale'. (tramp-find-inline-encoding): Check, that the remote host has installed perl, before sending scripts. === modified file 'lisp/net/dbus.el' --- lisp/net/dbus.el 2014-06-15 12:15:25 +0000 +++ lisp/net/dbus.el 2014-07-04 10:03:14 +0000 @@ -544,6 +544,10 @@ `:already-owner': Service is already the primary owner." + ;; Add Peer handler. + (dbus-register-method + bus service nil dbus-interface-peer "Ping" 'dbus-peer-handler 'dont-register) + ;; Add ObjectManager handler. (dbus-register-method bus service nil dbus-interface-objectmanager "GetManagedObjects" @@ -1151,6 +1155,22 @@ bus service dbus-path-dbus dbus-interface-peer "Ping"))) (dbus-error nil))) +(defun dbus-peer-handler () + "Default handler for the \"org.freedesktop.DBus.Peer\" interface. +It will be registered for all objects created by `dbus-register-service'." + (let* ((last-input-event last-input-event) + (method (dbus-event-member-name last-input-event))) + (cond + ;; "Ping" does not return an output parameter. + ((string-equal method "Ping") + :ignore) + ;; "GetMachineId" returns "s". + ((string-equal method "GetMachineId") + (signal + 'dbus-error + (list + (format "%s.GetMachineId not implemented" dbus-interface-peer))))))) + ;;; D-Bus introspection. @@ -1672,7 +1692,7 @@ (defun dbus-managed-objects-handler () "Default handler for the \"org.freedesktop.DBus.ObjectManager\" interface. -It will be registered for all objects created by `dbus-register-method'." +It will be registered for all objects created by `dbus-register-service'." (let* ((last-input-event last-input-event) (bus (dbus-event-bus-name last-input-event)) (path (dbus-event-path-name last-input-event))) ------------------------------------------------------------ revno: 117476 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2014-07-04 06:28:54 +0400 message: * font.h (struct font_driver): Remove get_outline and free_outline; not used by any font driver. * ftfont.c (ftfont_driver): * macfont.m (macfont_driver): * nsfont.m (nsfont_driver): * w32font.c (w32font_driver): * w32uniscribe.c (uniscribe_font_driver): * xfont.c (xfont_driver): Related users changed. * xselect.c (x_get_window_property): Use convenient xmalloc. Call to xfree only if some data was really allocated. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-07-03 18:12:41 +0000 +++ src/ChangeLog 2014-07-04 02:28:54 +0000 @@ -1,3 +1,16 @@ +2014-07-04 Dmitry Antipov + + * font.h (struct font_driver): Remove get_outline and free_outline; + not used by any font driver. + * ftfont.c (ftfont_driver): + * macfont.m (macfont_driver): + * nsfont.m (nsfont_driver): + * w32font.c (w32font_driver): + * w32uniscribe.c (uniscribe_font_driver): + * xfont.c (xfont_driver): Related users changed. + * xselect.c (x_get_window_property): Use convenient xmalloc. + Call to xfree only if some data was really allocated. + 2014-07-03 Dmitry Antipov On MS-Windows, display busy cursor on all GUI frames. === modified file 'src/font.h' --- src/font.h 2014-07-03 12:20:00 +0000 +++ src/font.h 2014-07-04 02:28:54 +0000 @@ -614,15 +614,6 @@ #endif /* HAVE_WINDOW_SYSTEM */ /* Optional. - Return an outline data for glyph-code CODE of FONT. The format - of the outline data depends on the font-driver. */ - void *(*get_outline) (struct font *font, unsigned code); - - /* Optional. - Free OUTLINE (that is obtained by the above method). */ - void (*free_outline) (struct font *font, void *outline); - - /* Optional. Get coordinates of the INDEXth anchor point of the glyph whose code is CODE. Store the coordinates in *X and *Y. Return 0 if the operations was successful. Otherwise return -1. */ === modified file 'src/ftfont.c' --- src/ftfont.c 2014-06-17 16:09:19 +0000 +++ src/ftfont.c 2014-07-04 02:28:54 +0000 @@ -538,8 +538,6 @@ NULL, /* draw */ ftfont_get_bitmap, NULL, /* free_bitmap */ - NULL, /* get_outline */ - NULL, /* free_outline */ ftfont_anchor_point, #ifdef HAVE_LIBOTF ftfont_otf_capability, === modified file 'src/macfont.m' --- src/macfont.m 2014-06-11 17:57:51 +0000 +++ src/macfont.m 2014-07-04 02:28:54 +0000 @@ -1580,8 +1580,6 @@ macfont_draw, NULL, /* get_bitmap */ NULL, /* free_bitmap */ - NULL, /* get_outline */ - NULL, /* free_outline */ NULL, /* anchor_point */ NULL, /* otf_capability */ NULL, /* otf_drive */ === modified file 'src/nsfont.m' --- src/nsfont.m 2014-05-25 10:28:52 +0000 +++ src/nsfont.m 2014-07-04 02:28:54 +0000 @@ -649,7 +649,7 @@ nsfont_encode_char, nsfont_text_extents, nsfont_draw, - /* excluded: get_bitmap, free_bitmap, get_outline, free_outline, + /* excluded: get_bitmap, free_bitmap, anchor_point, otf_capability, otf_driver, start_for_frame, end_for_frame, shape */ }; === modified file 'src/w32font.c' --- src/w32font.c 2014-01-19 15:42:48 +0000 +++ src/w32font.c 2014-07-04 02:28:54 +0000 @@ -757,19 +757,6 @@ static void w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); */ -/* w32 implementation of get_outline for font backend. - Optional. - Return an outline data for glyph-code CODE of FONT. The format - of the outline data depends on the font-driver. -static void * -w32font_get_outline (struct font *font, unsigned code); - */ -/* w32 implementation of free_outline for font backend. - Optional. - Free OUTLINE (that is obtained by the above method). -static void -w32font_free_outline (struct font *font, void *outline); - */ /* w32 implementation of anchor_point for font backend. Optional. Get coordinates of the INDEXth anchor point of the glyph whose @@ -2557,8 +2544,6 @@ w32font_draw, NULL, /* get_bitmap */ NULL, /* free_bitmap */ - NULL, /* get_outline */ - NULL, /* free_outline */ NULL, /* anchor_point */ NULL, /* otf_capability */ NULL, /* otf_drive */ === modified file 'src/w32uniscribe.c' --- src/w32uniscribe.c 2014-01-01 07:43:34 +0000 +++ src/w32uniscribe.c 2014-07-04 02:28:54 +0000 @@ -604,8 +604,6 @@ int uniscribe_get_bitmap (struct font *font, unsigned code, struct font_bitmap *bitmap, int bits_per_pixel); void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap); - void * uniscribe_get_outline (struct font *font, unsigned code); - void uniscribe_free_outline (struct font *font, void *outline); int uniscribe_anchor_point (struct font *font, unsigned code, int index, int *x, int *y); int uniscribe_start_for_frame (struct frame *f); @@ -981,8 +979,6 @@ w32font_draw, NULL, /* get_bitmap */ NULL, /* free_bitmap */ - NULL, /* get_outline */ - NULL, /* free_outline */ NULL, /* anchor_point */ uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ NULL, /* otf_drive - use shape instead. */ === modified file 'src/xfont.c' --- src/xfont.c 2014-06-10 03:32:36 +0000 +++ src/xfont.c 2014-07-04 02:28:54 +0000 @@ -146,7 +146,7 @@ xfont_encode_char, xfont_text_extents, xfont_draw, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, xfont_check, NULL, /* get_variation_glyphs */ NULL, /* filter_properties */ === modified file 'src/xselect.c' --- src/xselect.c 2014-06-22 05:00:14 +0000 +++ src/xselect.c 2014-07-04 02:28:54 +0000 @@ -1299,9 +1299,7 @@ if (total_size_max < bytes_remaining) goto size_overflow; total_size = bytes_remaining; - data = malloc (total_size + 1); - if (! data) - goto memory_exhausted; + data = xmalloc (total_size + 1); /* Now read, until we've gotten it all. */ while (bytes_remaining) @@ -1352,9 +1350,7 @@ if (remaining_lim < 0 || remaining_lim < bytes_remaining) goto size_overflow; total_size = offset + bytes_gotten + bytes_remaining; - data1 = realloc (data, total_size + 1); - if (! data1) - goto memory_exhausted; + data1 = xrealloc (data, total_size + 1); data = data1; } @@ -1386,14 +1382,10 @@ return; size_overflow: - free (data); + if (data) + xfree (data); unblock_input (); memory_full (SIZE_MAX); - - memory_exhausted: - free (data); - unblock_input (); - memory_full (total_size + 1); } /* Use xfree, not XFree, to free the data obtained with this function. */