| 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_win.h" | 5 #include "components/policy/core/common/preg_parser_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 value->reset(base::Value::CreateStringValue(DecodePRegStringValue(data))); | 121 value->reset(base::Value::CreateStringValue(DecodePRegStringValue(data))); |
| 122 return true; | 122 return true; |
| 123 case REG_DWORD_LITTLE_ENDIAN: | 123 case REG_DWORD_LITTLE_ENDIAN: |
| 124 case REG_DWORD_BIG_ENDIAN: | 124 case REG_DWORD_BIG_ENDIAN: |
| 125 if (data.size() == sizeof(uint32)) { | 125 if (data.size() == sizeof(uint32)) { |
| 126 uint32 val = *reinterpret_cast<const uint32*>(vector_as_array(&data)); | 126 uint32 val = *reinterpret_cast<const uint32*>(vector_as_array(&data)); |
| 127 if (type == REG_DWORD_BIG_ENDIAN) | 127 if (type == REG_DWORD_BIG_ENDIAN) |
| 128 val = base::NetToHost32(val); | 128 val = base::NetToHost32(val); |
| 129 else | 129 else |
| 130 val = base::ByteSwapToLE32(val); | 130 val = base::ByteSwapToLE32(val); |
| 131 value->reset(base::Value::CreateIntegerValue(static_cast<int>(val))); | 131 value->reset(new base::FundamentalValue(static_cast<int>(val))); |
| 132 return true; | 132 return true; |
| 133 } else { | 133 } else { |
| 134 LOG(ERROR) << "Bad data size " << data.size(); | 134 LOG(ERROR) << "Bad data size " << data.size(); |
| 135 } | 135 } |
| 136 break; | 136 break; |
| 137 case REG_NONE: | 137 case REG_NONE: |
| 138 case REG_LINK: | 138 case REG_LINK: |
| 139 case REG_MULTI_SZ: | 139 case REG_MULTI_SZ: |
| 140 case REG_RESOURCE_LIST: | 140 case REG_RESOURCE_LIST: |
| 141 case REG_FULL_RESOURCE_DESCRIPTOR: | 141 case REG_FULL_RESOURCE_DESCRIPTOR: |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 300 } |
| 301 | 301 |
| 302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " | 302 LOG(ERROR) << "Error parsing " << file_path.value() << " at offset " |
| 303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); | 303 << reinterpret_cast<const uint8*>(cursor - 1) - mapped_file.data(); |
| 304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); | 304 status->Add(POLICY_LOAD_STATUS_PARSE_ERROR); |
| 305 return false; | 305 return false; |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace preg_parser | 308 } // namespace preg_parser |
| 309 } // namespace policy | 309 } // namespace policy |
| OLD | NEW |