summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/hashing.cpp
diff options
context:
space:
mode:
author Jean-François DEL NERO <jeanfrancoisdelnero@free.fr>2015-12-28 11:27:47 +0100
committer Jean-François DEL NERO <jeanfrancoisdelnero@free.fr>2015-12-28 11:27:47 +0100
commit2a5e044fc23624a388bdb5f82ef9c11cbed6a9c7 (patch)
treeb468f54cdcbb7252d14790a7a013b138b1bd9b03 /src/lib/util/hashing.cpp
parent077fe7ad89d65bbeafde141c9b3f71ca8df42f1c (diff)
parent11fcbaa28583023ea93a8f0c1f3fb9082d3295ab (diff)
Merge https://github.com/mamedev/mame
# Conflicts: # src/devices/video/ef9365.cpp
Diffstat (limited to 'src/lib/util/hashing.cpp')
-rw-r--r--src/lib/util/hashing.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp
index e7f315ecc53..785127e01e8 100644
--- a/src/lib/util/hashing.cpp
+++ b/src/lib/util/hashing.cpp
@@ -63,13 +63,13 @@ bool sha1_t::from_string(const char *string, int length)
return false;
// iterate through our raw buffer
- for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
+ for (auto & elem : m_raw)
{
int upper = char_to_hex(*string++);
int lower = char_to_hex(*string++);
if (upper == -1 || lower == -1)
return false;
- m_raw[bytenum] = (upper << 4) | lower;
+ elem = (upper << 4) | lower;
}
return true;
}
@@ -82,8 +82,8 @@ bool sha1_t::from_string(const char *string, int length)
const char *sha1_t::as_string(std::string &buffer) const
{
buffer.clear();
- for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- strcatprintf(buffer, "%02x", m_raw[i]);
+ for (auto & elem : m_raw)
+ strcatprintf(buffer, "%02x", elem);
return buffer.c_str();
}
@@ -106,13 +106,13 @@ bool md5_t::from_string(const char *string, int length)
return false;
// iterate through our raw buffer
- for (int bytenum = 0; bytenum < sizeof(m_raw); bytenum++)
+ for (auto & elem : m_raw)
{
int upper = char_to_hex(*string++);
int lower = char_to_hex(*string++);
if (upper == -1 || lower == -1)
return false;
- m_raw[bytenum] = (upper << 4) | lower;
+ elem = (upper << 4) | lower;
}
return true;
}
@@ -125,8 +125,8 @@ bool md5_t::from_string(const char *string, int length)
const char *md5_t::as_string(std::string &buffer) const
{
buffer.clear();
- for (int i = 0; i < ARRAY_LENGTH(m_raw); i++)
- strcatprintf(buffer, "%02x", m_raw[i]);
+ for (auto & elem : m_raw)
+ strcatprintf(buffer, "%02x", elem);
return buffer.c_str();
}