summaryrefslogtreecommitdiff
path: root/src/MessageDigest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-09 23:45:28 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-09 23:45:28 +0900
commitf333231c7a0cd08e25bf56ff7ddb6aaf8c6972da (patch)
tree2e5c197dd56e33c0217c1f66c789737ccc4d8f97 /src/MessageDigest.cc
parent15e1a799147fdb5fb9471cb9e96c928b6cae31c3 (diff)
Fix broken MessageDigst::getSupportedHashTypeString()
Diffstat (limited to 'src/MessageDigest.cc')
-rw-r--r--src/MessageDigest.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/MessageDigest.cc b/src/MessageDigest.cc
index c07c46cb..a4750918 100644
--- a/src/MessageDigest.cc
+++ b/src/MessageDigest.cc
@@ -35,6 +35,7 @@
#include "MessageDigest.h"
#include <sstream>
+#include <iterator>
#include "MessageDigestImpl.h"
#include "util.h"
@@ -104,7 +105,11 @@ std::string MessageDigest::getSupportedHashTypeString()
std::vector<std::string> ht = getSupportedHashTypes();
std::stringstream ss;
std::copy(ht.begin(), ht.end(), std::ostream_iterator<std::string>(ss, ", "));
- return ss.str().substr(ss.str().length() - 2);
+ std::string res = ss.str();
+ if(!res.empty()) {
+ res.erase(ss.str().length()-2);
+ }
+ return res;
}
size_t MessageDigest::getDigestLength(const std::string& hashType)