summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-06-26 00:39:00 +0000
commit25c10ed028da5c547b11f1f461916897272b0e6d (patch)
tree350a5858f8970b6e28b2dc395625d74d8bd597b2 /indra/llmath
parent6dd125d375b38455997a0c4b8747659f4c2351aa (diff)
QAR-628 merge string-cleanup-5 -r 90476:90508 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llline.cpp2
-rw-r--r--indra/llmath/llmath.h2
-rw-r--r--indra/llmath/llquaternion.cpp6
-rw-r--r--indra/llmath/llquaternion.h2
-rw-r--r--indra/llmath/llsphere.cpp2
-rw-r--r--indra/llmath/llvolumemgr.cpp3
-rw-r--r--indra/llmath/v3dmath.cpp6
-rw-r--r--indra/llmath/v3dmath.h2
-rw-r--r--indra/llmath/v3math.cpp6
-rw-r--r--indra/llmath/v3math.h2
-rw-r--r--indra/llmath/v4color.cpp28
-rw-r--r--indra/llmath/v4color.h4
-rw-r--r--indra/llmath/v4coloru.cpp8
-rw-r--r--indra/llmath/v4coloru.h2
14 files changed, 39 insertions, 36 deletions
diff --git a/indra/llmath/llline.cpp b/indra/llmath/llline.cpp
index b62631072b..749e3bcdd0 100644
--- a/indra/llmath/llline.cpp
+++ b/indra/llmath/llline.cpp
@@ -7,6 +7,8 @@
* $License$
*/
+#include "linden_common.h"
+
#include "llline.h"
#include "llrand.h"
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 9d31df12e2..fde210ef50 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -35,6 +35,8 @@
#include <cmath>
#include <cstdlib>
#include "lldefs.h"
+#include "llstl.h" // *TODO: Remove when LLString is gone
+#include "llstring.h" // *TODO: Remove when LLString is gone
// work around for Windows & older gcc non-standard function names.
#if LL_WINDOWS
diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp
index 7711d0881d..79b93e6a46 100644
--- a/indra/llmath/llquaternion.cpp
+++ b/indra/llmath/llquaternion.cpp
@@ -937,15 +937,15 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec )
}
}
-BOOL LLQuaternion::parseQuat(const char* buf, LLQuaternion* value)
+BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value)
{
- if( buf == NULL || buf[0] == '\0' || value == NULL)
+ if( buf.empty() || value == NULL)
{
return FALSE;
}
LLQuaternion quat;
- S32 count = sscanf( buf, "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 );
+ S32 count = sscanf( buf.c_str(), "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 );
if( 4 == count )
{
value->set( quat );
diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h
index a088d70674..34a02f6e76 100644
--- a/indra/llmath/llquaternion.h
+++ b/indra/llmath/llquaternion.h
@@ -158,7 +158,7 @@ public:
friend const char *OrderToString( const Order order );
friend Order StringToOrder( const char *str );
- static BOOL parseQuat(const char* buf, LLQuaternion* value);
+ static BOOL parseQuat(const std::string& buf, LLQuaternion* value);
// For debugging, only
//static U32 mMultCount;
diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp
index 3428dc1487..be4df39443 100644
--- a/indra/llmath/llsphere.cpp
+++ b/indra/llmath/llsphere.cpp
@@ -7,6 +7,8 @@
* $License$
*/
+#include "linden_common.h"
+
#include "llsphere.h"
LLSphere::LLSphere()
diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp
index c4f10467a9..8a34d9d33b 100644
--- a/indra/llmath/llvolumemgr.cpp
+++ b/indra/llmath/llvolumemgr.cpp
@@ -376,7 +376,6 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail)
F32 LLVolumeLODGroup::dump()
{
- char dump_str[255]; /* Flawfinder: ignore */
F32 usage = 0.f;
for (S32 i = 0; i < NUM_LODS; i++)
{
@@ -387,7 +386,7 @@ F32 LLVolumeLODGroup::dump()
}
usage = usage / (F32)NUM_LODS;
- snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */
+ std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]);
llinfos << dump_str << llendl;
return usage;
diff --git a/indra/llmath/v3dmath.cpp b/indra/llmath/v3dmath.cpp
index efe1274cbe..41f26c10d7 100644
--- a/indra/llmath/v3dmath.cpp
+++ b/indra/llmath/v3dmath.cpp
@@ -132,15 +132,15 @@ const LLVector3d& LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z)
}
-BOOL LLVector3d::parseVector3d(const char* buf, LLVector3d* value)
+BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value)
{
- if( buf == NULL || buf[0] == '\0' || value == NULL)
+ if( buf.empty() || value == NULL)
{
return FALSE;
}
LLVector3d v;
- S32 count = sscanf( buf, "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 );
+ S32 count = sscanf( buf.c_str(), "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 );
if( 3 == count )
{
value->setVec( v );
diff --git a/indra/llmath/v3dmath.h b/indra/llmath/v3dmath.h
index d5e5223571..36a28e25e6 100644
--- a/indra/llmath/v3dmath.h
+++ b/indra/llmath/v3dmath.h
@@ -132,7 +132,7 @@ class LLVector3d
friend std::ostream& operator<<(std::ostream& s, const LLVector3d &a); // Stream a
- static BOOL parseVector3d(const char* buf, LLVector3d* value);
+ static BOOL parseVector3d(const std::string& buf, LLVector3d* value);
};
diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp
index 6299bbd1b7..166761e550 100644
--- a/indra/llmath/v3math.cpp
+++ b/indra/llmath/v3math.cpp
@@ -326,15 +326,15 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot)
}
// static
-BOOL LLVector3::parseVector3(const char* buf, LLVector3* value)
+BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value)
{
- if( buf == NULL || buf[0] == '\0' || value == NULL)
+ if( buf.empty() || value == NULL)
{
return FALSE;
}
LLVector3 v;
- S32 count = sscanf( buf, "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 );
+ S32 count = sscanf( buf.c_str(), "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 );
if( 3 == count )
{
value->setVec( v );
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index d8f3bec193..051d5376b7 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -148,7 +148,7 @@ class LLVector3
friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a
- static BOOL parseVector3(const char* buf, LLVector3* value);
+ static BOOL parseVector3(const std::string& buf, LLVector3* value);
};
typedef LLVector3 LLSimLocalVec;
diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp
index 21166472e4..8ba329eaf2 100644
--- a/indra/llmath/v4color.cpp
+++ b/indra/llmath/v4color.cpp
@@ -286,16 +286,14 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const
}
// static
-BOOL LLColor4::parseColor(const char* buf, LLColor4* color)
+BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color)
{
- if( buf == NULL || buf[0] == '\0' || color == NULL)
+ if( buf.empty() || color == NULL)
{
return FALSE;
}
- LLString full_string(buf);
-
- boost_tokenizer tokens(full_string, boost::char_separator<char>(", "));
+ boost_tokenizer tokens(buf, boost::char_separator<char>(", "));
boost_tokenizer::iterator token_iter = tokens.begin();
if (token_iter == tokens.end())
{
@@ -304,15 +302,15 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color)
// Grab the first token into a string, since we don't know
// if this is a float or a color name.
- LLString color_name( (*token_iter) );
+ std::string color_name( (*token_iter) );
++token_iter;
if (token_iter != tokens.end())
{
// There are more tokens to read. This must be a vector.
LLColor4 v;
- LLString::convertToF32( color_name, v.mV[VX] );
- LLString::convertToF32( *token_iter, v.mV[VY] );
+ LLStringUtil::convertToF32( color_name, v.mV[VX] );
+ LLStringUtil::convertToF32( *token_iter, v.mV[VY] );
v.mV[VZ] = 0.0f;
v.mV[VW] = 1.0f;
@@ -320,18 +318,18 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color)
if (token_iter == tokens.end())
{
// This is a malformed vector.
- llwarns << "LLColor4::parseColor() malformed color " << full_string << llendl;
+ llwarns << "LLColor4::parseColor() malformed color " << buf << llendl;
}
else
{
// There is a z-component.
- LLString::convertToF32( *token_iter, v.mV[VZ] );
+ LLStringUtil::convertToF32( *token_iter, v.mV[VZ] );
++token_iter;
if (token_iter != tokens.end())
{
// There is an alpha component.
- LLString::convertToF32( *token_iter, v.mV[VW] );
+ LLStringUtil::convertToF32( *token_iter, v.mV[VW] );
}
}
@@ -615,19 +613,19 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color)
}
// static
-BOOL LLColor4::parseColor4(const char* buf, LLColor4* value)
+BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value)
{
- if( buf == NULL || buf[0] == '\0' || value == NULL)
+ if( buf.empty() || value == NULL)
{
return FALSE;
}
LLColor4 v;
- S32 count = sscanf( buf, "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 );
+ S32 count = sscanf( buf.c_str(), "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 );
if (1 == count )
{
// try this format
- count = sscanf( buf, "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 );
+ count = sscanf( buf.c_str(), "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 );
}
if( 4 == count )
{
diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h
index bd990444b5..62c0b663b8 100644
--- a/indra/llmath/v4color.h
+++ b/indra/llmath/v4color.h
@@ -211,8 +211,8 @@ class LLColor4
static LLColor4 cyan5;
static LLColor4 cyan6;
- static BOOL parseColor(const char* buf, LLColor4* color);
- static BOOL parseColor4(const char* buf, LLColor4* color);
+ static BOOL parseColor(const std::string& buf, LLColor4* color);
+ static BOOL parseColor4(const std::string& buf, LLColor4* color);
inline void clamp();
};
diff --git a/indra/llmath/v4coloru.cpp b/indra/llmath/v4coloru.cpp
index 6f6900b6c2..26f3804209 100644
--- a/indra/llmath/v4coloru.cpp
+++ b/indra/llmath/v4coloru.cpp
@@ -93,19 +93,19 @@ std::ostream& operator<<(std::ostream& s, const LLColor4U &a)
}
// static
-BOOL LLColor4U::parseColor4U(const char* buf, LLColor4U* value)
+BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value)
{
- if( buf == NULL || buf[0] == '\0' || value == NULL)
+ if( buf.empty() || value == NULL)
{
return FALSE;
}
U32 v[4];
- S32 count = sscanf( buf, "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 );
+ S32 count = sscanf( buf.c_str(), "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 );
if (1 == count )
{
// try this format
- count = sscanf( buf, "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 );
+ count = sscanf( buf.c_str(), "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 );
}
if( 4 != count )
{
diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index fc7845ad15..1d3f31e968 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -127,7 +127,7 @@ public:
inline void setVecScaleClamp(const LLColor3 &color);
inline void setVecScaleClamp(const LLColor4 &color);
- static BOOL parseColor4U(const char* buf, LLColor4U* value);
+ static BOOL parseColor4U(const std::string& buf, LLColor4U* value);
static LLColor4U white;
static LLColor4U black;