summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-24 12:11:15 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-24 12:11:15 +0200
commit337fc151e4b2682de4c3b2496045e4054080b844 (patch)
treee5060f773fce5ca21069fe60078cfb95edfca4a9
parent248315ada26ff8e308bb99d5e46f25534e148620 (diff)
downloadabrt-337fc151e4b2682de4c3b2496045e4054080b844.tar.gz
abrt-337fc151e4b2682de4c3b2496045e4054080b844.tar.xz
abrt-337fc151e4b2682de4c3b2496045e4054080b844.zip
simplify CAnalyzerCCpp::CreateHash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/Plugins/CCpp.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 176a77a4..7d302c79 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -78,12 +78,19 @@ std::string CAnalyzerCCpp::CreateHash(const std::string& pInput)
HASH_End(hc, hash, &len, sizeof(hash));
HASH_Destroy(hc);
- unsigned int ii;
- std::stringstream ss;
- for (ii = 0; ii < len; ii++)
- ss << std::setw(2) << std::setfill('0') << std::hex << (hash[ii]&0xff);
+ char hash_str[SHA1_LENGTH*2 + 1];
+ char *d = hash_str;
+ unsigned char *s = hash;
+ while (len)
+ {
+ *d++ = "0123456789abcdef"[*s >> 4];
+ *d++ = "0123456789abcdef"[*s & 0xf];
+ s++;
+ len--;
+ }
+ *d = '\0';
- return ss.str();
+ return hash_str;
}
void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)