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/common/common_type_converters.h" | 5 #include "mojo/common/common_type_converters.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 return std::string(reinterpret_cast<const char*>(&input.front()), | 45 return std::string(reinterpret_cast<const char*>(&input.front()), |
46 input.size()); | 46 input.size()); |
47 } | 47 } |
48 | 48 |
49 Array<uint8_t> TypeConverter<Array<uint8_t>, std::string>::Convert( | 49 Array<uint8_t> TypeConverter<Array<uint8_t>, std::string>::Convert( |
50 const std::string& input) { | 50 const std::string& input) { |
51 Array<uint8_t> result(input.size()); | 51 Array<uint8_t> result(input.size()); |
52 if (input.size() > 0) | 52 if (input.size() > 0) |
53 memcpy(&result.front(), input.c_str(), input.size()); | 53 memcpy(&result.front(), input.c_str(), input.size()); |
54 return result.Pass(); | 54 return result; |
55 } | 55 } |
56 | 56 |
57 } // namespace mojo | 57 } // namespace mojo |
OLD | NEW |