aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lldatapacker.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llmessage/lldatapacker.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llmessage/lldatapacker.cpp')
-rw-r--r--linden/indra/llmessage/lldatapacker.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/linden/indra/llmessage/lldatapacker.cpp b/linden/indra/llmessage/lldatapacker.cpp
index ec198f7..2c7c036 100644
--- a/linden/indra/llmessage/lldatapacker.cpp
+++ b/linden/indra/llmessage/lldatapacker.cpp
@@ -170,16 +170,16 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name,
170// LLDataPackerBinaryBuffer implementation 170// LLDataPackerBinaryBuffer implementation
171//--------------------------------------------------------------------------- 171//---------------------------------------------------------------------------
172 172
173BOOL LLDataPackerBinaryBuffer::packString(const char *value, const char *name) 173BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name)
174{ 174{
175 BOOL success = TRUE; 175 BOOL success = TRUE;
176 S32 length = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ 176 S32 length = value.length()+1;
177 177
178 success &= verifyLength(length, name); 178 success &= verifyLength(length, name);
179 179
180 if (mWriteEnabled) 180 if (mWriteEnabled)
181 { 181 {
182 htonmemcpy(mCurBufferp, value, MVT_VARIABLE, length); 182 htonmemcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length);
183 } 183 }
184 mCurBufferp += length; 184 mCurBufferp += length;
185 return success; 185 return success;
@@ -577,18 +577,18 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog()
577//--------------------------------------------------------------------------- 577//---------------------------------------------------------------------------
578// LLDataPackerAsciiBuffer implementation 578// LLDataPackerAsciiBuffer implementation
579//--------------------------------------------------------------------------- 579//---------------------------------------------------------------------------
580BOOL LLDataPackerAsciiBuffer::packString(const char *value, const char *name) 580BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name)
581{ 581{
582 BOOL success = TRUE; 582 BOOL success = TRUE;
583 writeIndentedName(name); 583 writeIndentedName(name);
584 int numCopied = 0; 584 int numCopied = 0;
585 if (mWriteEnabled) 585 if (mWriteEnabled)
586 { 586 {
587 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value); /* Flawfinder: ignore */ 587 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", value.c_str()); /* Flawfinder: ignore */
588 } 588 }
589 else 589 else
590 { 590 {
591 numCopied = (S32)strlen(value) + 1; /*Flawfinder: ignore*/ 591 numCopied = value.length() + 1; /*Flawfinder: ignore*/
592 } 592 }
593 593
594 // snprintf returns number of bytes that would have been written 594 // snprintf returns number of bytes that would have been written
@@ -1242,9 +1242,9 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name)
1242 int numCopied = 0; 1242 int numCopied = 0;
1243 if (mWriteEnabled) 1243 if (mWriteEnabled)
1244 { 1244 {
1245 char tmp_str[64]; /* Flawfinder: ignore */ 1245 std::string tmp_str;
1246 value.toString(tmp_str); 1246 value.toString(tmp_str);
1247 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */ 1247 numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str.c_str()); /* Flawfinder: ignore */
1248 } 1248 }
1249 else 1249 else
1250 { 1250 {
@@ -1376,13 +1376,13 @@ std::string convertF32ToString(F32 val)
1376//--------------------------------------------------------------------------- 1376//---------------------------------------------------------------------------
1377// LLDataPackerAsciiFile implementation 1377// LLDataPackerAsciiFile implementation
1378//--------------------------------------------------------------------------- 1378//---------------------------------------------------------------------------
1379BOOL LLDataPackerAsciiFile::packString(const char *value, const char *name) 1379BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name)
1380{ 1380{
1381 BOOL success = TRUE; 1381 BOOL success = TRUE;
1382 writeIndentedName(name); 1382 writeIndentedName(name);
1383 if (mFP) 1383 if (mFP)
1384 { 1384 {
1385 fprintf(mFP,"%s\n", value); 1385 fprintf(mFP,"%s\n", value.c_str());
1386 } 1386 }
1387 else if (mOutputStream) 1387 else if (mOutputStream)
1388 { 1388 {
@@ -1829,11 +1829,11 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name)
1829{ 1829{
1830 BOOL success = TRUE; 1830 BOOL success = TRUE;
1831 writeIndentedName(name); 1831 writeIndentedName(name);
1832 char tmp_str[64]; /*Flawfinder: ignore */ 1832 std::string tmp_str;
1833 value.toString(tmp_str); 1833 value.toString(tmp_str);
1834 if (mFP) 1834 if (mFP)
1835 { 1835 {
1836 fprintf(mFP,"%s\n", tmp_str); 1836 fprintf(mFP,"%s\n", tmp_str.c_str());
1837 } 1837 }
1838 else if (mOutputStream) 1838 else if (mOutputStream)
1839 { 1839 {
@@ -1877,7 +1877,7 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name)
1877 } 1877 }
1878 else if (mOutputStream) 1878 else if (mOutputStream)
1879 { 1879 {
1880 *mOutputStream << indent_buf.c_str() << name << "\t"; 1880 *mOutputStream << indent_buf << name << "\t";
1881 } 1881 }
1882} 1882}
1883 1883