diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2008-06-02 21:14:31 +0000 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2008-06-02 21:14:31 +0000 |
commit | 9db949eec327df4173fde3de934a87bedb0db13c (patch) | |
tree | aeffa0f0e68b1d2ceb74d460cbbd22652c9cd159 /indra/lscript | |
parent | 419e13d0acaabf5e1e02e9b64a07648bce822b2f (diff) |
svn merge -r88066:88786 svn+ssh://svn.lindenlab.com/svn/linden/branches/cmake-9-merge
dataserver-is-deprecated
for-fucks-sake-whats-with-these-commit-markers
Diffstat (limited to 'indra/lscript')
-rw-r--r-- | indra/lscript/CMakeLists.txt | 17 | ||||
-rw-r--r-- | indra/lscript/lscript_byteformat.h | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/CMakeLists.txt | 142 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/bison.bat | 11 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/indra.l | 6 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_bytecode.cpp | 4 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_bytecode.h | 4 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_error.cpp | 4 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_scope.h | 22 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/lscript_tree.cpp | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_compile/windows/unistd.h | 29 | ||||
-rw-r--r-- | indra/lscript/lscript_execute.h | 2 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/CMakeLists.txt | 34 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/lscript_execute.cpp | 6 | ||||
-rw-r--r-- | indra/lscript/lscript_library.h | 33 | ||||
-rw-r--r-- | indra/lscript/lscript_library/CMakeLists.txt | 32 | ||||
-rw-r--r-- | indra/lscript/lscript_library/lscript_library.cpp | 13 |
17 files changed, 303 insertions, 60 deletions
diff --git a/indra/lscript/CMakeLists.txt b/indra/lscript/CMakeLists.txt new file mode 100644 index 0000000000..d3e3dc1103 --- /dev/null +++ b/indra/lscript/CMakeLists.txt @@ -0,0 +1,17 @@ +# -*- cmake -*- + +set(lscript_HEADER_FILES + lscript_alloc.h + lscript_byteconvert.h + lscript_byteformat.h + lscript_execute.h + lscript_export.h + lscript_http.h + lscript_library.h + lscript_rt_interface.h + ) + +add_subdirectory (lscript_compile) +add_subdirectory (lscript_execute) +add_subdirectory (lscript_library) + diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h index 4e8f13f68a..6edf2b740d 100644 --- a/indra/lscript/lscript_byteformat.h +++ b/indra/lscript/lscript_byteformat.h @@ -515,7 +515,7 @@ typedef enum e_lscript_runtime_faults LSRF_EOF } LSCRIPTRunTimeFaults; -extern char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ +extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] = { diff --git a/indra/lscript/lscript_compile/CMakeLists.txt b/indra/lscript/lscript_compile/CMakeLists.txt new file mode 100644 index 0000000000..3b144c5338 --- /dev/null +++ b/indra/lscript/lscript_compile/CMakeLists.txt @@ -0,0 +1,142 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLInventory) +include(LScript) + +include(FindCygwin) + +find_program(FLEX flex + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(FLEX) + +find_program(BISON bison + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(BISON) + +find_program(M4 m4 + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(M4) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_compile_SOURCE_FILES + indra.l.cpp + indra.y.cpp + lscript_alloc.cpp + lscript_bytecode.cpp + lscript_error.cpp + lscript_heap.cpp + lscript_resource.cpp + lscript_scope.cpp + lscript_tree.cpp + lscript_typecheck.cpp + ) + +set(lscript_compile_HEADER_FILES + CMakeLists.txt + + indra.l + indra.y + + ../lscript_alloc.h + ../lscript_byteformat.h + ../lscript_byteconvert.h + ../lscript_http.h + + lscript_error.h + lscript_bytecode.h + lscript_heap.h + lscript_resource.h + lscript_scope.h + lscript_tree.h + lscript_typecheck.h + ) + +set_source_files_properties(${lscript_compile_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_compile_SOURCE_FILES ${lscript_compile_HEADER_FILES}) + +add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + COMMAND ${FLEX} + ARGS + -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + ) + +if (WINDOWS) + set_source_files_properties(indra.l.cpp + PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H) +endif (WINDOWS) + +if (WINDOWS) + get_filename_component(M4_PATH ${M4} PATH) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${BISON} ${M4_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows) +else (WINDOWS) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + ${BISON} + ARGS + -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) +endif (WINDOWS) + +if (DARWIN) + # Mac OS X 10.4 compatibility + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + mv + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + ) +endif (DARWIN) + +add_library (lscript_compile ${lscript_compile_SOURCE_FILES}) diff --git a/indra/lscript/lscript_compile/bison.bat b/indra/lscript/lscript_compile/bison.bat new file mode 100644 index 0000000000..54cf0231d9 --- /dev/null +++ b/indra/lscript/lscript_compile/bison.bat @@ -0,0 +1,11 @@ +@REM Run bison under Windows. This script is needed so that bison can +@REM find m4, even if neither program is present in PATH. + +@set bison=%1 +set M4PATH=%2 +set M4= +@set output=%3 +@set input=%4 + +set PATH=%M4PATH%;%PATH% +%bison% -d -o %output% %input% diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index ba10ef6fcc..eec3cb7bbf 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -19,11 +19,7 @@ FS (f|F) #include "lscript_tree.h" #include "lscript_typecheck.h" #include "lscript_resource.h" -#if LL_WINDOWS -#include "ytab.h" -#else -#include "indra.y.h" -#endif +#include "indra.y.hpp" #include "lltimer.h" #include "indra_constants.h" #include "llagentconstants.h" diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index 5fe42fd9a8..4ff9849193 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -101,7 +101,7 @@ void LLScriptByteCodeChunk::addU16(U16 data) addBytes(temp, 2); } -void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const U8 *bytes, S32 size) { if (mCodeChunk) { @@ -118,7 +118,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) mCurrentOffset += size; } -void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const char *bytes, S32 size) { if (mCodeChunk) { diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h index fcc5a23403..28505a12a9 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/indra/lscript/lscript_compile/lscript_bytecode.h @@ -56,8 +56,8 @@ public: void addByte(U8 byte); void addU16(U16 data); - void addBytes(U8 *bytes, S32 size); - void addBytes(char *bytes, S32 size); + void addBytes(const U8 *bytes, S32 size); + void addBytes(const char *bytes, S32 size); void addBytes(S32 size); void addBytesDontInc(S32 size); void addInteger(S32 value); diff --git a/indra/lscript/lscript_compile/lscript_error.cpp b/indra/lscript/lscript_compile/lscript_error.cpp index 62d36f74d7..309eb07dc2 100644 --- a/indra/lscript/lscript_compile/lscript_error.cpp +++ b/indra/lscript/lscript_compile/lscript_error.cpp @@ -49,13 +49,13 @@ void LLScriptFilePosition::fdotabs(LLFILE *fp, S32 tabs, S32 tabsize) } } -char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ +const char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Dead code found beyond return statement" }; -char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ +const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Syntax error", diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h index c55d99577a..5a629df021 100644 --- a/indra/lscript/lscript_compile/lscript_scope.h +++ b/indra/lscript/lscript_compile/lscript_scope.h @@ -277,14 +277,14 @@ public: class LLScriptScopeEntry { public: - LLScriptScopeEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) + LLScriptScopeEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) : mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0) { } ~LLScriptScopeEntry() {} - char *mIdentifier; + const char *mIdentifier; LSCRIPTIdentifierType mIDType; LSCRIPTType mType; S32 mOffset; @@ -309,9 +309,9 @@ public: mEntryMap.deleteAllData(); } - LLScriptScopeEntry *addEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) + LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (!mEntryMap.checkData(name)) { if (idtype == LIT_FUNCTION) @@ -329,9 +329,9 @@ public: } } - BOOL checkEntry(char *identifier) + BOOL checkEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (mEntryMap.checkData(name)) { return TRUE; @@ -343,9 +343,9 @@ public: } } - LLScriptScopeEntry *findEntry(char *identifier) + LLScriptScopeEntry *findEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -360,9 +360,9 @@ public: return NULL; } - LLScriptScopeEntry *findEntryTyped(char *identifier, LSCRIPTIdentifierType idtype) + LLScriptScopeEntry *findEntryTyped(const char *identifier, LSCRIPTIdentifierType idtype) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -397,7 +397,7 @@ public: mParentScope = scope; } - LLMap<char *, LLScriptScopeEntry *> mEntryMap; + LLMap<const char *, LLScriptScopeEntry *> mEntryMap; LLScriptScope *mParentScope; LLStringTable *mSTable; S32 mFunctionCount; diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp index f00a2e51e7..efbbe374ed 100644 --- a/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/indra/lscript/lscript_compile/lscript_tree.cpp @@ -9804,7 +9804,7 @@ void LLScriptScript::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa mGlobalScope = new LLScriptScope(gScopeStringTable); // zeroth, add library functions to global scope S32 i; - char *arg; + const char *arg; LLScriptScopeEntry *sentry; for (i = 0; i < gScriptLibrary.mNextNumber; i++) { diff --git a/indra/lscript/lscript_compile/windows/unistd.h b/indra/lscript/lscript_compile/windows/unistd.h new file mode 100644 index 0000000000..b8034039e6 --- /dev/null +++ b/indra/lscript/lscript_compile/windows/unistd.h @@ -0,0 +1,29 @@ +/** + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +/* After all that, this file is empty. */ diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h index 5048f5a8d9..dd1aa97e71 100644 --- a/indra/lscript/lscript_execute.h +++ b/indra/lscript/lscript_execute.h @@ -372,7 +372,7 @@ public: ~LLScriptExecute(); void init(); - U32 run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition); + U32 run(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition); BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id); diff --git a/indra/lscript/lscript_execute/CMakeLists.txt b/indra/lscript/lscript_execute/CMakeLists.txt new file mode 100644 index 0000000000..f30915bab0 --- /dev/null +++ b/indra/lscript/lscript_execute/CMakeLists.txt @@ -0,0 +1,34 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_execute_SOURCE_FILES + lscript_execute.cpp + lscript_heapruntime.cpp + lscript_readlso.cpp + ) + +set(lscript_execute_HEADER_FILES + CMakeLists.txt + + ../lscript_execute.h + ../lscript_rt_interface.h + lscript_heapruntime.h + lscript_readlso.h + ) + +set_source_files_properties(${lscript_execute_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_execute_SOURCE_FILES ${lscript_execute_HEADER_FILES}) + +add_library (lscript_execute ${lscript_execute_SOURCE_FILES}) diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index f1c0ead118..77e24cd8f4 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -43,7 +43,7 @@ void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); -char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ +const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ { "invalid", // LSRF_INVALID, "Math Error", // LSRF_MATH, @@ -296,7 +296,7 @@ void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEv S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); -U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) +U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition) { // is there a fault? // if yes, print out message and exit @@ -3687,7 +3687,7 @@ void lscript_run(char *filename, BOOL b_debug) } else { - char *error; + const char *error; BOOL b_state; LLScriptExecute *execute = NULL; diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index d9702ced84..48a566de3e 100644 --- a/indra/lscript/lscript_library.h +++ b/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; @@ -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 */ @@ -391,25 +391,6 @@ public: 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 */ - } - } - LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) { if (!string) diff --git a/indra/lscript/lscript_library/CMakeLists.txt b/indra/lscript/lscript_library/CMakeLists.txt new file mode 100644 index 0000000000..f6bc67a994 --- /dev/null +++ b/indra/lscript/lscript_library/CMakeLists.txt @@ -0,0 +1,32 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +set(lscript_library_SOURCE_FILES + lscript_alloc.cpp + lscript_export.cpp + lscript_library.cpp + ) + +set(lscript_library_HEADER_FILES + CMakeLists.txt + + ../lscript_library.h + ../lscript_export.h + ) + +set_source_files_properties(${lscript_library_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_library_SOURCE_FILES ${lscript_library_HEADER_FILES}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +add_library (lscript_library ${lscript_library_SOURCE_FILES}) diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index 3a5b6eacc0..0b357c9182 100644 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -468,14 +468,14 @@ void LLScriptLibrary::init() //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale.")); -LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only) +LLScriptLibraryFunction::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) : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only) { - mDesc = new char[512]; + char *mDesc_ = new char[512]; if (mSleepTime) { snprintf( /* Flawfinder: ignore */ - mDesc, + mDesc_, 512, "%s\nSleeps script for %.1f seconds.", desc, @@ -483,9 +483,10 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun } else { - strncpy(mDesc, desc, 512); /* Flawfinder: ignore */ - mDesc[511] = '\0'; // just in case. + strncpy(mDesc_, desc, 512); /* Flawfinder: ignore */ + mDesc_[511] = '\0'; // just in case. } + mDesc = mDesc_; } LLScriptLibraryFunction::~LLScriptLibraryFunction() @@ -509,7 +510,7 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) mNextNumber++; } -void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) +void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) { S32 i; for (i = 0; i < mNextNumber; i++) |