aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_library.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/lscript/lscript_library.h
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/lscript/lscript_library.h')
-rw-r--r--linden/indra/lscript/lscript_library.h43
1 files changed, 13 insertions, 30 deletions
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;
43class LLScriptLibraryFunction 43class LLScriptLibraryFunction
44{ 44{
45public: 45public:
46 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); 46 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);
47 ~LLScriptLibraryFunction(); 47 ~LLScriptLibraryFunction();
48 48
49 F32 mEnergyUse; 49 F32 mEnergyUse;
50 F32 mSleepTime; 50 F32 mSleepTime;
51 void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); 51 void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &);
52 char *mName; 52 const char *mName;
53 char *mReturnType; 53 const char *mReturnType;
54 char *mArgs; 54 const char *mArgs;
55 char *mDesc; 55 const char *mDesc;
56 BOOL mGodOnly; 56 BOOL mGodOnly;
57}; 57};
58 58
@@ -65,7 +65,7 @@ public:
65 void init(); 65 void init();
66 66
67 void addFunction(LLScriptLibraryFunction *func); 67 void addFunction(LLScriptLibraryFunction *func);
68 void assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); 68 void assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &));
69 69
70 S32 mNextNumber; 70 S32 mNextNumber;
71 LLScriptLibraryFunction **mFunctions; 71 LLScriptLibraryFunction **mFunctions;
@@ -146,9 +146,9 @@ public:
146 return FALSE; 146 return FALSE;
147 } 147 }
148 148
149 S32 getListLength() 149 S32 getListLength() const
150 { 150 {
151 LLScriptLibData *data = this; 151 const LLScriptLibData *data = this;
152 S32 retval = 0; 152 S32 retval = 0;
153 while (data->mListp) 153 while (data->mListp)
154 { 154 {
@@ -365,7 +365,7 @@ public:
365 void print(std::ostream &s, BOOL b_prepend_comma); 365 void print(std::ostream &s, BOOL b_prepend_comma);
366 void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); 366 void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep);
367 367
368 void setFromCSV(char *src) 368 void setFromCSV(const char *src)
369 { 369 {
370 mType = LST_STRING; 370 mType = LST_STRING;
371 mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ 371 mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */
@@ -387,27 +387,10 @@ public:
387 387
388 LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) 388 LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL)
389 { 389 {
390 mKey = new char[UUID_STR_LENGTH]; 390 std::string idstr;
391 id.toString(mKey); 391 id.toString(idstr);
392 } 392 mKey = new char[idstr.length()+1];
393 393 LLStringUtil::copy(mKey,idstr.c_str(),idstr.length()+1);
394 LLScriptLibData(char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL)
395 {
396 if (!string)
397 {
398 mString = new char[1];
399 mString[0] = 0;
400 }
401 else
402 {
403 mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */
404 if (mString == NULL)
405 {
406 llerrs << "Memory Allocation Failed" << llendl;
407 return;
408 }
409 strcpy(mString, string); /* Flawfinder: ignore */
410 }
411 } 394 }
412 395
413 LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) 396 LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL)