mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: Implement c16lcpy without base:c16*
Chromium base doesn't have base::c16len, c16memcpy, etc. when WCHAR_T_IS_UTF16, so implement c16lcpy without using those. R=mark@chromium.org BUG=crashpad:1, chromium:546288 Review URL: https://codereview.chromium.org/1417403004 .
This commit is contained in:
parent
3d598cdbcd
commit
4b8b42be6c
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user