diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-26 14:44:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-26 14:44:14 +0400 |
commit | e93d1ba8e775a481e9a719355b12d4523cabcae1 (patch) | |
tree | bf9425fceaabbf1abfea06625b59dc0addccfeeb /source/gameengine | |
parent | ca4d741ce9865c696ef0e41c0c44dd916974d099 (diff) |
Misc warnings
- Removed/Commented some unused vars
- CValue::GetPropertyText() could return a temp reference to a variable on the stack, option wasnt used anywhere so removed.
- KX_ConstraintWrapper::GetConstraintId allows args but ignored them
- KX_ConstraintWrapper::PySetParam didnt return NULL on an error (messing up pythons exceptions).
- BLI_natstrcmp didnt return 0 when the while loop exited
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Expressions/Value.h | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 1 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | 17 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ConstraintWrapper.h | 3 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_MeshProxy.cpp | 1 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/PyTypeList.cpp | 1 |
8 files changed, 10 insertions, 22 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index 773fd94a0fb..08249f92902 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -292,15 +292,13 @@ CValue* CValue::GetProperty(const char *inName) // // Get text description of property with name <inName>, returns an empty string if there is no property named <inName> // -const STR_String& CValue::GetPropertyText(const STR_String & inName,const char *deftext) +const STR_String& CValue::GetPropertyText(const STR_String & inName) { const static STR_String sEmpty(""); CValue *property = GetProperty(inName); if (property) return property->GetText(); - else if (deftext) - return STR_String(deftext); else return sEmpty; } diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index 0be76c4f452..29ef19b46c9 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -310,7 +310,7 @@ public: virtual void SetProperty(const char* name,CValue* ioProperty); virtual CValue* GetProperty(const char* inName); // Get pointer to a property with name <inName>, returns NULL if there is no property named <inName> virtual CValue* GetProperty(const STR_String & inName); - const STR_String& GetPropertyText(const STR_String & inName,const char *deftext=NULL); // Get text description of property with name <inName>, returns an empty string if there is no property named <inName> + const STR_String& GetPropertyText(const STR_String & inName); // Get text description of property with name <inName>, returns an empty string if there is no property named <inName> float GetPropertyNumber(const STR_String& inName,float defnumber); virtual bool RemoveProperty(const char *inName); // Remove the property named <inName>, returns true if the property was succesfully removed, false if property was not found or could not be removed virtual vector<STR_String> GetPropertyNames(); diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 1a0d985a864..02f23a8431b 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -288,10 +288,7 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, int height) { STR_String tmpstr(text); - int lines; char* s = tmpstr.Ptr(); - char* p; - // Save and change OpenGL settings int texture2D; diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 144ff4ac883..1d6c5f77ae5 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -1105,7 +1105,6 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, "getScreenRay()\n" ) { - KX_Camera* cam; MT_Vector3 vect; double x,y,dist; char *propName = NULL; diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp index b40100db2f7..3e5594e0d1c 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp @@ -49,23 +49,20 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper() { } -PyObject* KX_ConstraintWrapper::PyGetConstraintId(PyObject* args, PyObject* kwds) +PyObject* KX_ConstraintWrapper::PyGetConstraintId() { return PyInt_FromLong(m_constraintId); } PyObject* KX_ConstraintWrapper::PySetParam(PyObject* args, PyObject* kwds) { - int len = PyTuple_Size(args); - int success = 1; - int dof; float minLimit,maxLimit; - success = PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit); - if (success) - { - m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit); - } + + if (!PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit)) + return NULL; + + m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit); Py_RETURN_NONE; } @@ -120,7 +117,7 @@ int KX_ConstraintWrapper::py_setattro(PyObject *attr,PyObject* value) PyMethodDef KX_ConstraintWrapper::Methods[] = { - {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_VARARGS}, + {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_NOARGS}, {"setParam",(PyCFunction) KX_ConstraintWrapper::sPySetParam, METH_VARARGS}, {NULL,NULL} //Sentinel }; diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h index b8ac464ceab..d4f038e2898 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h @@ -43,8 +43,7 @@ public: virtual ~KX_ConstraintWrapper (); int getConstraintId() { return m_constraintId;}; - KX_PYMETHOD(KX_ConstraintWrapper,TestMethod); - KX_PYMETHOD(KX_ConstraintWrapper,GetConstraintId); + KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId); KX_PYMETHOD(KX_ConstraintWrapper,SetParam); private: diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index 0d1bc289a5c..11effa1ca98 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -222,7 +222,6 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds) { int vertexindex; int matindex; - PyObject* vertexob = NULL; if (!PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex)) return NULL; diff --git a/source/gameengine/VideoTexture/PyTypeList.cpp b/source/gameengine/VideoTexture/PyTypeList.cpp index 6d2676dce09..2d571675dbd 100644 --- a/source/gameengine/VideoTexture/PyTypeList.cpp +++ b/source/gameengine/VideoTexture/PyTypeList.cpp @@ -45,7 +45,6 @@ bool PyTypeList::in (PyTypeObject * type) /// add type to list void PyTypeList::add (PyTypeObject * type, const char * name) { - PyTypeListItem * typeItem; // if list doesn't exist, create it if (m_list.get() == NULL) m_list.reset(new PyTypeListType()); |