| Index: sandbox/win/src/policy_engine_opcodes.h
|
| diff --git a/sandbox/win/src/policy_engine_opcodes.h b/sandbox/win/src/policy_engine_opcodes.h
|
| index 11a9c813ed9d53a398f632be21c17676eb2e911e..17d1764b1c860185141fbf2ed1ca5c410b90f7c2 100644
|
| --- a/sandbox/win/src/policy_engine_opcodes.h
|
| +++ b/sandbox/win/src/policy_engine_opcodes.h
|
| @@ -5,10 +5,7 @@
|
| #ifndef SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_
|
| #define SANDBOX_WIN_SRC_POLICY_ENGINE_OPCODES_H_
|
|
|
| -#include <stddef.h>
|
| -#include <stdint.h>
|
| -
|
| -#include "base/macros.h"
|
| +#include "base/basictypes.h"
|
| #include "base/numerics/safe_conversions.h"
|
| #include "sandbox/win/src/policy_engine_params.h"
|
|
|
| @@ -87,22 +84,22 @@
|
| // Options that apply to every opcode. They are specified when creating
|
| // each opcode using OpcodeFactory::MakeOpXXXXX() family of functions
|
| // Do nothing special.
|
| -const uint32_t kPolNone = 0;
|
| +const uint32 kPolNone = 0;
|
|
|
| // Convert EVAL_TRUE into EVAL_FALSE and vice-versa. This allows to express
|
| // negated conditions such as if ( a && !b).
|
| -const uint32_t kPolNegateEval = 1;
|
| +const uint32 kPolNegateEval = 1;
|
|
|
| // Zero the MatchContext context structure. This happens after the opcode
|
| // is evaluated.
|
| -const uint32_t kPolClearContext = 2;
|
| +const uint32 kPolClearContext = 2;
|
|
|
| // Use OR when evaluating this set of opcodes. The policy evaluator by default
|
| // uses AND when evaluating. Very helpful when
|
| // used with kPolNegateEval. For example if you have a condition best expressed
|
| // as if(! (a && b && c)), the use of this flags allows it to be expressed as
|
| // if ((!a) || (!b) || (!c)).
|
| -const uint32_t kPolUseOREval = 4;
|
| +const uint32 kPolUseOREval = 4;
|
|
|
| // Keeps the evaluation state between opcode evaluations. This is used
|
| // for string matching where the next opcode needs to continue matching
|
| @@ -111,7 +108,7 @@
|
| // as an option kPolClearContext.
|
| struct MatchContext {
|
| size_t position;
|
| - uint32_t options;
|
| + uint32 options;
|
|
|
| MatchContext() {
|
| Clear();
|
| @@ -193,11 +190,13 @@
|
| }
|
|
|
| // Returns the stored options such as kPolNegateEval and others.
|
| - uint32_t GetOptions() const { return options_; }
|
| + uint32 GetOptions() const {
|
| + return options_;
|
| + }
|
|
|
| // Sets the stored options such as kPolNegateEval.
|
| - void SetOptions(uint32_t options) {
|
| - options_ = base::checked_cast<uint16_t>(options);
|
| + void SetOptions(uint32 options) {
|
| + options_ = base::checked_cast<uint16>(options);
|
| }
|
|
|
| private:
|
| @@ -219,11 +218,11 @@
|
| EvalResult EvaluateHelper(const ParameterSet* parameters,
|
| MatchContext* match);
|
| OpcodeID opcode_id_;
|
| - int16_t parameter_;
|
| - // TODO(cpu): Making |options_| a uint32_t would avoid casting, but causes
|
| - // test failures. Somewhere code is relying on the size of this struct.
|
| + int16 parameter_;
|
| + // TODO(cpu): Making |options_| a uint32 would avoid casting, but causes test
|
| + // failures. Somewhere code is relying on the size of this struct.
|
| // http://crbug.com/420296
|
| - uint16_t options_;
|
| + uint16 options_;
|
| OpcodeArgument arguments_[PolicyOpcode::kArgumentCount];
|
| };
|
|
|
| @@ -298,39 +297,39 @@
|
| }
|
|
|
| // Creates an OpAlwaysFalse opcode.
|
| - PolicyOpcode* MakeOpAlwaysFalse(uint32_t options);
|
| + PolicyOpcode* MakeOpAlwaysFalse(uint32 options);
|
|
|
| // Creates an OpAlwaysFalse opcode.
|
| - PolicyOpcode* MakeOpAlwaysTrue(uint32_t options);
|
| + PolicyOpcode* MakeOpAlwaysTrue(uint32 options);
|
|
|
| // Creates an OpAction opcode.
|
| // action: The action to return when Evaluate() is called.
|
| - PolicyOpcode* MakeOpAction(EvalResult action, uint32_t options);
|
| + PolicyOpcode* MakeOpAction(EvalResult action, uint32 options);
|
|
|
| // Creates an OpNumberMatch opcode.
|
| - // selected_param: index of the input argument. It must be a uint32_t or the
|
| + // selected_param: index of the input argument. It must be a uint32 or the
|
| // evaluation result will generate a EVAL_ERROR.
|
| // match: the number to compare against the selected_param.
|
| - PolicyOpcode* MakeOpNumberMatch(int16_t selected_param,
|
| - uint32_t match,
|
| - uint32_t options);
|
| + PolicyOpcode* MakeOpNumberMatch(int16 selected_param,
|
| + uint32 match,
|
| + uint32 options);
|
|
|
| // Creates an OpNumberMatch opcode (void pointers are cast to numbers).
|
| // selected_param: index of the input argument. It must be an void* or the
|
| // evaluation result will generate a EVAL_ERROR.
|
| // match: the pointer numeric value to compare against selected_param.
|
| - PolicyOpcode* MakeOpVoidPtrMatch(int16_t selected_param,
|
| + PolicyOpcode* MakeOpVoidPtrMatch(int16 selected_param,
|
| const void* match,
|
| - uint32_t options);
|
| + uint32 options);
|
|
|
| // Creates an OpNumberMatchRange opcode using the memory passed in the ctor.
|
| - // selected_param: index of the input argument. It must be a uint32_t or the
|
| + // selected_param: index of the input argument. It must be a uint32 or the
|
| // evaluation result will generate a EVAL_ERROR.
|
| // lower_bound, upper_bound: the range to compare against selected_param.
|
| - PolicyOpcode* MakeOpNumberMatchRange(int16_t selected_param,
|
| - uint32_t lower_bound,
|
| - uint32_t upper_bound,
|
| - uint32_t options);
|
| + PolicyOpcode* MakeOpNumberMatchRange(int16 selected_param,
|
| + uint32 lower_bound,
|
| + uint32 upper_bound,
|
| + uint32 options);
|
|
|
| // Creates an OpWStringMatch opcode using the raw memory passed in the ctor.
|
| // selected_param: index of the input argument. It must be a wide string
|
| @@ -345,27 +344,26 @@
|
| // current implementation.
|
| // match_opts: Indicates additional matching flags. Currently CaseInsensitive
|
| // is supported.
|
| - PolicyOpcode* MakeOpWStringMatch(int16_t selected_param,
|
| + PolicyOpcode* MakeOpWStringMatch(int16 selected_param,
|
| const wchar_t* match_str,
|
| int start_position,
|
| StringMatchOptions match_opts,
|
| - uint32_t options);
|
| + uint32 options);
|
|
|
| // Creates an OpNumberAndMatch opcode using the raw memory passed in the ctor.
|
| - // selected_param: index of the input argument. It must be uint32_t or the
|
| + // selected_param: index of the input argument. It must be uint32 or the
|
| // evaluation result will generate a EVAL_ERROR.
|
| // match: the value to bitwise AND against selected_param.
|
| - PolicyOpcode* MakeOpNumberAndMatch(int16_t selected_param,
|
| - uint32_t match,
|
| - uint32_t options);
|
| + PolicyOpcode* MakeOpNumberAndMatch(int16 selected_param,
|
| + uint32 match,
|
| + uint32 options);
|
|
|
| private:
|
| // Constructs the common part of every opcode. selected_param is the index
|
| // of the input param to use when evaluating the opcode. Pass -1 in
|
| // selected_param to indicate that no input parameter is required.
|
| - PolicyOpcode* MakeBase(OpcodeID opcode_id,
|
| - uint32_t options,
|
| - int16_t selected_param);
|
| + PolicyOpcode* MakeBase(OpcodeID opcode_id, uint32 options,
|
| + int16 selected_param);
|
|
|
| // Allocates (and copies) a string (of size length) inside the buffer and
|
| // returns the displacement with respect to start.
|
|
|