From b706b9eabe38e19e18daeac7ea60568c9081cbcb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 17 Jan 2017 20:50:08 +0000 Subject: [PATCH] DBusTransport: be explicit about _dbus_auth_do_work() results Explicitly enumerate the states where we reset the maybe_authenticated flag, and assert that _dbus_auth_do_work() doesn't return an impossible or invalid state (by source code inspection, it doesn't). This silences -Wswitch-enum. Based on part of a patch from Thomas Zimmermann. Signed-off-by: Simon McVittie Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98191 --- dbus/dbus-transport.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index b1932c32e..69e2241d7 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -749,8 +749,17 @@ _dbus_transport_try_to_authenticate (DBusTransport *transport) case DBUS_AUTH_STATE_AUTHENTICATED: /* leave as maybe_authenticated */ break; - default: + + case DBUS_AUTH_STATE_WAITING_FOR_INPUT: + case DBUS_AUTH_STATE_WAITING_FOR_MEMORY: + case DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND: + case DBUS_AUTH_STATE_NEED_DISCONNECT: maybe_authenticated = FALSE; + break; + + case DBUS_AUTH_STATE_INVALID: + default: + _dbus_assert_not_reached ("invalid authentication state"); } } -- 2.47.3