|
|
|
@ -9384,7 +9384,7 @@ static char sip_api_string_as_ascii_char(PyObject *obj)
|
|
|
|
|
if (parseString_AsASCIIChar(obj, &ch) < 0)
|
|
|
|
|
{
|
|
|
|
|
/* Use the exception set if it was an encoding error. */
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1)
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"bytes or ASCII string of length 1 expected not '%s'",
|
|
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
@ -9416,7 +9416,7 @@ static char sip_api_string_as_latin1_char(PyObject *obj)
|
|
|
|
|
if (parseString_AsLatin1Char(obj, &ch) < 0)
|
|
|
|
|
{
|
|
|
|
|
/* Use the exception set if it was an encoding error. */
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1)
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"bytes or Latin-1 string of length 1 expected not '%s'",
|
|
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
@ -9448,7 +9448,7 @@ static char sip_api_string_as_utf8_char(PyObject *obj)
|
|
|
|
|
if (parseString_AsUTF8Char(obj, &ch) < 0)
|
|
|
|
|
{
|
|
|
|
|
/* Use the exception set if it was an encoding error. */
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_SIZE(obj) != 1)
|
|
|
|
|
if (!PyUnicode_Check(obj) || PyUnicode_GET_LENGTH(obj) != 1)
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"bytes or UTF-8 string of length 1 expected not '%s'",
|
|
|
|
|
Py_TYPE(obj)->tp_name);
|
|
|
|
@ -9757,7 +9757,7 @@ static int convertToWCharArray(PyObject *obj, wchar_t **ap, SIP_SSIZE_T *aszp)
|
|
|
|
|
SIP_SSIZE_T ulen;
|
|
|
|
|
wchar_t *wc;
|
|
|
|
|
|
|
|
|
|
ulen = PyUnicode_GET_SIZE(obj);
|
|
|
|
|
ulen = PyUnicode_GET_LENGTH(obj);
|
|
|
|
|
|
|
|
|
|
if ((wc = sip_api_malloc(ulen * sizeof (wchar_t))) == NULL)
|
|
|
|
|
return -1;
|
|
|
|
@ -9794,7 +9794,7 @@ static int parseWChar(PyObject *obj, wchar_t *ap)
|
|
|
|
|
*/
|
|
|
|
|
static int convertToWChar(PyObject *obj, wchar_t *ap)
|
|
|
|
|
{
|
|
|
|
|
if (PyUnicode_GET_SIZE(obj) != 1)
|
|
|
|
|
if (PyUnicode_GET_LENGTH(obj) != 1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (PyUnicode_AsWideChar((PyUnicodeObject *)obj, ap, 1) != 1)
|
|
|
|
@ -9832,7 +9832,7 @@ static int convertToWCharString(PyObject *obj, wchar_t **ap)
|
|
|
|
|
SIP_SSIZE_T ulen;
|
|
|
|
|
wchar_t *wc;
|
|
|
|
|
|
|
|
|
|
ulen = PyUnicode_GET_SIZE(obj);
|
|
|
|
|
ulen = PyUnicode_GET_LENGTH(obj);
|
|
|
|
|
|
|
|
|
|
if ((wc = sip_api_malloc((ulen + 1) * sizeof (wchar_t))) == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|