OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/utility/safe_browsing/mac/udif.h" | 5 #include "chrome/utility/safe_browsing/mac/udif.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <bzlib.h> | 8 #include <bzlib.h> |
9 #include <libkern/OSByteOrder.h> | 9 #include <libkern/OSByteOrder.h> |
10 #include <uuid/uuid.h> | 10 #include <uuid/uuid.h> |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 if (!decompress_read_offset.IsValid()) { | 674 if (!decompress_read_offset.IsValid()) { |
675 DLOG(ERROR) << "Partition decompress read offset overflows"; | 675 DLOG(ERROR) << "Partition decompress read offset overflows"; |
676 return -1; | 676 return -1; |
677 } | 677 } |
678 | 678 |
679 if (!chunk_stream_ || chunk != chunk_stream_->chunk()) { | 679 if (!chunk_stream_ || chunk != chunk_stream_->chunk()) { |
680 chunk_stream_.reset( | 680 chunk_stream_.reset( |
681 new UDIFBlockChunkReadStream(stream_, block_size_, chunk)); | 681 new UDIFBlockChunkReadStream(stream_, block_size_, chunk)); |
682 } | 682 } |
683 current_chunk_ = chunk_number; | 683 current_chunk_ = chunk_number; |
684 if (chunk_stream_->Seek(decompress_read_offset.ValueOrDie(), SEEK_SET) == -1) | 684 if (chunk_stream_->Seek( |
| 685 base::ValueOrDieForType<off_t>(decompress_read_offset), SEEK_SET) == |
| 686 -1) |
685 return -1; | 687 return -1; |
686 | 688 |
687 return offset; | 689 return offset; |
688 } | 690 } |
689 | 691 |
690 UDIFBlockChunkReadStream::UDIFBlockChunkReadStream(ReadStream* stream, | 692 UDIFBlockChunkReadStream::UDIFBlockChunkReadStream(ReadStream* stream, |
691 uint16_t block_size, | 693 uint16_t block_size, |
692 const UDIFBlockChunk* chunk) | 694 const UDIFBlockChunk* chunk) |
693 : stream_(stream), | 695 : stream_(stream), |
694 chunk_(chunk), | 696 chunk_(chunk), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 << chunk_->compressed_offset; | 865 << chunk_->compressed_offset; |
864 return false; | 866 return false; |
865 } | 867 } |
866 return true; | 868 return true; |
867 } | 869 } |
868 | 870 |
869 } // namespace | 871 } // namespace |
870 | 872 |
871 } // namespace dmg | 873 } // namespace dmg |
872 } // namespace safe_browsing | 874 } // namespace safe_browsing |
OLD | NEW |