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

Side by Side Diff: chrome/common/safe_browsing/pe_image_reader_win.h

Issue 1880143002: Convert chrome/common 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_ 5 #ifndef CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_
6 #define CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_ 6 #define CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_
7 7
8 #include <windows.h>
9 #include <stddef.h> 8 #include <stddef.h>
10 #include <stdint.h> 9 #include <stdint.h>
10 #include <windows.h>
11
12 #include <memory>
11 13
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 15
15 namespace safe_browsing { 16 namespace safe_browsing {
16 17
17 // Parses headers and various data from a PE image. This parser is safe for use 18 // Parses headers and various data from a PE image. This parser is safe for use
18 // on untrusted data. 19 // on untrusted data.
19 class PeImageReader { 20 class PeImageReader {
20 public: 21 public:
21 enum WordSize { 22 enum WordSize {
22 WORD_SIZE_32, 23 WORD_SIZE_32,
23 WORD_SIZE_64, 24 WORD_SIZE_64,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return false; 142 return false;
142 if (structure_size > image_size_ - offset) 143 if (structure_size > image_size_ - offset)
143 return false; 144 return false;
144 *structure = reinterpret_cast<const T*>(image_data_ + offset); 145 *structure = reinterpret_cast<const T*>(image_data_ + offset);
145 return true; 146 return true;
146 } 147 }
147 148
148 const uint8_t* image_data_; 149 const uint8_t* image_data_;
149 size_t image_size_; 150 size_t image_size_;
150 uint32_t validation_state_; 151 uint32_t validation_state_;
151 scoped_ptr<OptionalHeader> optional_header_; 152 std::unique_ptr<OptionalHeader> optional_header_;
152 DISALLOW_COPY_AND_ASSIGN(PeImageReader); 153 DISALLOW_COPY_AND_ASSIGN(PeImageReader);
153 }; 154 };
154 155
155 } // namespace safe_browsing 156 } // namespace safe_browsing
156 157
157 #endif // CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_ 158 #endif // CHROME_COMMON_SAFE_BROWSING_PE_IMAGE_READER_WIN_H_
OLDNEW
« no previous file with comments | « chrome/common/safe_browsing/mach_o_image_reader_mac.h ('k') | chrome/common/safe_browsing/pe_image_reader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698