1 // Copyright 2013 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifdef UNSAFE_BUFFERS_BUILD 6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors. 7 #pragma allow_unsafe_buffers 8 #endif 9 10 #include "base/strings/latin1_string_conversions.h" 11 12 namespace base { 13 Latin1OrUTF16ToUTF16(size_t length,const Latin1Char * latin1,const char16_t * utf16)14std::u16string Latin1OrUTF16ToUTF16(size_t length, 15 const Latin1Char* latin1, 16 const char16_t* utf16) { 17 if (!length) 18 return std::u16string(); 19 if (latin1) 20 return std::u16string(latin1, latin1 + length); 21 return std::u16string(utf16, utf16 + length); 22 } 23 24 } // namespace base 25