summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/lldatapacker.cpp258
-rw-r--r--indra/llmessage/message_prehash.cpp3
-rw-r--r--indra/llmessage/message_prehash.h2
-rw-r--r--indra/llmessage/tests/llcoproceduremanager_test.cpp2
4 files changed, 157 insertions, 108 deletions
diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp
index b6adc102d2..9f7768f78e 100644
--- a/indra/llmessage/lldatapacker.cpp
+++ b/indra/llmessage/lldatapacker.cpp
@@ -116,9 +116,8 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name,
BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
const BOOL is_signed, const U32 int_bits, const U32 frac_bits)
{
- //BOOL success = TRUE;
+ BOOL success = TRUE;
//LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL;
- BOOL ok = FALSE;
S32 unsigned_bits = int_bits + frac_bits;
S32 total_bits = unsigned_bits;
@@ -134,19 +133,19 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
if (total_bits <= 8)
{
U8 fixed_8;
- ok = unpackU8(fixed_8, name);
+ success = unpackU8(fixed_8, name);
fixed_val = (F32)fixed_8;
}
else if (total_bits <= 16)
{
U16 fixed_16;
- ok = unpackU16(fixed_16, name);
+ success = unpackU16(fixed_16, name);
fixed_val = (F32)fixed_16;
}
else if (total_bits <= 31)
{
U32 fixed_32;
- ok = unpackU32(fixed_32, name);
+ success = unpackU32(fixed_32, name);
fixed_val = (F32)fixed_32;
}
else
@@ -164,7 +163,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
}
value = fixed_val;
//LL_INFOS() << "Value: " << value << LL_ENDL;
- return ok;
+ return success;
}
BOOL LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name)
@@ -238,37 +237,43 @@ BOOL LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name)
BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name)
{
- BOOL success = TRUE;
S32 length = value.length()+1;
- success &= verifyLength(length, name);
+ if (!verifyLength(length, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length);
}
mCurBufferp += length;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name)
{
- BOOL success = TRUE;
S32 length = (S32)strlen((char *)mCurBufferp) + 1; /*Flawfinder: ignore*/
- success &= verifyLength(length, name);
+ if (!verifyLength(length, name))
+ {
+ return FALSE;
+ }
value = std::string((char*)mCurBufferp); // We already assume NULL termination calling strlen()
mCurBufferp += length;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(size + 4, name);
+ if (!verifyLength(size + 4, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
@@ -280,102 +285,117 @@ BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const c
htolememcpy(mCurBufferp, value, MVT_VARIABLE, size);
}
mCurBufferp += size;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(4, name);
- htolememcpy(&size, mCurBufferp, MVT_S32, 4);
- mCurBufferp += 4;
- success &= verifyLength(size, name);
- if (success)
+ if (!verifyLength(4, name))
{
- htolememcpy(value, mCurBufferp, MVT_VARIABLE, size);
- mCurBufferp += size;
+ LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL;
+ return FALSE;
}
- else
+
+ htolememcpy(&size, mCurBufferp, MVT_S32, 4);
+ mCurBufferp += 4;
+
+ if (!verifyLength(size, name))
{
LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL;
- success = FALSE;
+ return FALSE;
}
- return success;
+
+ htolememcpy(value, mCurBufferp, MVT_VARIABLE, size);
+ mCurBufferp += size;
+
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(size, name);
+ if (!verifyLength(size, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value, MVT_VARIABLE, size);
}
mCurBufferp += size;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(size, name);
+ if (!verifyLength(size, name))
+ {
+ return FALSE;
+ }
htolememcpy(value, mCurBufferp, MVT_VARIABLE, size);
mCurBufferp += size;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U8), name);
+ if (!verifyLength(sizeof(U8), name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
*mCurBufferp = value;
}
mCurBufferp++;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U8), name);
+ if (!verifyLength(sizeof(U8), name))
+ {
+ return FALSE;
+ }
value = *mCurBufferp;
mCurBufferp++;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U16), name);
+ if (!verifyLength(sizeof(U16), name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, &value, MVT_U16, 2);
}
mCurBufferp += 2;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U16), name);
+ if (!verifyLength(sizeof(U16), name))
+ {
+ return FALSE;
+ }
htolememcpy(&value, mCurBufferp, MVT_U16, 2);
mCurBufferp += 2;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name)
@@ -404,134 +424,156 @@ BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name)
BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U32), name);
+ if (!verifyLength(sizeof(U32), name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, &value, MVT_U32, 4);
}
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(U32), name);
+ if (!verifyLength(sizeof(U32), name))
+ {
+ return FALSE;
+ }
htolememcpy(&value, mCurBufferp, MVT_U32, 4);
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(S32), name);
+ if (!verifyLength(sizeof(S32), name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, &value, MVT_S32, 4);
}
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(S32), name);
+ if(!verifyLength(sizeof(S32), name))
+ {
+ return FALSE;
+ }
htolememcpy(&value, mCurBufferp, MVT_S32, 4);
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(F32), name);
+ if (!verifyLength(sizeof(F32), name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, &value, MVT_F32, 4);
}
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(sizeof(F32), name);
+ if (!verifyLength(sizeof(F32), name))
+ {
+ return FALSE;
+ }
htolememcpy(&value, mCurBufferp, MVT_F32, 4);
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16);
}
mCurBufferp += 16;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16);
mCurBufferp += 16;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(4, name);
+ if (!verifyLength(4, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.mV, MVT_VARIABLE, 4);
}
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(4, name);
+ if (!verifyLength(4, name))
+ {
+ return FALSE;
+ }
htolememcpy(value.mV, mCurBufferp, MVT_VARIABLE, 4);
mCurBufferp += 4;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(8, name);
+ if (!verifyLength(8, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
@@ -539,92 +581,106 @@ BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *n
htolememcpy(mCurBufferp+4, &value.mV[1], MVT_F32, 4);
}
mCurBufferp += 8;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(8, name);
+ if (!verifyLength(8, name))
+ {
+ return FALSE;
+ }
htolememcpy(&value.mV[0], mCurBufferp, MVT_F32, 4);
htolememcpy(&value.mV[1], mCurBufferp+4, MVT_F32, 4);
mCurBufferp += 8;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(12, name);
+ if (!verifyLength(12, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.mV, MVT_LLVector3, 12);
}
mCurBufferp += 12;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(12, name);
+ if (!verifyLength(12, name))
+ {
+ return FALSE;
+ }
htolememcpy(value.mV, mCurBufferp, MVT_LLVector3, 12);
mCurBufferp += 12;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16);
}
mCurBufferp += 16;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16);
mCurBufferp += 16;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
if (mWriteEnabled)
{
htolememcpy(mCurBufferp, value.mData, MVT_LLUUID, 16);
}
mCurBufferp += 16;
- return success;
+ return TRUE;
}
BOOL LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name)
{
- BOOL success = TRUE;
- success &= verifyLength(16, name);
+ if (!verifyLength(16, name))
+ {
+ return FALSE;
+ }
htolememcpy(value.mData, mCurBufferp, MVT_LLUUID, 16);
mCurBufferp += 16;
- return success;
+ return TRUE;
}
const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLDataPackerBinaryBuffer &a)
@@ -698,15 +754,13 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n
BOOL LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name)
{
- BOOL success = TRUE;
char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/
- BOOL res = getValueStr(name, valuestr, DP_BUFSIZE); // NULL terminated
- if (!res) //
+ if (!getValueStr(name, valuestr, DP_BUFSIZE)) // NULL terminated
{
return FALSE;
}
value = valuestr;
- return success;
+ return TRUE;
}
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index 35dcbe3836..57ea954054 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -666,7 +666,6 @@ char const* const _PREHASH_GroupRolesCount = LLMessageStringTable::getInstance()
char const* const _PREHASH_SimulatorBlock = LLMessageStringTable::getInstance()->getString("SimulatorBlock");
char const* const _PREHASH_GroupID = LLMessageStringTable::getInstance()->getString("GroupID");
char const* const _PREHASH_AgentVel = LLMessageStringTable::getInstance()->getString("AgentVel");
-char const* const _PREHASH_RequestImage = LLMessageStringTable::getInstance()->getString("RequestImage");
char const* const _PREHASH_NetStats = LLMessageStringTable::getInstance()->getString("NetStats");
char const* const _PREHASH_AgentPos = LLMessageStringTable::getInstance()->getString("AgentPos");
char const* const _PREHASH_AgentSit = LLMessageStringTable::getInstance()->getString("AgentSit");
@@ -1047,7 +1046,6 @@ char const* const _PREHASH_SortOrder = LLMessageStringTable::getInstance()->getS
char const* const _PREHASH_Hunter = LLMessageStringTable::getInstance()->getString("Hunter");
char const* const _PREHASH_SunAngVelocity = LLMessageStringTable::getInstance()->getString("SunAngVelocity");
char const* const _PREHASH_BinaryBucket = LLMessageStringTable::getInstance()->getString("BinaryBucket");
-char const* const _PREHASH_ImagePacket = LLMessageStringTable::getInstance()->getString("ImagePacket");
char const* const _PREHASH_StartGroupProposal = LLMessageStringTable::getInstance()->getString("StartGroupProposal");
char const* const _PREHASH_EnergyLevel = LLMessageStringTable::getInstance()->getString("EnergyLevel");
char const* const _PREHASH_PriceForListing = LLMessageStringTable::getInstance()->getString("PriceForListing");
@@ -1236,7 +1234,6 @@ char const* const _PREHASH_ForceScriptControlRelease = LLMessageStringTable::get
char const* const _PREHASH_ParcelRelease = LLMessageStringTable::getInstance()->getString("ParcelRelease");
char const* const _PREHASH_VFileType = LLMessageStringTable::getInstance()->getString("VFileType");
char const* const _PREHASH_EjectGroupMemberReply = LLMessageStringTable::getInstance()->getString("EjectGroupMemberReply");
-char const* const _PREHASH_ImageData = LLMessageStringTable::getInstance()->getString("ImageData");
char const* const _PREHASH_SimulatorViewerTimeMessage = LLMessageStringTable::getInstance()->getString("SimulatorViewerTimeMessage");
char const* const _PREHASH_Rotation = LLMessageStringTable::getInstance()->getString("Rotation");
char const* const _PREHASH_Selection = LLMessageStringTable::getInstance()->getString("Selection");
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index 3015f438b5..572dadd408 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -666,7 +666,6 @@ extern char const* const _PREHASH_GroupRolesCount;
extern char const* const _PREHASH_SimulatorBlock;
extern char const* const _PREHASH_GroupID;
extern char const* const _PREHASH_AgentVel;
-extern char const* const _PREHASH_RequestImage;
extern char const* const _PREHASH_NetStats;
extern char const* const _PREHASH_AgentPos;
extern char const* const _PREHASH_AgentSit;
@@ -1047,7 +1046,6 @@ extern char const* const _PREHASH_SortOrder;
extern char const* const _PREHASH_Hunter;
extern char const* const _PREHASH_SunAngVelocity;
extern char const* const _PREHASH_BinaryBucket;
-extern char const* const _PREHASH_ImagePacket;
extern char const* const _PREHASH_StartGroupProposal;
extern char const* const _PREHASH_EnergyLevel;
extern char const* const _PREHASH_PriceForListing;
diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp
index 6424117ef3..a1a4ce0520 100644
--- a/indra/llmessage/tests/llcoproceduremanager_test.cpp
+++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp
@@ -92,7 +92,7 @@ namespace tut
Sync sync;
int foo = 0;
LLCoprocedureManager::instance().initializePool("PoolName");
- LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName",
+ LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName",
[&foo, &sync] (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t & ptr, const LLUUID & id) {
sync.bump();
foo = 1;