Index: util/stdlib/strlcpy.cc |
diff --git a/util/stdlib/strlcpy.cc b/util/stdlib/strlcpy.cc |
index 90d6d96ecc71c55ce200e9fb70506ed4944f32ce..be0dfb27c3a9e9ef150865fac359b4df176755cf 100644 |
--- a/util/stdlib/strlcpy.cc |
+++ b/util/stdlib/strlcpy.cc |
@@ -14,8 +14,27 @@ |
#include "util/stdlib/strlcpy.h" |
+#include "base/logging.h" |
+#include "build/build_config.h" |
+ |
+#if defined(OS_WIN) && defined(WCHAR_T_IS_UTF16) |
+#include <strsafe.h> |
+#endif |
+ |
namespace crashpad { |
+#if defined(OS_WIN) && defined(WCHAR_T_IS_UTF16) |
+ |
+size_t c16lcpy(base::char16* destination, |
+ const base::char16* source, |
+ size_t length) { |
+ HRESULT result = StringCchCopyW(destination, length, source); |
+ CHECK(result == S_OK || result == STRSAFE_E_INSUFFICIENT_BUFFER); |
+ return wcslen(source); |
+} |
+ |
+#elif defined(WCHAR_T_IS_UTF32) |
+ |
size_t c16lcpy(base::char16* destination, |
const base::char16* source, |
size_t length) { |
@@ -29,4 +48,6 @@ size_t c16lcpy(base::char16* destination, |
return source_length; |
} |
+#endif // WCHAR_T_IS_UTF32 |
+ |
} // namespace crashpad |