| 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 <bzlib.h> | 8 #include <bzlib.h> |
| 8 #include <CoreFoundation/CoreFoundation.h> | |
| 9 #include <libkern/OSByteOrder.h> | 9 #include <libkern/OSByteOrder.h> |
| 10 #include <uuid/uuid.h> | 10 #include <uuid/uuid.h> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <utility> |
| 13 | 14 |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/mac/foundation_util.h" | 16 #include "base/mac/foundation_util.h" |
| 16 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/numerics/safe_math.h" | 19 #include "base/numerics/safe_math.h" |
| 19 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
| 20 #include "chrome/utility/safe_browsing/mac/convert_big_endian.h" | 21 #include "chrome/utility/safe_browsing/mac/convert_big_endian.h" |
| 21 #include "chrome/utility/safe_browsing/mac/read_stream.h" | 22 #include "chrome/utility/safe_browsing/mac/read_stream.h" |
| 22 #include "third_party/zlib/zlib.h" | 23 #include "third_party/zlib/zlib.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 const UDIFBlockChunk* chunk = block->chunk(j); | 464 const UDIFBlockChunk* chunk = block->chunk(j); |
| 464 DVLOG(1) << "Chunk#" << j | 465 DVLOG(1) << "Chunk#" << j |
| 465 << " type = " << std::hex << static_cast<uint32_t>(chunk->type) | 466 << " type = " << std::hex << static_cast<uint32_t>(chunk->type) |
| 466 << ", StartSector = " << std::dec << chunk->start_sector | 467 << ", StartSector = " << std::dec << chunk->start_sector |
| 467 << ", SectorCount = " << chunk->sector_count | 468 << ", SectorCount = " << chunk->sector_count |
| 468 << ", CompressOffset = " << chunk->compressed_offset | 469 << ", CompressOffset = " << chunk->compressed_offset |
| 469 << ", CompressLen = " << chunk->compressed_length; | 470 << ", CompressLen = " << chunk->compressed_length; |
| 470 } | 471 } |
| 471 } | 472 } |
| 472 | 473 |
| 473 blocks_.push_back(block.Pass()); | 474 blocks_.push_back(std::move(block)); |
| 474 partition_names_.push_back(partition_name); | 475 partition_names_.push_back(partition_name); |
| 475 } | 476 } |
| 476 | 477 |
| 477 return true; | 478 return true; |
| 478 } | 479 } |
| 479 | 480 |
| 480 bool UDIFParser::ReadBlockChunk(const UDIFBlockChunk* chunk, | 481 bool UDIFParser::ReadBlockChunk(const UDIFBlockChunk* chunk, |
| 481 std::vector<uint8_t>* decompressed_data) { | 482 std::vector<uint8_t>* decompressed_data) { |
| 482 UDIFBlockChunkReadStream chunk_read_stream(stream_, block_size_, chunk); | 483 UDIFBlockChunkReadStream chunk_read_stream(stream_, block_size_, chunk); |
| 483 decompressed_data->resize(chunk_read_stream.length_in_bytes()); | 484 decompressed_data->resize(chunk_read_stream.length_in_bytes()); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 << chunk_->compressed_offset; | 787 << chunk_->compressed_offset; |
| 787 return false; | 788 return false; |
| 788 } | 789 } |
| 789 return true; | 790 return true; |
| 790 } | 791 } |
| 791 | 792 |
| 792 } // namespace | 793 } // namespace |
| 793 | 794 |
| 794 } // namespace dmg | 795 } // namespace dmg |
| 795 } // namespace safe_browsing | 796 } // namespace safe_browsing |
| OLD | NEW |