Use nd::exceptions::xran to handle out of bounds errors in datapacker instead of a plain std::string.

Nicky 2013-01-02 18:48:29 +01:00
parent 1ce09b4d33
commit 3be4e07442
3 changed files with 10 additions and 4 deletions

View File

@ -27,6 +27,8 @@
#ifndef LL_LLDATAPACKER_H
#define LL_LLDATAPACKER_H
#include "ndexceptions.h" // <FS:ND/> For ndxran
class LLColor4;
class LLColor4U;
class LLVector2;
@ -208,7 +210,7 @@ inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const ch
std::stringstream strm;
strm << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << std::endl;
strm << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << std::endl;
throw std::string( strm.str() );
throw nd::exceptions::xran( strm.str() );
// </FS:ND>
}

View File

@ -32,6 +32,8 @@
#include "llstat.h"
#include "llstl.h"
#include "ndexceptions.h" // <FS:ND/> For ndxran
class LLMsgVarData
{
public:
@ -374,9 +376,9 @@ public:
{
mHandlerFunc(msgsystem, mUserData);
}
catch( std::string &why )
catch( nd::exceptions::xran &ex )
{
llwarns << why << llendl;
llwarns << ex.what() << llendl;
}
// </FS:ND>

View File

@ -38,6 +38,8 @@
#include "v3math.h"
#include "v4math.h"
#include "ndexceptions.h" // <FS:ND/> For ndxran
LLTemplateMessageReader::LLTemplateMessageReader(message_template_number_map_t&
number_template_map) :
mReceiveSize(0),
@ -542,7 +544,7 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3
<< getMessageName() << std::endl;
}
gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET);
throw std::string( strm.str() );
throw nd::exceptions::xran( strm.str() );
}
static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");