Remove/replace old conditional python code.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/9/head
Michele Calgaro 2 years ago
parent 12236609d0
commit 79ced6fbbd
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -143,7 +143,7 @@ TQString expandMacrosShellQuote (const TQString&, const TQMap<TQStr
for (it = map.begin (); it != map.end (); ++it) for (it = map.begin (); it != map.end (); ++it)
{ {
TQChar acpp = it.key (); TQChar acpp = it.key ();
PyObject *binst = SIPBytes_FromString ((char *)((TQString *)&it.data ())); PyObject *binst = PyBytes_FromString ((char *)((TQString *)&it.data ()));
PyObject *ainst; PyObject *ainst;
if (((ainst = sipConvertFromNewType(new TQChar(acpp), sipType_TQChar, sipTransferObj)) == NULL) if (((ainst = sipConvertFromNewType(new TQChar(acpp), sipType_TQChar, sipTransferObj)) == NULL)
|| (binst == NULL) || (binst == NULL)
@ -232,7 +232,7 @@ TQString expandMacrosShellQuote (const TQString&, const TQMap<TQStr
for (it = map.begin (); it != map.end (); ++it) for (it = map.begin (); it != map.end (); ++it)
{ {
TQStringList bcpp = it.data (); TQStringList bcpp = it.data ();
PyObject *ainst = SIPBytes_FromString ((char *)((TQString *)&it.key ())); PyObject *ainst = PyBytes_FromString ((char *)((TQString *)&it.key ()));
PyObject *binst; PyObject *binst;
if (((binst = sipConvertFromNewType(new TQStringList(bcpp), sipType_TQStringList, sipTransferObj)) == NULL) if (((binst = sipConvertFromNewType(new TQStringList(bcpp), sipType_TQStringList, sipTransferObj)) == NULL)
|| (ainst == NULL) || (ainst == NULL)

@ -184,7 +184,7 @@ public:
for (it = map.begin (); it != map.end (); ++it) for (it = map.begin (); it != map.end (); ++it)
{ {
PyObject *iKey = PyLong_FromLong (((long) it.key ())); PyObject *iKey = PyLong_FromLong (((long) it.key ()));
PyObject *sData = SIPBytes_FromString ((char *)((TQString *)&it.data ())); PyObject *sData = PyBytes_FromString ((char *)((TQString *)&it.data ()));
if ((iKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, iKey, sData) < 0)) if ((iKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, iKey, sData) < 0))
{ {

@ -419,9 +419,9 @@ char **pyArgvToC(PyObject *argvlist,int *argcp)
{ {
arg = tqstrdup(sipString_AsUTF8String(&argObject)); arg = tqstrdup(sipString_AsUTF8String(&argObject));
} }
else if (SIPBytes_Check(argObject)) else if (PyBytes_Check(argObject))
{ {
arg = tqstrdup(SIPBytes_AS_STRING(argObject)); arg = tqstrdup(PyBytes_AS_STRING(argObject));
} }
else else
{ {

@ -172,9 +172,9 @@ public:
{ {
opts[i].name= tqstrdup(sipString_AsUTF8String(&member)); opts[i].name= tqstrdup(sipString_AsUTF8String(&member));
} }
else if (SIPBytes_Check(member)) else if (PyBytes_Check(member))
{ {
opts[i].name= tqstrdup(SIPBytes_AS_STRING(member)); opts[i].name= tqstrdup(PyBytes_AS_STRING(member));
} }
else else
{ {
@ -188,9 +188,9 @@ public:
{ {
opts[i].description= tqstrdup(sipString_AsUTF8String(&member)); opts[i].description= tqstrdup(sipString_AsUTF8String(&member));
} }
else if (SIPBytes_Check(member)) else if (PyBytes_Check(member))
{ {
opts[i].description= tqstrdup(SIPBytes_AS_STRING(member)); opts[i].description= tqstrdup(PyBytes_AS_STRING(member));
} }
else else
{ {
@ -208,9 +208,9 @@ public:
{ {
opts[i].def= tqstrdup(sipString_AsUTF8String(&member)); opts[i].def= tqstrdup(sipString_AsUTF8String(&member));
} }
else if (SIPBytes_Check(member)) else if (PyBytes_Check(member))
{ {
opts[i].def= tqstrdup(SIPBytes_AS_STRING(member)); opts[i].def= tqstrdup(PyBytes_AS_STRING(member));
} }
else else
{ {

@ -260,11 +260,6 @@ protected:
%MappedType longlong %MappedType longlong
//converts a Python long //converts a Python long
{ {
%TypeHeaderCode
#if PY_MAJOR_VERSION >= 2 && PY_MINOR_VERSION >= 3
#define LONG_LONG PY_LONG_LONG
#endif
%End
%ConvertFromTypeCode %ConvertFromTypeCode
if (!sipCpp) if (!sipCpp)
Py_INCREF (Py_None); Py_INCREF (Py_None);
@ -272,7 +267,7 @@ protected:
// PyObject *LongLong; // PyObject *LongLong;
return PyLong_FromLongLong (*(LONG_LONG *)sipCpp); return PyLong_FromLongLong (*(PY_LONG_LONG *)sipCpp);
%End %End
%ConvertToTypeCode %ConvertToTypeCode
@ -296,17 +291,12 @@ protected:
%MappedType ulonglong %MappedType ulonglong
//converts a Python long //converts a Python long
{ {
%TypeHeaderCode
#if PY_MAJOR_VERSION >= 2 && PY_MINOR_VERSION >= 3
#define LONG_LONG PY_LONG_LONG
#endif
%End
%ConvertFromTypeCode %ConvertFromTypeCode
if (!sipCpp) if (!sipCpp)
Py_INCREF (Py_None); Py_INCREF (Py_None);
return Py_None; return Py_None;
return PyLong_FromUnsignedLongLong (*(LONG_LONG *)sipCpp); return PyLong_FromUnsignedLongLong (*(PY_LONG_LONG *)sipCpp);
%End %End
%ConvertToTypeCode %ConvertToTypeCode

@ -151,7 +151,7 @@ typedef TQMap<TQString, TQStringList> KStringListMap;
for (it = map.begin (); it != map.end (); ++it) for (it = map.begin (); it != map.end (); ++it)
{ {
PyObject *sKey = SIPBytes_FromString ((const char *)((TQString)it.key ())); PyObject *sKey = PyBytes_FromString ((const char *)((TQString)it.key ()));
PyObject *sData = sipConvertFromInstance ((void *)&it.data (), sipClass_TQStringList, sipTransferObj); PyObject *sData = sipConvertFromInstance ((void *)&it.data (), sipClass_TQStringList, sipTransferObj);
if ((sKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, sKey, sData) < 0)) if ((sKey == NULL) || (sData == NULL) || (PyDict_SetItem (dict, sKey, sData) < 0))

Loading…
Cancel
Save