diff --git a/indra/llmessage/llmessagelog.cpp b/indra/llmessage/llmessagelog.cpp index 371617b6b..965b8c0de 100644 --- a/indra/llmessage/llmessagelog.cpp +++ b/indra/llmessage/llmessagelog.cpp @@ -9,10 +9,18 @@ LLMessageLogEntry::LLMessageLogEntry(EType type, LLHost from_host, LLHost to_hos { if(data) { - mData = new U8[data_size]; - memcpy(mData, data, data_size); + mData.resize(data_size); + memcpy(&(mData[0]), data, data_size); } } +LLMessageLogEntry::LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, std::vector data, S32 data_size) +: mType(type), + mFromHost(from_host), + mToHost(to_host), + mDataSize(data_size), + mData(data) +{ +} LLMessageLogEntry::~LLMessageLogEntry() { } @@ -32,7 +40,7 @@ void LLMessageLog::setCallback(void (*callback)(LLMessageLogEntry)) void LLMessageLog::log(LLHost from_host, LLHost to_host, U8* data, S32 data_size) { LLMessageLogEntry entry = LLMessageLogEntry(LLMessageLogEntry::TEMPLATE, from_host, to_host, data, data_size); - if(!entry.mDataSize || !entry.mData) return; + if(!entry.mDataSize || !entry.mData.size()) return; if(sCallback) sCallback(entry); if(!sMaxSize) return; sDeque.push_back(entry); diff --git a/indra/llmessage/llmessagelog.h b/indra/llmessage/llmessagelog.h index 96fae9750..5046d808b 100644 --- a/indra/llmessage/llmessagelog.h +++ b/indra/llmessage/llmessagelog.h @@ -17,12 +17,13 @@ public: HTTP_RESPONSE }; LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, U8* data, S32 data_size); + LLMessageLogEntry(EType type, LLHost from_host, LLHost to_host, std::vector data, S32 data_size); ~LLMessageLogEntry(); EType mType; LLHost mFromHost; LLHost mToHost; S32 mDataSize; - U8* mData; + std::vector mData; }; class LLMessageLog { diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 75babe45a..575ed1ffb 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -41,8 +41,8 @@ LLFloaterMessageLogItem::LLFloaterMessageLogItem(LLMessageLogEntry entry) { BOOL decode_invalid = FALSE; S32 decode_len = mDataSize; - U8 DecodeBuffer[MAX_PACKET_LEN]; - memcpy(&(DecodeBuffer[0]),mData,decode_len); + std::vector DecodeBuffer(MAX_PACKET_LEN,0); + memcpy(&(DecodeBuffer[0]),&(mData[0]),decode_len); U8* decodep = &(DecodeBuffer[0]); mFlags = DecodeBuffer[0]; gMessageSystem->zeroCodeExpand(&decodep, &decode_len); @@ -142,8 +142,8 @@ std::string LLFloaterMessageLogItem::getFull(BOOL show_header) { BOOL decode_invalid = FALSE; S32 decode_len = mDataSize; - U8 DecodeBuffer[MAX_PACKET_LEN]; - memcpy(&(DecodeBuffer[0]),mData,decode_len); + std::vector DecodeBuffer(MAX_PACKET_LEN,0); + memcpy(&(DecodeBuffer[0]),&(mData[0]),decode_len); U8* decodep = &(DecodeBuffer[0]); gMessageSystem->zeroCodeExpand(&decodep, &decode_len); if(decode_len < 7) @@ -416,8 +416,8 @@ LLMessageLogFilterApply::LLMessageLogFilterApply() mProgress(0) { //make extra sure we don't invalidate any iterators and reserve a deque exclusively for our use - mFilterTempMessages = new std::deque (LLFloaterMessageLog::sMessageLogEntries); - mIter = mFilterTempMessages->begin(); + mFilterTempMessages = LLFloaterMessageLog::sMessageLogEntries; + mIter = mFilterTempMessages.begin(); } void LLMessageLogFilterApply::cancel() { @@ -425,7 +425,7 @@ void LLMessageLogFilterApply::cancel() } BOOL LLMessageLogFilterApply::tick() { - std::deque::iterator end = mFilterTempMessages->end(); + std::deque::iterator end = mFilterTempMessages.end(); if(mIter == end || !LLFloaterMessageLog::sInstance) { mFinished = TRUE; @@ -451,8 +451,6 @@ BOOL LLMessageLogFilterApply::tick() } } - delete mFilterTempMessages; - return TRUE; } diff --git a/indra/newview/llfloatermessagelog.h b/indra/newview/llfloatermessagelog.h index d90ea38fd..653b92b36 100644 --- a/indra/newview/llfloatermessagelog.h +++ b/indra/newview/llfloatermessagelog.h @@ -46,7 +46,7 @@ public: S32 mProgress; BOOL mFinished; private: - std::deque *mFilterTempMessages; + std::deque mFilterTempMessages; std::deque::iterator mIter; }; class LLFloaterMessageLog : public LLFloater, public LLEventTimer