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

Side by Side Diff: sandbox/win/src/policy_engine_opcodes.h

Issue 821693003: replace COMPILE_ASSERT with static_assert in sandbox/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 11 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
« no previous file with comments | « sandbox/win/src/crosscall_params.h ('k') | sandbox/win/src/policy_low_level.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_ 5 #ifndef SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_
6 #define SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_ 6 #define SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "sandbox/win/src/policy_engine_params.h" 10 #include "sandbox/win/src/policy_engine_params.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // count: The number of parameters passed as first argument. 147 // count: The number of parameters passed as first argument.
148 // match: The match context that is persisted across the opcode evaluation 148 // match: The match context that is persisted across the opcode evaluation
149 // sequence. 149 // sequence.
150 EvalResult Evaluate(const ParameterSet* parameters, size_t count, 150 EvalResult Evaluate(const ParameterSet* parameters, size_t count,
151 MatchContext* match); 151 MatchContext* match);
152 152
153 // Retrieves a stored argument by index. Valid index values are 153 // Retrieves a stored argument by index. Valid index values are
154 // from 0 to < kArgumentCount. 154 // from 0 to < kArgumentCount.
155 template <typename T> 155 template <typename T>
156 void GetArgument(size_t index, T* argument) const { 156 void GetArgument(size_t index, T* argument) const {
157 COMPILE_ASSERT(sizeof(T) <= sizeof(arguments_[0]), invalid_size); 157 static_assert(sizeof(T) <= sizeof(arguments_[0]), "invalid size");
158 *argument = *reinterpret_cast<const T*>(&arguments_[index].mem); 158 *argument = *reinterpret_cast<const T*>(&arguments_[index].mem);
159 } 159 }
160 160
161 // Sets a stored argument by index. Valid index values are 161 // Sets a stored argument by index. Valid index values are
162 // from 0 to < kArgumentCount. 162 // from 0 to < kArgumentCount.
163 template <typename T> 163 template <typename T>
164 void SetArgument(size_t index, const T& argument) { 164 void SetArgument(size_t index, const T& argument) {
165 COMPILE_ASSERT(sizeof(T) <= sizeof(arguments_[0]), invalid_size); 165 static_assert(sizeof(T) <= sizeof(arguments_[0]), "invalid size");
166 *reinterpret_cast<T*>(&arguments_[index].mem) = argument; 166 *reinterpret_cast<T*>(&arguments_[index].mem) = argument;
167 } 167 }
168 168
169 // Retrieves the actual address of an string argument. When using 169 // Retrieves the actual address of an string argument. When using
170 // GetArgument() to retrieve an index that contains a string, the returned 170 // GetArgument() to retrieve an index that contains a string, the returned
171 // value is just an offset to the actual string. 171 // value is just an offset to the actual string.
172 // index: the stored string index. Valid values are from 0 172 // index: the stored string index. Valid values are from 0
173 // to < kArgumentCount. 173 // to < kArgumentCount.
174 const wchar_t* GetRelativeString(size_t index) const { 174 const wchar_t* GetRelativeString(size_t index) const {
175 ptrdiff_t str_delta = 0; 175 ptrdiff_t str_delta = 0;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // used to make the opcodes. This pointer decrements as opcode strings are 377 // used to make the opcodes. This pointer decrements as opcode strings are
378 // allocated. 378 // allocated.
379 char* memory_bottom_; 379 char* memory_bottom_;
380 380
381 DISALLOW_COPY_AND_ASSIGN(OpcodeFactory); 381 DISALLOW_COPY_AND_ASSIGN(OpcodeFactory);
382 }; 382 };
383 383
384 } // namespace sandbox 384 } // namespace sandbox
385 385
386 #endif // SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_ 386 #endif // SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_
OLDNEW
« no previous file with comments | « sandbox/win/src/crosscall_params.h ('k') | sandbox/win/src/policy_low_level.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698