diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
commit | b8a71efeba70d6c3ebc579f5043daa4162da86e8 (patch) | |
tree | d2d89da2a59f8955583f4968a35e48c578fd4d4c /source/gameengine/Expressions | |
parent | 81d8f17843f92c6d6abbacb652ca22917910f4bc (diff) |
style cleanup: follow style guide for/with/if spacing
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r-- | source/gameengine/Expressions/InputParser.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Expressions/IntValue.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Expressions/ListValue.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.cpp | 28 | ||||
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 6 |
5 files changed, 22 insertions, 22 deletions
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp index e13cb8200b1..c8f757f263c 100644 --- a/source/gameengine/Expressions/InputParser.cpp +++ b/source/gameengine/Expressions/InputParser.cpp @@ -108,7 +108,7 @@ void CParser::TermChar(char c) { // generates an error if the next char isn't the specified char c, // otherwise, skip the char - if(ch == c) + if (ch == c) { NextCh(); } @@ -379,7 +379,7 @@ void CParser::Term(int s) { // generates an error if the next symbol isn't the specified symbol s // otherwise, skip the symbol - if(s == sym) NextSym(); + if (s == sym) NextSym(); else { STR_String msg; msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it"); diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index 20a4bbc0405..2d427440620 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -328,7 +328,7 @@ void CIntValue::SetValue(CValue* newval) #ifdef WITH_PYTHON PyObject* CIntValue::ConvertValueToPython() { - if((m_int > INT_MIN) && (m_int < INT_MAX)) + if ((m_int > INT_MIN) && (m_int < INT_MAX)) return PyLong_FromSsize_t(m_int); else return PyLong_FromLongLong(m_int); diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 2c8cffbef82..f43625a7821 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -329,7 +329,7 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex) CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex)); if (item) { PyObject* pyobj = item->ConvertValueToPython(); - if(pyobj) + if (pyobj) return pyobj; else return item->GetProxy(); @@ -437,7 +437,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other) else if (PyObject_TypeCheck(other, &CListValue::Type)) { // add items from otherlist to this list CListValue* otherval = static_cast<CListValue *>(BGE_PROXY_REF(other)); - if(otherval==NULL) { + if (otherval==NULL) { listval_new->Release(); PyErr_SetString(PyExc_SystemError, "CList+other, "BGE_PROXY_ERROR_MSG); return NULL; diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 65aa3e23dfa..38d622a7d45 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -55,7 +55,7 @@ PyObjectPlus::~PyObjectPlus() { #ifdef WITH_PYTHON - if(m_proxy) { + if (m_proxy) { BGE_PROXY_REF(m_proxy)= NULL; Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */ } @@ -90,7 +90,7 @@ void PyObjectPlus::ProcessReplica() void PyObjectPlus::InvalidateProxy() // check typename of each parent { #ifdef WITH_PYTHON - if(m_proxy) { + if (m_proxy) { BGE_PROXY_REF(m_proxy)=NULL; Py_DECREF(m_proxy); m_proxy= NULL; @@ -137,7 +137,7 @@ PyTypeObject PyObjectPlus::Type = { PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the entry in Type. { PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus==NULL) { + if (self_plus==NULL) { PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); return NULL; } @@ -173,13 +173,13 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec while(base_type && !BGE_PROXY_CHECK_TYPE(base_type)) base_type= base_type->tp_base; - if(base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) { + if (base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) { PyErr_SetString(PyExc_TypeError, "can't subclass from a blender game type because the argument given is not a game class or subclass"); return NULL; } /* use base_type rather than Py_TYPE(base) because we could already be subtyped */ - if(!PyType_IsSubtype(type, base_type)) { + if (!PyType_IsSubtype(type, base_type)) { PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name); return NULL; } @@ -228,8 +228,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper if (BGE_PROXY_PYREF(self)) { PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ + if (self_plus) { + if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ self_plus->m_proxy = NULL; /* Need this to stop ~PyObjectPlus from decrefing m_proxy otherwise its decref'd twice and py-debug crashes */ delete self_plus; } @@ -239,8 +239,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper BGE_PROXY_PTR(self)= NULL; // not really needed } else { void *ptr= BGE_PROXY_PTR(self); - if(ptr) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ + if (ptr) { + if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ // generic structure owned by python MUST be created though MEM_alloc MEM_freeN(ptr); } @@ -280,8 +280,8 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * { PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { - if(attrdef == attr_invalid) + if (ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { + if (attrdef == attr_invalid) Py_RETURN_TRUE; // don't bother running the function PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); @@ -512,7 +512,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ref==NULL || !ref->py_is_valid() || ptr==NULL) { + if (ref==NULL || !ref->py_is_valid() || ptr==NULL) { PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); return PY_SET_ATTR_FAIL; } @@ -1150,7 +1150,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v } if (self->m_proxy) { - if(py_owns) + if (py_owns) { /* Free */ BGE_PROXY_REF(self->m_proxy) = NULL; Py_DECREF(self->m_proxy); @@ -1164,7 +1164,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v } GetProxyPlus_Ext(self, tp, ptr); - if(py_owns) { + if (py_owns) { BGE_PROXY_PYOWNS(self->m_proxy) = py_owns; Py_DECREF(self->m_proxy); /* could avoid thrashing here but for now its ok */ } diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index c0952f29d8f..30bc33adddd 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -325,7 +325,7 @@ bool CValue::RemoveProperty(const char *inName) vector<STR_String> CValue::GetPropertyNames() { vector<STR_String> result; - if(!m_pNamedPropertyArray) return result; + if (!m_pNamedPropertyArray) return result; result.reserve(m_pNamedPropertyArray->size()); std::map<STR_String,CValue*>::iterator it; @@ -366,7 +366,7 @@ void CValue::ClearProperties() // void CValue::SetPropertiesModified(bool inModified) { - if(!m_pNamedPropertyArray) return; + if (!m_pNamedPropertyArray) return; std::map<STR_String,CValue*>::iterator it; for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) @@ -380,7 +380,7 @@ void CValue::SetPropertiesModified(bool inModified) // bool CValue::IsAnyPropertyModified() { - if(!m_pNamedPropertyArray) return false; + if (!m_pNamedPropertyArray) return false; std::map<STR_String,CValue*>::iterator it; for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) |