Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: util/stdlib/strlcpy.cc

Issue 1417403004: win: Implement c16lcpy without base:c16* (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698