Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: tools/android/md5sum/md5sum.cc

Issue 1321503003: Fix md5sum printing a stale checksum for missing files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forgot if I already uploaded... Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/utils/md5sum_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Md5sum implementation for Android. This version handles files as well as 5 // Md5sum implementation for Android. This version handles files as well as
6 // directories. Its output is sorted by file path. 6 // directories. Its output is sorted by file path.
7 7
8 #include <fstream> 8 #include <fstream>
9 #include <iostream> 9 #include <iostream>
10 #include <set> 10 #include <set>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 int main(int argc, const char* argv[]) { 72 int main(int argc, const char* argv[]) {
73 if (argc < 2) { 73 if (argc < 2) {
74 LOG(ERROR) << "Usage: md5sum <path/to/file_or_dir>..."; 74 LOG(ERROR) << "Usage: md5sum <path/to/file_or_dir>...";
75 return 1; 75 return 1;
76 } 76 }
77 const std::set<std::string> files = MakeFileSet(argv + 1); 77 const std::set<std::string> files = MakeFileSet(argv + 1);
78 bool failed = false; 78 bool failed = false;
79 std::string digest; 79 std::string digest;
80 for (std::set<std::string>::const_iterator it = files.begin(); 80 for (std::set<std::string>::const_iterator it = files.begin();
81 it != files.end(); ++it) { 81 it != files.end(); ++it) {
82 if (!MD5Sum(it->c_str(), &digest)) 82 if (!MD5Sum(it->c_str(), &digest)) {
83 failed = true; 83 failed = true;
84 base::FilePath file_path(*it); 84 } else {
85 std::cout << digest << " " 85 base::FilePath file_path(*it);
86 << base::MakeAbsoluteFilePath(file_path).value() << std::endl; 86 std::cout << digest << " "
87 << base::MakeAbsoluteFilePath(file_path).value() << std::endl;
88 }
87 } 89 }
88 return failed; 90 return failed;
89 } 91 }
OLDNEW
« no previous file with comments | « build/android/pylib/utils/md5sum_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698