| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 value->reset(new base::StringValue(DecodePRegStringValue(data))); | 151 value->reset(new base::StringValue(DecodePRegStringValue(data))); |
| 152 return true; | 152 return true; |
| 153 case REG_DWORD_LITTLE_ENDIAN: | 153 case REG_DWORD_LITTLE_ENDIAN: |
| 154 case REG_DWORD_BIG_ENDIAN: | 154 case REG_DWORD_BIG_ENDIAN: |
| 155 if (data.size() == sizeof(uint32_t)) { | 155 if (data.size() == sizeof(uint32_t)) { |
| 156 uint32_t val = *reinterpret_cast<const uint32_t*>(data.data()); | 156 uint32_t val = *reinterpret_cast<const uint32_t*>(data.data()); |
| 157 if (type == REG_DWORD_BIG_ENDIAN) | 157 if (type == REG_DWORD_BIG_ENDIAN) |
| 158 val = base::NetToHost32(val); | 158 val = base::NetToHost32(val); |
| 159 else | 159 else |
| 160 val = base::ByteSwapToLE32(val); | 160 val = base::ByteSwapToLE32(val); |
| 161 value->reset(new base::FundamentalValue(static_cast<int>(val))); | 161 value->reset(new base::Value(static_cast<int>(val))); |
| 162 return true; | 162 return true; |
| 163 } else { | 163 } else { |
| 164 LOG(ERROR) << "Bad data size " << data.size(); | 164 LOG(ERROR) << "Bad data size " << data.size(); |
| 165 } | 165 } |
| 166 break; | 166 break; |
| 167 case REG_NONE: | 167 case REG_NONE: |
| 168 case REG_LINK: | 168 case REG_LINK: |
| 169 case REG_MULTI_SZ: | 169 case REG_MULTI_SZ: |
| 170 case REG_RESOURCE_LIST: | 170 case REG_RESOURCE_LIST: |
| 171 case REG_FULL_RESOURCE_DESCRIPTOR: | 171 case REG_FULL_RESOURCE_DESCRIPTOR: |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 344 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
| 345 << reinterpret_cast<const uint8_t*>(cursor - 1) - | 345 << reinterpret_cast<const uint8_t*>(cursor - 1) - |
| 346 mapped_file.data(); | 346 mapped_file.data(); |
| 347 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 347 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
| 348 return false; | 348 return false; |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace preg_parser | 351 } // namespace preg_parser |
| 352 } // namespace policy | 352 } // namespace policy |
| OLD | NEW |