OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "mojo/public/bindings/array.h" | 5 #include "mojo/public/cpp/bindings/array.h" |
6 | 6 |
7 namespace mojo { | 7 namespace mojo { |
8 | 8 |
9 // static | 9 // static |
10 String TypeConverter<String, std::string>::ConvertFrom(const std::string& input, | 10 String TypeConverter<String, std::string>::ConvertFrom(const std::string& input, |
11 Buffer* buf) { | 11 Buffer* buf) { |
12 String::Builder result(input.size(), buf); | 12 String::Builder result(input.size(), buf); |
13 if (!input.empty()) | 13 if (!input.empty()) |
14 memcpy(&result[0], input.data(), input.size()); | 14 memcpy(&result[0], input.data(), input.size()); |
15 return result.Finish(); | 15 return result.Finish(); |
(...skipping 13 matching lines...) Expand all Loading... |
29 return String(); | 29 return String(); |
30 | 30 |
31 size_t size = strlen(input); | 31 size_t size = strlen(input); |
32 String::Builder result(size, buf); | 32 String::Builder result(size, buf); |
33 if (size != 0) | 33 if (size != 0) |
34 memcpy(&result[0], input, size); | 34 memcpy(&result[0], input, size); |
35 return result.Finish(); | 35 return result.Finish(); |
36 } | 36 } |
37 | 37 |
38 } // namespace mojo | 38 } // namespace mojo |
OLD | NEW |