OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/policy/core/common/preg_parser.h" | 5 #include "components/policy/core/common/preg_parser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 value->reset(new base::StringValue(DecodePRegStringValue(data))); | 146 value->reset(new base::StringValue(DecodePRegStringValue(data))); |
147 return true; | 147 return true; |
148 case REG_DWORD_LITTLE_ENDIAN: | 148 case REG_DWORD_LITTLE_ENDIAN: |
149 case REG_DWORD_BIG_ENDIAN: | 149 case REG_DWORD_BIG_ENDIAN: |
150 if (data.size() == sizeof(uint32_t)) { | 150 if (data.size() == sizeof(uint32_t)) { |
151 uint32_t val = *reinterpret_cast<const uint32_t*>(data.data()); | 151 uint32_t val = *reinterpret_cast<const uint32_t*>(data.data()); |
152 if (type == REG_DWORD_BIG_ENDIAN) | 152 if (type == REG_DWORD_BIG_ENDIAN) |
153 val = base::NetToHost32(val); | 153 val = base::NetToHost32(val); |
154 else | 154 else |
155 val = base::ByteSwapToLE32(val); | 155 val = base::ByteSwapToLE32(val); |
156 value->reset(new base::FundamentalValue(static_cast<int>(val))); | 156 value->reset(new base::Value(static_cast<int>(val))); |
157 return true; | 157 return true; |
158 } else { | 158 } else { |
159 LOG(ERROR) << "Bad data size " << data.size(); | 159 LOG(ERROR) << "Bad data size " << data.size(); |
160 } | 160 } |
161 break; | 161 break; |
162 case REG_NONE: | 162 case REG_NONE: |
163 case REG_LINK: | 163 case REG_LINK: |
164 case REG_MULTI_SZ: | 164 case REG_MULTI_SZ: |
165 case REG_RESOURCE_LIST: | 165 case REG_RESOURCE_LIST: |
166 case REG_FULL_RESOURCE_DESCRIPTOR: | 166 case REG_FULL_RESOURCE_DESCRIPTOR: |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 339 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
340 << reinterpret_cast<const uint8_t*>(cursor - 1) - | 340 << reinterpret_cast<const uint8_t*>(cursor - 1) - |
341 mapped_file.data(); | 341 mapped_file.data(); |
342 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 342 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
343 return false; | 343 return false; |
344 } | 344 } |
345 | 345 |
346 } // namespace preg_parser | 346 } // namespace preg_parser |
347 } // namespace policy | 347 } // namespace policy |
OLD | NEW |