diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-06-26 00:39:00 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-06-26 00:39:00 +0000 |
commit | 25c10ed028da5c547b11f1f461916897272b0e6d (patch) | |
tree | 350a5858f8970b6e28b2dc395625d74d8bd597b2 /indra/lscript | |
parent | 6dd125d375b38455997a0c4b8747659f4c2351aa (diff) |
QAR-628 merge string-cleanup-5 -r 90476:90508 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/lscript')
-rw-r--r-- | indra/lscript/lscript_byteconvert.h | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/indra.l | 4 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_tree.cpp | 6 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_tree.h | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/lscript_execute.cpp | 7 | ||||
-rw-r--r-- | indra/lscript/lscript_library.h | 6 | ||||
-rw-r--r-- | indra/lscript/lscript_rt_interface.h | 2 |
7 files changed, 15 insertions, 14 deletions
diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h index e8b727b737..89f3cc4a21 100644 --- a/indra/lscript/lscript_byteconvert.h +++ b/indra/lscript/lscript_byteconvert.h @@ -1110,7 +1110,7 @@ inline void safe_heap_bytestream_count_char(U8 *stream, S32 &offset) ; } -inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, char *buffer) +inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, const char* buffer) { while ( (safe_instruction_check_address(stream, offset, 1)) &&(*(stream + offset++) = *buffer++)) diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index eec3cb7bbf..5f649d1f8d 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -691,10 +691,10 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, init_temp_jumps(); gAllocationManager = new LLScriptAllocationManager(); - yyin = LLFile::fopen(src_filename, "r"); + yyin = LLFile::fopen(std::string(src_filename), "r"); if (yyin) { - yyout = LLFile::fopen(err_filename, "w"); + yyout = LLFile::fopen(std::string(err_filename), "w"); // Reset the lexer's internal buffering. diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp index efbbe374ed..3a93f7b896 100644 --- a/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/indra/lscript/lscript_compile/lscript_tree.cpp @@ -9704,8 +9704,7 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, mStates(states), mGlobalScope(NULL), mGlobals(NULL), mGlobalFunctions(NULL), mGodLike(FALSE) { const char DEFAULT_BYTECODE_FILENAME[] = "lscript.lso"; - strncpy(mBytecodeDest, DEFAULT_BYTECODE_FILENAME, sizeof(mBytecodeDest) -1); /*Flawfinder: ignore*/ - mBytecodeDest[MAX_STRING-1] = '\0'; + mBytecodeDest = DEFAULT_BYTECODE_FILENAME; LLScriptGlobalVariable *tvar; LLScriptGlobalFunctions *tfunc; LLScritpGlobalStorage *temp; @@ -9751,8 +9750,7 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, void LLScriptScript::setBytecodeDest(const char* dst_filename) { - strncpy(mBytecodeDest, dst_filename, MAX_STRING); /*Flawfinder: ignore*/ - mBytecodeDest[MAX_STRING-1] = '\0'; + mBytecodeDest = ll_safe_string(dst_filename); } void print_cil_globals(LLFILE* fp, LLScriptGlobalVariable* global) diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h index f80d7fdf24..4c25c097d8 100644 --- a/indra/lscript/lscript_compile/lscript_tree.h +++ b/indra/lscript/lscript_compile/lscript_tree.h @@ -2269,7 +2269,7 @@ public: BOOL mGodLike; private: - char mBytecodeDest[MAX_STRING]; /*Flawfinder: ignore*/ + std::string mBytecodeDest; }; class LLScriptAllocationManager diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 70202f7d4d..aa73025b7f 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -3684,10 +3684,10 @@ BOOL run_print(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) } -void lscript_run(char *filename, BOOL b_debug) +void lscript_run(const std::string& filename, BOOL b_debug) { LLTimer timer; - if (filename == NULL) + if (filename.empty()) { llerrs << "filename is NULL" << llendl; // Just reporting error is likely not enough. Need @@ -3709,7 +3709,8 @@ void lscript_run(char *filename, BOOL b_debug) file = LLFile::fopen(filename, "r"); if (file) { - LLFILE* fp = LLFile::fopen("lscript.parse", "w"); /*Flawfinder: ignore*/ + std::string parsefile("lscript.parse"); + LLFILE* fp = LLFile::fopen(parsefile, "w"); /*Flawfinder: ignore*/ LLScriptLSOParse *parse = new LLScriptLSOParse(file); parse->printData(fp); delete parse; diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index 48a566de3e..74356256ae 100644 --- a/indra/lscript/lscript_library.h +++ b/indra/lscript/lscript_library.h @@ -387,8 +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); + 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) diff --git a/indra/lscript/lscript_rt_interface.h b/indra/lscript/lscript_rt_interface.h index 791c447d33..3e05212c67 100644 --- a/indra/lscript/lscript_rt_interface.h +++ b/indra/lscript/lscript_rt_interface.h @@ -35,7 +35,7 @@ BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE); BOOL lscript_compile(const char* src_filename, const char* dst_filename, const char* err_filename, BOOL is_god_like = FALSE); -void lscript_run(char *filename, BOOL b_debug); +void lscript_run(const std::string& filename, BOOL b_debug); #endif |