From 409d3c7136a62d9b73706f05aaefc04e60652164 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Jul 2018 17:45:45 +0200 Subject: [PATCH] lib/gcrypt/MD5: return a StringBuffer --- src/input/plugins/QobuzClient.cxx | 2 +- src/lib/gcrypt/MD5.cxx | 6 +++--- src/lib/gcrypt/MD5.hxx | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/input/plugins/QobuzClient.cxx b/src/input/plugins/QobuzClient.cxx index 419f24682..05bc666ba 100644 --- a/src/input/plugins/QobuzClient.cxx +++ b/src/input/plugins/QobuzClient.cxx @@ -213,7 +213,7 @@ QobuzClient::MakeSignedUrl(const char *object, const char *method, concatenated_query += app_secret; const auto md5_hex = MD5Hex({concatenated_query.data(), concatenated_query.size()}); - q(uri, "request_sig", &md5_hex.front()); + q(uri, "request_sig", md5_hex); return uri; } diff --git a/src/lib/gcrypt/MD5.cxx b/src/lib/gcrypt/MD5.cxx index c45d3d9da..621c8c29e 100644 --- a/src/lib/gcrypt/MD5.cxx +++ b/src/lib/gcrypt/MD5.cxx @@ -38,13 +38,13 @@ MD5(ConstBuffer input) noexcept return Gcrypt::Hash(input); } -std::array +StringBuffer<33> MD5Hex(ConstBuffer input) noexcept { const auto raw = MD5(input); - std::array result; + StringBuffer<33> result; - char *p = &result.front(); + char *p = result.data(); for (const auto i : raw) { sprintf(p, "%02x", i); p += 2; diff --git a/src/lib/gcrypt/MD5.hxx b/src/lib/gcrypt/MD5.hxx index d4a1f57d0..478a7ef12 100644 --- a/src/lib/gcrypt/MD5.hxx +++ b/src/lib/gcrypt/MD5.hxx @@ -30,6 +30,7 @@ #ifndef GCRYPT_MD5_HXX #define GCRYPT_MD5_HXX +#include "util/StringBuffer.hxx" #include "Compiler.h" #include @@ -41,7 +42,7 @@ std::array MD5(ConstBuffer input) noexcept; gcc_pure -std::array +StringBuffer<33> MD5Hex(ConstBuffer input) noexcept; #endif