From 375a70e14bedde610df4de3b46014c1705c45426 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Thu, 11 Jul 2013 23:07:38 +0800 Subject: [PATCH 04/10] DBusWatch: dbus_watch_get_socket deprecated the other two APIs dbus_watch_get_fd and dbus_watch_get_unix_fd were deprecated by dbus_watch_get_socket since 2007, so update the document and code to reflect this change. In current implementation, socket used on both UNIX and Windows, although it could be others on UNIX, for example, file, pipe and so on. --- dbus/dbus-watch.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index b82c57d..bcccb3e 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -506,7 +506,7 @@ _dbus_watch_set_handler (DBusWatch *watch, */ /** - * Deprecated former name of dbus_watch_get_unix_fd(). + * Deprecated by dbus_watch_get_socket(). * * @param watch the DBusWatch object. * @returns the file descriptor to watch. @@ -516,19 +516,12 @@ dbus_watch_get_fd (DBusWatch *watch) { _dbus_return_val_if_fail (watch != NULL, -1); - return dbus_watch_get_unix_fd(watch); + return dbus_watch_get_socket (watch); } /** - * Returns a UNIX file descriptor to be watched, - * which may be a pipe, socket, or other type of - * descriptor. On UNIX this is preferred to - * dbus_watch_get_socket() since it works with - * more kinds of #DBusWatch. - * - * Always returns -1 on Windows. On Windows you use - * dbus_watch_get_socket() to get a Winsock socket to watch. - * + * Deprecated by dbus_watch_get_socket(). + * * @param watch the DBusWatch object. * @returns the file descriptor to watch. */ @@ -537,27 +530,12 @@ dbus_watch_get_unix_fd (DBusWatch *watch) { _dbus_return_val_if_fail (watch != NULL, -1); - /* FIXME remove #ifdef and do this on a lower level - * (watch should have set_socket and set_unix_fd and track - * which it has, and the transport should provide the - * appropriate watch type) - */ -#ifdef DBUS_UNIX - return watch->fd; -#else - return dbus_watch_get_socket( watch ); -#endif + return dbus_watch_get_socket (watch); } /** - * Returns a socket to be watched, on UNIX this will return -1 if our - * transport is not socket-based so dbus_watch_get_unix_fd() is - * preferred. + * Returns a socket to be watched. * - * On Windows, dbus_watch_get_unix_fd() returns -1 but this function - * returns a Winsock socket (assuming the transport is socket-based, - * as it always is for now). - * * @param watch the DBusWatch object. * @returns the socket to watch. */ -- 1.7.9.5