diff options
Diffstat (limited to 'python/modules/IcePy')
-rw-r--r-- | python/modules/IcePy/Communicator.cpp | 4 | ||||
-rw-r--r-- | python/modules/IcePy/Connection.cpp | 38 | ||||
-rw-r--r-- | python/modules/IcePy/ConnectionInfo.cpp | 2 | ||||
-rw-r--r-- | python/modules/IcePy/ObjectAdapter.cpp | 2 | ||||
-rw-r--r-- | python/modules/IcePy/Operation.cpp | 21 | ||||
-rw-r--r-- | python/modules/IcePy/Proxy.cpp | 8 | ||||
-rw-r--r-- | python/modules/IcePy/Types.cpp | 38 | ||||
-rw-r--r-- | python/modules/IcePy/Util.cpp | 20 |
8 files changed, 53 insertions, 80 deletions
diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp index df6af7330a1..71b1a96d44f 100644 --- a/python/modules/IcePy/Communicator.cpp +++ b/python/modules/IcePy/Communicator.cpp @@ -936,9 +936,9 @@ communicatorBeginFlushBatchRequests(CommunicatorObject* self, PyObject* args, Py result = (*self->communicator)->begin_flushBatchRequests(cb); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - setPythonException(ex); + setPythonException(e); return 0; } diff --git a/python/modules/IcePy/Connection.cpp b/python/modules/IcePy/Connection.cpp index f083e6ced6b..9f0b54de55c 100644 --- a/python/modules/IcePy/Connection.cpp +++ b/python/modules/IcePy/Connection.cpp @@ -107,20 +107,9 @@ public: Py_DECREF(_con); } - virtual void closed(const Ice::ConnectionPtr& con) - { - invoke(con); - } - -private: - - void invoke(const Ice::ConnectionPtr& con) + virtual void closed(const Ice::ConnectionPtr&) { AdoptThread adoptThread; // Ensure the current thread is able to call into Python. -#ifndef NDEBUG - ConnectionObject* c = reinterpret_cast<ConnectionObject*>(_con); - assert(con == *(c->connection)); -#endif PyObjectHandle args = Py_BuildValue(STRCAST("(O)"), _con); assert(_cb); @@ -141,6 +130,8 @@ private: } } +private: + PyObject* _cb; PyObject* _con; }; @@ -164,20 +155,9 @@ public: Py_DECREF(_con); } - virtual void heartbeat(const Ice::ConnectionPtr& con) - { - invoke(con); - } - -private: - - void invoke(const Ice::ConnectionPtr& con) + virtual void heartbeat(const Ice::ConnectionPtr&) { AdoptThread adoptThread; // Ensure the current thread is able to call into Python. -#ifndef NDEBUG - ConnectionObject* c = reinterpret_cast<ConnectionObject*>(_con); - assert(con == *(c->connection)); -#endif PyObjectHandle args = Py_BuildValue(STRCAST("(O)"), _con); assert(_cb); @@ -198,6 +178,8 @@ private: } } +private: + PyObject* _cb; PyObject* _con; }; @@ -642,9 +624,9 @@ connectionBeginFlushBatchRequests(ConnectionObject* self, PyObject* args, PyObje result = (*self->connection)->begin_flushBatchRequests(cb); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - setPythonException(ex); + setPythonException(e); return 0; } @@ -845,9 +827,9 @@ connectionBeginHeartbeat(ConnectionObject* self, PyObject* args, PyObject* kwds) result = (*self->connection)->begin_heartbeat(); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - setPythonException(ex); + setPythonException(e); return 0; } diff --git a/python/modules/IcePy/ConnectionInfo.cpp b/python/modules/IcePy/ConnectionInfo.cpp index 97ea121c07c..14b6ae61f7a 100644 --- a/python/modules/IcePy/ConnectionInfo.cpp +++ b/python/modules/IcePy/ConnectionInfo.cpp @@ -158,7 +158,7 @@ udpConnectionInfoGetMcastAddress(ConnectionInfoObject* self) extern "C" #endif static PyObject* -udpConnectionInfoGetMcastPort(ConnectionInfoObject* self, void* member) +udpConnectionInfoGetMcastPort(ConnectionInfoObject* self, void* /*member*/) { Ice::UDPConnectionInfoPtr info = Ice::UDPConnectionInfoPtr::dynamicCast(*self->connectionInfo); assert(info); diff --git a/python/modules/IcePy/ObjectAdapter.cpp b/python/modules/IcePy/ObjectAdapter.cpp index ec06cce6961..7506aa08d4f 100644 --- a/python/modules/IcePy/ObjectAdapter.cpp +++ b/python/modules/IcePy/ObjectAdapter.cpp @@ -219,7 +219,7 @@ IcePy::ServantLocatorWrapper::locate(const Ice::Current& current, Ice::LocalObje } void -IcePy::ServantLocatorWrapper::finished(const Ice::Current& current, const Ice::ObjectPtr&, +IcePy::ServantLocatorWrapper::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie) { AdoptThread adoptThread; // Ensure the current thread is able to call into Python. diff --git a/python/modules/IcePy/Operation.cpp b/python/modules/IcePy/Operation.cpp index 2e2657839ba..7898b52daeb 100644 --- a/python/modules/IcePy/Operation.cpp +++ b/python/modules/IcePy/Operation.cpp @@ -1172,11 +1172,12 @@ extern "C" static int marshaledResultInit(MarshaledResultObject* self, PyObject* args, PyObject* /*kwds*/) { + PyObject* versionType = IcePy::lookupType("Ice.EncodingVersion"); PyObject* result; OperationObject* opObj; PyObject* communicatorObj; PyObject* encodingObj; - if(!PyArg_ParseTuple(args, STRCAST("OOOO"), &result, &opObj, &communicatorObj, &encodingObj)) + if(!PyArg_ParseTuple(args, STRCAST("OOOO!"), &result, &opObj, &communicatorObj, versionType, &encodingObj)) { return -1; } @@ -3214,12 +3215,12 @@ IcePy::SyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */) if(!out.empty()) { void* buf; - Py_ssize_t sz; - if(PyObject_AsWriteBuffer(op.get(), &buf, &sz)) + Py_ssize_t ssz; + if(PyObject_AsWriteBuffer(op.get(), &buf, &ssz)) { throwPythonException(); } - memcpy(buf, &out[0], sz); + memcpy(buf, &out[0], ssz); } #endif @@ -3403,12 +3404,12 @@ IcePy::AsyncBlobjectInvocation::invoke(PyObject* args, PyObject* kwds) } } } - catch(const Ice::CommunicatorDestroyedException& ex) + catch(const Ice::CommunicatorDestroyedException& e) { // // CommunicatorDestroyedException is the only exception that can propagate directly. // - setPythonException(ex); + setPythonException(e); return 0; } catch(const Ice::Exception&) @@ -4026,9 +4027,9 @@ IcePy::TypedUpcall::exception(PyException& ex) throwPythonException(); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - exception(ex); + exception(e); } } @@ -4193,9 +4194,9 @@ IcePy::BlobjectUpcall::exception(PyException& ex) ex.raise(); } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - exception(ex); + exception(e); } } diff --git a/python/modules/IcePy/Proxy.cpp b/python/modules/IcePy/Proxy.cpp index f406b6a8137..fccd0ebef6d 100644 --- a/python/modules/IcePy/Proxy.cpp +++ b/python/modules/IcePy/Proxy.cpp @@ -1997,9 +1997,9 @@ proxyBeginIceGetConnection(ProxyObject* self, PyObject* args, PyObject* kwds) result = (*self->proxy)->begin_ice_getConnection(); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - setPythonException(ex); + setPythonException(e); return 0; } @@ -2196,9 +2196,9 @@ proxyBeginIceFlushBatchRequests(ProxyObject* self, PyObject* args, PyObject* kwd result = (*self->proxy)->begin_ice_flushBatchRequests(); } } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - setPythonException(ex); + setPythonException(e); return 0; } diff --git a/python/modules/IcePy/Types.cpp b/python/modules/IcePy/Types.cpp index 753e45b514b..dd6bc1069d4 100644 --- a/python/modules/IcePy/Types.cpp +++ b/python/modules/IcePy/Types.cpp @@ -483,10 +483,10 @@ IcePy::StreamUtil::setSlicedDataMember(PyObject* obj, const Ice::SlicedDataPtr& assert(*q); ObjectReaderPtr r = ObjectReaderPtr::dynamicCast(*q); assert(r); - PyObject* obj = r->getObject(); - assert(obj != Py_None); // Should be non-nil. - PyTuple_SET_ITEM(instances.get(), j++, obj); - Py_INCREF(obj); // PyTuple_SET_ITEM steals a reference. + PyObject* pobj = r->getObject(); + assert(pobj != Py_None); // Should be non-nil. + PyTuple_SET_ITEM(instances.get(), j++, pobj); + Py_INCREF(pobj); // PyTuple_SET_ITEM steals a reference. } // @@ -582,15 +582,15 @@ IcePy::StreamUtil::getSlicedDataMember(PyObject* obj, ObjectMap* objectMap) Ice::ObjectPtr writer; - ObjectMap::iterator i = objectMap->find(o); - if(i == objectMap->end()) + ObjectMap::iterator k = objectMap->find(o); + if(k == objectMap->end()) { writer = new ObjectWriter(o, objectMap, 0); objectMap->insert(ObjectMap::value_type(o, writer)); } else { - writer = i->second; + writer = k->second; } info->instances.push_back(writer); @@ -1115,7 +1115,7 @@ IcePy::EnumInfo::optionalFormat() const } void -IcePy::EnumInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap*, bool optional, const Ice::StringSeq*) +IcePy::EnumInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap*, bool /*optional*/, const Ice::StringSeq*) { // // Validate value. @@ -1567,7 +1567,7 @@ IcePy::SequenceInfo::usesClasses() const void IcePy::SequenceInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectMap, bool optional, - const Ice::StringSeq* metaData) + const Ice::StringSeq* /*metaData*/) { PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); @@ -2467,8 +2467,8 @@ IcePy::CustomInfo::usesClasses() const } void -IcePy::CustomInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectMap, bool, - const Ice::StringSeq* metaData) +IcePy::CustomInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* /*objectMap*/, bool, + const Ice::StringSeq* /*metaData*/) { assert(PyObject_IsInstance(p, pythonType) == 1); // validate() should have caught this. @@ -2503,7 +2503,7 @@ IcePy::CustomInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* object void IcePy::CustomInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& cb, PyObject* target, - void* closure, bool, const Ice::StringSeq* metaData) + void* closure, bool, const Ice::StringSeq* /*metaData*/) { // // Unmarshal the raw byte sequence. @@ -2567,7 +2567,7 @@ IcePy::CustomInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& c } void -IcePy::CustomInfo::print(PyObject* value, IceUtilInternal::Output& out, PrintObjectHistory* history) +IcePy::CustomInfo::print(PyObject* value, IceUtilInternal::Output& out, PrintObjectHistory*) { if(!validate(value)) { @@ -2858,7 +2858,7 @@ IcePy::ClassInfo::getId() const } bool -IcePy::ClassInfo::validate(PyObject* val) +IcePy::ClassInfo::validate(PyObject*) { assert(false); return true; @@ -2890,7 +2890,7 @@ IcePy::ClassInfo::usesClasses() const } void -IcePy::ClassInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectMap, bool, +IcePy::ClassInfo::marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq*) { assert(false); @@ -2898,8 +2898,8 @@ IcePy::ClassInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectM } void -IcePy::ClassInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& cb, PyObject* target, - void* closure, bool, const Ice::StringSeq*) +IcePy::ClassInfo::unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, + void*, bool, const Ice::StringSeq*) { assert(false); throw AbortMarshaling(); @@ -3679,10 +3679,10 @@ IcePy::ExceptionInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* obj } void -IcePy::ExceptionInfo::writeMembers(PyObject* p, Ice::OutputStream* os, const DataMemberList& members, +IcePy::ExceptionInfo::writeMembers(PyObject* p, Ice::OutputStream* os, const DataMemberList& membersP, ObjectMap* objectMap) const { - for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) + for(DataMemberList::const_iterator q = membersP.begin(); q != membersP.end(); ++q) { DataMemberPtr member = *q; diff --git a/python/modules/IcePy/Util.cpp b/python/modules/IcePy/Util.cpp index 289fab58f93..f3f2b56e1ff 100644 --- a/python/modules/IcePy/Util.cpp +++ b/python/modules/IcePy/Util.cpp @@ -25,18 +25,9 @@ using namespace Slice::Python; namespace IcePy { -bool -checkIsInstance(PyObject* p, const char* type) -{ - PyObject* pyType = lookupType(type); - return PyObject_IsInstance(p, pyType) == 1; -} - template<typename T> bool -setVersion(PyObject* p, const T& version, const char* type) +setVersion(PyObject* p, const T& version) { - assert(checkIsInstance(p, type)); - PyObjectHandle major = PyLong_FromLong(version.major); PyObjectHandle minor = PyLong_FromLong(version.minor); if(!major.get() || !minor.get()) @@ -52,9 +43,8 @@ setVersion(PyObject* p, const T& version, const char* type) } template<typename T> bool -getVersion(PyObject* p, T& v, const char* type) +getVersion(PyObject* p, T& v) { - assert(checkIsInstance(p, type)); PyObjectHandle major = getAttr(p, "major", false); PyObjectHandle minor = getAttr(p, "minor", false); if(major.get()) @@ -112,7 +102,7 @@ createVersion(const T& version, const char* type) return 0; } - if(!setVersion<T>(obj.get(), version, type)) + if(!setVersion<T>(obj.get(), version)) { return 0; } @@ -131,7 +121,7 @@ versionToString(PyObject* args, const char* type) } T v; - if(!getVersion<T>(p, v, type)) + if(!getVersion<T>(p, v)) { return ICE_NULLPTR; } @@ -1109,7 +1099,7 @@ IcePy::createEncodingVersion(const Ice::EncodingVersion& v) bool IcePy::getEncodingVersion(PyObject* p, Ice::EncodingVersion& v) { - if(!getVersion<Ice::EncodingVersion>(p, v, Ice_EncodingVersion)) + if(!getVersion<Ice::EncodingVersion>(p, v)) { return false; } |