No longer include llerrorlegacy.h. Updated llstl to include deletion utilites.

This commit is contained in:
Shyotl
2015-06-19 03:54:20 -05:00
parent 283f5298d5
commit 1c627317ec
634 changed files with 8200 additions and 12214 deletions

View File

@@ -314,7 +314,7 @@ void LLScriptScriptCodeChunk::build(LLFILE *efp, LLFILE *bcfp)
if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != (size_t)mTotalSize)
{
llwarns << "Short write" << llendl;
LL_WARNS() << "Short write" << LL_ENDL;
}
}
else

View File

@@ -33,7 +33,7 @@
#ifndef LL_LSCRIPT_SCOPE_H
#define LL_LSCRIPT_SCOPE_H
#include "string_table.h"
#include "llstringtable.h"
#include "llmap.h"
#include "lscript_byteformat.h"

View File

@@ -35,7 +35,6 @@
#include "v3math.h"
#include "llquaternion.h"
#include "linked_lists.h"
#include "lscript_error.h"
#include "lscript_typecheck.h"
#include "lscript_byteformat.h"
@@ -2310,20 +2309,20 @@ public:
LLScriptAllocationManager() {}
~LLScriptAllocationManager()
{
mAllocationList.deleteAllData();
deleteAllocations();
}
void addAllocation(LLScriptFilePosition *ptr)
{
mAllocationList.addData(ptr);
mAllocationList.push_front(ptr);
}
void deleteAllocations()
{
mAllocationList.deleteAllData();
delete_and_clear(mAllocationList);
}
LLLinkedList<LLScriptFilePosition> mAllocationList;
std::list<LLScriptFilePosition*> mAllocationList;
};
extern LLScriptAllocationManager *gAllocationManager;

View File

@@ -33,9 +33,10 @@
#ifndef LL_LSCRIPT_EXECUTE_H
#define LL_LSCRIPT_EXECUTE_H
#include "stdtypes.h"
#include "lscript_byteconvert.h"
#include "linked_lists.h"
#include "lscript_library.h"
#include "llstl.h"
class LLTimer;
@@ -268,7 +269,7 @@ public:
S32 i, number = bytestream2integer(src, offset);
for (i = 0; i < number; i++)
{
mEventDataList.addData(new LLScriptDataCollection(src, offset));
mEventDataList.push_front(new LLScriptDataCollection(src, offset));
}
}
@@ -277,32 +278,32 @@ public:
S32 i, number = bytestream2integer(src, offset);
for (i = 0; i < number; i++)
{
mEventDataList.addData(new LLScriptDataCollection(src, offset));
mEventDataList.push_front(new LLScriptDataCollection(src, offset));
}
}
~LLScriptEventData()
{
mEventDataList.deleteAllData();
delete_and_clear(mEventDataList);
}
void addEventData(LLScriptDataCollection *data)
{
if (mEventDataList.getLength() < MAX_EVENTS_IN_QUEUE)
mEventDataList.addDataAtEnd(data);
if (mEventDataList.size() < MAX_EVENTS_IN_QUEUE)
mEventDataList.push_back(data);
else
delete data;
}
LLScriptDataCollection *getNextEvent(LSCRIPTStateEventType type)
{
LLScriptDataCollection *temp;
for (temp = mEventDataList.getFirstData();
temp;
temp = mEventDataList.getNextData())
for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
it != end_it;
++it)
{
LLScriptDataCollection* temp = *it;
if (temp->mType == type)
{
mEventDataList.removeCurrentData();
mEventDataList.erase(it);
return temp;
}
}
@@ -311,24 +312,24 @@ public:
LLScriptDataCollection *getNextEvent()
{
LLScriptDataCollection *temp;
temp = mEventDataList.getFirstData();
temp = mEventDataList.front();
if (temp)
{
mEventDataList.removeCurrentData();
mEventDataList.pop_front();
return temp;
}
return NULL;
}
void removeEventType(LSCRIPTStateEventType type)
{
LLScriptDataCollection *temp;
for (temp = mEventDataList.getFirstData();
temp;
temp = mEventDataList.getNextData())
for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
it != end_it;
++it)
{
if (temp->mType == type)
if ((*it)->mType == type)
{
mEventDataList.deleteCurrentData();
delete *it;
mEventDataList.erase(it);
}
}
}
@@ -338,12 +339,11 @@ public:
S32 size = 0;
// number in linked list
size += 4;
LLScriptDataCollection *temp;
for (temp = mEventDataList.getFirstData();
temp;
temp = mEventDataList.getNextData())
for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
it != end_it;
++it)
{
size += temp->getSavedSize();
size += (*it)->getSavedSize();
}
return size;
}
@@ -352,19 +352,18 @@ public:
{
S32 offset = 0;
// number in linked list
S32 number = mEventDataList.getLength();
S32 number = mEventDataList.size();
integer2bytestream(dest, offset, number);
LLScriptDataCollection *temp;
for (temp = mEventDataList.getFirstData();
temp;
temp = mEventDataList.getNextData())
for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
it != end_it;
++it)
{
offset += temp->write2bytestream(dest + offset);
offset += (*it)->write2bytestream(dest + offset);
}
return offset;
}
LLLinkedList<LLScriptDataCollection> mEventDataList;
std::list<LLScriptDataCollection*> mEventDataList;
};
class LLScriptExecute
@@ -480,9 +479,9 @@ public:
virtual ~LLScriptExecuteLSL2();
virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);}
virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();}
virtual void deleteAllEvents() {delete_and_clear(mEventData.mEventDataList);}
virtual void addEvent(LLScriptDataCollection* event);
virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();}
virtual U32 getEventCount() {return mEventData.mEventDataList.size();}
virtual void removeEventType(LSCRIPTStateEventType event_type);
virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);}
virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);}

