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

Side by Side Diff: chrome/utility/safe_browsing/mac/hfs.cc

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 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
11 #include <map> 11 #include <map>
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h"
17 #include "base/numerics/safe_math.h" 18 #include "base/numerics/safe_math.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/utility/safe_browsing/mac/convert_big_endian.h" 20 #include "chrome/utility/safe_browsing/mac/convert_big_endian.h"
20 #include "chrome/utility/safe_browsing/mac/read_stream.h" 21 #include "chrome/utility/safe_browsing/mac/read_stream.h"
21 22
22 namespace safe_browsing { 23 namespace safe_browsing {
23 namespace dmg { 24 namespace dmg {
24 25
25 // UTF-16 character for file path seprator. 26 // UTF-16 character for file path seprator.
26 static const uint16_t kFilePathSeparator = '/'; 27 static const uint16_t kFilePathSeparator = '/';
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (IsDirectory()) 298 if (IsDirectory())
298 return false; 299 return false;
299 const HFSPlusCatalogFile* file = catalog_->current_record()->file; 300 const HFSPlusCatalogFile* file = catalog_->current_record()->file;
300 return file->bsdInfo.ownerFlags & UF_COMPRESSED; 301 return file->bsdInfo.ownerFlags & UF_COMPRESSED;
301 } 302 }
302 303
303 base::string16 HFSIterator::GetPath() { 304 base::string16 HFSIterator::GetPath() {
304 return catalog_->current_record()->path; 305 return catalog_->current_record()->path;
305 } 306 }
306 307
307 scoped_ptr<ReadStream> HFSIterator::GetReadStream() { 308 std::unique_ptr<ReadStream> HFSIterator::GetReadStream() {
308 if (IsDirectory() || IsHardLink()) 309 if (IsDirectory() || IsHardLink())
309 return nullptr; 310 return nullptr;
310 311
311 DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type); 312 DCHECK_EQ(kHFSPlusFileRecord, catalog_->current_record()->record_type);
312 return make_scoped_ptr( 313 return base::WrapUnique(
313 new HFSForkReadStream(this, catalog_->current_record()->file->dataFork)); 314 new HFSForkReadStream(this, catalog_->current_record()->file->dataFork));
314 } 315 }
315 316
316 bool HFSIterator::SeekToBlock(uint64_t block) { 317 bool HFSIterator::SeekToBlock(uint64_t block) {
317 uint64_t offset = block * volume_header_.blockSize; 318 uint64_t offset = block * volume_header_.blockSize;
318 off_t rv = stream_->Seek(offset, SEEK_SET); 319 off_t rv = stream_->Seek(offset, SEEK_SET);
319 return rv >= 0 && static_cast<uint64_t>(rv) == offset; 320 return rv >= 0 && static_cast<uint64_t>(rv) == offset;
320 } 321 }
321 322
322 bool HFSIterator::ReadCatalogFile() { 323 bool HFSIterator::ReadCatalogFile() {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return object; 642 return object;
642 } 643 }
643 644
644 bool HFSBTreeIterator::IsKeyUnexported(const base::string16& key) { 645 bool HFSBTreeIterator::IsKeyUnexported(const base::string16& key) {
645 return key == kHFSDirMetadataFolder || 646 return key == kHFSDirMetadataFolder ||
646 key == kHFSMetadataFolder; 647 key == kHFSMetadataFolder;
647 } 648 }
648 649
649 } // namespace dmg 650 } // namespace dmg
650 } // namespace safe_browsing 651 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/utility/safe_browsing/mac/hfs.h ('k') | chrome/utility/safe_browsing/mac/hfs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698