From 699030ceb698f827fe582bf03a78a44ffc283629 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Oct 2011 14:41:26 +0000 Subject: use const for readonly strings and set some functions to static --- source/gameengine/Ketsji/KX_CameraActuator.cpp | 2 +- source/gameengine/Ketsji/KX_CameraActuator.h | 2 +- source/gameengine/Ketsji/KX_IpoActuator.cpp | 3 ++- source/gameengine/Ketsji/KX_IpoActuator.h | 2 +- source/gameengine/Ketsji/KX_PythonInit.cpp | 8 ++++---- source/gameengine/Ketsji/KX_PythonInit.h | 2 +- source/gameengine/Ketsji/KX_SceneActuator.cpp | 4 ++-- source/gameengine/Ketsji/KX_SceneActuator.h | 4 ++-- 8 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source/gameengine/Ketsji') diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index 47c10439f02..d4aae68dafb 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -346,7 +346,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) return true; } -CValue *KX_CameraActuator::findObject(char *obName) +CValue *KX_CameraActuator::findObject(const char *obName) { /* hook to object system */ return NULL; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index 5c2535f9c3d..c06904ea56b 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -77,7 +77,7 @@ private : float m_damping; /* get the KX_IGameObject with this name */ - CValue *findObject(char *obName); + CValue *findObject(const char *obName); /* parse x or y to a toggle pick */ bool string2axischoice(const char *axisString); diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index 563ceba1d64..878bdcedfda 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -382,7 +382,8 @@ void KX_IpoActuator::ResetStartTime() this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0; } -int KX_IpoActuator::string2mode(char* modename) { +int KX_IpoActuator::string2mode(const char *modename) +{ IpoActType res = KX_ACT_IPO_NODEF; if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) { diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h index e9820fa0eeb..5ee008ac5e3 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.h +++ b/source/gameengine/Ketsji/KX_IpoActuator.h @@ -118,7 +118,7 @@ public: static const char *S_KX_ACT_IPO_KEY2KEY_STRING; static const char *S_KX_ACT_IPO_FROM_PROP_STRING; - int string2mode(char* modename); + int string2mode(const char *modename); int m_type; diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 2f7b0c06dcd..25145e87b78 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1089,7 +1089,7 @@ static PyObject* gPyDisableMotionBlur(PyObject*) Py_RETURN_NONE; } -int getGLSLSettingFlag(char *setting) +static int getGLSLSettingFlag(const char *setting) { if(strcmp(setting, "lights") == 0) return GAME_GLSL_NO_LIGHTS; @@ -1725,7 +1725,7 @@ static void backupPySysObjects(void) * * "/home/me/foo.blend" -> "/home/me/scripts" */ -static void initPySysObjects__append(PyObject *sys_path, char *filename) +static void initPySysObjects__append(PyObject *sys_path, const char *filename) { PyObject *item; char expanded[FILE_MAXDIR + FILE_MAXFILE]; @@ -2325,7 +2325,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length) return 0; } -void pathGamePythonConfig( char *path ) +void pathGamePythonConfig(char *path) { int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename @@ -2339,7 +2339,7 @@ void pathGamePythonConfig( char *path ) } } -void setGamePythonPath(char *path) +void setGamePythonPath(const char *path) { BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath)); BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */ diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index dd2a75d793e..40d2d38a465 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -54,7 +54,7 @@ void exitGamePythonScripting(); void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv); -void setGamePythonPath(char *path); +void setGamePythonPath(const char *path); void resetGamePythonPath(); void pathGamePythonConfig( char *path ); int saveGamePythonConfig( char **marshal_buffer); diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index af6de882c99..16474437142 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -190,7 +190,7 @@ bool KX_SceneActuator::Update() /* returns a camera if the name is valid */ -KX_Camera* KX_SceneActuator::FindCamera(char *camName) +KX_Camera* KX_SceneActuator::FindCamera(const char *camName) { KX_SceneList* sl = m_KetsjiEngine->CurrentScenes(); STR_String name = STR_String(camName); @@ -208,7 +208,7 @@ KX_Camera* KX_SceneActuator::FindCamera(char *camName) -KX_Scene* KX_SceneActuator::FindScene(char * sceneName) +KX_Scene* KX_SceneActuator::FindScene(const char * sceneName) { return m_KetsjiEngine->FindScene(sceneName); } diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h index 4dbd489d0c8..30f325a775e 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ b/source/gameengine/Ketsji/KX_SceneActuator.h @@ -54,9 +54,9 @@ class KX_SceneActuator : public SCA_IActuator class KX_Camera* m_camera; /** Is this a valid scene? */ - class KX_Scene* FindScene(char* sceneName); + class KX_Scene* FindScene(const char* sceneName); /** Is this a valid camera? */ - class KX_Camera* FindCamera(char* cameraName); + class KX_Camera* FindCamera(const char* cameraName); public: enum SCA_SceneActuatorMode -- cgit v1.2.3