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/hfs.h" | 5 #include "chrome/utility/safe_browsing/mac/hfs.h" |
6 | 6 |
7 #include <libkern/OSByteOrder.h> | 7 #include <libkern/OSByteOrder.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 base::string16 HFSIterator::GetPath() { | 304 base::string16 HFSIterator::GetPath() { |
305 return catalog_->current_record()->path; | 305 return catalog_->current_record()->path; |
306 } | 306 } |
307 | 307 |
308 std::unique_ptr<ReadStream> HFSIterator::GetReadStream() { | 308 std::unique_ptr<ReadStream> HFSIterator::GetReadStream() { |
309 if (IsDirectory() || IsHardLink()) | 309 if (IsDirectory() || IsHardLink()) |
310 return nullptr; | 310 return nullptr; |
311 | 311 |
312 DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type); | 312 DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type); |
313 return base::WrapUnique( | 313 return base::MakeUnique<HFSForkReadStream>( |
314 new HFSForkReadStream(this, catalog_->current_record()->file->dataFork)); | 314 this, catalog_->current_record()->file->dataFork); |
315 } | 315 } |
316 | 316 |
317 bool HFSIterator::SeekToBlock(uint64_t block) { | 317 bool HFSIterator::SeekToBlock(uint64_t block) { |
318 uint64_t offset = block * volume_header_.blockSize; | 318 uint64_t offset = block * volume_header_.blockSize; |
319 off_t rv = stream_->Seek(offset, SEEK_SET); | 319 off_t rv = stream_->Seek(offset, SEEK_SET); |
320 return rv >= 0 && static_cast<uint64_t>(rv) == offset; | 320 return rv >= 0 && static_cast<uint64_t>(rv) == offset; |
321 } | 321 } |
322 | 322 |
323 bool HFSIterator::ReadCatalogFile() { | 323 bool HFSIterator::ReadCatalogFile() { |
324 catalog_file_.reset(new HFSForkReadStream(this, volume_header_.catalogFile)); | 324 catalog_file_.reset(new HFSForkReadStream(this, volume_header_.catalogFile)); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return object; | 645 return object; |
646 } | 646 } |
647 | 647 |
648 bool HFSBTreeIterator::IsKeyUnexported(const base::string16& key) { | 648 bool HFSBTreeIterator::IsKeyUnexported(const base::string16& key) { |
649 return key == kHFSDirMetadataFolder || | 649 return key == kHFSDirMetadataFolder || |
650 key == kHFSMetadataFolder; | 650 key == kHFSMetadataFolder; |
651 } | 651 } |
652 | 652 |
653 } // namespace dmg | 653 } // namespace dmg |
654 } // namespace safe_browsing | 654 } // namespace safe_browsing |
OLD | NEW |