From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/lscript/lscript_library.h | 43 ++++++++++------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) (limited to 'linden/indra/lscript/lscript_library.h') diff --git a/linden/indra/lscript/lscript_library.h b/linden/indra/lscript/lscript_library.h index 458ab25..077c02b 100644 --- a/linden/indra/lscript/lscript_library.h +++ b/linden/indra/lscript/lscript_library.h @@ -43,16 +43,16 @@ class LLScriptLibData; class LLScriptLibraryFunction { public: - LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only = FALSE); + LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, const char *desc, BOOL god_only = FALSE); ~LLScriptLibraryFunction(); F32 mEnergyUse; F32 mSleepTime; void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); - char *mName; - char *mReturnType; - char *mArgs; - char *mDesc; + const char *mName; + const char *mReturnType; + const char *mArgs; + const char *mDesc; BOOL mGodOnly; }; @@ -65,7 +65,7 @@ public: void init(); void addFunction(LLScriptLibraryFunction *func); - void assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); + void assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); S32 mNextNumber; LLScriptLibraryFunction **mFunctions; @@ -146,9 +146,9 @@ public: return FALSE; } - S32 getListLength() + S32 getListLength() const { - LLScriptLibData *data = this; + const LLScriptLibData *data = this; S32 retval = 0; while (data->mListp) { @@ -365,7 +365,7 @@ public: void print(std::ostream &s, BOOL b_prepend_comma); void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); - void setFromCSV(char *src) + void setFromCSV(const char *src) { mType = LST_STRING; mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ @@ -387,27 +387,10 @@ public: LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) { - mKey = new char[UUID_STR_LENGTH]; - id.toString(mKey); - } - - LLScriptLibData(char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) - { - if (!string) - { - mString = new char[1]; - mString[0] = 0; - } - else - { - mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */ - if (mString == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - strcpy(mString, string); /* Flawfinder: ignore */ - } + std::string idstr; + id.toString(idstr); + mKey = new char[idstr.length()+1]; + LLStringUtil::copy(mKey,idstr.c_str(),idstr.length()+1); } LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) -- cgit v1.1