From 7a9e76216b4ce12ce29135cd851fb5f22f77fe22 Mon Sep 17 00:00:00 2001 From: Oleksiy Vyalov Date: Fri, 20 Feb 2015 18:34:03 +0000 Subject: Introduce FileSystem::CalculateMD5AsString that supports any platform and make existing FileSystem::CalculateMD5 to use it. http://reviews.llvm.org/D7771 llvm-svn: 230036 --- lldb/source/Host/posix/FileSystem.cpp | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'lldb/source/Host/posix/FileSystem.cpp') 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 -} -- cgit v1.2.3