Skip to content

Commit c957620

Browse files
committed
BUG: Fix windows compilation error C2664
Commenting the #ifdef WIN32 seems to fix the problem. The text below illustrates the error: Line 677 'QString::fromUtf16' : cannot convert parameter 1 from 'Py_UNICODE *' to 'const ushort *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Line 1044 'PyUnicodeUCS2_FromUnicode' : cannot convert parameter 1 from 'const ushort *' to 'const Py_UNICODE *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1 parent 853bc3c commit c957620

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/PythonQtConversion.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -673,15 +673,15 @@ QString PythonQtConv::PyObjGetString(PyObject* val, bool strict, bool& ok) {
673673
if (val->ob_type == &PyString_Type) {
674674
r = QString(PyString_AS_STRING(val));
675675
} else if (PyUnicode_Check(val)) {
676-
#ifdef WIN32
677-
r = QString::fromUtf16(PyUnicode_AS_UNICODE(val));
678-
#else
676+
//#ifdef WIN32
677+
// r = QString::fromUtf16(PyUnicode_AS_UNICODE(val));
678+
//#else
679679
PyObject *ptmp = PyUnicode_AsUTF8String(val);
680680
if(ptmp) {
681681
r = QString::fromUtf8(PyString_AS_STRING(ptmp));
682682
Py_DECREF(ptmp);
683683
}
684-
#endif
684+
//#endif
685685
} else if (!strict) {
686686
// EXTRA: could also use _Unicode, but why should we?
687687
PyObject* str = PyObject_Str(val);
@@ -1039,12 +1039,12 @@ PyObject* PythonQtConv::QStringToPyObject(const QString& str)
10391039
if (str.isNull()) {
10401040
return PyString_FromString("");
10411041
} else {
1042-
#ifdef WIN32
1042+
//#ifdef WIN32
10431043
// return PyString_FromString(str.toLatin1().data());
1044-
return PyUnicode_FromUnicode(str.utf16(), str.length());
1045-
#else
1044+
// return PyUnicode_FromUnicode(str.utf16(), str.length());
1045+
//#else
10461046
return PyUnicode_DecodeUTF16((const char*)str.utf16(), str.length()*2, NULL, NULL);
1047-
#endif
1047+
//#endif
10481048
}
10491049
}
10501050

0 commit comments

Comments
 (0)