diff options
author | 2016-03-02 21:49:49 +0100 | |
---|---|---|
committer | 2016-03-02 21:49:49 +0100 | |
commit | 9fe9f6d93e672bcd926f9e7461774bc9cc22e094 (patch) | |
tree | 3911b611dd010a4108b90fb8b8c82116eec21117 /src/lib/util/hashing.cpp | |
parent | dbdf21ee465acadf3e643d62d6bedfcc297ada85 (diff) | |
parent | 1914702e6fae052668df5b068a502bca57c9a3b0 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
# Resolved Conflicts:
# src/osd/modules/render/d3d/d3dhlsl.cpp
# src/osd/windows/winmain.cpp
Diffstat (limited to 'src/lib/util/hashing.cpp')
-rw-r--r-- | src/lib/util/hashing.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp index 8e85e4a42d2..240e64af9ad 100644 --- a/src/lib/util/hashing.cpp +++ b/src/lib/util/hashing.cpp @@ -10,6 +10,8 @@ #include "hashing.h" #include <zlib.h> +#include <iomanip> +#include <sstream> //************************************************************************** @@ -81,10 +83,12 @@ bool sha1_t::from_string(const char *string, int length) std::string sha1_t::as_string() const { - std::string buffer; + std::ostringstream buffer; + buffer.fill('0'); + buffer << std::hex; for (auto & elem : m_raw) - strcatprintf(buffer, "%02x", elem); - return buffer; + buffer << std::setw(2) << unsigned(elem); + return buffer.str(); } @@ -124,10 +128,12 @@ bool md5_t::from_string(const char *string, int length) std::string md5_t::as_string() const { - std::string buffer; + std::ostringstream buffer; + buffer.fill('0'); + buffer << std::hex; for (auto & elem : m_raw) - strcatprintf(buffer, "%02x", elem); - return buffer; + buffer << std::setw(2) << unsigned(elem); + return buffer.str(); } @@ -168,7 +174,7 @@ bool crc32_t::from_string(const char *string, int length) std::string crc32_t::as_string() const { - return strformat("%08x", m_raw); + return string_format("%08x", m_raw); } @@ -225,7 +231,7 @@ bool crc16_t::from_string(const char *string, int length) std::string crc16_t::as_string() const { - return strformat("%04x", m_raw); + return string_format("%04x", m_raw); } /** |