diff options
-rw-r--r-- | sources/shiboken2/libshiboken/autodecref.h | 11 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.cpp | 8 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/conversions.h | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/helper.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkconverter.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/shibokenbuffer.cpp | 2 |
6 files changed, 18 insertions, 9 deletions
diff --git a/sources/shiboken2/libshiboken/autodecref.h b/sources/shiboken2/libshiboken/autodecref.h index 1fefcc259..a82bbb35c 100644 --- a/sources/shiboken2/libshiboken/autodecref.h +++ b/sources/shiboken2/libshiboken/autodecref.h @@ -43,6 +43,11 @@ #include "sbkpython.h" #include "basewrapper.h" +#ifdef _MSC_VER +__pragma(warning(push)) +__pragma(warning(disable:4522)) // warning: C4522: 'Shiboken::AutoDecRef': multiple assignment operators specified +#endif + struct SbkObject; namespace Shiboken { @@ -75,7 +80,7 @@ public: inline PyObject* object() { return m_pyObj; } inline operator PyObject*() { return m_pyObj; } inline operator PyTupleObject*() { return reinterpret_cast<PyTupleObject*>(m_pyObj); } - inline operator bool() const { return m_pyObj; } + inline operator bool() const { return m_pyObj != 0; } inline PyObject* operator->() { return m_pyObj; } template<typename T> @@ -111,5 +116,9 @@ private: } // namespace Shiboken +#ifdef _MSC_VER +__pragma(warning(pop)) +#endif + #endif // AUTODECREF_H diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index b3f99a8a5..b319fea7e 100644 --- a/sources/shiboken2/libshiboken/basewrapper.cpp +++ b/sources/shiboken2/libshiboken/basewrapper.cpp @@ -624,7 +624,7 @@ namespace ObjectType bool checkType(PyTypeObject* type) { - return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(&SbkObject_Type)); + return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(&SbkObject_Type)) != 0; } bool isUserType(PyTypeObject* type) @@ -653,7 +653,7 @@ void* callExternalCppConversion(SbkObjectType*, PyObject*) { return 0; } bool hasCast(SbkObjectType* type) { - return type->d->mi_specialcast; + return type->d->mi_specialcast != 0; } void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType) @@ -1013,7 +1013,7 @@ void makeValid(SbkObject* self) bool hasParentInfo(SbkObject* pyObj) { - return pyObj->d->parentInfo; + return pyObj->d->parentInfo != 0; } void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType) @@ -1043,7 +1043,7 @@ bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr) if (reinterpret_cast<SbkObjectType*>(Py_TYPE(sbkObj))->d->is_multicpp) idx = getTypeIndexOnHierarchy(Py_TYPE(sbkObj), desiredType); - bool alreadyInitialized = sbkObj->d->cptr[idx]; + const bool alreadyInitialized = sbkObj->d->cptr[idx] != 0; if (alreadyInitialized) PyErr_SetString(PyExc_RuntimeError, "You can't initialize an object twice!"); else diff --git a/sources/shiboken2/libshiboken/conversions.h b/sources/shiboken2/libshiboken/conversions.h index f0af2be8e..a21fa0c2b 100644 --- a/sources/shiboken2/libshiboken/conversions.h +++ b/sources/shiboken2/libshiboken/conversions.h @@ -279,7 +279,7 @@ struct Converter<bool> static inline bool isConvertible(PyObject* pyobj) { return PyInt_Check(pyobj); } static inline PyObject* toPython(void* cppobj) { return toPython(*reinterpret_cast<bool*>(cppobj)); } static inline PyObject* toPython(bool cppobj) { return PyBool_FromLong(cppobj); } - static inline bool toCpp(PyObject* pyobj) { return PyInt_AS_LONG(pyobj); } + static inline bool toCpp(PyObject* pyobj) { return PyInt_AS_LONG(pyobj) != 0; } }; /** diff --git a/sources/shiboken2/libshiboken/helper.cpp b/sources/shiboken2/libshiboken/helper.cpp index 9709d0776..2249bf458 100644 --- a/sources/shiboken2/libshiboken/helper.cpp +++ b/sources/shiboken2/libshiboken/helper.cpp @@ -53,7 +53,7 @@ bool sequenceToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* // Check all items Shiboken::AutoDecRef args(PySequence_Fast(argList, 0)); - int numArgs = PySequence_Fast_GET_SIZE(argList); + int numArgs = int(PySequence_Fast_GET_SIZE(argList)); for (int i = 0; i < numArgs; ++i) { PyObject* item = PySequence_Fast_GET_ITEM(args.object(), i); if (!PyBytes_Check(item) && !PyUnicode_Check(item)) diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp index e7e9995b4..0b18e49d4 100644 --- a/sources/shiboken2/libshiboken/sbkconverter.cpp +++ b/sources/shiboken2/libshiboken/sbkconverter.cpp @@ -517,7 +517,7 @@ bool pythonTypeIsObjectType(const SbkConverter *converter) bool pythonTypeIsWrapperType(const SbkConverter *converter) { - return converter->pointerToPython; + return converter->pointerToPython != 0; } SpecificConverter::SpecificConverter(const char* typeName) diff --git a/sources/shiboken2/libshiboken/shibokenbuffer.cpp b/sources/shiboken2/libshiboken/shibokenbuffer.cpp index 6cc617668..222deb3fa 100644 --- a/sources/shiboken2/libshiboken/shibokenbuffer.cpp +++ b/sources/shiboken2/libshiboken/shibokenbuffer.cpp @@ -43,7 +43,7 @@ bool Shiboken::Buffer::checkType(PyObject* pyObj) { - return PyObject_CheckReadBuffer(pyObj); + return PyObject_CheckReadBuffer(pyObj) != 0; } void* Shiboken::Buffer::getPointer(PyObject* pyObj, Py_ssize_t* size) |