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

Side by Side Diff: sandbox/win/src/policy_low_level.cc

Issue 1106203002: sandbox/win: Fix warnings found by clang chromium-style plugin on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/policy_low_level.h ('k') | sandbox/win/src/restricted_token.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "sandbox/win/src/policy_low_level.h"
6
5 #include <string> 7 #include <string>
6 #include <map> 8 #include <map>
7 9
8 #include "sandbox/win/src/policy_low_level.h"
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 11
11 namespace { 12 namespace {
12 13
13 // A single rule can use at most this amount of memory. 14 // A single rule can use at most this amount of memory.
14 const size_t kRuleBufferSize = 1024*4; 15 const size_t kRuleBufferSize = 1024*4;
15 16
16 // The possible states of the string matching opcode generator. 17 // The possible states of the string matching opcode generator.
17 enum { 18 enum {
18 PENDING_NONE, 19 PENDING_NONE,
19 PENDING_ASTERISK, // Have seen an '*' but have not generated an opcode. 20 PENDING_ASTERISK, // Have seen an '*' but have not generated an opcode.
20 PENDING_QMARK, // Have seen an '?' but have not generated an opcode. 21 PENDING_QMARK, // Have seen an '?' but have not generated an opcode.
21 }; 22 };
22 23
23 // The category of the last character seen by the string matching opcode 24 // The category of the last character seen by the string matching opcode
24 // generator. 25 // generator.
25 const uint32 kLastCharIsNone = 0; 26 const uint32 kLastCharIsNone = 0;
26 const uint32 kLastCharIsAlpha = 1; 27 const uint32 kLastCharIsAlpha = 1;
27 const uint32 kLastCharIsWild = 2; 28 const uint32 kLastCharIsWild = 2;
28 const uint32 kLastCharIsAsterisk = kLastCharIsWild + 4; 29 const uint32 kLastCharIsAsterisk = kLastCharIsWild + 4;
29 const uint32 kLastCharIsQuestionM = kLastCharIsWild + 8; 30 const uint32 kLastCharIsQuestionM = kLastCharIsWild + 8;
30 } 31 }
31 32
32 namespace sandbox { 33 namespace sandbox {
33 34
35 LowLevelPolicy::LowLevelPolicy(PolicyGlobal* policy_store)
36 : policy_store_(policy_store) {
37 }
38
34 // Adding a rule is nothing more than pushing it into an stl container. Done() 39 // Adding a rule is nothing more than pushing it into an stl container. Done()
35 // is called for the rule in case the code that made the rule in the first 40 // is called for the rule in case the code that made the rule in the first
36 // place has not done it. 41 // place has not done it.
37 bool LowLevelPolicy::AddRule(int service, PolicyRule* rule) { 42 bool LowLevelPolicy::AddRule(int service, PolicyRule* rule) {
38 if (!rule->Done()) { 43 if (!rule->Done()) {
39 return false; 44 return false;
40 } 45 }
41 46
42 PolicyRule* local_rule = new PolicyRule(*rule); 47 PolicyRule* local_rule = new PolicyRule(*rule);
43 RuleNode node = {local_rule, service}; 48 RuleNode node = {local_rule, service};
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 347
343 return true; 348 return true;
344 } 349 }
345 350
346 PolicyRule::~PolicyRule() { 351 PolicyRule::~PolicyRule() {
347 delete [] reinterpret_cast<char*>(buffer_); 352 delete [] reinterpret_cast<char*>(buffer_);
348 delete opcode_factory_; 353 delete opcode_factory_;
349 } 354 }
350 355
351 } // namespace sandbox 356 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_low_level.h ('k') | sandbox/win/src/restricted_token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698