| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "update_engine/delta_diff_generator.h" | 5 #include "update_engine/delta_diff_generator.h" |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 #include <sys/types.h> | 7 #include <sys/types.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 graph->back().op.set_dst_length(graph->back().op.src_length()); | 645 graph->back().op.set_dst_length(graph->back().op.src_length()); |
| 646 | 646 |
| 647 // make the dest node read from the scratch space | 647 // make the dest node read from the scratch space |
| 648 DeltaDiffGenerator::SubstituteBlocks( | 648 DeltaDiffGenerator::SubstituteBlocks( |
| 649 &((*graph)[it->second].op), | 649 &((*graph)[it->second].op), |
| 650 (*graph)[it->first].out_edges[it->second].extents, | 650 (*graph)[it->first].out_edges[it->second].extents, |
| 651 scratch); | 651 scratch); |
| 652 | 652 |
| 653 // delete the old edge | 653 // delete the old edge |
| 654 CHECK_EQ(1, (*graph)[it->first].out_edges.erase(it->second)); | 654 CHECK_EQ(1, (*graph)[it->first].out_edges.erase(it->second)); |
| 655 |
| 656 // Add an edge from dst to copy operation |
| 657 (*graph)[it->second].out_edges.insert(make_pair(graph->size() - 1, |
| 658 EdgeProperties())); |
| 655 } | 659 } |
| 656 return true; | 660 return true; |
| 657 } | 661 } |
| 658 | 662 |
| 659 // Stores all Extents in 'extents' into 'out'. | 663 // Stores all Extents in 'extents' into 'out'. |
| 660 void DeltaDiffGenerator::StoreExtents( | 664 void DeltaDiffGenerator::StoreExtents( |
| 661 vector<Extent>& extents, | 665 vector<Extent>& extents, |
| 662 google::protobuf::RepeatedPtrField<Extent>* out) { | 666 google::protobuf::RepeatedPtrField<Extent>* out) { |
| 663 for (vector<Extent>::const_iterator it = extents.begin(); | 667 for (vector<Extent>::const_iterator it = extents.begin(); |
| 664 it != extents.end(); ++it) { | 668 it != extents.end(); ++it) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 | 942 |
| 939 LOG(INFO) << "All done. Successfully created delta file."; | 943 LOG(INFO) << "All done. Successfully created delta file."; |
| 940 return true; | 944 return true; |
| 941 } | 945 } |
| 942 | 946 |
| 943 const char* const kBsdiffPath = "/usr/bin/bsdiff"; | 947 const char* const kBsdiffPath = "/usr/bin/bsdiff"; |
| 944 const char* const kBspatchPath = "/usr/bin/bspatch"; | 948 const char* const kBspatchPath = "/usr/bin/bspatch"; |
| 945 const char* const kDeltaMagic = "CrAU"; | 949 const char* const kDeltaMagic = "CrAU"; |
| 946 | 950 |
| 947 }; // namespace chromeos_update_engine | 951 }; // namespace chromeos_update_engine |
| OLD | NEW |