adapt for boost 1.83

This commit is contained in:
luocai 2024-08-27 14:14:27 +08:00
parent 521c40cbd5
commit 7f5f273e14
2 changed files with 8 additions and 1 deletions

View File

@ -43,8 +43,11 @@ std::string Encrypt::sha1sum(const std::string_view &data, Sha1DigestType &diges
std::string Encrypt::sha1sum(const char *data, size_t size, Sha1DigestType &digest) {
boost::uuids::detail::sha1 sha1;
sha1.process_bytes(data, size);
#if BOOST_VERSION < 108600
sha1.get_digest(*reinterpret_cast<boost::uuids::detail::sha1::digest_type *>(&digest));
#else
sha1.get_digest(digest);
#endif
std::ostringstream oss;
for (int i = 0; i < 5; ++i) oss << std::hex << std::setfill('0') << std::setw(8) << digest[i];

View File

@ -24,7 +24,11 @@ void IoContext::runIoContext() {
} catch (const boost::exception &e) {
LOG(error) << boost::diagnostic_information(e);
} catch (const std::exception &e) {
#if BOOST_VERSION < 108600
LOG(error) << e.what();
#else
boost::stacktrace::stacktrace trace = boost::stacktrace::stacktrace::from_current_exception();
LOG(error) << e.what() << ", trace:\n" << trace;
#endif
}
}