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

Side by Side Diff: src/platform/update_engine/delta_diff_generator.cc

Issue 1599029: update engine: 32- and 64-bit compile (Closed)
Patch Set: int32->int32_t, PRIi64, 80 cols for review Created 10 years, 8 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
OLDNEW
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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 TEST_AND_RETURN_FALSE_ERRNO(stat(new_image.c_str(), &new_image_stbuf) == 0); 684 TEST_AND_RETURN_FALSE_ERRNO(stat(new_image.c_str(), &new_image_stbuf) == 0);
685 LOG_IF(WARNING, new_image_stbuf.st_size != old_image_stbuf.st_size) 685 LOG_IF(WARNING, new_image_stbuf.st_size != old_image_stbuf.st_size)
686 << "Old and new images are different sizes."; 686 << "Old and new images are different sizes.";
687 LOG_IF(FATAL, new_image_stbuf.st_size % kBlockSize) 687 LOG_IF(FATAL, new_image_stbuf.st_size % kBlockSize)
688 << "New image not a multiple of block size " << kBlockSize; 688 << "New image not a multiple of block size " << kBlockSize;
689 LOG_IF(FATAL, old_image_stbuf.st_size % kBlockSize) 689 LOG_IF(FATAL, old_image_stbuf.st_size % kBlockSize)
690 << "Old image not a multiple of block size " << kBlockSize; 690 << "Old image not a multiple of block size " << kBlockSize;
691 691
692 vector<Block> blocks(min(old_image_stbuf.st_size / kBlockSize, 692 vector<Block> blocks(min(old_image_stbuf.st_size / kBlockSize,
693 new_image_stbuf.st_size / kBlockSize)); 693 new_image_stbuf.st_size / kBlockSize));
694 LOG(INFO) << "blocks (orig): " << (uint32)(&blocks);
695 LOG(INFO) << "w:" << blocks[4097].writer; 694 LOG(INFO) << "w:" << blocks[4097].writer;
696 LOG(INFO) << "invalid: " << Vertex::kInvalidIndex; 695 LOG(INFO) << "invalid: " << Vertex::kInvalidIndex;
697 LOG(INFO) << "len: " << blocks.size(); 696 LOG(INFO) << "len: " << blocks.size();
698 for (vector<Block>::size_type i = 0; i < blocks.size(); i++) { 697 for (vector<Block>::size_type i = 0; i < blocks.size(); i++) {
699 CHECK(blocks[i].reader == Vertex::kInvalidIndex); 698 CHECK(blocks[i].reader == Vertex::kInvalidIndex);
700 CHECK(blocks[i].writer == Vertex::kInvalidIndex); 699 CHECK(blocks[i].writer == Vertex::kInvalidIndex);
701 } 700 }
702 Graph graph; 701 Graph graph;
703 CheckGraph(graph); 702 CheckGraph(graph);
704 703
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 818
820 LOG(INFO) << "Writing final delta file header..."; 819 LOG(INFO) << "Writing final delta file header...";
821 DirectFileWriter writer; 820 DirectFileWriter writer;
822 TEST_AND_RETURN_FALSE_ERRNO(writer.Open(output_path.c_str(), 821 TEST_AND_RETURN_FALSE_ERRNO(writer.Open(output_path.c_str(),
823 O_WRONLY | O_CREAT | O_TRUNC, 822 O_WRONLY | O_CREAT | O_TRUNC,
824 0644) == 0); 823 0644) == 0);
825 ScopedFileWriterCloser writer_closer(&writer); 824 ScopedFileWriterCloser writer_closer(&writer);
826 825
827 // Write header 826 // Write header
828 TEST_AND_RETURN_FALSE(writer.Write(kDeltaMagic, strlen(kDeltaMagic)) == 827 TEST_AND_RETURN_FALSE(writer.Write(kDeltaMagic, strlen(kDeltaMagic)) ==
829 strlen(kDeltaMagic)); 828 static_cast<ssize_t>(strlen(kDeltaMagic)));
830 829
831 // Write version number 830 // Write version number
832 TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer, kVersionNumber)); 831 TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer, kVersionNumber));
833 832
834 // Write protobuf length 833 // Write protobuf length
835 TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer, 834 TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer,
836 serialized_manifest.size())); 835 serialized_manifest.size()));
837 836
838 // Write protobuf 837 // Write protobuf
839 LOG(INFO) << "Writing final delta file protobuf... " 838 LOG(INFO) << "Writing final delta file protobuf... "
(...skipping 16 matching lines...) Expand all
856 } 855 }
857 TEST_AND_RETURN_FALSE_ERRNO(rc > 0); 856 TEST_AND_RETURN_FALSE_ERRNO(rc > 0);
858 TEST_AND_RETURN_FALSE(writer.Write(buf, rc) == rc); 857 TEST_AND_RETURN_FALSE(writer.Write(buf, rc) == rc);
859 } 858 }
860 859
861 LOG(INFO) << "All done. Successfully created delta file."; 860 LOG(INFO) << "All done. Successfully created delta file.";
862 return true; 861 return true;
863 } 862 }
864 863
865 }; // namespace chromeos_update_engine 864 }; // namespace chromeos_update_engine
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698