Issue 8781: On systems a signed 4-byte wchar_t and a 4-byte Py_UNICODE, use memcpy to convert between the two (as already done when wchar_t is unsigned)

This commit is contained in:
Daniel Stutzbach 2010-08-24 21:57:33 +00:00
parent 16925e8539
commit 8515eaefda
4 changed files with 10 additions and 11 deletions

View file

@ -664,7 +664,7 @@ PyObject *PyUnicode_FromWideChar(register const wchar_t *w,
return NULL;
/* Copy the wchar_t data into the new object */
#ifdef HAVE_USABLE_WCHAR_T
#if Py_UNICODE_SIZE == SIZEOF_WCHAR_T
memcpy(unicode->str, w, size * sizeof(wchar_t));
#else
{
@ -1167,7 +1167,7 @@ Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode,
if (size > PyUnicode_GET_SIZE(unicode))
size = PyUnicode_GET_SIZE(unicode) + 1;
#ifdef HAVE_USABLE_WCHAR_T
#if Py_UNICODE_SIZE == SIZEOF_WCHAR_T
memcpy(w, unicode->str, size * sizeof(wchar_t));
#else
{