summaryrefslogtreecommitdiff
path: root/lldb/source/Host/posix/FileSystem.cpp
diff options
context:
space:
mode:
authorOleksiy Vyalov <ovyalov@google.com>2015-02-20 18:34:03 +0000
committerOleksiy Vyalov <ovyalov@google.com>2015-02-20 18:34:03 +0000
commit7a9e76216b4ce12ce29135cd851fb5f22f77fe22 (patch)
treed172e9a8736266a4d0190f84133483f1dfa81031 /lldb/source/Host/posix/FileSystem.cpp
parente8595de64747d26397767c92a9809f6ab8c124c5 (diff)
Introduce FileSystem::CalculateMD5AsString that supports any platform and make existing FileSystem::CalculateMD5 to use it.
http://reviews.llvm.org/D7771 llvm-svn: 230036
Diffstat (limited to 'lldb/source/Host/posix/FileSystem.cpp')
-rw-r--r--lldb/source/Host/posix/FileSystem.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp
index 571316811142..b55b01b45691 100644
--- a/lldb/source/Host/posix/FileSystem.cpp
+++ b/lldb/source/Host/posix/FileSystem.cpp
@@ -172,30 +172,3 @@ FileSystem::Readlink(const char *path, char *buf, size_t buf_len)
error.SetErrorString("'buf' buffer is too small to contain link contents");
return error;
}
-
-bool
-FileSystem::CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high)
-{
-#if defined(__APPLE__)
- StreamString md5_cmd_line;
- md5_cmd_line.Printf("md5 -q '%s'", file_spec.GetPath().c_str());
- std::string hash_string;
- Error err = Host::RunShellCommand(md5_cmd_line.GetData(), NULL, NULL, NULL, &hash_string, 60);
- if (err.Fail())
- return false;
- // a correctly formed MD5 is 16-bytes, that is 32 hex digits
- // if the output is any other length it is probably wrong
- if (hash_string.size() != 32)
- return false;
- std::string part1(hash_string, 0, 16);
- std::string part2(hash_string, 16);
- const char *part1_cstr = part1.c_str();
- const char *part2_cstr = part2.c_str();
- high = ::strtoull(part1_cstr, NULL, 16);
- low = ::strtoull(part2_cstr, NULL, 16);
- return true;
-#else
- // your own MD5 implementation here
- return false;
-#endif
-}