OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/environment.h" | 5 #include "base/environment.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 char* storage_data = reinterpret_cast<char*>( | 221 char* storage_data = reinterpret_cast<char*>( |
222 &result.get()[result_indices.size() + 1]); | 222 &result.get()[result_indices.size() + 1]); |
223 if (!value_storage.empty()) | 223 if (!value_storage.empty()) |
224 memcpy(storage_data, value_storage.data(), value_storage.size()); | 224 memcpy(storage_data, value_storage.data(), value_storage.size()); |
225 | 225 |
226 // Fill array of pointers at the beginning of the result. | 226 // Fill array of pointers at the beginning of the result. |
227 for (size_t i = 0; i < result_indices.size(); i++) | 227 for (size_t i = 0; i < result_indices.size(); i++) |
228 result[i] = &storage_data[result_indices[i]]; | 228 result[i] = &storage_data[result_indices[i]]; |
229 result[result_indices.size()] = 0; // Null terminator. | 229 result[result_indices.size()] = 0; // Null terminator. |
230 | 230 |
231 return result.Pass(); | 231 return result; |
232 } | 232 } |
233 | 233 |
234 #endif // OS_POSIX | 234 #endif // OS_POSIX |
235 | 235 |
236 } // namespace base | 236 } // namespace base |
OLD | NEW |