Skip to content

Commit

Permalink
Digest::fromHexifiedString now uses a std::string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Nov 22, 2024
1 parent 3b53b20 commit 4fb8f1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DataFormats/Provenance/src/CompactHash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace edm {

std::array<unsigned char, 16> fromHex_(std::string_view v) {
cms::MD5Result temp;
temp.fromHexifiedString(std::string(v));
temp.fromHexifiedString(v);
auto hash = temp.compactForm();
std::array<unsigned char, 16> ret;
std::copy(hash.begin(), hash.end(), ret.begin());
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Utilities/interface/Digest.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace cms {
std::string compactForm() const;

// Set our data from the given hexdigest string.
void fromHexifiedString(std::string const& s);
void fromHexifiedString(std::string_view);

bool isValid() const;
};
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Utilities/src/Digest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ namespace cms {
return std::string(p, p + bytes.size());
}

void MD5Result::fromHexifiedString(std::string const& hexy) {
void MD5Result::fromHexifiedString(std::string_view hexy) {
switch (hexy.size()) {
case 0: {
set_to_default(*this);
} break;
case 32: {
std::string::const_iterator it = hexy.begin();
auto it = hexy.cbegin();
for (size_t i = 0; i != 16; ++i) {
// first nybble
bytes[i] = (unhexify(*it++) << 4);
Expand Down

0 comments on commit 4fb8f1a

Please sign in to comment.