View File

@@ -62,7 +62,7 @@ bool LLScriptResourceConsumer::switchScriptResourcePools(LLScriptResourcePool& n
{
if (&new_pool == &LLScriptResourcePool::null)
{
llwarns << "New pool is null" << llendl;
LL_WARNS() << "New pool is null" << LL_ENDL;
}
if (isInPool(new_pool))

View File

@@ -83,7 +83,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp)
S32 pos = 0;
if (fread(&sizearray, 1, 4, fp) != 4)
{
llwarns << "Short read" << llendl;
LL_WARNS() << "Short read" << LL_ENDL;
filesize = 0;
} else {
filesize = bytestream2integer(sizearray, pos);
@@ -92,7 +92,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp)
fseek(fp, 0, SEEK_SET);
if (fread(mBuffer, 1, filesize, fp) != filesize)
{
llwarns << "Short read" << llendl;
LL_WARNS() << "Short read" << LL_ENDL;
}
fclose(fp);
@@ -296,7 +296,7 @@ void LLScriptExecuteLSL2::init()
void LLScriptExecuteLSL2::recordBoundaryError( const LLUUID &id )
{
set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR);
llwarns << "Script boundary error for ID " << id << llendl;
LL_WARNS() << "Script boundary error for ID " << id << LL_ENDL;
}
@@ -520,7 +520,7 @@ void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const L
}
else
{
llwarns << "Somehow got an event that we're not registered for!" << llendl;
LL_WARNS() << "Somehow got an event that we're not registered for!" << LL_ENDL;
}
delete eventdata;
}
@@ -628,7 +628,7 @@ S32 LLScriptExecuteLSL2::writeState(U8 **dest, U32 header_size, U32 footer_size)
// registers
integer2bytestream(*dest, dest_offset, registers_size);
// llinfos << "Writing CE: " << getCurrentEvents() << llendl;
// LL_INFOS() << "Writing CE: " << getCurrentEvents() << LL_ENDL;
bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, registers_size);
// heap
@@ -680,11 +680,11 @@ S32 LLScriptExecuteLSL2::readState(U8 *src)
// copy data into register area
bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size);
// llinfos << "Read CE: " << getCurrentEvents() << llendl;
// LL_INFOS() << "Read CE: " << getCurrentEvents() << LL_ENDL;
if (get_register(mBuffer, LREG_TM) != TOP_OF_MEMORY)
{
llwarns << "Invalid state. Top of memory register does not match"
<< " constant." << llendl;
LL_WARNS() << "Invalid state. Top of memory register does not match"
<< " constant." << LL_ENDL;
reset_hp_to_safe_spot(mBuffer);
return -1;
}
@@ -4036,7 +4036,7 @@ void lscript_run(const std::string& filename, BOOL b_debug)
if (filename.empty())
{
llerrs << "filename is NULL" << llendl;
LL_ERRS() << "filename is NULL" << LL_ENDL;
// Just reporting error is likely not enough. Need
// to check how to abort or error out gracefully
// from this function. XXXTBD
@@ -4061,8 +4061,8 @@ void lscript_run(const std::string& filename, BOOL b_debug)
F32 time = timer.getElapsedTimeF32();
F32 ips = execute->mInstructionCount / time;
llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl;
llinfos << ips/1000 << "K instructions per second" << llendl;
LL_INFOS() << execute->mInstructionCount << " instructions in " << time << " seconds" << LL_ENDL;
LL_INFOS() << ips/1000 << "K instructions per second" << LL_ENDL;
printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP));
printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP));
printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP));

