Skip to content

Commit

Permalink
add default cases for hash_algorithm value traits serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tfussell committed Mar 20, 2017
1 parent 07001e0 commit f7db4b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/detail/xlsx_crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file

#include <detail/default_case.hpp>
#include <detail/xlsx_crypto.hpp>

namespace {
Expand Down Expand Up @@ -63,7 +64,7 @@ struct value_traits<xlnt::detail::hash_algorithm>
return xlnt::detail::hash_algorithm::ripemd160;
else if (hash_algorithm_string == "Whirlpool")
return xlnt::detail::hash_algorithm::whirlpool;
throw xlnt::exception(hash_algorithm_string);
default_case(xlnt::detail::hash_algorithm::sha1);
}

static std::string serialize(xlnt::detail::hash_algorithm algorithm, const serializer &)
Expand Down Expand Up @@ -91,6 +92,8 @@ struct value_traits<xlnt::detail::hash_algorithm>
case xlnt::detail::hash_algorithm::whirlpool:
return "Whirlpool";
}

default_case("SHA1");
}
}; // struct value_traits<>

Expand Down

0 comments on commit f7db4b0

Please sign in to comment.