summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2017-01-17 20:50:08 +0000
committerSimon McVittie <smcv@collabora.com>2017-04-07 14:02:13 +0100
commitb706b9eabe38e19e18daeac7ea60568c9081cbcb (patch)
tree5ba0af4199470267f6c26115acca2048bff96173
parentdd72fed8c5ad9ebd8d88271a4eb89b3b0b8097eb (diff)
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 <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98191
-rw-r--r--dbus/dbus-transport.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c
index b1932c32..69e2241d 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");
}
}