View File

@@ -43,7 +43,7 @@ LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp)
S32 pos = 0;
if (fread(&sizearray, 1, 4, fp) != 4)
{
llwarns << "Short read" << llendl;
LL_WARNS() << "Short read" << LL_ENDL;
filesize = 0;
} else {
filesize = bytestream2integer(sizearray, pos);
@@ -52,7 +52,7 @@ LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp)
fseek(fp, 0, SEEK_SET);
if (fread(mRawData, 1, filesize, fp) != filesize)
{
llwarns << "Short read" << llendl;
LL_WARNS() << "Short read" << LL_ENDL;
}
initOpCodePrinting();

View File

@@ -34,7 +34,6 @@
#define LL_LSCRIPT_READLSO_H
#include "lscript_byteconvert.h"
#include "linked_lists.h"
// list of op code print functions
void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);

View File

@@ -169,8 +169,8 @@ GetMemoryUsage (MonoObject *obj)
int printObjectSize(MonoObject* obj, MonoType* type, int total)
{
total += mono_object_get_size (obj);
llinfos << "Object type: " << mono_type_full_name(type) << " size: "
<< total << llendl;
LL_INFOS() << "Object type: " << mono_type_full_name(type) << " size: "
<< total << LL_ENDL;
return total;
}

View File

@@ -246,7 +246,7 @@ public:
mKey = new char[strlen(data.mKey) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mKey, data.mKey); /* Flawfinder: ignore */
@@ -256,7 +256,7 @@ public:
mString = new char[strlen(data.mString) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mString, data.mString); /* Flawfinder: ignore */
@@ -281,7 +281,7 @@ public:
mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mKey, temp); /* Flawfinder: ignore */
@@ -293,7 +293,7 @@ public:
mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mString, temp); /* Flawfinder: ignore */
@@ -330,7 +330,7 @@ public:
mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mKey == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mKey, temp); /* Flawfinder: ignore */
@@ -342,7 +342,7 @@ public:
mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mString, temp); /* Flawfinder: ignore */
@@ -370,7 +370,7 @@ public:
mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mString, src); /* Flawfinder: ignore */
@@ -404,7 +404,7 @@ public:
mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */
if (mString == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
return;
}
strcpy(mString, string); /* Flawfinder: ignore */

View File

@@ -441,7 +441,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset)
U8 *tbuff = new U8[size + listsize];
if (tbuff == NULL)
{
llerrs << "Memory Allocation Failed" << llendl;
LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
}
memcpy(tbuff, *buffer, size); /*Flawfinder: ignore*/
memcpy(tbuff + size, listbuf, listsize); /*Flawfinder: ignore*/

View File

@@ -774,7 +774,7 @@ void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLib
}
}
llerrs << "Unknown LSL function in assignExec: " << name << llendl;
LL_ERRS() << "Unknown LSL function in assignExec: " << name << LL_ENDL;
}
void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)