aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zucchini_commands.cc2
-rw-r--r--zucchini_integration.cc13
2 files changed, 8 insertions, 7 deletions
diff --git a/zucchini_commands.cc b/zucchini_commands.cc
index 90208a0..53b5bd7 100644
--- a/zucchini_commands.cc
+++ b/zucchini_commands.cc
@@ -144,7 +144,7 @@ zucchini::status::Code MainMatch(MainParams params) {
}
File new_file(params.file_paths[1], File::FLAG_OPEN | File::FLAG_READ);
zucchini::MappedFileReader new_image(std::move(new_file));
- if (old_image.HasError()) {
+ if (new_image.HasError()) {
LOG(ERROR) << "Error with file " << params.file_paths[1].value() << ": "
<< new_image.error();
return zucchini::status::kStatusFileReadError;
diff --git a/zucchini_integration.cc b/zucchini_integration.cc
index 3ca4601..2d78fdd 100644
--- a/zucchini_integration.cc
+++ b/zucchini_integration.cc
@@ -17,8 +17,7 @@ namespace {
struct FileNames {
FileNames() : is_dummy(true) {
- // Use fake names. If |is_dummy| is true these files are only used for error
- // output.
+ // Use fake names.
old_name = old_name.AppendASCII("old_name");
patch_name = patch_name.AppendASCII("patch_name");
new_name = new_name.AppendASCII("new_name");
@@ -35,6 +34,8 @@ struct FileNames {
base::FilePath old_name;
base::FilePath patch_name;
base::FilePath new_name;
+
+ // A flag to decide whether the filenames are only for error output.
const bool is_dummy;
};
@@ -97,10 +98,10 @@ status::Code ApplyCommon(base::File&& old_file_handle,
} // namespace
-status::Code Apply(base::File old_file_handle,
- base::File patch_file_handle,
- base::File new_file_handle) {
- const FileNames file_names = FileNames();
+status::Code Apply(base::File&& old_file_handle,
+ base::File&& patch_file_handle,
+ base::File&& new_file_handle) {
+ const FileNames file_names;
return ApplyCommon(std::move(old_file_handle), std::move(patch_file_handle),
std::move(new_file_handle), file_names);
}