enum: Return boolean result for enum_from_name() lookup
authorMartin Willi <martin@revosec.ch>
Fri, 16 May 2014 09:57:54 +0000 (11:57 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 16 May 2014 13:42:07 +0000 (15:42 +0200)
commit064fe9c963b7aa0ea904ab15443198d965175461
treebaafea8cdeb46701d996a07fa2bbb2c54fdf3458
parent9ee8b3b41f9dd24e49f4fd80c5891f134b38d161
enum: Return boolean result for enum_from_name() lookup

Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.

Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.

This also fixes several clang warnings where enums are unsigned.
28 files changed:
scripts/hash_burn.c
src/charon-cmd/cmd/cmd_connection.c
src/conftest/hooks/add_notify.c
src/conftest/hooks/add_payload.c
src/conftest/hooks/custom_proposal.c
src/conftest/hooks/set_critical.c
src/conftest/hooks/set_length.c
src/conftest/hooks/set_reserved.c
src/conftest/hooks/unencrypted_notify.c
src/conftest/hooks/unsort_message.c
src/libcharon/plugins/coupling/coupling_validator.c
src/libcharon/plugins/eap_radius/eap_radius_forward.c
src/libcharon/plugins/load_tester/load_tester_creds.c
src/libcharon/plugins/stroke/stroke_socket.c
src/libcharon/plugins/vici/vici_query.c
src/libstrongswan/tests/suites/test_enum.c
src/libstrongswan/utils/enum.c
src/libstrongswan/utils/enum.h
src/libtls/tls_crypto.c
src/libtnccs/plugins/tnc_imv/tnc_imv_manager.c
src/libtnccs/plugins/tnccs_11/messages/tnccs_error_msg.c
src/libtnccs/plugins/tnccs_11/messages/tnccs_msg.c
src/pki/commands/acert.c
src/pki/commands/issue.c
src/pki/commands/req.c
src/pki/commands/self.c
src/pki/commands/signcrl.c
src/swanctl/commands/list_certs.c