Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into project/gltf_development

master
Brad Linden 2024-06-10 16:22:12 -07:00
commit 7c42711ca3
410 changed files with 2549 additions and 2622 deletions

8
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,8 @@
# Replace tabs with spaces
1b68f71348ecf3983b76b40d7940da8377f049b7
# Trim trailing whitespace
a0b3021bdcf76859054fda8e30abb3ed47749e83
# Wrong line endings
1b67dd855c41f5a0cda7ec2a68d98071986ca703
6cc7dd09d5e69cf57e6de7fb568a0ad2693f9c9a
e2e37cced861b98de8c1a7c9c0d3a50d2d90e433

View File

@ -16,3 +16,5 @@ repos:
hooks: hooks:
- id: check-xml - id: check-xml
- id: mixed-line-ending - id: mixed-line-ending
- id: trailing-whitespace
files: \.(cpp|c|h|inl|py|glsl|cmake|yaml|sh)$

View File

@ -1418,6 +1418,14 @@
</map> </map>
<key>llphysicsextensions_source</key> <key>llphysicsextensions_source</key>
<map> <map>
<key>copyright</key>
<string>Copyright (c) 2010, Linden Research, Inc.</string>
<key>license</key>
<string>internal</string>
<key>license_file</key>
<string>LICENSES/llphysicsextensions.txt</string>
<key>name</key>
<string>llphysicsextensions_source</string>
<key>platforms</key> <key>platforms</key>
<map> <map>
<key>darwin64</key> <key>darwin64</key>
@ -1427,11 +1435,11 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>b037cc0b29ea70ee834cfae6dda5b7a25cd57174</string> <string>755a3de464149ae88b048f976828a8c0c46e3bdb</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851460</string> <string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/172966323</string>
</map> </map>
<key>name</key> <key>name</key>
<string>darwin64</string> <string>darwin64</string>
@ -1443,11 +1451,11 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>bdea1fd5c4da9da5afde088d16188b45d0853e04</string> <string>813e7b5e294d7958e3d69e2252752ff346953b0c</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851461</string> <string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/172966322</string>
</map> </map>
<key>name</key> <key>name</key>
<string>linux64</string> <string>linux64</string>
@ -1459,26 +1467,18 @@
<key>creds</key> <key>creds</key>
<string>github</string> <string>github</string>
<key>hash</key> <key>hash</key>
<string>f652ce0d6aef864689f0ed44255da4d9cd65a43f</string> <string>67f647538b1b49d0152fd9d03cfb9bdf978e33d1</string>
<key>hash_algorithm</key> <key>hash_algorithm</key>
<string>sha1</string> <string>sha1</string>
<key>url</key> <key>url</key>
<string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/144851463</string> <string>https://api.github.com/repos/secondlife/llphysicsextensions_source/releases/assets/172966328</string>
</map> </map>
<key>name</key> <key>name</key>
<string>windows64</string> <string>windows64</string>
</map> </map>
</map> </map>
<key>license</key>
<string>internal</string>
<key>license_file</key>
<string>LICENSES/llphysicsextensions.txt</string>
<key>copyright</key>
<string>Copyright (c) 2010, Linden Research, Inc.</string>
<key>version</key> <key>version</key>
<string>1.0.479d20a</string> <string>1.0.b8b1f73</string>
<key>name</key>
<string>llphysicsextensions_source</string>
</map> </map>
<key>llphysicsextensions_stub</key> <key>llphysicsextensions_stub</key>
<map> <map>

View File

@ -164,19 +164,7 @@ LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAv
LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
LLCharacter(), LLCharacter(),
mIsDummy(false), mWearableData(wearable_data)
mTexSkinColor( NULL ),
mTexHairColor( NULL ),
mTexEyeColor( NULL ),
mPelvisToFoot(0.f),
mHeadOffset(),
mRoot(NULL),
mWearableData(wearable_data),
mNumBones(0),
mNumCollisionVolumes(0),
mCollisionVolumes(NULL),
mIsBuilt(false),
mInitFlags(0)
{ {
llassert_always(mWearableData); llassert_always(mWearableData);
mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES); mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
@ -1459,9 +1447,9 @@ void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_
U32 param_name[3]; U32 param_name[3];
if( teToColorParams( te, param_name ) ) if( teToColorParams( te, param_name ) )
{ {
setVisualParamWeight( param_name[0], new_color.mV[VX]); setVisualParamWeight( param_name[0], new_color.mV[VRED]);
setVisualParamWeight( param_name[1], new_color.mV[VY]); setVisualParamWeight( param_name[1], new_color.mV[VGREEN]);
setVisualParamWeight( param_name[2], new_color.mV[VZ]); setVisualParamWeight( param_name[2], new_color.mV[VBLUE]);
} }
} }
@ -1471,9 +1459,9 @@ LLColor4 LLAvatarAppearance::getClothesColor( ETextureIndex te )
U32 param_name[3]; U32 param_name[3];
if( teToColorParams( te, param_name ) ) if( teToColorParams( te, param_name ) )
{ {
color.mV[VX] = getVisualParamWeight( param_name[0] ); color.mV[VRED] = getVisualParamWeight( param_name[0] );
color.mV[VY] = getVisualParamWeight( param_name[1] ); color.mV[VGREEN] = getVisualParamWeight( param_name[1] );
color.mV[VZ] = getVisualParamWeight( param_name[2] ); color.mV[VBLUE] = getVisualParamWeight( param_name[2] );
} }
return color; return color;
} }

View File

@ -70,7 +70,7 @@ public:
static void initClass(); static void initClass();
static void cleanupClass(); // Cleanup data that's only init'd once per class. static void cleanupClass(); // Cleanup data that's only init'd once per class.
virtual void initInstance(); // Called after construction to initialize the instance. virtual void initInstance(); // Called after construction to initialize the instance.
S32 mInitFlags; S32 mInitFlags{ 0 };
virtual bool loadSkeletonNode(); virtual bool loadSkeletonNode();
bool loadMeshNodes(); bool loadMeshNodes();
bool loadLayersets(); bool loadLayersets();
@ -135,8 +135,8 @@ public:
F32 getPelvisToFoot() const { return mPelvisToFoot; } F32 getPelvisToFoot() const { return mPelvisToFoot; }
/*virtual*/ LLJoint* getRootJoint() { return mRoot; } /*virtual*/ LLJoint* getRootJoint() { return mRoot; }
LLVector3 mHeadOffset; // current head position LLVector3 mHeadOffset{}; // current head position
LLAvatarJoint *mRoot; LLAvatarJoint* mRoot{ nullptr };
typedef std::map<std::string, LLJoint*> joint_map_t; typedef std::map<std::string, LLJoint*> joint_map_t;
joint_map_t mJointMap; joint_map_t mJointMap;
@ -165,7 +165,7 @@ protected:
bool buildSkeleton(const LLAvatarSkeletonInfo *info); bool buildSkeleton(const LLAvatarSkeletonInfo *info);
void clearSkeleton(); void clearSkeleton();
bool mIsBuilt; // state of deferred character building bool mIsBuilt{ false }; // state of deferred character building
avatar_joint_list_t mSkeleton; avatar_joint_list_t mSkeleton;
LLVector3OverrideMap mPelvisFixups; LLVector3OverrideMap mPelvisFixups;
joint_alias_map_t mJointAliasMap; joint_alias_map_t mJointAliasMap;
@ -182,30 +182,30 @@ public:
LLVector3 mBodySize; LLVector3 mBodySize;
LLVector3 mAvatarOffset; LLVector3 mAvatarOffset;
protected: protected:
F32 mPelvisToFoot; F32 mPelvisToFoot{ 0.f };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Cached pointers to well known joints // Cached pointers to well known joints
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
LLJoint* mPelvisp; LLJoint* mPelvisp{nullptr};
LLJoint* mTorsop; LLJoint* mTorsop{ nullptr };
LLJoint* mChestp; LLJoint* mChestp{ nullptr };
LLJoint* mNeckp; LLJoint* mNeckp{ nullptr };
LLJoint* mHeadp; LLJoint* mHeadp{ nullptr };
LLJoint* mSkullp; LLJoint* mSkullp{ nullptr };
LLJoint* mEyeLeftp; LLJoint* mEyeLeftp{ nullptr };
LLJoint* mEyeRightp; LLJoint* mEyeRightp{ nullptr };
LLJoint* mHipLeftp; LLJoint* mHipLeftp{ nullptr };
LLJoint* mHipRightp; LLJoint* mHipRightp{ nullptr };
LLJoint* mKneeLeftp; LLJoint* mKneeLeftp{ nullptr };
LLJoint* mKneeRightp; LLJoint* mKneeRightp{ nullptr };
LLJoint* mAnkleLeftp; LLJoint* mAnkleLeftp{ nullptr };
LLJoint* mAnkleRightp; LLJoint* mAnkleRightp{ nullptr };
LLJoint* mFootLeftp; LLJoint* mFootLeftp{ nullptr };
LLJoint* mFootRightp; LLJoint* mFootRightp{ nullptr };
LLJoint* mWristLeftp; LLJoint* mWristLeftp{ nullptr };
LLJoint* mWristRightp; LLJoint* mWristRightp{ nullptr };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// XML parse tree // XML parse tree
@ -225,7 +225,7 @@ protected:
** RENDERING ** RENDERING
**/ **/
public: public:
bool mIsDummy; // for special views and animated object controllers; local to viewer bool mIsDummy{ false }; // for special views and animated object controllers; local to viewer
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Morph masks // Morph masks
@ -288,9 +288,9 @@ public:
LLColor4 getGlobalColor(const std::string& color_name ) const; LLColor4 getGlobalColor(const std::string& color_name ) const;
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0; virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color) = 0;
protected: protected:
LLTexGlobalColor* mTexSkinColor; LLTexGlobalColor* mTexSkinColor{ nullptr };
LLTexGlobalColor* mTexHairColor; LLTexGlobalColor* mTexHairColor{ nullptr };
LLTexGlobalColor* mTexEyeColor; LLTexGlobalColor* mTexEyeColor{ nullptr };
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Visibility // Visibility
@ -313,7 +313,7 @@ public:
virtual bool isWearingWearableType(LLWearableType::EType type ) const; virtual bool isWearingWearableType(LLWearableType::EType type ) const;
private: private:
LLWearableData* mWearableData; LLWearableData* mWearableData{ nullptr };
/******************************************************************************** /********************************************************************************
** ** ** **
@ -331,11 +331,11 @@ protected:
struct BakedTextureData struct BakedTextureData
{ {
LLUUID mLastTextureID; LLUUID mLastTextureID;
LLTexLayerSet* mTexLayerSet; // Only exists for self LLTexLayerSet* mTexLayerSet{ nullptr }; // Only exists for self
bool mIsLoaded; bool mIsLoaded{ false };
bool mIsUsed; bool mIsUsed{ false };
LLAvatarAppearanceDefines::ETextureIndex mTextureIndex; LLAvatarAppearanceDefines::ETextureIndex mTextureIndex{ LLAvatarAppearanceDefines::ETextureIndex::TEX_INVALID };
U32 mMaskTexName; U32 mMaskTexName{ 0 };
// Stores pointers to the joint meshes that this baked texture deals with // Stores pointers to the joint meshes that this baked texture deals with
avatar_joint_mesh_list_t mJointMeshes; avatar_joint_mesh_list_t mJointMeshes;
morph_list_t mMaskedMorphs; morph_list_t mMaskedMorphs;
@ -352,9 +352,9 @@ protected:
// Collision volumes // Collision volumes
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
S32 mNumBones; S32 mNumBones{ 0 };
S32 mNumCollisionVolumes; S32 mNumCollisionVolumes{ 0 };
LLAvatarJointCollisionVolume* mCollisionVolumes; LLAvatarJointCollisionVolume* mCollisionVolumes{ nullptr };
protected: protected:
bool allocateCollisionVolumes(U32 num); bool allocateCollisionVolumes(U32 num);

View File

@ -422,7 +422,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **po
S32 LLDriverParam::getDrivenParamsCount() const S32 LLDriverParam::getDrivenParamsCount() const
{ {
return mDriven.size(); return static_cast<S32>(mDriven.size());
} }
const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const

View File

@ -130,10 +130,10 @@ protected:
LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder LL_ALIGN_16(LLVector4a mDefaultVec); // temp holder
entry_list_t mDriven; entry_list_t mDriven;
LLViewerVisualParam* mCurrentDistortionParam; LLViewerVisualParam* mCurrentDistortionParam{ nullptr };
// Backlink only; don't make this an LLPointer. // Backlink only; don't make this an LLPointer.
LLAvatarAppearance* mAvatarAppearance; LLAvatarAppearance* mAvatarAppearance{ nullptr };
LLWearable* mWearablep; LLWearable* mWearablep{ nullptr };
}; };
#endif // LL_LLDRIVERPARAM_H #endif // LL_LLDRIVERPARAM_H

View File

@ -109,7 +109,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name)
U32 LLLocalTextureObject::getNumTexLayers() const U32 LLLocalTextureObject::getNumTexLayers() const
{ {
return mTexLayers.size(); return static_cast<U32>(mTexLayers.size());
} }
LLUUID LLLocalTextureObject::getID() const LLUUID LLLocalTextureObject::getID() const

View File

@ -983,7 +983,7 @@ void LLPolyMesh::initializeForMorph()
LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2));
for (U32 i = 0; i < mSharedData->mNumVertices; ++i) for (S32 i = 0; i < mSharedData->mNumVertices; ++i)
{ {
mClothingWeights[i].clear(); mClothingWeights[i].clear();
} }

View File

@ -107,7 +107,7 @@ LLPolyMorphData::~LLPolyMorphData()
bool LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) bool LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
{ {
S32 numVertices; S32 numVertices;
S32 numRead; size_t numRead;
numRead = fread(&numVertices, sizeof(S32), 1, fp); numRead = fread(&numVertices, sizeof(S32), 1, fp);
llendianswizzle(&numVertices, sizeof(S32), 1); llendianswizzle(&numVertices, sizeof(S32), 1);
@ -384,8 +384,8 @@ bool LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
if (!mMorphData) if (!mMorphData)
{ {
const std::string driven_tag = "_Driven"; const std::string driven_tag = "_Driven";
U32 pos = morph_param_name.find(driven_tag); auto pos = morph_param_name.find(driven_tag);
if (pos > 0) if (pos != std::string::npos && pos > 0)
{ {
morph_param_name = morph_param_name.substr(0,pos); morph_param_name = morph_param_name.substr(0,pos);
mMorphData = mMesh->getMorphData(morph_param_name); mMorphData = mMesh->getMorphData(morph_param_name);

View File

@ -1038,7 +1038,7 @@ bool LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou
bool success = true; bool success = true;
// If you can't see the layer, don't render it. // If you can't see the layer, don't render it.
if( is_approx_zero( net_color.mV[VW] ) ) if( is_approx_zero( net_color.mV[VALPHA] ) )
{ {
return success; return success;
} }
@ -1213,7 +1213,7 @@ bool LLTexLayer::findNetColor(LLColor4* net_color) const
{ {
net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) ); net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) );
} }
else if (getInfo()->mFixedColor.mV[VW]) else if (getInfo()->mFixedColor.mV[VALPHA])
{ {
net_color->setVec( getInfo()->mFixedColor ); net_color->setVec( getInfo()->mFixedColor );
} }
@ -1232,7 +1232,7 @@ bool LLTexLayer::findNetColor(LLColor4* net_color) const
return true; return true;
} }
if( getInfo()->mFixedColor.mV[VW] ) if( getInfo()->mFixedColor.mV[VALPHA] )
{ {
net_color->setVec( getInfo()->mFixedColor ); net_color->setVec( getInfo()->mFixedColor );
return true; return true;
@ -1373,7 +1373,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
// Draw a rectangle with the layer color to multiply the alpha by that color's alpha. // Draw a rectangle with the layer color to multiply the alpha by that color's alpha.
// Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
if ( !is_approx_equal(layer_color.mV[VW], 1.f) ) if ( !is_approx_equal(layer_color.mV[VALPHA], 1.f) )
{ {
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4fv(layer_color.mV); gGL.color4fv(layer_color.mV);

View File

@ -464,10 +464,10 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
F32 weight = scaled_weight - index_start; F32 weight = scaled_weight - index_start;
const LLColor4 *start = &info->mColors[ index_start ]; const LLColor4 *start = &info->mColors[ index_start ];
const LLColor4 *end = &info->mColors[ index_end ]; const LLColor4 *end = &info->mColors[ index_end ];
return LLColor4((1.f - weight) * start->mV[VX] + weight * end->mV[VX], return LLColor4((1.f - weight) * start->mV[VRED] + weight * end->mV[VRED],
(1.f - weight) * start->mV[VY] + weight * end->mV[VY], (1.f - weight) * start->mV[VGREEN] + weight * end->mV[VGREEN],
(1.f - weight) * start->mV[VZ] + weight * end->mV[VZ], (1.f - weight) * start->mV[VBLUE] + weight * end->mV[VBLUE],
(1.f - weight) * start->mV[VW] + weight * end->mV[VW]); (1.f - weight) * start->mV[VALPHA] + weight * end->mV[VALPHA]);
} }
} }

View File

@ -744,7 +744,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
std::string terse_F32_to_string(F32 f) std::string terse_F32_to_string(F32 f)
{ {
std::string r = llformat("%.2f", f); std::string r = llformat("%.2f", f);
S32 len = r.length(); auto len = r.length();
// "1.20" -> "1.2" // "1.20" -> "1.2"
// "24.00" -> "24." // "24.00" -> "24."

View File

@ -334,7 +334,7 @@ U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
return 0; return 0;
} }
const wearableentry_vec_t& wearable_vec = wearable_iter->second; const wearableentry_vec_t& wearable_vec = wearable_iter->second;
return wearable_vec.size(); return static_cast<U32>(wearable_vec.size());
} }
U32 LLWearableData::getWearableCount(const U32 tex_index) const U32 LLWearableData::getWearableCount(const U32 tex_index) const

View File

@ -422,7 +422,7 @@ bool LLVorbisDecodeState::finishDecode()
ov_clear(&mVF); ov_clear(&mVF);
// write "data" chunk length, in little-endian format // write "data" chunk length, in little-endian format
S32 data_length = mWAVBuffer.size() - WAV_HEADER_SIZE; S32 data_length = static_cast<S32>(mWAVBuffer.size()) - WAV_HEADER_SIZE;
mWAVBuffer[40] = (data_length) & 0x000000FF; mWAVBuffer[40] = (data_length) & 0x000000FF;
mWAVBuffer[41] = (data_length >> 8) & 0x000000FF; mWAVBuffer[41] = (data_length >> 8) & 0x000000FF;
mWAVBuffer[42] = (data_length >> 16) & 0x000000FF; mWAVBuffer[42] = (data_length >> 16) & 0x000000FF;
@ -463,7 +463,7 @@ bool LLVorbisDecodeState::finishDecode()
{ {
memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/ memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/
} }
S32 near_end = mWAVBuffer.size() - (2 * fade_length); S32 near_end = static_cast<S32>(mWAVBuffer.size()) - (2 * fade_length);
if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length)) if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
{ {
memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/ memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/
@ -491,7 +491,7 @@ bool LLVorbisDecodeState::finishDecode()
return true; // we've finished return true; // we've finished
} }
mBytesRead = -1; mBytesRead = -1;
mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(), mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, static_cast<S32>(mWAVBuffer.size()),
new WriteResponder(this)); new WriteResponder(this));
} }

View File

@ -73,8 +73,8 @@ LLCharacter::~LLCharacter()
delete param; delete param;
} }
U32 i ; size_t i ;
U32 size = sInstances.size() ; size_t size = sInstances.size() ;
for(i = 0 ; i < size ; i++) for(i = 0 ; i < size ; i++)
{ {
if(sInstances[i] == this) if(sInstances[i] == this)

View File

@ -282,7 +282,7 @@ bool LLGestureList::trigger(KEY key, MASK mask)
U8 *LLGestureList::serialize(U8 *buffer) const U8 *LLGestureList::serialize(U8 *buffer) const
{ {
// a single S32 serves as the header that tells us how many to read // a single S32 serves as the header that tells us how many to read
U32 count = mList.size(); auto count = mList.size();
htolememcpy(buffer, &count, MVT_S32, 4); htolememcpy(buffer, &count, MVT_S32, 4);
buffer += sizeof(count); buffer += sizeof(count);

View File

@ -90,7 +90,7 @@ public:
bool triggerAndReviseString(const std::string &string, std::string* revised_string); bool triggerAndReviseString(const std::string &string, std::string* revised_string);
// Used for construction from UI // Used for construction from UI
S32 count() const { return mList.size(); } S32 count() const { return static_cast<S32>(mList.size()); }
virtual LLGesture* get(S32 i) const { return mList.at(i); } virtual LLGesture* get(S32 i) const { return mList.at(i); }
virtual void put(LLGesture* gesture) { mList.push_back( gesture ); } virtual void put(LLGesture* gesture) { mList.push_back( gesture ); }
void deleteAll(); void deleteAll();

View File

@ -76,7 +76,7 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c
U32 LLVector3OverrideMap::count() const U32 LLVector3OverrideMap::count() const
{ {
return m_map.size(); return static_cast<U32>(m_map.size());
} }
void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos)
@ -86,7 +86,7 @@ void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos)
bool LLVector3OverrideMap::remove(const LLUUID& mesh_id) bool LLVector3OverrideMap::remove(const LLUUID& mesh_id)
{ {
U32 remove_count = m_map.erase(mesh_id); auto remove_count = m_map.erase(mesh_id);
return (remove_count > 0); return (remove_count > 0);
} }

View File

@ -430,8 +430,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id) LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id)
: LLMotion(id), : LLMotion(id),
mJointMotionList(NULL), mJointMotionList(nullptr),
mPelvisp(NULL), mPelvisp(nullptr),
mCharacter(nullptr),
mLastSkeletonSerialNum(0), mLastSkeletonSerialNum(0),
mLastUpdateTime(0.f), mLastUpdateTime(0.f),
mLastLoopedTime(0.f), mLastLoopedTime(0.f),
@ -2079,7 +2080,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const
JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); JointMotion* joint_motionp = mJointMotionList->getJointMotion(i);
success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packString(joint_motionp->mJointName, "joint_name");
success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority");
success &= dp.packS32(joint_motionp->mRotationCurve.mKeys.size(), "num_rot_keys"); success &= dp.packS32(static_cast<S32>(joint_motionp->mRotationCurve.mKeys.size()), "num_rot_keys");
LL_DEBUGS("BVH") << "Joint " << i LL_DEBUGS("BVH") << "Joint " << i
<< " name: " << joint_motionp->mJointName << " name: " << joint_motionp->mJointName
@ -2105,7 +2106,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const
LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL; LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL;
} }
success &= dp.packS32(joint_motionp->mPositionCurve.mKeys.size(), "num_pos_keys"); success &= dp.packS32(static_cast<S32>(joint_motionp->mPositionCurve.mKeys.size()), "num_pos_keys");
for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys) for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys)
{ {
PositionKey& pos_key = pos_pair.second; PositionKey& pos_key = pos_pair.second;
@ -2125,7 +2126,7 @@ bool LLKeyframeMotion::serialize(LLDataPacker& dp) const
} }
} }
success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints"); success &= dp.packS32(static_cast<S32>(mJointMotionList->mConstraints.size()), "num_constraints");
LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL; LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL;
for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints) for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
{ {

View File

@ -420,7 +420,7 @@ public:
~JointMotionList(); ~JointMotionList();
U32 dumpDiagInfo(); U32 dumpDiagInfo();
JointMotion* getJointMotion(U32 index) const { llassert(index < mJointMotionArray.size()); return mJointMotionArray[index]; } JointMotion* getJointMotion(U32 index) const { llassert(index < mJointMotionArray.size()); return mJointMotionArray[index]; }
U32 getNumJointMotions() const { return mJointMotionArray.size(); } U32 getNumJointMotions() const { return static_cast<U32>(mJointMotionArray.size()); }
}; };
protected: protected:

View File

@ -156,11 +156,11 @@ LLMotionController::~LLMotionController()
void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions) void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions)
{ {
num_motions += mAllMotions.size(); num_motions += static_cast<S32>(mAllMotions.size());
num_loading_motions += mLoadingMotions.size(); num_loading_motions += static_cast<S32>(mLoadingMotions.size());
num_loaded_motions += mLoadedMotions.size(); num_loaded_motions += static_cast<S32>(mLoadedMotions.size());
num_active_motions += mActiveMotions.size(); num_active_motions += static_cast<S32>(mActiveMotions.size());
num_deprecated_motions += mDeprecatedMotions.size(); num_deprecated_motions += static_cast<S32>(mDeprecatedMotions.size());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -222,7 +222,7 @@ void LLMotionController::purgeExcessMotions()
} }
// clean up all inactive, loaded motions // clean up all inactive, loaded motions
for (LLUUID motion_id : motions_to_kill) for (const LLUUID& motion_id : motions_to_kill)
{ {
// look up the motion again by ID to get canonical instance // look up the motion again by ID to get canonical instance
// and kill it only if that one is inactive // and kill it only if that one is inactive
@ -233,7 +233,7 @@ void LLMotionController::purgeExcessMotions()
} }
} }
U32 loaded_count = mLoadedMotions.size(); U32 loaded_count = static_cast<U32>(mLoadedMotions.size());
if (loaded_count > (2 * MAX_MOTION_INSTANCES) && loaded_count > mLastCountAfterPurge) if (loaded_count > (2 * MAX_MOTION_INSTANCES) && loaded_count > mLastCountAfterPurge)
{ {
LL_WARNS_ONCE("Animation") << loaded_count << " Loaded Motions. Amount of motions is over limit." << LL_ENDL; LL_WARNS_ONCE("Animation") << loaded_count << " Loaded Motions. Amount of motions is over limit." << LL_ENDL;

View File

@ -116,7 +116,7 @@ void LLAlignedArray<T, alignment>::resize(U32 size)
template <class T, U32 alignment> template <class T, U32 alignment>
T& LLAlignedArray<T, alignment>::operator[](int idx) T& LLAlignedArray<T, alignment>::operator[](int idx)
{ {
if(idx >= mElementCount || idx < 0) if (idx < 0 || unsigned(idx) >= mElementCount)
{ {
LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL; LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
} }
@ -126,7 +126,7 @@ T& LLAlignedArray<T, alignment>::operator[](int idx)
template <class T, U32 alignment> template <class T, U32 alignment>
const T& LLAlignedArray<T, alignment>::operator[](int idx) const const T& LLAlignedArray<T, alignment>::operator[](int idx) const
{ {
if (idx >= mElementCount || idx < 0) if (idx < 0 || unsigned(idx) >= mElementCount)
{ {
LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL; LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
} }

View File

@ -199,9 +199,9 @@ bool LLApp::parseCommandOptions(int argc, char** argv)
#if LL_WINDOWS #if LL_WINDOWS
//Windows changed command line parsing. Deal with it. //Windows changed command line parsing. Deal with it.
S32 slen = value.length() - 1; size_t slen = value.length() - 1;
S32 start = 0; size_t start = 0;
S32 end = slen; size_t end = slen;
if (argv[ii][start]=='"')start++; if (argv[ii][start]=='"')start++;
if (argv[ii][end]=='"')end--; if (argv[ii][end]=='"')end--;
if (start!=0 || end!=slen) if (start!=0 || end!=slen)
@ -264,9 +264,9 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
#if LL_WINDOWS #if LL_WINDOWS
//Windows changed command line parsing. Deal with it. //Windows changed command line parsing. Deal with it.
S32 slen = value.length() - 1; size_t slen = value.length() - 1;
S32 start = 0; size_t start = 0;
S32 end = slen; size_t end = slen;
if (wargv[ii][start]=='"')start++; if (wargv[ii][start]=='"')start++;
if (wargv[ii][end]=='"')end--; if (wargv[ii][end]=='"')end--;
if (start!=0 || end!=slen) if (start!=0 || end!=slen)

View File

@ -31,41 +31,41 @@
#include <type_traits> #include <type_traits>
// Often used array indices // Often used array indices
const U32 VX = 0; constexpr U32 VX = 0;
const U32 VY = 1; constexpr U32 VY = 1;
const U32 VZ = 2; constexpr U32 VZ = 2;
const U32 VW = 3; constexpr U32 VW = 3;
const U32 VS = 3; constexpr U32 VS = 3;
const U32 VRED = 0; constexpr U32 VRED = 0;
const U32 VGREEN = 1; constexpr U32 VGREEN = 1;
const U32 VBLUE = 2; constexpr U32 VBLUE = 2;
const U32 VALPHA = 3; constexpr U32 VALPHA = 3;
const U32 INVALID_DIRECTION = 0xFFFFFFFF; constexpr U32 INVALID_DIRECTION = 0xFFFFFFFF;
const U32 EAST = 0; constexpr U32 EAST = 0;
const U32 NORTH = 1; constexpr U32 NORTH = 1;
const U32 WEST = 2; constexpr U32 WEST = 2;
const U32 SOUTH = 3; constexpr U32 SOUTH = 3;
const U32 NORTHEAST = 4; constexpr U32 NORTHEAST = 4;
const U32 NORTHWEST = 5; constexpr U32 NORTHWEST = 5;
const U32 SOUTHWEST = 6; constexpr U32 SOUTHWEST = 6;
const U32 SOUTHEAST = 7; constexpr U32 SOUTHEAST = 7;
const U32 MIDDLE = 8; constexpr U32 MIDDLE = 8;
const U8 EAST_MASK = 0x1<<EAST; constexpr U8 EAST_MASK = 0x1<<EAST;
const U8 NORTH_MASK = 0x1<<NORTH; constexpr U8 NORTH_MASK = 0x1<<NORTH;
const U8 WEST_MASK = 0x1<<WEST; constexpr U8 WEST_MASK = 0x1<<WEST;
const U8 SOUTH_MASK = 0x1<<SOUTH; constexpr U8 SOUTH_MASK = 0x1<<SOUTH;
const U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK; constexpr U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK;
const U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK; constexpr U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK;
const U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK; constexpr U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK;
const U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK; constexpr U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK;
const U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5}; constexpr U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5};
const U32 gDirAdjacent[8][2] = { constexpr U32 gDirAdjacent[8][2] = {
{4, 7}, {4, 7},
{4, 5}, {4, 5},
{5, 6}, {5, 6},
@ -77,7 +77,7 @@ const U32 gDirAdjacent[8][2] = {
}; };
// Magnitude along the x and y axis // Magnitude along the x and y axis
const S32 gDirAxes[8][2] = { constexpr S32 gDirAxes[8][2] = {
{ 1, 0}, // east { 1, 0}, // east
{ 0, 1}, // north { 0, 1}, // north
{-1, 0}, // west {-1, 0}, // west
@ -88,7 +88,7 @@ const S32 gDirAxes[8][2] = {
{ 1,-1}, // se { 1,-1}, // se
}; };
const S32 gDirMasks[8] = { constexpr S32 gDirMasks[8] = {
EAST_MASK, EAST_MASK,
NORTH_MASK, NORTH_MASK,
WEST_MASK, WEST_MASK,
@ -117,22 +117,22 @@ const S32 gDirMasks[8] = {
// | / -6- | / // | / -6- | /
// |/ / |/ // |/ / |/
// +------------------+ // +------------------+
const U32 NO_SIDE = 0; constexpr U32 NO_SIDE = 0;
const U32 FRONT_SIDE = 1; constexpr U32 FRONT_SIDE = 1;
const U32 BACK_SIDE = 2; constexpr U32 BACK_SIDE = 2;
const U32 LEFT_SIDE = 3; constexpr U32 LEFT_SIDE = 3;
const U32 RIGHT_SIDE = 4; constexpr U32 RIGHT_SIDE = 4;
const U32 TOP_SIDE = 5; constexpr U32 TOP_SIDE = 5;
const U32 BOTTOM_SIDE = 6; constexpr U32 BOTTOM_SIDE = 6;
const U8 LL_SOUND_FLAG_NONE = 0x0; constexpr U8 LL_SOUND_FLAG_NONE = 0x0;
const U8 LL_SOUND_FLAG_LOOP = 1<<0; constexpr U8 LL_SOUND_FLAG_LOOP = 1<<0;
const U8 LL_SOUND_FLAG_SYNC_MASTER = 1<<1; constexpr U8 LL_SOUND_FLAG_SYNC_MASTER = 1<<1;
const U8 LL_SOUND_FLAG_SYNC_SLAVE = 1<<2; constexpr U8 LL_SOUND_FLAG_SYNC_SLAVE = 1<<2;
const U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3; constexpr U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3;
const U8 LL_SOUND_FLAG_QUEUE = 1<<4; constexpr U8 LL_SOUND_FLAG_QUEUE = 1<<4;
const U8 LL_SOUND_FLAG_STOP = 1<<5; constexpr U8 LL_SOUND_FLAG_STOP = 1<<5;
const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; constexpr U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING;
// //
// *NOTE: These values may be used as hard-coded numbers in scanf() variants. // *NOTE: These values may be used as hard-coded numbers in scanf() variants.
@ -141,17 +141,17 @@ const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYN
// DO NOT CHANGE. // DO NOT CHANGE.
// -------------- // --------------
// //
const U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length constexpr U32 LL_MAX_PATH = 1024; // buffer size of maximum path + filename string length
// For strings we send in messages // For strings we send in messages
const U32 STD_STRING_BUF_SIZE = 255; // Buffer size constexpr U32 STD_STRING_BUF_SIZE = 255; // Buffer size
const U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0) constexpr U32 STD_STRING_STR_LEN = 254; // Length of the string (not including \0)
// *NOTE: This value is used as hard-coded numbers in scanf() variants. // *NOTE: This value is used as hard-coded numbers in scanf() variants.
// DO NOT CHANGE. // DO NOT CHANGE.
const U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size constexpr U32 MAX_STRING = STD_STRING_BUF_SIZE; // Buffer size
const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck constexpr U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luck
// C++ is our friend. . . use template functions to make life easier! // C++ is our friend. . . use template functions to make life easier!

View File

@ -215,7 +215,7 @@ private:
private: private:
U64 mStartTime; U64 mStartTime;
BlockTimerStackRecord mParentTimerData; BlockTimerStackRecord mParentTimerData{};
public: public:
// statics // statics

View File

@ -27,6 +27,12 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#include "linden_common.h"
#include "llfile.h"
#include "llstring.h"
#include "llerror.h"
#include "stringize.h"
#if LL_WINDOWS #if LL_WINDOWS
#include "llwin32headerslean.h" #include "llwin32headerslean.h"
#include <stdlib.h> // Windows errno #include <stdlib.h> // Windows errno
@ -35,12 +41,6 @@
#include <errno.h> #include <errno.h>
#endif #endif
#include "linden_common.h"
#include "llfile.h"
#include "llstring.h"
#include "llerror.h"
#include "stringize.h"
using namespace std; using namespace std;
static std::string empty; static std::string empty;
@ -345,7 +345,7 @@ const char *LLFile::tmpdir()
sep = '\\'; sep = '\\';
std::vector<wchar_t> utf16path(MAX_PATH + 1); std::vector<wchar_t> utf16path(MAX_PATH + 1);
GetTempPathW(utf16path.size(), &utf16path[0]); GetTempPathW(static_cast<DWORD>(utf16path.size()), &utf16path[0]);
utf8path = ll_convert_wide_to_string(&utf16path[0]); utf8path = ll_convert_wide_to_string(&utf16path[0]);
#else #else
sep = '/'; sep = '/';

View File

@ -97,7 +97,7 @@ public:
// no copy // no copy
LLUniqueFile(const LLUniqueFile&) = delete; LLUniqueFile(const LLUniqueFile&) = delete;
// move construction // move construction
LLUniqueFile(LLUniqueFile&& other) LLUniqueFile(LLUniqueFile&& other) noexcept
{ {
mFileHandle = other.mFileHandle; mFileHandle = other.mFileHandle;
other.mFileHandle = nullptr; other.mFileHandle = nullptr;
@ -118,7 +118,7 @@ public:
// copy assignment deleted // copy assignment deleted
LLUniqueFile& operator=(const LLUniqueFile&) = delete; LLUniqueFile& operator=(const LLUniqueFile&) = delete;
// move assignment // move assignment
LLUniqueFile& operator=(LLUniqueFile&& other) LLUniqueFile& operator=(LLUniqueFile&& other) noexcept
{ {
close(); close();
std::swap(mFileHandle, other.mFileHandle); std::swap(mFileHandle, other.mFileHandle);

View File

@ -157,14 +157,22 @@ canonise_fl(FL_Locale *l) {
if (l->lang && 0 == strcmp(l->lang, "en")) { if (l->lang && 0 == strcmp(l->lang, "en")) {
if (l->country && 0 == strcmp(l->country, "UK")) { if (l->country && 0 == strcmp(l->country, "UK")) {
free((void*)l->country); free((void*)l->country);
#ifdef LL_WINDOWS
l->country = _strdup("GB");
#else
l->country = strdup("GB"); l->country = strdup("GB");
#endif
} }
} }
/* ja_JA -> ja_JP */ /* ja_JA -> ja_JP */
if (l->lang && 0 == strcmp(l->lang, "ja")) { if (l->lang && 0 == strcmp(l->lang, "ja")) {
if (l->country && 0 == strcmp(l->country, "JA")) { if (l->country && 0 == strcmp(l->country, "JA")) {
free((void*)l->country); free((void*)l->country);
#ifdef LL_WINDOWS
l->country = _strdup("JP");
#else
l->country = strdup("JP"); l->country = strdup("JP");
#endif
} }
} }
} }

View File

@ -47,7 +47,7 @@ public:
typedef typename std::vector<Type>::size_type size_type; typedef typename std::vector<Type>::size_type size_type;
protected: protected:
std::vector<Type> mVector; std::vector<Type> mVector;
std::map<Key, U32> mIndexMap; std::map<Key, size_t> mIndexMap;
public: public:
LLIndexedVector() { mVector.reserve(BlockSize); } LLIndexedVector() { mVector.reserve(BlockSize); }
@ -68,10 +68,10 @@ public:
Type& operator[](const Key& k) Type& operator[](const Key& k)
{ {
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); typename std::map<Key, size_t>::const_iterator iter = mIndexMap.find(k);
if (iter == mIndexMap.end()) if (iter == mIndexMap.end())
{ {
U32 n = mVector.size(); auto n = mVector.size();
mIndexMap[k] = n; mIndexMap[k] = n;
mVector.push_back(Type()); mVector.push_back(Type());
llassert(mVector.size() == mIndexMap.size()); llassert(mVector.size() == mIndexMap.size());
@ -85,7 +85,7 @@ public:
const_iterator find(const Key& k) const const_iterator find(const Key& k) const
{ {
typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); typename std::map<Key, size_t>::const_iterator iter = mIndexMap.find(k);
if(iter == mIndexMap.end()) if(iter == mIndexMap.end())
{ {
return mVector.end(); return mVector.end();

View File

@ -233,7 +233,7 @@ public:
LL_DEBUGS("EventHost") << "Sending: " LL_DEBUGS("EventHost") << "Sending: "
<< static_cast<U64>(buffer.tellp()) << ':'; << static_cast<U64>(buffer.tellp()) << ':';
std::string::size_type truncate(80); llssize truncate(80);
if (buffer.tellp() <= truncate) if (buffer.tellp() <= truncate)
{ {
LL_CONT << buffer.str(); LL_CONT << buffer.str();

View File

@ -120,44 +120,20 @@
#endif // LL_WINDOWS #endif // LL_WINDOWS
// Deal with VC6 problems // Deal with VC++ problems
#if LL_MSVC #if LL_MSVC
#pragma warning( 3 : 4701 ) // "local variable used without being initialized" Treat this as level 3, not level 4. #ifndef _CRT_SECURE_NO_WARNINGS
#pragma warning( 3 : 4702 ) // "unreachable code" Treat this as level 3, not level 4. #define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe
#pragma warning( 3 : 4189 ) // "local variable initialized but not referenced" Treat this as level 3, not level 4. #endif
//#pragma warning( 3 : 4018 ) // "signed/unsigned mismatch" Treat this as level 3, not level 4. #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#pragma warning( 3 : 4263 ) // 'function' : member function does not override any base class virtual member function #define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings
#pragma warning( 3 : 4264 ) // "'virtual_function' : no override available for virtual member function from base 'class'; function is hidden"
#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"
#pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden
#pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored
//#pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file
#if ADDRESS_SIZE == 64
// That one is all over the place for x64 builds.
#pragma warning( disable : 4267 ) // 'var' : conversion from 'size_t' to 'type', possible loss of data)
#endif #endif
#pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
#pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
#pragma warning( disable : 4996 ) // warning: deprecated
// Linker optimization with "extern template" generates these warnings
#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation
#pragma warning( disable : 4506 ) // no definition for inline function
// level 4 warnings that we need to disable: // level 4 warnings that we need to disable:
#pragma warning (disable : 4100) // unreferenced formal parameter
#pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) )
#pragma warning (disable : 4244) // possible loss of data on conversions #pragma warning (disable : 4244) // possible loss of data on conversions
#pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template #pragma warning (disable : 4396) // the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
#pragma warning (disable : 4512) // assignment operator could not be generated
#pragma warning (disable : 4706) // assignment within conditional (even if((x = y)) )
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class #pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class #pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
#pragma warning (disable : 4018) // '<' : signed/unsigned mismatch
#endif // LL_MSVC #endif // LL_MSVC
#if LL_WINDOWS #if LL_WINDOWS

View File

@ -210,7 +210,7 @@ void LLQueuedThread::waitOnPending()
// MAIN thread // MAIN thread
void LLQueuedThread::printQueueStats() void LLQueuedThread::printQueueStats()
{ {
U32 size = mRequestQueue.size(); auto size = mRequestQueue.size();
if (size > 0) if (size > 0)
{ {
LL_INFOS() << llformat("Pending Requests:%d ", mRequestQueue.size()) << LL_ENDL; LL_INFOS() << llformat("Pending Requests:%d ", mRequestQueue.size()) << LL_ENDL;

View File

@ -1546,7 +1546,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr,
case LLSD::TypeMap: case LLSD::TypeMap:
{ {
ostr.put('{'); ostr.put('{');
U32 size_nbo = htonl(data.size()); U32 size_nbo = htonl(static_cast<u_long>(data.size()));
ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write((const char*)(&size_nbo), sizeof(U32));
LLSD::map_const_iterator iter = data.beginMap(); LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap(); LLSD::map_const_iterator end = data.endMap();
@ -1563,7 +1563,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr,
case LLSD::TypeArray: case LLSD::TypeArray:
{ {
ostr.put('['); ostr.put('[');
U32 size_nbo = htonl(data.size()); U32 size_nbo = htonl(static_cast<u_long>(data.size()));
ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write((const char*)(&size_nbo), sizeof(U32));
LLSD::array_const_iterator iter = data.beginArray(); LLSD::array_const_iterator iter = data.beginArray();
LLSD::array_const_iterator end = data.endArray(); LLSD::array_const_iterator end = data.endArray();
@ -1630,7 +1630,7 @@ S32 LLSDBinaryFormatter::format_impl(const LLSD& data, std::ostream& ostr,
{ {
ostr.put('b'); ostr.put('b');
const std::vector<U8>& buffer = data.asBinary(); const std::vector<U8>& buffer = data.asBinary();
U32 size_nbo = htonl(buffer.size()); U32 size_nbo = htonl(static_cast<u_long>(buffer.size()));
ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write((const char*)(&size_nbo), sizeof(U32));
if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size()); if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size());
break; break;
@ -1648,7 +1648,7 @@ void LLSDBinaryFormatter::formatString(
const std::string& string, const std::string& string,
std::ostream& ostr) const std::ostream& ostr) const
{ {
U32 size_nbo = htonl(string.size()); U32 size_nbo = htonl(static_cast<u_long>(string.size()));
ostr.write((const char*)(&size_nbo), sizeof(U32)); ostr.write((const char*)(&size_nbo), sizeof(U32));
ostr.write(string.c_str(), string.size()); ostr.write(string.c_str(), string.size());
} }

View File

@ -36,6 +36,10 @@
#include "llthread.h" // on_main_thread() #include "llthread.h" // on_main_thread()
#include "llmainthreadtask.h" #include "llmainthreadtask.h"
#ifdef LL_WINDOWS
#pragma warning( disable : 4506 ) // no definition for inline function
#endif
class LLSingletonBase: private boost::noncopyable class LLSingletonBase: private boost::noncopyable
{ {
public: public:
@ -528,6 +532,7 @@ public:
classname<DERIVED_TYPE>(), classname<DERIVED_TYPE>(),
" -- creating new instance"}); " -- creating new instance"});
// fall through // fall through
[[fallthrough]];
case UNINITIALIZED: case UNINITIALIZED:
case QUEUED: case QUEUED:
// QUEUED means some secondary thread has already requested an // QUEUED means some secondary thread has already requested an

View File

@ -326,7 +326,7 @@ inline bool vector_replace_with_last(std::vector<T>& invec, const T& val)
template <typename T> template <typename T>
inline T* vector_append(std::vector<T>& invec, S32 N) inline T* vector_append(std::vector<T>& invec, S32 N)
{ {
U32 sz = invec.size(); auto sz = invec.size();
invec.resize(sz+N); invec.resize(sz+N);
return &(invec[sz]); return &(invec[sz]);
} }

View File

@ -216,7 +216,7 @@ std::streamsize LLGenericStreamQueue<Ch>::skip(std::streamsize n)
{ {
typename BufferList::iterator bli(mBuffer.begin()), blend(mBuffer.end()); typename BufferList::iterator bli(mBuffer.begin()), blend(mBuffer.end());
std::streamsize toskip(n), skipped(0); std::streamsize toskip(n), skipped(0);
while (bli != blend && toskip >= bli->length()) while (bli != blend && (size_t)toskip >= bli->length())
{ {
std::streamsize chunk(bli->length()); std::streamsize chunk(bli->length());
typename BufferList::iterator zap(bli++); typename BufferList::iterator zap(bli++);

View File

@ -809,7 +809,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned
code_page, code_page,
0, 0,
in, in,
len_in, static_cast<int>(len_in),
NULL, NULL,
0, 0,
0, 0,
@ -824,7 +824,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned
code_page, code_page,
0, 0,
in, in,
len_in, static_cast<int>(len_in),
pout, pout,
len_out, len_out,
0, 0,
@ -851,8 +851,8 @@ std::wstring ll_convert_string_to_wide(const char* in, size_t len, unsigned int
std::vector<wchar_t> w_out(len + 1); std::vector<wchar_t> w_out(len + 1);
memset(&w_out[0], 0, w_out.size()); memset(&w_out[0], 0, w_out.size());
int real_output_str_len = MultiByteToWideChar(code_page, 0, in, len, int real_output_str_len = MultiByteToWideChar(code_page, 0, in, static_cast<int>(len),
&w_out[0], w_out.size() - 1); &w_out[0], static_cast<int>(w_out.size() - 1));
//looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858. //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858.
w_out[real_output_str_len] = 0; w_out[real_output_str_len] = 0;
@ -943,7 +943,7 @@ std::optional<std::wstring> llstring_getoptenv(const std::string& key)
auto wkey = ll_convert_string_to_wide(key); auto wkey = ll_convert_string_to_wide(key);
// Take a wild guess as to how big the buffer should be. // Take a wild guess as to how big the buffer should be.
std::vector<wchar_t> buffer(1024); std::vector<wchar_t> buffer(1024);
auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); auto n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast<DWORD>(buffer.size()));
// If our initial guess was too short, n will indicate the size (in // If our initial guess was too short, n will indicate the size (in
// wchar_t's) that buffer should have been, including the terminating nul. // wchar_t's) that buffer should have been, including the terminating nul.
if (n > (buffer.size() - 1)) if (n > (buffer.size() - 1))
@ -951,7 +951,7 @@ std::optional<std::wstring> llstring_getoptenv(const std::string& key)
// make it big enough // make it big enough
buffer.resize(n); buffer.resize(n);
// and try again // and try again
n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], buffer.size()); n = GetEnvironmentVariableW(wkey.c_str(), &buffer[0], static_cast<DWORD>(buffer.size()));
} }
// did that (ultimately) succeed? // did that (ultimately) succeed?
if (n) if (n)

View File

@ -522,9 +522,9 @@ namespace LLTrace
struct BlockTimerStackRecord struct BlockTimerStackRecord
{ {
class BlockTimer* mActiveTimer; class BlockTimer* mActiveTimer{ nullptr };
class BlockTimerStatHandle* mTimeBlock; class BlockTimerStatHandle* mTimeBlock{ nullptr };
U64 mChildTime; U64 mChildTime{ 0 };
}; };
struct AccumulatorBufferGroup : public LLRefCount struct AccumulatorBufferGroup : public LLRefCount

View File

@ -82,8 +82,6 @@ public:
// to integers, among other things. Use isNull() or notNull(). // to integers, among other things. Use isNull() or notNull().
// operator bool() const; // operator bool() const;
// JC: These must return real bool's (not BOOLs) or else use of the STL
// will generate bool-to-int performance warnings.
bool operator==(const LLUUID &rhs) const; bool operator==(const LLUUID &rhs) const;
bool operator!=(const LLUUID &rhs) const; bool operator!=(const LLUUID &rhs) const;
bool operator<(const LLUUID &rhs) const; bool operator<(const LLUUID &rhs) const;

View File

@ -67,7 +67,7 @@ namespace tut
std::ostringstream resp; std::ostringstream resp;
resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}"; resp << "{'connect':true, 'position':[r128,r128,r128], 'look_at':[r0,r1,r0], 'agent_access':'M', 'region_x':i8192, 'region_y':i8192}";
std::string str = resp.str(); std::string str = resp.str();
LLMemoryStream mstr((U8*)str.c_str(), str.size()); LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size()));
LLSD response; LLSD response;
S32 count = LLSDSerialize::fromNotation(response, mstr, str.size()); S32 count = LLSDSerialize::fromNotation(response, mstr, str.size());
ensure("stream parsed", response.isDefined()); ensure("stream parsed", response.isDefined());
@ -252,7 +252,7 @@ namespace tut
resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }"; resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }";
std::string str = resp.str(); std::string str = resp.str();
LLSD sd; LLSD sd;
LLMemoryStream mstr((U8*)str.c_str(), str.size()); LLMemoryStream mstr((U8*)str.c_str(), static_cast<S32>(str.size()));
S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size()); S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size());
ensure_equals("parse count", count, 5); ensure_equals("parse count", count, 5);
ensure("sd created", sd.isDefined()); ensure("sd created", sd.isDefined());
@ -456,7 +456,7 @@ namespace tut
void mem_object::test<1>() void mem_object::test<1>()
{ {
const char HELLO_WORLD[] = "hello world"; const char HELLO_WORLD[] = "hello world";
LLMemoryStream mem((U8*)&HELLO_WORLD[0], strlen(HELLO_WORLD)); /* Flawfinder: ignore */ LLMemoryStream mem((U8*)&HELLO_WORLD[0], static_cast<S32>(strlen(HELLO_WORLD))); /* Flawfinder: ignore */
std::string hello; std::string hello;
std::string world; std::string world;
mem >> hello >> world; mem >> hello >> world;

View File

@ -491,7 +491,7 @@ namespace tut
// Partial defaults arrays. // Partial defaults arrays.
for (LLSD::String a: ab) for (LLSD::String a: ab)
{ {
LLSD::Integer partition(std::min(partial_offset, dft_array_full[a].size())); LLSD::Integer partition(static_cast<LLSD::Integer>(std::min(partial_offset, dft_array_full[a].size())));
dft_array_partial[a] = dft_array_partial[a] =
llsd_copy_array(dft_array_full[a].beginArray() + partition, llsd_copy_array(dft_array_full[a].beginArray() + partition,
dft_array_full[a].endArray()); dft_array_full[a].endArray());
@ -508,7 +508,7 @@ namespace tut
// (params, dft_array_full). Part of the point of using map-style // (params, dft_array_full). Part of the point of using map-style
// defaults is to allow any subset of the target function's // defaults is to allow any subset of the target function's
// parameters to be optional, not just the rightmost. // parameters to be optional, not just the rightmost.
for (LLSD::Integer ix = 0, ixend = params[a].size(); ix < ixend; ix += 2) for (LLSD::Integer ix = 0, ixend = static_cast<LLSD::Integer>(params[a].size()); ix < ixend; ix += 2)
{ {
dft_map_partial[a][params[a][ix].asString()] = dft_array_full[a][ix]; dft_map_partial[a][params[a][ix].asString()] = dft_array_full[a][ix];
} }
@ -696,7 +696,7 @@ namespace tut
LLSD zipmap(const LLSD& keys, const LLSD& values) LLSD zipmap(const LLSD& keys, const LLSD& values)
{ {
LLSD map; LLSD map;
for (LLSD::Integer i = 0, iend = keys.size(); i < iend; ++i) for (LLSD::Integer i = 0, iend = static_cast<LLSD::Integer>(keys.size()); i < iend; ++i)
{ {
// Have to select asString() since you can index an LLSD // Have to select asString() since you can index an LLSD
// object with either String or Integer. // object with either String or Integer.
@ -955,7 +955,7 @@ namespace tut
allreq[a] = zipmap(params[a], LLSD::emptyArray()); allreq[a] = zipmap(params[a], LLSD::emptyArray());
// Same for leftreq, save that we use the subset of the params not // Same for leftreq, save that we use the subset of the params not
// supplied by dft_array_partial[a]. // supplied by dft_array_partial[a].
LLSD::Integer partition(params[a].size() - dft_array_partial[a].size()); LLSD::Integer partition(static_cast<LLSD::Integer>(params[a].size() - dft_array_partial[a].size()));
leftreq[a] = zipmap(llsd_copy_array(params[a].beginArray(), leftreq[a] = zipmap(llsd_copy_array(params[a].beginArray(),
params[a].beginArray() + partition), params[a].beginArray() + partition),
LLSD::emptyArray()); LLSD::emptyArray());

View File

@ -701,7 +701,7 @@ namespace tut
"<key>cam</key><real>1.23</real>" "<key>cam</key><real>1.23</real>"
"</map></llsd>", "</map></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
} }
template<> template<> template<> template<>
@ -721,7 +721,7 @@ namespace tut
"<key>cam</key><real>1.23</real>" "<key>cam</key><real>1.23</real>"
"</map></llsd>", "</map></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
v.clear(); v.clear();
v["amy"] = 23; v["amy"] = 23;
@ -734,7 +734,7 @@ namespace tut
"<key>cam</key><real>1.23</real>" "<key>cam</key><real>1.23</real>"
"</map></llsd>", "</map></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
v.clear(); v.clear();
v["amy"] = 23; v["amy"] = 23;
@ -751,7 +751,7 @@ namespace tut
"<key>cam</key><real>1.23</real>" "<key>cam</key><real>1.23</real>"
"</map></llsd>", "</map></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
v.clear(); v.clear();
v[0] = 23; v[0] = 23;
@ -766,7 +766,7 @@ namespace tut
"<real>1.23</real>" "<real>1.23</real>"
"</array></llsd>", "</array></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
v.clear(); v.clear();
v[0] = 23; v[0] = 23;
@ -782,7 +782,7 @@ namespace tut
"<real>1.23</real>" "<real>1.23</real>"
"</array></llsd>", "</array></llsd>",
v, v,
v.size() + 1); static_cast<S32>(v.size()) + 1);
} }
template<> template<> template<> template<>
@ -1405,13 +1405,13 @@ namespace tut
uint32_t size = htonl(1); uint32_t size = htonl(1);
memcpy(&vec[1], &size, sizeof(uint32_t)); memcpy(&vec[1], &size, sizeof(uint32_t));
vec.push_back('k'); vec.push_back('k');
int key_size_loc = vec.size(); auto key_size_loc = vec.size();
size = htonl(1); // 1 too short size = htonl(1); // 1 too short
vec.resize(vec.size() + 4); vec.resize(vec.size() + 4);
memcpy(&vec[key_size_loc], &size, sizeof(uint32_t)); memcpy(&vec[key_size_loc], &size, sizeof(uint32_t));
vec.push_back('a'); vec.push_back('m'); vec.push_back('y'); vec.push_back('a'); vec.push_back('m'); vec.push_back('y');
vec.push_back('i'); vec.push_back('i');
int integer_loc = vec.size(); auto integer_loc = vec.size();
vec.resize(vec.size() + 4); vec.resize(vec.size() + 4);
uint32_t val_int = htonl(23); uint32_t val_int = htonl(23);
memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t));
@ -1473,7 +1473,7 @@ namespace tut
memcpy(&vec[1], &size, sizeof(uint32_t)); memcpy(&vec[1], &size, sizeof(uint32_t));
vec.push_back('"'); vec.push_back('a'); vec.push_back('m'); vec.push_back('"'); vec.push_back('a'); vec.push_back('m');
vec.push_back('y'); vec.push_back('"'); vec.push_back('i'); vec.push_back('y'); vec.push_back('"'); vec.push_back('i');
int integer_loc = vec.size(); auto integer_loc = vec.size();
vec.resize(vec.size() + 4); vec.resize(vec.size() + 4);
uint32_t val_int = htonl(23); uint32_t val_int = htonl(23);
memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t)); memcpy(&vec[integer_loc], &val_int, sizeof(uint32_t));

View File

@ -88,7 +88,7 @@ void HttpLibcurl::shutdown()
if (mMultiHandles) if (mMultiHandles)
{ {
for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class)
{ {
if (mMultiHandles[policy_class]) if (mMultiHandles[policy_class])
{ {
@ -122,7 +122,7 @@ void HttpLibcurl::start(int policy_count)
mActiveHandles = new int [mPolicyCount]; mActiveHandles = new int [mPolicyCount];
mDirtyPolicy = new bool [mPolicyCount]; mDirtyPolicy = new bool [mPolicyCount];
for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class)
{ {
if (NULL == (mMultiHandles[policy_class] = curl_multi_init())) if (NULL == (mMultiHandles[policy_class] = curl_multi_init()))
{ {
@ -148,7 +148,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport()
HttpService::ELoopSpeed ret(HttpService::REQUEST_SLEEP); HttpService::ELoopSpeed ret(HttpService::REQUEST_SLEEP);
// Give libcurl some cycles to do I/O & callbacks // Give libcurl some cycles to do I/O & callbacks
for (int policy_class(0); policy_class < mPolicyCount; ++policy_class) for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class)
{ {
if (! mMultiHandles[policy_class]) if (! mMultiHandles[policy_class])
{ {
@ -442,18 +442,18 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode
int HttpLibcurl::getActiveCount() const int HttpLibcurl::getActiveCount() const
{ {
return mActiveOps.size(); return static_cast<int>(mActiveOps.size());
} }
int HttpLibcurl::getActiveCountInClass(int policy_class) const int HttpLibcurl::getActiveCountInClass(unsigned int policy_class) const
{ {
llassert_always(policy_class < mPolicyCount); llassert_always(policy_class < mPolicyCount);
return mActiveHandles ? mActiveHandles[policy_class] : 0; return mActiveHandles ? mActiveHandles[policy_class] : 0;
} }
void HttpLibcurl::policyUpdated(int policy_class) void HttpLibcurl::policyUpdated(unsigned int policy_class)
{ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
if (policy_class < 0 || policy_class >= mPolicyCount || ! mMultiHandles) if (policy_class < 0 || policy_class >= mPolicyCount || ! mMultiHandles)

View File

@ -107,7 +107,7 @@ public:
/// ///
/// Threading: called by worker thread. /// Threading: called by worker thread.
int getActiveCount() const; int getActiveCount() const;
int getActiveCountInClass(int policy_class) const; int getActiveCountInClass(unsigned int policy_class) const;
/// Attempt to cancel a request identified by handle. /// Attempt to cancel a request identified by handle.
/// ///
@ -124,7 +124,7 @@ public:
/// initialization and dynamic option setting. /// initialization and dynamic option setting.
/// ///
/// Threading: called by worker thread. /// Threading: called by worker thread.
void policyUpdated(int policy_class); void policyUpdated(unsigned int policy_class);
/// Allocate a curl handle for caller. May be freed using /// Allocate a curl handle for caller. May be freed using
/// either the freeHandle() method or calling curl_easy_cleanup() /// either the freeHandle() method or calling curl_easy_cleanup()
@ -211,7 +211,7 @@ protected:
HttpService * mService; // Simple reference, not owner HttpService * mService; // Simple reference, not owner
HandleCache mHandleCache; // Handle allocator, owner HandleCache mHandleCache; // Handle allocator, owner
active_set_t mActiveOps; active_set_t mActiveOps;
int mPolicyCount; unsigned int mPolicyCount;
CURLM ** mMultiHandles; // One handle per policy class CURLM ** mMultiHandles; // One handle per policy class
int * mActiveHandles; // Active count per policy class int * mActiveHandles; // Active count per policy class
bool * mDirtyPolicy; // Dirty policy update waiting for stall (per pc) bool * mDirtyPolicy; // Dirty policy update waiting for stall (per pc)

View File

@ -267,7 +267,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request)
if (mReplyOffset || mReplyLength) if (mReplyOffset || mReplyLength)
{ {
// Got an explicit offset/length in response // Got an explicit offset/length in response
response->setRange(mReplyOffset, mReplyLength, mReplyFullLength); response->setRange(mReplyOffset, static_cast<unsigned int>(mReplyLength), static_cast<unsigned int>(mReplyFullLength));
} }
response->setContentType(mReplyConType); response->setContentType(mReplyConType);
response->setRetries(mPolicyRetries, mPolicy503Retries); response->setRetries(mPolicyRetries, mPolicy503Retries);
@ -328,7 +328,7 @@ HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id,
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
setupCommon(policy_id, url, NULL, options, headers); setupCommon(policy_id, url, NULL, options, headers);
mReqMethod = HOR_GET; mReqMethod = HOR_GET;
mReqOffset = offset; mReqOffset = static_cast<off_t>(offset);
mReqLength = len; mReqLength = len;
if (offset || len) if (offset || len)
{ {
@ -607,7 +607,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
long data_size(0); long data_size(0);
if (mReqBody) if (mReqBody)
{ {
data_size = mReqBody->size(); data_size = static_cast<long>(mReqBody->size());
} }
check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast<void *>(NULL)); check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast<void *>(NULL));
check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDSIZE, data_size); check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDSIZE, data_size);
@ -618,13 +618,14 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
case HOR_PATCH: case HOR_PATCH:
check_curl_easy_setopt(mCurlHandle, CURLOPT_CUSTOMREQUEST, "PATCH"); check_curl_easy_setopt(mCurlHandle, CURLOPT_CUSTOMREQUEST, "PATCH");
// fall through. The rest is the same as PUT // fall through. The rest is the same as PUT
[[fallthrough]];
case HOR_PUT: case HOR_PUT:
{ {
check_curl_easy_setopt(mCurlHandle, CURLOPT_UPLOAD, 1); check_curl_easy_setopt(mCurlHandle, CURLOPT_UPLOAD, 1);
long data_size(0); long data_size(0);
if (mReqBody) if (mReqBody)
{ {
data_size = mReqBody->size(); data_size = static_cast<long>(mReqBody->size());
} }
check_curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size); check_curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size);
mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:");

View File

@ -98,7 +98,7 @@ HttpPolicy::~HttpPolicy()
HttpRequest::policy_t HttpPolicy::createPolicyClass() HttpRequest::policy_t HttpPolicy::createPolicyClass()
{ {
const HttpRequest::policy_t policy_class(mClasses.size()); const HttpRequest::policy_t policy_class(static_cast<HttpRequest::policy_t>(mClasses.size()));
if (policy_class >= HTTP_POLICY_CLASS_LIMIT) if (policy_class >= HTTP_POLICY_CLASS_LIMIT)
{ {
return HttpRequest::INVALID_POLICY_ID; return HttpRequest::INVALID_POLICY_ID;
@ -432,8 +432,8 @@ int HttpPolicy::getReadyCount(HttpRequest::policy_t policy_class) const
{ {
if (policy_class < mClasses.size()) if (policy_class < mClasses.size())
{ {
return (mClasses[policy_class]->mReadyQueue.size() return static_cast<int>((mClasses[policy_class]->mReadyQueue.size()
+ mClasses[policy_class]->mRetryQueue.size()); + mClasses[policy_class]->mRetryQueue.size()));
} }
return 0; return 0;
} }

View File

@ -24,6 +24,8 @@
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
#include "linden_common.h"
#include <iostream> #include <iostream>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
@ -33,8 +35,6 @@
#include <pthread.h> #include <pthread.h>
#endif #endif
#include "linden_common.h"
#include "httpcommon.h" #include "httpcommon.h"
#include "httprequest.h" #include "httprequest.h"
#include "httphandler.h" #include "httphandler.h"
@ -519,7 +519,7 @@ void WorkingSet::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * r
{ {
// More success // More success
LLCore::BufferArray * data(response->getBody()); LLCore::BufferArray * data(response->getBody());
mByteCount += data ? data->size() : 0; mByteCount += data ? static_cast<long>(data->size()) : 0L;
++mSuccesses; ++mSuccesses;
} }
else else
@ -602,7 +602,7 @@ void WorkingSet::loadAssetUuids(FILE * in)
mAssets.push_back(asset); mAssets.push_back(asset);
} }
} }
mRemaining = mLimit = mAssets.size(); mRemaining = mLimit = static_cast<int>(mAssets.size());
} }

View File

@ -131,7 +131,7 @@ std::string getStartupStateFromLog(std::string& sllog)
std::string startup_state = "STATE_FIRST"; std::string startup_state = "STATE_FIRST";
std::string startup_token = "Startup state changing from "; std::string startup_token = "Startup state changing from ";
int index = sllog.rfind(startup_token); auto index = sllog.rfind(startup_token);
if (index < 0 || index + startup_token.length() > sllog.length()) { if (index < 0 || index + startup_token.length() > sllog.length()) {
return startup_state; return startup_state;
} }

View File

@ -638,7 +638,7 @@ std::string LLDir::getBaseFileName(const std::string& filepath, bool strip_exten
std::string LLDir::getDirName(const std::string& filepath) const std::string LLDir::getDirName(const std::string& filepath) const
{ {
std::size_t offset = filepath.find_last_of(getDirDelimiter()); std::size_t offset = filepath.find_last_of(getDirDelimiter());
S32 len = (offset == std::string::npos) ? 0 : offset; auto len = (offset == std::string::npos) ? 0 : offset;
std::string dirname = filepath.substr(0, len); std::string dirname = filepath.substr(0, len);
return dirname; return dirname;
} }
@ -883,8 +883,8 @@ std::string LLDir::getScrubbedFileName(const std::string uncleanFileName)
// replace any illegal file chars with and underscore '_' // replace any illegal file chars with and underscore '_'
for( unsigned int i = 0; i < illegalChars.length(); i++ ) for( unsigned int i = 0; i < illegalChars.length(); i++ )
{ {
int j = -1; std::string::size_type j = -1;
while((j = name.find(illegalChars[i])) > -1) while((j = name.find(illegalChars[i])) > std::string::npos)
{ {
name[j] = '_'; name[j] = '_';
} }

View File

@ -233,7 +233,7 @@ LLDir_Win32::LLDir_Win32()
{ {
w_str[size] = '\0'; w_str[size] = '\0';
mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str)); mExecutablePathAndName = utf16str_to_utf8str(llutf16string(w_str));
S32 path_end = mExecutablePathAndName.find_last_of('\\'); auto path_end = mExecutablePathAndName.find_last_of('\\');
if (path_end != std::string::npos) if (path_end != std::string::npos)
{ {
mExecutableDir = mExecutablePathAndName.substr(0, path_end); mExecutableDir = mExecutablePathAndName.substr(0, path_end);

View File

@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded)
//static //static
S32 LLLFSThread::updateClass(U32 ms_elapsed) S32 LLLFSThread::updateClass(U32 ms_elapsed)
{ {
return sLocal->update((F32)ms_elapsed); return static_cast<S32>(sLocal->update((F32)ms_elapsed));
} }
//static //static

View File

@ -476,7 +476,7 @@ bool LLImageDXT::convertToDXR()
// virtual // virtual
S32 LLImageDXT::calcHeaderSize() S32 LLImageDXT::calcHeaderSize()
{ {
return llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t)); return static_cast<S32>(llmax(sizeof(dxtfile_header_old_t), sizeof(dxtfile_header_t)));
} }
// virtual // virtual

View File

@ -781,9 +781,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha)
// Compute min and max counts minus tail // Compute min and max counts minus tail
tail = llclampf(tail); tail = llclampf(tail);
S32 total = cumulated_histo[255]; U32 total = cumulated_histo[255];
S32 min_c = (S32)((F32)(total) * tail); U32 min_c = (U32)((F32)(total) * tail);
S32 max_c = (S32)((F32)(total) * (1.0 - tail)); U32 max_c = (U32)((F32)(total) * (1.0 - tail));
// Find min and max values // Find min and max values
S32 min_v = 0; S32 min_v = 0;
@ -798,9 +798,9 @@ void LLImageFilter::filterLinearize(F32 tail, const LLColor3& alpha)
} }
// Compute linear lookup table // Compute linear lookup table
U8 linear_red_lut[256]; U8 linear_red_lut[256]{};
U8 linear_green_lut[256]; U8 linear_green_lut[256]{};
U8 linear_blue_lut[256]; U8 linear_blue_lut[256]{};
if (max_v == min_v) if (max_v == min_v)
{ {
// Degenerated binary split case // Degenerated binary split case
@ -850,16 +850,16 @@ void LLImageFilter::filterEqualize(S32 nb_classes, const LLColor3& alpha)
} }
// Compute deltas // Compute deltas
S32 total = cumulated_histo[255]; U32 total = cumulated_histo[255];
S32 delta_count = total / nb_classes; U32 delta_count = total / nb_classes;
S32 current_count = delta_count; U32 current_count = delta_count;
S32 delta_value = 256 / (nb_classes - 1); U32 delta_value = 256 / (nb_classes - 1);
S32 current_value = 0; U32 current_value = 0;
// Compute equalized lookup table // Compute equalized lookup table
U8 equalize_red_lut[256]; U8 equalize_red_lut[256]{};
U8 equalize_green_lut[256]; U8 equalize_green_lut[256]{};
U8 equalize_blue_lut[256]; U8 equalize_blue_lut[256]{};
for (S32 i = 0; i < 256; i++) for (S32 i = 0; i < 256; i++)
{ {
// Blend in current_value with alpha values // Blend in current_value with alpha values

View File

@ -467,7 +467,7 @@ bool LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaqu
S32 pixels = getWidth() * getHeight(); S32 pixels = getWidth() * getHeight();
if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset) if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - (S32)mDataOffset)
{ //here we have situation when data size in src less than actually needed { //here we have situation when data size in src less than actually needed
return false; return false;
} }
@ -1179,7 +1179,7 @@ bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight
// Reads a .tga file and creates an LLImageTGA with its data. // Reads a .tga file and creates an LLImageTGA with its data.
bool LLImageTGA::loadFile( const std::string& path ) bool LLImageTGA::loadFile( const std::string& path )
{ {
S32 len = path.size(); auto len = path.size();
if( len < 5 ) if( len < 5 )
{ {
return false; return false;
@ -1206,7 +1206,7 @@ bool LLImageTGA::loadFile( const std::string& path )
} }
U8* buffer = allocateData(file_size); U8* buffer = allocateData(file_size);
S32 bytes_read = fread(buffer, 1, file_size, file); S32 bytes_read = static_cast<S32>(fread(buffer, 1, file_size, file));
if( bytes_read != file_size ) if( bytes_read != file_size )
{ {
deleteData(); deleteData();

View File

@ -328,10 +328,10 @@ bool LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSiz
mWriteInfoPtr = png_create_info_struct(mWritePngPtr); mWriteInfoPtr = png_create_info_struct(mWritePngPtr);
// Setup write function // Setup write function
PngDataInfo dataPtr; PngDataInfo dataPtr{};
dataPtr.mData = dest; dataPtr.mData = dest;
dataPtr.mOffset = 0; dataPtr.mOffset = 0;
dataPtr.mDataSize = destSize; dataPtr.mDataSize = static_cast<S32>(destSize);
png_set_write_fn(mWritePngPtr, &dataPtr, &writeDataCallback, &writeFlush); png_set_write_fn(mWritePngPtr, &dataPtr, &writeDataCallback, &writeFlush);
// Setup image params // Setup image params

View File

@ -172,7 +172,7 @@ static OPJ_OFF_T opj_skip(OPJ_OFF_T bytes, void* user_data)
JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data); JPEG2KBase* jpeg_codec = static_cast<JPEG2KBase*>(user_data);
jpeg_codec->offset += bytes; jpeg_codec->offset += bytes;
if (jpeg_codec->offset > jpeg_codec->size) if (jpeg_codec->offset > (OPJ_OFF_T)jpeg_codec->size)
{ {
jpeg_codec->offset = jpeg_codec->size; jpeg_codec->offset = jpeg_codec->size;
// Indicate end of stream // Indicate end of stream
@ -793,7 +793,7 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
S32 offset = dest; S32 offset = dest;
for (S32 y = (height - 1); y >= 0; y--) for (S32 y = (height - 1); y >= 0; y--)
{ {
for (S32 x = 0; x < width; x++) for (U32 x = 0; x < width; x++)
{ {
rawp[offset] = image->comps[comp].data[y*comp_width + x]; rawp[offset] = image->comps[comp].data[y*comp_width + x];
offset += channels; offset += channels;

View File

@ -111,10 +111,10 @@ const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0);
const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset)
const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours
const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const U32 LLSettingsDay::TRACK_WATER(0); // water track is 0
const S32 LLSettingsDay::TRACK_GROUND_LEVEL(1); const U32 LLSettingsDay::TRACK_GROUND_LEVEL(1);
const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const U32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water
const S32 LLSettingsDay::FRAME_MAX(56); const U32 LLSettingsDay::FRAME_MAX(56);
const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f);
@ -462,7 +462,7 @@ namespace
// Trim extra tracks. // Trim extra tracks.
while (value.size() > LLSettingsDay::TRACK_MAX) while (value.size() > LLSettingsDay::TRACK_MAX)
{ {
value.erase(value.size() - 1); value.erase(static_cast<LLSD::Integer>(value.size()) - 1);
} }
S32 framecount(0); S32 framecount(0);
@ -511,7 +511,7 @@ namespace
} }
int waterTracks = value[0].size(); int waterTracks = static_cast<int>(value[0].size());
int skyTracks = framecount - waterTracks; int skyTracks = framecount - waterTracks;
if (waterTracks < 1) if (waterTracks < 1)

View File

@ -59,10 +59,10 @@ public:
static const Seconds DEFAULT_DAYOFFSET; static const Seconds DEFAULT_DAYOFFSET;
static const Seconds MAXIMUM_DAYOFFSET; static const Seconds MAXIMUM_DAYOFFSET;
static const S32 TRACK_WATER; static const U32 TRACK_WATER;
static const S32 TRACK_GROUND_LEVEL; static const U32 TRACK_GROUND_LEVEL;
static const S32 TRACK_MAX; static const U32 TRACK_MAX;
static const S32 FRAME_MAX; static const U32 FRAME_MAX;
static const F32 DEFAULT_FRAME_SLOP_FACTOR; static const F32 DEFAULT_FRAME_SLOP_FACTOR;

View File

@ -453,7 +453,7 @@ public:
S32 i = data->getBinIndex(); S32 i = data->getBinIndex();
if (i >= 0 && i < getElementCount()) if (i >= 0 && i < (S32)getElementCount())
{ {
if (mData[i] == data) if (mData[i] == data)
{ //found it { //found it

View File

@ -60,7 +60,7 @@ public:
inline operator bool() const { return static_cast<const bool&>(m_bool); } inline operator bool() const { return static_cast<const bool&>(m_bool); }
private: private:
int m_bool; int m_bool{ 0 };
}; };
#if LL_WINDOWS #if LL_WINDOWS
@ -118,7 +118,7 @@ public:
} }
private: private:
LLQuad mQ; LLQuad mQ{};
}; };
#endif //LL_SIMD_TYPES_H #endif //LL_SIMD_TYPES_H

View File

@ -185,7 +185,7 @@ LLSphere LLSphere::getBoundingSphere(const std::vector<LLSphere>& sphere_list)
// TODO -- improve the accuracy for small collections of spheres // TODO -- improve the accuracy for small collections of spheres
LLSphere bounding_sphere( LLVector3(0.f, 0.f, 0.f), 0.f ); LLSphere bounding_sphere( LLVector3(0.f, 0.f, 0.f), 0.f );
S32 sphere_count = sphere_list.size(); auto sphere_count = sphere_list.size();
if (1 == sphere_count) if (1 == sphere_count)
{ {
// trivial case -- single sphere // trivial case -- single sphere

View File

@ -57,7 +57,7 @@ public:
virtual bool remove(T* data); virtual bool remove(T* data);
virtual void notifyRemoval(T* data); virtual void notifyRemoval(T* data);
virtual U32 hasListeners() const { return !mListeners.empty(); } virtual U32 hasListeners() const { return !mListeners.empty(); }
virtual U32 getListenerCount() const { return mListeners.size(); } virtual U32 getListenerCount() const { return static_cast<U32>(mListeners.size()); }
virtual LLTreeListener<T>* getListener(U32 index) const virtual LLTreeListener<T>* getListener(U32 index) const
{ {
if (index < mListeners.size()) if (index < mListeners.size())

View File

@ -365,7 +365,7 @@ public:
inline operator LLQuad() const; inline operator LLQuad() const;
private: private:
LLQuad mQ; LLQuad mQ{};
}; };
inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p) inline void update_min_max(LLVector4a& min, LLVector4a& max, const LLVector4a& p)

View File

@ -120,7 +120,7 @@ public:
private: private:
LLQuad mQ; LLQuad mQ{};
}; };
#endif //LL_VECTOR4ALOGICAL_H #endif //LL_VECTOR4ALOGICAL_H

View File

@ -2320,7 +2320,7 @@ bool LLVolume::unpackVolumeFaces(U8* in_data, S32 size)
bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl) bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
{ {
{ {
U32 face_count = mdl.size(); auto face_count = mdl.size();
if (face_count == 0) if (face_count == 0)
{ //no faces unpacked, treat as failed decode { //no faces unpacked, treat as failed decode
@ -2352,7 +2352,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
LLSD::Binary idx = mdl[i]["TriangleList"]; LLSD::Binary idx = mdl[i]["TriangleList"];
//copy out indices //copy out indices
S32 num_indices = idx.size() / 2; auto num_indices = idx.size() / 2;
const S32 indices_to_discard = num_indices % 3; const S32 indices_to_discard = num_indices % 3;
if (indices_to_discard > 0) if (indices_to_discard > 0)
{ {
@ -2360,7 +2360,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
LL_WARNS() << "Incomplete triangle discarded from face! Indices count " << num_indices << " was not divisible by 3. face index: " << i << " Total: " << face_count << LL_ENDL; LL_WARNS() << "Incomplete triangle discarded from face! Indices count " << num_indices << " was not divisible by 3. face index: " << i << " Total: " << face_count << LL_ENDL;
num_indices -= indices_to_discard; num_indices -= indices_to_discard;
} }
face.resizeIndices(num_indices); face.resizeIndices(static_cast<S32>(num_indices));
if (num_indices > 2 && !face.mIndices) if (num_indices > 2 && !face.mIndices)
{ {
@ -2381,7 +2381,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
} }
//copy out vertices //copy out vertices
U32 num_verts = pos.size()/(3*2); U32 num_verts = static_cast<U32>(pos.size())/(3*2);
face.resizeVertices(num_verts); face.resizeVertices(num_verts);
if (num_verts > 0 && !face.mPositions) if (num_verts > 0 && !face.mPositions)
@ -2645,7 +2645,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
if (do_reverse_triangles) if (do_reverse_triangles)
{ {
for (U32 j = 0; j < face.mNumIndices; j += 3) for (S32 j = 0; j < face.mNumIndices; j += 3)
{ {
// swap the 2nd and 3rd index // swap the 2nd and 3rd index
S32 swap = face.mIndices[j+1]; S32 swap = face.mIndices[j+1];
@ -2682,7 +2682,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
min_tc = face.mTexCoords[0]; min_tc = face.mTexCoords[0];
max_tc = face.mTexCoords[0]; max_tc = face.mTexCoords[0];
for (U32 j = 1; j < face.mNumVertices; ++j) for (S32 j = 1; j < face.mNumVertices; ++j)
{ {
update_min_max(min_tc, max_tc, face.mTexCoords[j]); update_min_max(min_tc, max_tc, face.mTexCoords[j]);
} }
@ -3778,7 +3778,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
LLVector4a* v = (LLVector4a*)face.mPositions; LLVector4a* v = (LLVector4a*)face.mPositions;
LLVector4a* n = (LLVector4a*)face.mNormals; LLVector4a* n = (LLVector4a*)face.mNormals;
for (U32 j = 0; j < face.mNumIndices / 3; j++) for (S32 j = 0; j < face.mNumIndices / 3; j++)
{ {
for (S32 k = 0; k < 3; k++) for (S32 k = 0; k < 3; k++)
{ {
@ -3904,7 +3904,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
LLVector4a* v = (LLVector4a*) face.mPositions; LLVector4a* v = (LLVector4a*) face.mPositions;
LLVector4a* n = (LLVector4a*) face.mNormals; LLVector4a* n = (LLVector4a*) face.mNormals;
for (U32 j = 0; j < face.mNumIndices/3; j++) for (S32 j = 0; j < face.mNumIndices/3; j++)
{ {
//approximate normal //approximate normal
S32 v1 = face.mIndices[j*3+0]; S32 v1 = face.mIndices[j*3+0];
@ -3941,7 +3941,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
} }
//for each triangle //for each triangle
for (U32 j = 0; j < face.mNumIndices/3; j++) for (S32 j = 0; j < face.mNumIndices/3; j++)
{ {
if (fFacing[j] == (AWAY | TOWARDS)) if (fFacing[j] == (AWAY | TOWARDS))
{ //this is a degenerate triangle { //this is a degenerate triangle
@ -4943,13 +4943,13 @@ void LLVolumeFace::remap()
{ {
// Generate a remap buffer // Generate a remap buffer
std::vector<unsigned int> remap(mNumVertices); std::vector<unsigned int> remap(mNumVertices);
S32 remap_vertices_count = LLMeshOptimizer::generateRemapMultiU16(&remap[0], S32 remap_vertices_count = static_cast<S32>(LLMeshOptimizer::generateRemapMultiU16(&remap[0],
mIndices, mIndices,
mNumIndices, mNumIndices,
mPositions, mPositions,
mNormals, mNormals,
mTexCoords, mTexCoords,
mNumVertices); mNumVertices));
// Allocate new buffers // Allocate new buffers
S32 size = ((mNumIndices * sizeof(U16)) + 0xF) & ~0xF; S32 size = ((mNumIndices * sizeof(U16)) + 0xF) & ~0xF;
@ -4994,7 +4994,7 @@ void LLVolumeFace::optimize(F32 angle_cutoff)
range.setSub(mExtents[1],mExtents[0]); range.setSub(mExtents[1],mExtents[0]);
//remove redundant vertices //remove redundant vertices
for (U32 i = 0; i < mNumIndices; ++i) for (S32 i = 0; i < mNumIndices; ++i)
{ {
U16 index = mIndices[i]; U16 index = mIndices[i];
@ -5380,7 +5380,7 @@ struct MikktData
LLVector3 inv_scale(1.f / face->mNormalizedScale.mV[0], 1.f / face->mNormalizedScale.mV[1], 1.f / face->mNormalizedScale.mV[2]); LLVector3 inv_scale(1.f / face->mNormalizedScale.mV[0], 1.f / face->mNormalizedScale.mV[1], 1.f / face->mNormalizedScale.mV[2]);
for (int i = 0; i < face->mNumIndices; ++i) for (S32 i = 0; i < face->mNumIndices; ++i)
{ {
U32 idx = face->mIndices[i]; U32 idx = face->mIndices[i];
@ -5391,17 +5391,6 @@ struct MikktData
n[i].normalize(); n[i].normalize();
tc[i].set(face->mTexCoords[idx]); tc[i].set(face->mTexCoords[idx]);
if (idx >= face->mNumVertices)
{
// invalid index
// replace with a valid index to avoid crashes
idx = face->mNumVertices - 1;
face->mIndices[i] = idx;
// Needs better logging
LL_DEBUGS_ONCE("LLVOLUME") << "Invalid index, substituting" << LL_ENDL;
}
if (face->mWeights) if (face->mWeights)
{ {
w[i].set(face->mWeights[idx].getF32ptr()); w[i].set(face->mWeights[idx].getF32ptr());
@ -5473,7 +5462,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
U32 stream_count = data.w.empty() ? 4 : 5; U32 stream_count = data.w.empty() ? 4 : 5;
size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count); S32 vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
if (vert_count < 65535 && vert_count != 0) if (vert_count < 65535 && vert_count != 0)
{ {
@ -5487,11 +5476,11 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
allocateTangents(mNumVertices); allocateTangents(mNumVertices);
for (int i = 0; i < mNumIndices; ++i) for (S32 i = 0; i < mNumIndices; ++i)
{ {
U32 src_idx = i; U32 src_idx = i;
U32 dst_idx = remap[i]; U32 dst_idx = remap[i];
if (dst_idx >= mNumVertices) if (dst_idx >= (U32)mNumVertices)
{ {
dst_idx = mNumVertices - 1; dst_idx = mNumVertices - 1;
// Shouldn't happen, figure out what gets returned in remap and why. // Shouldn't happen, figure out what gets returned in remap and why.
@ -5518,7 +5507,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
scale.load3(mNormalizedScale.mV); scale.load3(mNormalizedScale.mV);
scale.getF32ptr()[3] = 1.f; scale.getF32ptr()[3] = 1.f;
for (int i = 0; i < mNumVertices; ++i) for (S32 i = 0; i < mNumVertices; ++i)
{ {
mPositions[i].mul(inv_scale); mPositions[i].mul(inv_scale);
mNormals[i].mul(scale); mNormals[i].mul(scale);
@ -6373,7 +6362,7 @@ void LLVolumeFace::createTangents()
LLCalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices / 3, mIndices, mTangents); LLCalculateTangentArray(mNumVertices, mPositions, mNormals, mTexCoords, mNumIndices / 3, mIndices, mTangents);
//normalize normals //normalize normals
for (U32 i = 0; i < mNumVertices; i++) for (S32 i = 0; i < mNumVertices; i++)
{ {
//bump map/planar projection code requires normals to be normalized //bump map/planar projection code requires normals to be normalized
mNormals[i].normalize3fast(); mNormals[i].normalize3fast();
@ -6549,8 +6538,8 @@ void LLVolumeFace::pushIndex(const U16& idx)
void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, std::vector<U16>& idx) void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v, std::vector<U16>& idx)
{ {
resizeVertices(v.size()); resizeVertices(static_cast<S32>(v.size()));
resizeIndices(idx.size()); resizeIndices(static_cast<S32>(idx.size()));
for (U32 i = 0; i < v.size(); ++i) for (U32 i = 0; i < v.size(); ++i)
{ {
@ -6645,7 +6634,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
{ {
// Get s value for tex-coord. // Get s value for tex-coord.
S32 index = mBeginS + s; S32 index = mBeginS + s;
if (index >= profile.size()) if (index >= (S32)profile.size())
{ {
// edge? // edge?
ss = flat ? 1.f - begin_stex : 1.f; ss = flat ? 1.f - begin_stex : 1.f;

View File

@ -1022,7 +1022,7 @@ public:
U8 getProfileType() const { return mParams.getProfileParams().getCurveType(); } U8 getProfileType() const { return mParams.getProfileParams().getCurveType(); }
U8 getPathType() const { return mParams.getPathParams().getCurveType(); } U8 getPathType() const { return mParams.getPathParams().getCurveType(); }
S32 getNumFaces() const; S32 getNumFaces() const;
S32 getNumVolumeFaces() const { return mVolumeFaces.size(); } S32 getNumVolumeFaces() const { return static_cast<S32>(mVolumeFaces.size()); }
F32 getDetail() const { return mDetail; } F32 getDetail() const { return mDetail; }
F32 getSurfaceArea() const { return mSurfaceArea; } F32 getSurfaceArea() const { return mSurfaceArea; }
const LLVolumeParams& getParams() const { return mParams; } const LLVolumeParams& getParams() const { return mParams; }

View File

@ -113,7 +113,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle,
if (LLLineSegmentBoxIntersect(mStart, mEnd, vl->mBounds[0], vl->mBounds[1])) if (LLLineSegmentBoxIntersect(mStart, mEnd, vl->mBounds[0], vl->mBounds[1]))
{ {
node->accept(this); node->accept(this);
for (S32 i = 0; i < node->getChildCount(); ++i) for (U32 i = 0; i < node->getChildCount(); ++i)
{ {
traverse(node->getChild(i)); traverse(node->getChild(i));
} }

View File

@ -49,23 +49,23 @@ namespace tut
void v4color_object::test<1>() void v4color_object::test<1>()
{ {
LLColor4 llcolor4; LLColor4 llcolor4;
ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); ensure("1:LLColor4:Fail to initialize ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF; F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF;
LLColor4 llcolor4a(r,g,b); LLColor4 llcolor4a(r,g,b);
ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VX]) && (g == llcolor4a.mV[VY]) && (b == llcolor4a.mV[VZ])&& (1.0f == llcolor4a.mV[VW]))); ensure("2:LLColor4:Fail to initialize ", ((r == llcolor4a.mV[VRED]) && (g == llcolor4a.mV[VGREEN]) && (b == llcolor4a.mV[VBLUE])&& (1.0f == llcolor4a.mV[VALPHA])));
LLColor4 llcolor4b(r,g,b,a); LLColor4 llcolor4b(r,g,b,a);
ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VX]) && (g == llcolor4b.mV[VY]) && (b == llcolor4b.mV[VZ])&& (a == llcolor4b.mV[VW]))); ensure("3:LLColor4:Fail to initialize ", ((r == llcolor4b.mV[VRED]) && (g == llcolor4b.mV[VGREEN]) && (b == llcolor4b.mV[VBLUE])&& (a == llcolor4b.mV[VALPHA])));
const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f}; const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f};
LLColor4 llcolor4c(vec); LLColor4 llcolor4c(vec);
ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW]))); ensure("4:LLColor4:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA])));
LLColor3 llcolor3(-2.23f,1.01f,42.3f); LLColor3 llcolor3(-2.23f,1.01f,42.3f);
F32 val = -.1f; F32 val = -.1f;
LLColor4 llcolor4d(llcolor3,val); LLColor4 llcolor4d(llcolor3,val);
ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VX] == llcolor4d.mV[VX]) && (llcolor3.mV[VY] == llcolor4d.mV[VY]) && (llcolor3.mV[VZ] == llcolor4d.mV[VZ])&& (val == llcolor4d.mV[VW]))); ensure("5:LLColor4:Fail to initialize ", ((llcolor3.mV[VRED] == llcolor4d.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4d.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4d.mV[VBLUE])&& (val == llcolor4d.mV[VALPHA])));
LLSD sd = llcolor4d.getValue(); LLSD sd = llcolor4d.getValue();
LLColor4 llcolor4e(sd); LLColor4 llcolor4e(sd);
@ -76,7 +76,7 @@ namespace tut
LLColor4 llcolor4g(color4u); LLColor4 llcolor4g(color4u);
const F32 SCALE = 1.f/255.f; const F32 SCALE = 1.f/255.f;
F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE; F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE;
ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VX]) && (g2 == llcolor4g.mV[VY]) && (b2 == llcolor4g.mV[VZ]))); ensure("7:LLColor4:Fail to initialize ", ((r2 == llcolor4g.mV[VRED]) && (g2 == llcolor4g.mV[VGREEN]) && (b2 == llcolor4g.mV[VBLUE])));
} }
template<> template<> template<> template<>
@ -98,10 +98,10 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF,a = 0xAF; F32 r = 0x20, g = 0xFFFF, b = 0xFF,a = 0xAF;
LLColor4 llcolor4(r,g,b,a); LLColor4 llcolor4(r,g,b,a);
llcolor4.setToBlack(); llcolor4.setToBlack();
ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VX]) && (0 == llcolor4.mV[VY]) && (0 == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); ensure("setToBlack:Fail to set the black ", ((0 == llcolor4.mV[VRED]) && (0 == llcolor4.mV[VGREEN]) && (0 == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
llcolor4.setToWhite(); llcolor4.setToWhite();
ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VX]) && (1.f == llcolor4.mV[VY]) && (1.f == llcolor4.mV[VZ])&& (1.0f == llcolor4.mV[VW]))); ensure("setToWhite:Fail to set the white ", ((1.f == llcolor4.mV[VRED]) && (1.f == llcolor4.mV[VGREEN]) && (1.f == llcolor4.mV[VBLUE])&& (1.0f == llcolor4.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -110,10 +110,10 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF; F32 r = 0x20, g = 0xFFFF, b = 0xFF, a = 0xAF;
LLColor4 llcolor4; LLColor4 llcolor4;
llcolor4.setVec(r,g,b); llcolor4.setVec(r,g,b);
ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (1.f == llcolor4.mV[VW]))); ensure("1:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (1.f == llcolor4.mV[VALPHA])));
llcolor4.setVec(r,g,b,a); llcolor4.setVec(r,g,b,a);
ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VX]) && (g == llcolor4.mV[VY]) && (b == llcolor4.mV[VZ])&& (a == llcolor4.mV[VW]))); ensure("2:setVec:Fail to set the values ", ((r == llcolor4.mV[VRED]) && (g == llcolor4.mV[VGREEN]) && (b == llcolor4.mV[VBLUE])&& (a == llcolor4.mV[VALPHA])));
LLColor4 llcolor4a; LLColor4 llcolor4a;
llcolor4a.setVec(llcolor4); llcolor4a.setVec(llcolor4);
@ -121,23 +121,23 @@ namespace tut
LLColor3 llcolor3(-2.23f,1.01f,42.3f); LLColor3 llcolor3(-2.23f,1.01f,42.3f);
llcolor4a.setVec(llcolor3); llcolor4a.setVec(llcolor3);
ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ]))); ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE])));
F32 val = -.33f; F32 val = -.33f;
llcolor4a.setVec(llcolor3,val); llcolor4a.setVec(llcolor3,val);
ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VX] == llcolor4a.mV[VX]) && (llcolor3.mV[VY] == llcolor4a.mV[VY]) && (llcolor3.mV[VZ] == llcolor4a.mV[VZ]) && (val == llcolor4a.mV[VW]))); ensure("4:setVec:Fail to set the values ", ((llcolor3.mV[VRED] == llcolor4a.mV[VRED]) && (llcolor3.mV[VGREEN] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[VBLUE] == llcolor4a.mV[VBLUE]) && (val == llcolor4a.mV[VALPHA])));
const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f}; const F32 vec[4] = {.112f ,23.2f, -4.2f, -.0001f};
LLColor4 llcolor4c; LLColor4 llcolor4c;
llcolor4c.setVec(vec); llcolor4c.setVec(vec);
ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VX]) && (vec[1] == llcolor4c.mV[VY]) && (vec[2] == llcolor4c.mV[VZ])&& (vec[3] == llcolor4c.mV[VW]))); ensure("5:setVec:Fail to initialize ", ((vec[0] == llcolor4c.mV[VRED]) && (vec[1] == llcolor4c.mV[VGREEN]) && (vec[2] == llcolor4c.mV[VBLUE])&& (vec[3] == llcolor4c.mV[VALPHA])));
U8 r1 = 0xF2, g1 = 0xFA, b1= 0xBF; U8 r1 = 0xF2, g1 = 0xFA, b1= 0xBF;
LLColor4U color4u(r1,g1,b1); LLColor4U color4u(r1,g1,b1);
llcolor4.setVec(color4u); llcolor4.setVec(color4u);
const F32 SCALE = 1.f/255.f; const F32 SCALE = 1.f/255.f;
F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE; F32 r2 = r1*SCALE, g2 = g1* SCALE, b2 = b1* SCALE;
ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VX]) && (g2 == llcolor4.mV[VY]) && (b2 == llcolor4.mV[VZ]))); ensure("6:setVec:Fail to initialize ", ((r2 == llcolor4.mV[VRED]) && (g2 == llcolor4.mV[VGREEN]) && (b2 == llcolor4.mV[VBLUE])));
} }
template<> template<> template<> template<>
@ -146,7 +146,7 @@ namespace tut
F32 alpha = 0xAF; F32 alpha = 0xAF;
LLColor4 llcolor4; LLColor4 llcolor4;
llcolor4.setAlpha(alpha); llcolor4.setAlpha(alpha);
ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VW])); ensure("setAlpha:Fail to initialize ", (alpha == llcolor4.mV[VALPHA]));
} }
template<> template<> template<> template<>
@ -209,7 +209,7 @@ namespace tut
LLColor3 llcolor3(r,g,b); LLColor3 llcolor3(r,g,b);
LLColor4 llcolor4a,llcolor4b; LLColor4 llcolor4a,llcolor4b;
llcolor4a = llcolor3; llcolor4a = llcolor3;
ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VX]) && (llcolor3.mV[1] == llcolor4a.mV[VY]) && (llcolor3.mV[2] == llcolor4a.mV[VZ]))); ensure("Operator=:Fail to initialize ", ((llcolor3.mV[0] == llcolor4a.mV[VRED]) && (llcolor3.mV[1] == llcolor4a.mV[VGREEN]) && (llcolor3.mV[2] == llcolor4a.mV[VBLUE])));
LLSD sd = llcolor4a.getValue(); LLSD sd = llcolor4a.getValue();
llcolor4b = LLColor4(sd); llcolor4b = LLColor4(sd);
ensure_equals("Operator= LLSD:Fail ", llcolor4a, llcolor4b); ensure_equals("Operator= LLSD:Fail ", llcolor4a, llcolor4b);
@ -234,10 +234,10 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4b + llcolor4a; llcolor4c = llcolor4b + llcolor4a;
ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VX]) && is_approx_equal(g1+g2,llcolor4c.mV[VY]) && is_approx_equal(b1+b2,llcolor4c.mV[VZ]))); ensure("operator+:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4c.mV[VRED]) && is_approx_equal(g1+g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4c.mV[VBLUE])));
llcolor4b += llcolor4a; llcolor4b += llcolor4a;
ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VX]) && is_approx_equal(g1+g2,llcolor4b.mV[VY]) && is_approx_equal(b1+b2,llcolor4b.mV[VZ]))); ensure("operator+=:Fail to Add the values ", (is_approx_equal(r1+r2,llcolor4b.mV[VRED]) && is_approx_equal(g1+g2,llcolor4b.mV[VGREEN]) && is_approx_equal(b1+b2,llcolor4b.mV[VBLUE])));
} }
template<> template<> template<> template<>
@ -247,10 +247,10 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4a - llcolor4b; llcolor4c = llcolor4a - llcolor4b;
ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VX]) && is_approx_equal(g1-g2,llcolor4c.mV[VY]) && is_approx_equal(b1-b2,llcolor4c.mV[VZ]))); ensure("operator-:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4c.mV[VRED]) && is_approx_equal(g1-g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4c.mV[VBLUE])));
llcolor4a -= llcolor4b; llcolor4a -= llcolor4b;
ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VX]) && is_approx_equal(g1-g2,llcolor4a.mV[VY]) && is_approx_equal(b1-b2,llcolor4a.mV[VZ]))); ensure("operator-=:Fail to subtract the values ", (is_approx_equal(r1-r2,llcolor4a.mV[VRED]) && is_approx_equal(g1-g2,llcolor4a.mV[VGREEN]) && is_approx_equal(b1-b2,llcolor4a.mV[VBLUE])));
} }
template<> template<> template<> template<>
@ -260,20 +260,20 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = llcolor4a * llcolor4b; llcolor4c = llcolor4a * llcolor4b;
ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VX]) && is_approx_equal(g1*g2,llcolor4c.mV[VY]) && is_approx_equal(b1*b2,llcolor4c.mV[VZ]))); ensure("1:operator*:Fail to multiply the values", (is_approx_equal(r1*r2,llcolor4c.mV[VRED]) && is_approx_equal(g1*g2,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4c.mV[VBLUE])));
F32 mulVal = 3.33f; F32 mulVal = 3.33f;
llcolor4c = llcolor4a * mulVal; llcolor4c = llcolor4a * mulVal;
ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ]))); ensure("2:operator*:Fail ", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE])));
llcolor4c = mulVal * llcolor4a; llcolor4c = mulVal * llcolor4a;
ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VZ]))); ensure("3:operator*:Fail to multiply the values", (is_approx_equal(r1*mulVal,llcolor4c.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4c.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4c.mV[VBLUE])));
llcolor4a *= mulVal; llcolor4a *= mulVal;
ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VX]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VY]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VZ]))); ensure("4:operator*=:Fail to multiply the values ", (is_approx_equal(r1*mulVal,llcolor4a.mV[VRED]) && is_approx_equal(g1*mulVal,llcolor4a.mV[VGREEN]) && is_approx_equal(b1*mulVal,llcolor4a.mV[VBLUE])));
LLColor4 llcolor4d(r1,g1,b1),llcolor4e(r2,g2,b2); LLColor4 llcolor4d(r1,g1,b1),llcolor4e(r2,g2,b2);
llcolor4e *= llcolor4d; llcolor4e *= llcolor4d;
ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VX]) && is_approx_equal(g1*g2,llcolor4e.mV[VY]) && is_approx_equal(b1*b2,llcolor4e.mV[VZ]))); ensure("5:operator*=:Fail to multiply the values ", (is_approx_equal(r1*r2,llcolor4e.mV[VRED]) && is_approx_equal(g1*g2,llcolor4e.mV[VGREEN]) && is_approx_equal(b1*b2,llcolor4e.mV[VBLUE])));
} }
template<> template<> template<> template<>
@ -283,13 +283,13 @@ namespace tut
F32 div = 12.345f; F32 div = 12.345f;
LLColor4 llcolor4a(r,g,b,a),llcolor4b; LLColor4 llcolor4a(r,g,b,a),llcolor4b;
llcolor4b = llcolor4a % div;//chnage only alpha value nor r,g,b; llcolor4b = llcolor4a % div;//chnage only alpha value nor r,g,b;
ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW]))); ensure("1operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA])));
llcolor4b = div % llcolor4a; llcolor4b = div % llcolor4a;
ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VX]) && is_approx_equal(g,llcolor4b.mV[VY]) && is_approx_equal(b,llcolor4b.mV[VZ])&& is_approx_equal(div*a,llcolor4b.mV[VW]))); ensure("2operator%:Fail ", (is_approx_equal(r,llcolor4b.mV[VRED]) && is_approx_equal(g,llcolor4b.mV[VGREEN]) && is_approx_equal(b,llcolor4b.mV[VBLUE])&& is_approx_equal(div*a,llcolor4b.mV[VALPHA])));
llcolor4a %= div; llcolor4a %= div;
ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VW]))); ensure("operator%=:Fail ", (is_approx_equal(a*div,llcolor4a.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -312,7 +312,7 @@ namespace tut
F32 r = 0x20, g = 0xFFFF, b = 0xFF; F32 r = 0x20, g = 0xFFFF, b = 0xFF;
LLColor4 llcolor4a(r,g,b),llcolor4b; LLColor4 llcolor4a(r,g,b),llcolor4b;
LLColor3 llcolor3 = vec4to3(llcolor4a); LLColor3 llcolor3 = vec4to3(llcolor4a);
ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VX],llcolor4a.mV[VX]) && is_approx_equal(llcolor3.mV[VY],llcolor4a.mV[VY]) && is_approx_equal(llcolor3.mV[VZ],llcolor4a.mV[VZ]))); ensure("vec4to3:Fail to convert vec4 to vec3 ", (is_approx_equal(llcolor3.mV[VRED],llcolor4a.mV[VRED]) && is_approx_equal(llcolor3.mV[VGREEN],llcolor4a.mV[VGREEN]) && is_approx_equal(llcolor3.mV[VBLUE],llcolor4a.mV[VBLUE])));
llcolor4b = vec3to4(llcolor3); llcolor4b = vec3to4(llcolor3);
ensure_equals("vec3to4:Fail to convert vec3 to vec4 ", llcolor4b, llcolor4a); ensure_equals("vec3to4:Fail to convert vec3 to vec4 ", llcolor4b, llcolor4a);
} }
@ -324,7 +324,7 @@ namespace tut
F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF; F32 r2 = 0xABF, g2 = 0xFB, b2 = 0xFFF;
LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c; LLColor4 llcolor4a(r1,g1,b1),llcolor4b(r2,g2,b2),llcolor4c;
llcolor4c = lerp(llcolor4a,llcolor4b,val); llcolor4c = lerp(llcolor4a,llcolor4b,val);
ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VX]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VY]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VZ]))); ensure("lerp:Fail ", (is_approx_equal(r1 + (r2 - r1)* val,llcolor4c.mV[VRED]) && is_approx_equal(g1 + (g2 - g1)* val,llcolor4c.mV[VGREEN]) && is_approx_equal(b1 + (b2 - b1)* val,llcolor4c.mV[VBLUE])));
} }
template<> template<> template<> template<>

View File

@ -48,18 +48,18 @@ namespace tut
void v4coloru_object::test<1>() void v4coloru_object::test<1>()
{ {
LLColor4U llcolor4u; LLColor4U llcolor4u;
ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA])));
U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23;
LLColor4U llcolor4u1(r,g,b); LLColor4U llcolor4u1(r,g,b);
ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VX]) && (g == llcolor4u1.mV[VY]) && (b == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VRED]) && (g == llcolor4u1.mV[VGREEN]) && (b == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA])));
LLColor4U llcolor4u2(r,g,b,a); LLColor4U llcolor4u2(r,g,b,a);
ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VX]) && (g == llcolor4u2.mV[VY]) && (b == llcolor4u2.mV[VZ])&& (a == llcolor4u2.mV[VW]))); ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VRED]) && (g == llcolor4u2.mV[VGREEN]) && (b == llcolor4u2.mV[VBLUE])&& (a == llcolor4u2.mV[VALPHA])));
const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; const U8 vec[4] = {0x12,0xFF,0xAF,0x23};
LLColor4U llcolor4u3(vec); LLColor4U llcolor4u3(vec);
ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VX]) && (vec[1] == llcolor4u3.mV[VY]) && (vec[2] == llcolor4u3.mV[VZ])&& (vec[3] == llcolor4u3.mV[VW]))); ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VRED]) && (vec[1] == llcolor4u3.mV[VGREEN]) && (vec[2] == llcolor4u3.mV[VBLUE])&& (vec[3] == llcolor4u3.mV[VALPHA])));
LLSD sd = llcolor4u3.getValue(); LLSD sd = llcolor4u3.getValue();
LLColor4U llcolor4u4(sd); LLColor4U llcolor4u4(sd);
@ -82,10 +82,10 @@ namespace tut
U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23;
LLColor4U llcolor4u(r,g,b,a); LLColor4U llcolor4u(r,g,b,a);
llcolor4u.setToBlack(); llcolor4u.setToBlack();
ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA])));
llcolor4u.setToWhite(); llcolor4u.setToWhite();
ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VX]) && (255 == llcolor4u.mV[VY]) && (255 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VRED]) && (255 == llcolor4u.mV[VGREEN]) && (255 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -104,11 +104,11 @@ namespace tut
U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23;
LLColor4U llcolor4u; LLColor4U llcolor4u;
llcolor4u.setVec(r,g,b,a); llcolor4u.setVec(r,g,b,a);
ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (a == llcolor4u.mV[VW]))); ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (a == llcolor4u.mV[VALPHA])));
llcolor4u.setToBlack(); llcolor4u.setToBlack();
llcolor4u.setVec(r,g,b); llcolor4u.setVec(r,g,b);
ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA])));
LLColor4U llcolor4u1; LLColor4U llcolor4u1;
llcolor4u1.setVec(llcolor4u); llcolor4u1.setVec(llcolor4u);
@ -117,7 +117,7 @@ namespace tut
const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; const U8 vec[4] = {0x12,0xFF,0xAF,0x23};
LLColor4U llcolor4u2; LLColor4U llcolor4u2;
llcolor4u2.setVec(vec); llcolor4u2.setVec(vec);
ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VX]) && (vec[1] == llcolor4u2.mV[VY]) && (vec[2] == llcolor4u2.mV[VZ])&& (vec[3] == llcolor4u2.mV[VW]))); ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VRED]) && (vec[1] == llcolor4u2.mV[VGREEN]) && (vec[2] == llcolor4u2.mV[VBLUE])&& (vec[3] == llcolor4u2.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -126,7 +126,7 @@ namespace tut
U8 alpha = 0x12; U8 alpha = 0x12;
LLColor4U llcolor4u; LLColor4U llcolor4u;
llcolor4u.setAlpha(alpha); llcolor4u.setAlpha(alpha);
ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VW])); ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VALPHA]));
} }
template<> template<> template<> template<>
@ -159,29 +159,29 @@ namespace tut
llcolor4u3 = llcolor4u1 + llcolor4u2; llcolor4u3 = llcolor4u1 + llcolor4u2;
ensure_equals( ensure_equals(
"1a.operator+:Fail to Add the values ", "1a.operator+:Fail to Add the values ",
llcolor4u3.mV[VX], llcolor4u3.mV[VRED],
(U8)(r1+r2)); (U8)(r1+r2));
ensure_equals( ensure_equals(
"1b.operator+:Fail to Add the values ", "1b.operator+:Fail to Add the values ",
llcolor4u3.mV[VY], llcolor4u3.mV[VGREEN],
(U8)(g1+g2)); (U8)(g1+g2));
ensure_equals( ensure_equals(
"1c.operator+:Fail to Add the values ", "1c.operator+:Fail to Add the values ",
llcolor4u3.mV[VZ], llcolor4u3.mV[VBLUE],
(U8)(b1+b2)); (U8)(b1+b2));
llcolor4u2 += llcolor4u1; llcolor4u2 += llcolor4u1;
ensure_equals( ensure_equals(
"2a.operator+=:Fail to Add the values ", "2a.operator+=:Fail to Add the values ",
llcolor4u2.mV[VX], llcolor4u2.mV[VRED],
(U8)(r1+r2)); (U8)(r1+r2));
ensure_equals( ensure_equals(
"2b.operator+=:Fail to Add the values ", "2b.operator+=:Fail to Add the values ",
llcolor4u2.mV[VY], llcolor4u2.mV[VGREEN],
(U8)(g1+g2)); (U8)(g1+g2));
ensure_equals( ensure_equals(
"2c.operator+=:Fail to Add the values ", "2c.operator+=:Fail to Add the values ",
llcolor4u2.mV[VZ], llcolor4u2.mV[VBLUE],
(U8)(b1+b2)); (U8)(b1+b2));
} }
@ -194,29 +194,29 @@ namespace tut
llcolor4u3 = llcolor4u1 - llcolor4u2; llcolor4u3 = llcolor4u1 - llcolor4u2;
ensure_equals( ensure_equals(
"1a. operator-:Fail to Add the values ", "1a. operator-:Fail to Add the values ",
llcolor4u3.mV[VX], llcolor4u3.mV[VRED],
(U8)(r1-r2)); (U8)(r1-r2));
ensure_equals( ensure_equals(
"1b. operator-:Fail to Add the values ", "1b. operator-:Fail to Add the values ",
llcolor4u3.mV[VY], llcolor4u3.mV[VGREEN],
(U8)(g1-g2)); (U8)(g1-g2));
ensure_equals( ensure_equals(
"1c. operator-:Fail to Add the values ", "1c. operator-:Fail to Add the values ",
llcolor4u3.mV[VZ], llcolor4u3.mV[VBLUE],
(U8)(b1-b2)); (U8)(b1-b2));
llcolor4u1 -= llcolor4u2; llcolor4u1 -= llcolor4u2;
ensure_equals( ensure_equals(
"2a. operator-=:Fail to Add the values ", "2a. operator-=:Fail to Add the values ",
llcolor4u1.mV[VX], llcolor4u1.mV[VRED],
(U8)(r1-r2)); (U8)(r1-r2));
ensure_equals( ensure_equals(
"2b. operator-=:Fail to Add the values ", "2b. operator-=:Fail to Add the values ",
llcolor4u1.mV[VY], llcolor4u1.mV[VGREEN],
(U8)(g1-g2)); (U8)(g1-g2));
ensure_equals( ensure_equals(
"2c. operator-=:Fail to Add the values ", "2c. operator-=:Fail to Add the values ",
llcolor4u1.mV[VZ], llcolor4u1.mV[VBLUE],
(U8)(b1-b2)); (U8)(b1-b2));
} }
@ -229,30 +229,30 @@ namespace tut
llcolor4u3 = llcolor4u1 * llcolor4u2; llcolor4u3 = llcolor4u1 * llcolor4u2;
ensure_equals( ensure_equals(
"1a. operator*:Fail to multiply the values", "1a. operator*:Fail to multiply the values",
llcolor4u3.mV[VX], llcolor4u3.mV[VRED],
(U8)(r1*r2)); (U8)(r1*r2));
ensure_equals( ensure_equals(
"1b. operator*:Fail to multiply the values", "1b. operator*:Fail to multiply the values",
llcolor4u3.mV[VY], llcolor4u3.mV[VGREEN],
(U8)(g1*g2)); (U8)(g1*g2));
ensure_equals( ensure_equals(
"1c. operator*:Fail to multiply the values", "1c. operator*:Fail to multiply the values",
llcolor4u3.mV[VZ], llcolor4u3.mV[VBLUE],
(U8)(b1*b2)); (U8)(b1*b2));
U8 mulVal = 123; U8 mulVal = 123;
llcolor4u1 *= mulVal; llcolor4u1 *= mulVal;
ensure_equals( ensure_equals(
"2a. operator*=:Fail to multiply the values", "2a. operator*=:Fail to multiply the values",
llcolor4u1.mV[VX], llcolor4u1.mV[VRED],
(U8)(r1*mulVal)); (U8)(r1*mulVal));
ensure_equals( ensure_equals(
"2b. operator*=:Fail to multiply the values", "2b. operator*=:Fail to multiply the values",
llcolor4u1.mV[VY], llcolor4u1.mV[VGREEN],
(U8)(g1*mulVal)); (U8)(g1*mulVal));
ensure_equals( ensure_equals(
"2c. operator*=:Fail to multiply the values", "2c. operator*=:Fail to multiply the values",
llcolor4u1.mV[VZ], llcolor4u1.mV[VBLUE],
(U8)(b1*mulVal)); (U8)(b1*mulVal));
} }
@ -274,7 +274,7 @@ namespace tut
LLColor4U llcolor4u(r,g,b,a); LLColor4U llcolor4u(r,g,b,a);
U8 modVal = 45; U8 modVal = 45;
llcolor4u %= modVal; llcolor4u %= modVal;
ensure_equals("operator%=:Fail ", llcolor4u.mV[VW], (U8)(a * modVal)); ensure_equals("operator%=:Fail ", llcolor4u.mV[VALPHA], (U8)(a * modVal));
} }
template<> template<> template<> template<>
@ -284,7 +284,7 @@ namespace tut
LLColor4U llcolor4u1(r,g,b,a); LLColor4U llcolor4u1(r,g,b,a);
std::string color("12, 23, 132, 50"); std::string color("12, 23, 132, 50");
LLColor4U::parseColor4U(color, &llcolor4u1); LLColor4U::parseColor4U(color, &llcolor4u1);
ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VX]) && (23 == llcolor4u1.mV[VY]) && (132 == llcolor4u1.mV[VZ])&& (50 == llcolor4u1.mV[VW]))); ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VRED]) && (23 == llcolor4u1.mV[VGREEN]) && (132 == llcolor4u1.mV[VBLUE])&& (50 == llcolor4u1.mV[VALPHA])));
color = "12, 23, 132"; color = "12, 23, 132";
ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1))); ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1)));
@ -300,8 +300,8 @@ namespace tut
LLColor4U llcolor4u(r,g,b,a),llcolor4u1; LLColor4U llcolor4u(r,g,b,a),llcolor4u1;
const F32 fVal = 3.f; const F32 fVal = 3.f;
llcolor4u1 = llcolor4u.multAll(fVal); llcolor4u1 = llcolor4u.multAll(fVal);
ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VX]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VY] ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VRED]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VGREEN]
&& ((U8)ll_round(b * fVal) == llcolor4u1.mV[VZ])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VW]))); && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VBLUE])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -311,13 +311,13 @@ namespace tut
U8 r2 = 23, g2 = 230, b2 = 124, a2 = 255; U8 r2 = 23, g2 = 230, b2 = 124, a2 = 255;
LLColor4U llcolor4u(r1,g1,b1,a1),llcolor4u1(r2,g2,b2,a2); LLColor4U llcolor4u(r1,g1,b1,a1),llcolor4u1(r2,g2,b2,a2);
llcolor4u1 = llcolor4u1.addClampMax(llcolor4u); llcolor4u1 = llcolor4u1.addClampMax(llcolor4u);
ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VX]) && (255 == llcolor4u1.mV[VY]) && (b1+b2 == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VRED]) && (255 == llcolor4u1.mV[VGREEN]) && (b1+b2 == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA])));
r1 = 132, g1 = 3, b1 = 3, a1 = 2; r1 = 132, g1 = 3, b1 = 3, a1 = 2;
r2 = 123, g2 = 230, b2 = 154, a2 = 25; r2 = 123, g2 = 230, b2 = 154, a2 = 25;
LLColor4U llcolor4u2(r1,g1,b1,a1),llcolor4u3(r2,g2,b2,a2); LLColor4U llcolor4u2(r1,g1,b1,a1),llcolor4u3(r2,g2,b2,a2);
llcolor4u3 = llcolor4u3.addClampMax(llcolor4u2); llcolor4u3 = llcolor4u3.addClampMax(llcolor4u2);
ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VX]) && (g1+g2 == llcolor4u3.mV[VY]) && (b1+b2 == llcolor4u3.mV[VZ])&& (a1+a2 == llcolor4u3.mV[VW]))); ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VRED]) && (g1+g2 == llcolor4u3.mV[VGREEN]) && (b1+b2 == llcolor4u3.mV[VBLUE])&& (a1+a2 == llcolor4u3.mV[VALPHA])));
} }
template<> template<> template<> template<>
@ -331,6 +331,6 @@ namespace tut
F32 color_scale_factor = MAX_COLOR/r; F32 color_scale_factor = MAX_COLOR/r;
S32 r2 = ll_round(r * color_scale_factor); S32 r2 = ll_round(r * color_scale_factor);
S32 g2 = ll_round(g * color_scale_factor); S32 g2 = ll_round(g * color_scale_factor);
ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VX]) && (g2 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VRED]) && (g2 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA])));
} }
} }

View File

@ -63,7 +63,7 @@ const LLColor3& LLColor3::operator=(const LLColor4 &a)
std::ostream& operator<<(std::ostream& s, const LLColor3 &a) std::ostream& operator<<(std::ostream& s, const LLColor3 &a)
{ {
s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << " }"; s << "{ " << a.mV[VRED] << ", " << a.mV[VGREEN] << ", " << a.mV[VBLUE] << " }";
return s; return s;
} }

View File

@ -196,17 +196,17 @@ inline LLColor3::LLColor3(void)
inline LLColor3::LLColor3(F32 r, F32 g, F32 b) inline LLColor3::LLColor3(F32 r, F32 g, F32 b)
{ {
mV[VX] = r; mV[VRED] = r;
mV[VY] = g; mV[VGREEN] = g;
mV[VZ] = b; mV[VBLUE] = b;
} }
inline LLColor3::LLColor3(const F32 *vec) inline LLColor3::LLColor3(const F32 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
} }
#if LL_WINDOWS #if LL_WINDOWS
@ -226,11 +226,11 @@ inline LLColor3::LLColor3(const char* color_string) // takes a string of format
char tempstr[7]; char tempstr[7];
strncpy(tempstr,color_string,6); /* Flawfinder: ignore */ strncpy(tempstr,color_string,6); /* Flawfinder: ignore */
tempstr[6] = '\0'; tempstr[6] = '\0';
mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f; mV[VBLUE] = (F32)strtol(&tempstr[4],NULL,16)/255.f;
tempstr[4] = '\0'; tempstr[4] = '\0';
mV[VY] = (F32)strtol(&tempstr[2],NULL,16)/255.f; mV[VGREEN] = (F32)strtol(&tempstr[2],NULL,16)/255.f;
tempstr[2] = '\0'; tempstr[2] = '\0';
mV[VX] = (F32)strtol(&tempstr[0],NULL,16)/255.f; mV[VRED] = (F32)strtol(&tempstr[0],NULL,16)/255.f;
} }
inline const LLColor3& LLColor3::setToBlack(void) inline const LLColor3& LLColor3::setToBlack(void)

View File

@ -133,57 +133,57 @@ LLColor4::operator LLColor4U() const
LLColor4::LLColor4(const LLColor3 &vec, F32 a) LLColor4::LLColor4(const LLColor3 &vec, F32 a)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = a; mV[VALPHA] = a;
} }
LLColor4::LLColor4(const LLColor4U& color4u) LLColor4::LLColor4(const LLColor4U& color4u)
{ {
const F32 SCALE = 1.f/255.f; const F32 SCALE = 1.f/255.f;
mV[VX] = color4u.mV[VX] * SCALE; mV[VRED] = color4u.mV[VRED] * SCALE;
mV[VY] = color4u.mV[VY] * SCALE; mV[VGREEN] = color4u.mV[VGREEN] * SCALE;
mV[VZ] = color4u.mV[VZ] * SCALE; mV[VBLUE] = color4u.mV[VBLUE] * SCALE;
mV[VW] = color4u.mV[VW] * SCALE; mV[VALPHA] = color4u.mV[VALPHA] * SCALE;
} }
LLColor4::LLColor4(const LLVector4& vector4) LLColor4::LLColor4(const LLVector4& vector4)
{ {
mV[VX] = vector4.mV[VX]; mV[VRED] = vector4.mV[VRED];
mV[VY] = vector4.mV[VY]; mV[VGREEN] = vector4.mV[VGREEN];
mV[VZ] = vector4.mV[VZ]; mV[VBLUE] = vector4.mV[VBLUE];
mV[VW] = vector4.mV[VW]; mV[VALPHA] = vector4.mV[VALPHA];
} }
const LLColor4& LLColor4::set(const LLColor4U& color4u) const LLColor4& LLColor4::set(const LLColor4U& color4u)
{ {
const F32 SCALE = 1.f/255.f; const F32 SCALE = 1.f/255.f;
mV[VX] = color4u.mV[VX] * SCALE; mV[VRED] = color4u.mV[VRED] * SCALE;
mV[VY] = color4u.mV[VY] * SCALE; mV[VGREEN] = color4u.mV[VGREEN] * SCALE;
mV[VZ] = color4u.mV[VZ] * SCALE; mV[VBLUE] = color4u.mV[VBLUE] * SCALE;
mV[VW] = color4u.mV[VW] * SCALE; mV[VALPHA] = color4u.mV[VALPHA] * SCALE;
return (*this); return (*this);
} }
const LLColor4& LLColor4::set(const LLColor3 &vec) const LLColor4& LLColor4::set(const LLColor3 &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
// no change to alpha! // no change to alpha!
// mV[VW] = 1.f; // mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a) const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
@ -191,22 +191,22 @@ const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a)
const LLColor4& LLColor4::setVec(const LLColor4U& color4u) const LLColor4& LLColor4::setVec(const LLColor4U& color4u)
{ {
const F32 SCALE = 1.f/255.f; const F32 SCALE = 1.f/255.f;
mV[VX] = color4u.mV[VX] * SCALE; mV[VRED] = color4u.mV[VRED] * SCALE;
mV[VY] = color4u.mV[VY] * SCALE; mV[VGREEN] = color4u.mV[VGREEN] * SCALE;
mV[VZ] = color4u.mV[VZ] * SCALE; mV[VBLUE] = color4u.mV[VBLUE] * SCALE;
mV[VW] = color4u.mV[VW] * SCALE; mV[VALPHA] = color4u.mV[VALPHA] * SCALE;
return (*this); return (*this);
} }
// deprecated -- use set() // deprecated -- use set()
const LLColor4& LLColor4::setVec(const LLColor3 &vec) const LLColor4& LLColor4::setVec(const LLColor3 &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
// no change to alpha! // no change to alpha!
// mV[VW] = 1.f; // mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
@ -214,10 +214,10 @@ const LLColor4& LLColor4::setVec(const LLColor3 &vec)
// deprecated -- use set() // deprecated -- use set()
const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a) const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
@ -257,45 +257,45 @@ void LLColor4::setValue(const LLSD& sd)
const LLColor4& LLColor4::operator=(const LLColor3 &a) const LLColor4& LLColor4::operator=(const LLColor3 &a)
{ {
mV[VX] = a.mV[VX]; mV[VRED] = a.mV[VRED];
mV[VY] = a.mV[VY]; mV[VGREEN] = a.mV[VGREEN];
mV[VZ] = a.mV[VZ]; mV[VBLUE] = a.mV[VBLUE];
// converting from an rgb sets a=1 (opaque) // converting from an rgb sets a=1 (opaque)
mV[VW] = 1.f; mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
std::ostream& operator<<(std::ostream& s, const LLColor4 &a) std::ostream& operator<<(std::ostream& s, const LLColor4 &a)
{ {
s << "{ " << a.mV[VX] << ", " << a.mV[VY] << ", " << a.mV[VZ] << ", " << a.mV[VW] << " }"; s << "{ " << a.mV[VRED] << ", " << a.mV[VGREEN] << ", " << a.mV[VBLUE] << ", " << a.mV[VALPHA] << " }";
return s; return s;
} }
bool operator==(const LLColor4 &a, const LLColor3 &b) bool operator==(const LLColor4 &a, const LLColor3 &b)
{ {
return ( (a.mV[VX] == b.mV[VX]) return ( (a.mV[VRED] == b.mV[VRED])
&&(a.mV[VY] == b.mV[VY]) &&(a.mV[VGREEN] == b.mV[VGREEN])
&&(a.mV[VZ] == b.mV[VZ])); &&(a.mV[VBLUE] == b.mV[VBLUE]));
} }
bool operator!=(const LLColor4 &a, const LLColor3 &b) bool operator!=(const LLColor4 &a, const LLColor3 &b)
{ {
return ( (a.mV[VX] != b.mV[VX]) return ( (a.mV[VRED] != b.mV[VRED])
||(a.mV[VY] != b.mV[VY]) ||(a.mV[VGREEN] != b.mV[VGREEN])
||(a.mV[VZ] != b.mV[VZ])); ||(a.mV[VBLUE] != b.mV[VBLUE]));
} }
LLColor3 vec4to3(const LLColor4 &vec) LLColor3 vec4to3(const LLColor4 &vec)
{ {
LLColor3 temp(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); LLColor3 temp(vec.mV[VRED], vec.mV[VGREEN], vec.mV[VBLUE]);
return temp; return temp;
} }
LLColor4 vec3to4(const LLColor3 &vec) LLColor4 vec3to4(const LLColor3 &vec)
{ {
LLColor3 temp(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); LLColor3 temp(vec.mV[VRED], vec.mV[VGREEN], vec.mV[VBLUE]);
return temp; return temp;
} }
@ -408,10 +408,10 @@ bool LLColor4::parseColor(const std::string& buf, LLColor4* color)
{ {
// There are more tokens to read. This must be a vector. // There are more tokens to read. This must be a vector.
LLColor4 v; LLColor4 v;
LLStringUtil::convertToF32( color_name, v.mV[VX] ); LLStringUtil::convertToF32( color_name, v.mV[VRED] );
LLStringUtil::convertToF32( *token_iter, v.mV[VY] ); LLStringUtil::convertToF32( *token_iter, v.mV[VGREEN] );
v.mV[VZ] = 0.0f; v.mV[VBLUE] = 0.0f;
v.mV[VW] = 1.0f; v.mV[VALPHA] = 1.0f;
++token_iter; ++token_iter;
if (token_iter == tokens.end()) if (token_iter == tokens.end())
@ -422,18 +422,18 @@ bool LLColor4::parseColor(const std::string& buf, LLColor4* color)
else else
{ {
// There is a z-component. // There is a z-component.
LLStringUtil::convertToF32( *token_iter, v.mV[VZ] ); LLStringUtil::convertToF32( *token_iter, v.mV[VBLUE] );
++token_iter; ++token_iter;
if (token_iter != tokens.end()) if (token_iter != tokens.end())
{ {
// There is an alpha component. // There is an alpha component.
LLStringUtil::convertToF32( *token_iter, v.mV[VW] ); LLStringUtil::convertToF32( *token_iter, v.mV[VALPHA] );
} }
} }
// Make sure all values are between 0 and 1. // Make sure all values are between 0 and 1.
if (v.mV[VX] > 1.f || v.mV[VY] > 1.f || v.mV[VZ] > 1.f || v.mV[VW] > 1.f) if (v.mV[VRED] > 1.f || v.mV[VGREEN] > 1.f || v.mV[VBLUE] > 1.f || v.mV[VALPHA] > 1.f)
{ {
v = v * (1.f / 255.f); v = v * (1.f / 255.f);
} }

View File

@ -242,10 +242,10 @@ LLColor4 lerp(const LLColor4 &a, const LLColor4 &b, F32 u);
inline LLColor4::LLColor4(void) inline LLColor4::LLColor4(void)
{ {
mV[VX] = 0.f; mV[VRED] = 0.f;
mV[VY] = 0.f; mV[VGREEN] = 0.f;
mV[VZ] = 0.f; mV[VBLUE] = 0.f;
mV[VW] = 1.f; mV[VALPHA] = 1.f;
} }
inline LLColor4::LLColor4(const LLSD& sd) inline LLColor4::LLColor4(const LLSD& sd)
@ -255,113 +255,113 @@ inline LLColor4::LLColor4(const LLSD& sd)
inline LLColor4::LLColor4(F32 r, F32 g, F32 b) inline LLColor4::LLColor4(F32 r, F32 g, F32 b)
{ {
mV[VX] = r; mV[VRED] = r;
mV[VY] = g; mV[VGREEN] = g;
mV[VZ] = b; mV[VBLUE] = b;
mV[VW] = 1.f; mV[VALPHA] = 1.f;
} }
inline LLColor4::LLColor4(F32 r, F32 g, F32 b, F32 a) inline LLColor4::LLColor4(F32 r, F32 g, F32 b, F32 a)
{ {
mV[VX] = r; mV[VRED] = r;
mV[VY] = g; mV[VGREEN] = g;
mV[VZ] = b; mV[VBLUE] = b;
mV[VW] = a; mV[VALPHA] = a;
} }
inline LLColor4::LLColor4(U32 clr) inline LLColor4::LLColor4(U32 clr)
{ {
mV[VX] = (clr&0xff) * (1.0f/255.0f); mV[VRED] = (clr&0xff) * (1.0f/255.0f);
mV[VY] = ((clr>>8)&0xff) * (1.0f/255.0f); mV[VGREEN] = ((clr>>8)&0xff) * (1.0f/255.0f);
mV[VZ] = ((clr>>16)&0xff) * (1.0f/255.0f); mV[VBLUE] = ((clr>>16)&0xff) * (1.0f/255.0f);
mV[VW] = (clr>>24) * (1.0f/255.0f); mV[VALPHA] = (clr>>24) * (1.0f/255.0f);
} }
inline LLColor4::LLColor4(const F32 *vec) inline LLColor4::LLColor4(const F32 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
} }
inline const LLColor4& LLColor4::setToBlack(void) inline const LLColor4& LLColor4::setToBlack(void)
{ {
mV[VX] = 0.f; mV[VRED] = 0.f;
mV[VY] = 0.f; mV[VGREEN] = 0.f;
mV[VZ] = 0.f; mV[VBLUE] = 0.f;
mV[VW] = 1.f; mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::setToWhite(void) inline const LLColor4& LLColor4::setToWhite(void)
{ {
mV[VX] = 1.f; mV[VRED] = 1.f;
mV[VY] = 1.f; mV[VGREEN] = 1.f;
mV[VZ] = 1.f; mV[VBLUE] = 1.f;
mV[VW] = 1.f; mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z) inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
// no change to alpha! // no change to alpha!
// mV[VW] = 1.f; // mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z, F32 a) inline const LLColor4& LLColor4::set(F32 x, F32 y, F32 z, F32 a)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::set(const LLColor4 &vec) inline const LLColor4& LLColor4::set(const LLColor4 &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = vec.mV[VW]; mV[VALPHA] = vec.mV[VALPHA];
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::set(const F32 *vec) inline const LLColor4& LLColor4::set(const F32 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::set(const F64 *vec) inline const LLColor4& LLColor4::set(const F64 *vec)
{ {
mV[VX] = static_cast<F32>(vec[VX]); mV[VRED] = static_cast<F32>(vec[VRED]);
mV[VY] = static_cast<F32>(vec[VY]); mV[VGREEN] = static_cast<F32>(vec[VGREEN]);
mV[VZ] = static_cast<F32>(vec[VZ]); mV[VBLUE] = static_cast<F32>(vec[VBLUE]);
mV[VW] = static_cast<F32>(vec[VW]); mV[VALPHA] = static_cast<F32>(vec[VALPHA]);
return (*this); return (*this);
} }
// deprecated // deprecated
inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z) inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
// no change to alpha! // no change to alpha!
// mV[VW] = 1.f; // mV[VALPHA] = 1.f;
return (*this); return (*this);
} }
@ -369,20 +369,20 @@ inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z)
// deprecated // deprecated
inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z, F32 a) inline const LLColor4& LLColor4::setVec(F32 x, F32 y, F32 z, F32 a)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
// deprecated // deprecated
inline const LLColor4& LLColor4::setVec(const LLColor4 &vec) inline const LLColor4& LLColor4::setVec(const LLColor4 &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = vec.mV[VW]; mV[VALPHA] = vec.mV[VALPHA];
return (*this); return (*this);
} }
@ -390,16 +390,16 @@ inline const LLColor4& LLColor4::setVec(const LLColor4 &vec)
// deprecated // deprecated
inline const LLColor4& LLColor4::setVec(const F32 *vec) inline const LLColor4& LLColor4::setVec(const F32 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
return (*this); return (*this);
} }
inline const LLColor4& LLColor4::setAlpha(F32 a) inline const LLColor4& LLColor4::setAlpha(F32 a)
{ {
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
@ -407,25 +407,25 @@ inline const LLColor4& LLColor4::setAlpha(F32 a)
inline F32 LLColor4::length(void) const inline F32 LLColor4::length(void) const
{ {
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); return (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]);
} }
inline F32 LLColor4::lengthSquared(void) const inline F32 LLColor4::lengthSquared(void) const
{ {
return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; return mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE];
} }
inline F32 LLColor4::normalize(void) inline F32 LLColor4::normalize(void)
{ {
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 mag = (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]);
F32 oomag; F32 oomag;
if (mag) if (mag)
{ {
oomag = 1.f/mag; oomag = 1.f/mag;
mV[VX] *= oomag; mV[VRED] *= oomag;
mV[VY] *= oomag; mV[VGREEN] *= oomag;
mV[VZ] *= oomag; mV[VBLUE] *= oomag;
} }
return (mag); return (mag);
} }
@ -433,27 +433,27 @@ inline F32 LLColor4::normalize(void)
// deprecated // deprecated
inline F32 LLColor4::magVec(void) const inline F32 LLColor4::magVec(void) const
{ {
return (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); return (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]);
} }
// deprecated // deprecated
inline F32 LLColor4::magVecSquared(void) const inline F32 LLColor4::magVecSquared(void) const
{ {
return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; return mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE];
} }
// deprecated // deprecated
inline F32 LLColor4::normVec(void) inline F32 LLColor4::normVec(void)
{ {
F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); F32 mag = (F32) sqrt(mV[VRED]*mV[VRED] + mV[VGREEN]*mV[VGREEN] + mV[VBLUE]*mV[VBLUE]);
F32 oomag; F32 oomag;
if (mag) if (mag)
{ {
oomag = 1.f/mag; oomag = 1.f/mag;
mV[VX] *= oomag; mV[VRED] *= oomag;
mV[VY] *= oomag; mV[VGREEN] *= oomag;
mV[VZ] *= oomag; mV[VBLUE] *= oomag;
} }
return (mag); return (mag);
} }
@ -464,135 +464,135 @@ inline F32 LLColor4::normVec(void)
inline LLColor4 operator+(const LLColor4 &a, const LLColor4 &b) inline LLColor4 operator+(const LLColor4 &a, const LLColor4 &b)
{ {
return LLColor4( return LLColor4(
a.mV[VX] + b.mV[VX], a.mV[VRED] + b.mV[VRED],
a.mV[VY] + b.mV[VY], a.mV[VGREEN] + b.mV[VGREEN],
a.mV[VZ] + b.mV[VZ], a.mV[VBLUE] + b.mV[VBLUE],
a.mV[VW] + b.mV[VW]); a.mV[VALPHA] + b.mV[VALPHA]);
} }
inline LLColor4 operator-(const LLColor4 &a, const LLColor4 &b) inline LLColor4 operator-(const LLColor4 &a, const LLColor4 &b)
{ {
return LLColor4( return LLColor4(
a.mV[VX] - b.mV[VX], a.mV[VRED] - b.mV[VRED],
a.mV[VY] - b.mV[VY], a.mV[VGREEN] - b.mV[VGREEN],
a.mV[VZ] - b.mV[VZ], a.mV[VBLUE] - b.mV[VBLUE],
a.mV[VW] - b.mV[VW]); a.mV[VALPHA] - b.mV[VALPHA]);
} }
inline LLColor4 operator*(const LLColor4 &a, const LLColor4 &b) inline LLColor4 operator*(const LLColor4 &a, const LLColor4 &b)
{ {
return LLColor4( return LLColor4(
a.mV[VX] * b.mV[VX], a.mV[VRED] * b.mV[VRED],
a.mV[VY] * b.mV[VY], a.mV[VGREEN] * b.mV[VGREEN],
a.mV[VZ] * b.mV[VZ], a.mV[VBLUE] * b.mV[VBLUE],
a.mV[VW] * b.mV[VW]); a.mV[VALPHA] * b.mV[VALPHA]);
} }
inline LLColor4 operator*(const LLColor4 &a, F32 k) inline LLColor4 operator*(const LLColor4 &a, F32 k)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
return LLColor4( return LLColor4(
a.mV[VX] * k, a.mV[VRED] * k,
a.mV[VY] * k, a.mV[VGREEN] * k,
a.mV[VZ] * k, a.mV[VBLUE] * k,
a.mV[VW]); a.mV[VALPHA]);
} }
inline LLColor4 operator/(const LLColor4 &a, F32 k) inline LLColor4 operator/(const LLColor4 &a, F32 k)
{ {
return LLColor4( return LLColor4(
a.mV[VX] / k, a.mV[VRED] / k,
a.mV[VY] / k, a.mV[VGREEN] / k,
a.mV[VZ] / k, a.mV[VBLUE] / k,
a.mV[VW]); a.mV[VALPHA]);
} }
inline LLColor4 operator*(F32 k, const LLColor4 &a) inline LLColor4 operator*(F32 k, const LLColor4 &a)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
return LLColor4( return LLColor4(
a.mV[VX] * k, a.mV[VRED] * k,
a.mV[VY] * k, a.mV[VGREEN] * k,
a.mV[VZ] * k, a.mV[VBLUE] * k,
a.mV[VW]); a.mV[VALPHA]);
} }
inline LLColor4 operator%(F32 k, const LLColor4 &a) inline LLColor4 operator%(F32 k, const LLColor4 &a)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
return LLColor4( return LLColor4(
a.mV[VX], a.mV[VRED],
a.mV[VY], a.mV[VGREEN],
a.mV[VZ], a.mV[VBLUE],
a.mV[VW] * k); a.mV[VALPHA] * k);
} }
inline LLColor4 operator%(const LLColor4 &a, F32 k) inline LLColor4 operator%(const LLColor4 &a, F32 k)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
return LLColor4( return LLColor4(
a.mV[VX], a.mV[VRED],
a.mV[VY], a.mV[VGREEN],
a.mV[VZ], a.mV[VBLUE],
a.mV[VW] * k); a.mV[VALPHA] * k);
} }
inline bool operator==(const LLColor4 &a, const LLColor4 &b) inline bool operator==(const LLColor4 &a, const LLColor4 &b)
{ {
return ( (a.mV[VX] == b.mV[VX]) return ( (a.mV[VRED] == b.mV[VRED])
&&(a.mV[VY] == b.mV[VY]) &&(a.mV[VGREEN] == b.mV[VGREEN])
&&(a.mV[VZ] == b.mV[VZ]) &&(a.mV[VBLUE] == b.mV[VBLUE])
&&(a.mV[VW] == b.mV[VW])); &&(a.mV[VALPHA] == b.mV[VALPHA]));
} }
inline bool operator!=(const LLColor4 &a, const LLColor4 &b) inline bool operator!=(const LLColor4 &a, const LLColor4 &b)
{ {
return ( (a.mV[VX] != b.mV[VX]) return ( (a.mV[VRED] != b.mV[VRED])
||(a.mV[VY] != b.mV[VY]) ||(a.mV[VGREEN] != b.mV[VGREEN])
||(a.mV[VZ] != b.mV[VZ]) ||(a.mV[VBLUE] != b.mV[VBLUE])
||(a.mV[VW] != b.mV[VW])); ||(a.mV[VALPHA] != b.mV[VALPHA]));
} }
inline const LLColor4& operator+=(LLColor4 &a, const LLColor4 &b) inline const LLColor4& operator+=(LLColor4 &a, const LLColor4 &b)
{ {
a.mV[VX] += b.mV[VX]; a.mV[VRED] += b.mV[VRED];
a.mV[VY] += b.mV[VY]; a.mV[VGREEN] += b.mV[VGREEN];
a.mV[VZ] += b.mV[VZ]; a.mV[VBLUE] += b.mV[VBLUE];
a.mV[VW] += b.mV[VW]; a.mV[VALPHA] += b.mV[VALPHA];
return a; return a;
} }
inline const LLColor4& operator-=(LLColor4 &a, const LLColor4 &b) inline const LLColor4& operator-=(LLColor4 &a, const LLColor4 &b)
{ {
a.mV[VX] -= b.mV[VX]; a.mV[VRED] -= b.mV[VRED];
a.mV[VY] -= b.mV[VY]; a.mV[VGREEN] -= b.mV[VGREEN];
a.mV[VZ] -= b.mV[VZ]; a.mV[VBLUE] -= b.mV[VBLUE];
a.mV[VW] -= b.mV[VW]; a.mV[VALPHA] -= b.mV[VALPHA];
return a; return a;
} }
inline const LLColor4& operator*=(LLColor4 &a, F32 k) inline const LLColor4& operator*=(LLColor4 &a, F32 k)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
a.mV[VX] *= k; a.mV[VRED] *= k;
a.mV[VY] *= k; a.mV[VGREEN] *= k;
a.mV[VZ] *= k; a.mV[VBLUE] *= k;
return a; return a;
} }
inline const LLColor4& operator *=(LLColor4 &a, const LLColor4 &b) inline const LLColor4& operator *=(LLColor4 &a, const LLColor4 &b)
{ {
a.mV[VX] *= b.mV[VX]; a.mV[VRED] *= b.mV[VRED];
a.mV[VY] *= b.mV[VY]; a.mV[VGREEN] *= b.mV[VGREEN];
a.mV[VZ] *= b.mV[VZ]; a.mV[VBLUE] *= b.mV[VBLUE];
// a.mV[VW] *= b.mV[VW]; // a.mV[VALPHA] *= b.mV[VALPHA];
return a; return a;
} }
inline const LLColor4& operator%=(LLColor4 &a, F32 k) inline const LLColor4& operator%=(LLColor4 &a, F32 k)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
a.mV[VW] *= k; a.mV[VALPHA] *= k;
return a; return a;
} }
@ -614,10 +614,10 @@ inline F32 distVec_squared(const LLColor4 &a, const LLColor4 &b)
inline LLColor4 lerp(const LLColor4 &a, const LLColor4 &b, F32 u) inline LLColor4 lerp(const LLColor4 &a, const LLColor4 &b, F32 u)
{ {
return LLColor4( return LLColor4(
a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, a.mV[VRED] + (b.mV[VRED] - a.mV[VRED]) * u,
a.mV[VY] + (b.mV[VY] - a.mV[VY]) * u, a.mV[VGREEN] + (b.mV[VGREEN] - a.mV[VGREEN]) * u,
a.mV[VZ] + (b.mV[VZ] - a.mV[VZ]) * u, a.mV[VBLUE] + (b.mV[VBLUE] - a.mV[VBLUE]) * u,
a.mV[VW] + (b.mV[VW] - a.mV[VW]) * u); a.mV[VALPHA] + (b.mV[VALPHA] - a.mV[VALPHA]) * u);
} }
inline bool LLColor4::operator<(const LLColor4& rhs) const inline bool LLColor4::operator<(const LLColor4& rhs) const

View File

@ -53,10 +53,10 @@ LLColor4U::operator LLColor4()
/* /*
LLColor4U::LLColor4U(const LLColor3 &vec) LLColor4U::LLColor4U(const LLColor3 &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = 255; mV[VALPHA] = 255;
} }
*/ */
@ -70,12 +70,12 @@ LLColor4U::LLColor4U(const LLColor3 &vec)
/* /*
LLColor4U LLColor4U::operator=(const LLColor3 &a) LLColor4U LLColor4U::operator=(const LLColor3 &a)
{ {
mV[VX] = a.mV[VX]; mV[VRED] = a.mV[VRED];
mV[VY] = a.mV[VY]; mV[VGREEN] = a.mV[VGREEN];
mV[VZ] = a.mV[VZ]; mV[VBLUE] = a.mV[VBLUE];
// converting from an rgb sets a=1 (opaque) // converting from an rgb sets a=1 (opaque)
mV[VW] = 255; mV[VALPHA] = 255;
return (*this); return (*this);
} }
*/ */
@ -83,7 +83,7 @@ LLColor4U LLColor4U::operator=(const LLColor3 &a)
std::ostream& operator<<(std::ostream& s, const LLColor4U &a) std::ostream& operator<<(std::ostream& s, const LLColor4U &a)
{ {
s << "{ " << (S32)a.mV[VX] << ", " << (S32)a.mV[VY] << ", " << (S32)a.mV[VZ] << ", " << (S32)a.mV[VW] << " }"; s << "{ " << (S32)a.mV[VRED] << ", " << (S32)a.mV[VGREEN] << ", " << (S32)a.mV[VBLUE] << ", " << (S32)a.mV[VALPHA] << " }";
return s; return s;
} }

View File

@ -142,34 +142,34 @@ F32 distVec_squared(const LLColor4U &a, const LLColor4U &b); // Returns d
inline LLColor4U::LLColor4U() inline LLColor4U::LLColor4U()
{ {
mV[VX] = 0; mV[VRED] = 0;
mV[VY] = 0; mV[VGREEN] = 0;
mV[VZ] = 0; mV[VBLUE] = 0;
mV[VW] = 255; mV[VALPHA] = 255;
} }
inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b) inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b)
{ {
mV[VX] = r; mV[VRED] = r;
mV[VY] = g; mV[VGREEN] = g;
mV[VZ] = b; mV[VBLUE] = b;
mV[VW] = 255; mV[VALPHA] = 255;
} }
inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b, U8 a) inline LLColor4U::LLColor4U(U8 r, U8 g, U8 b, U8 a)
{ {
mV[VX] = r; mV[VRED] = r;
mV[VY] = g; mV[VGREEN] = g;
mV[VZ] = b; mV[VBLUE] = b;
mV[VW] = a; mV[VALPHA] = a;
} }
inline LLColor4U::LLColor4U(const U8 *vec) inline LLColor4U::LLColor4U(const U8 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
} }
/* /*
@ -181,30 +181,30 @@ inline LLColor4U::operator LLColor4()
inline const LLColor4U& LLColor4U::setToBlack(void) inline const LLColor4U& LLColor4U::setToBlack(void)
{ {
mV[VX] = 0; mV[VRED] = 0;
mV[VY] = 0; mV[VGREEN] = 0;
mV[VZ] = 0; mV[VBLUE] = 0;
mV[VW] = 255; mV[VALPHA] = 255;
return (*this); return (*this);
} }
inline const LLColor4U& LLColor4U::setToWhite(void) inline const LLColor4U& LLColor4U::setToWhite(void)
{ {
mV[VX] = 255; mV[VRED] = 255;
mV[VY] = 255; mV[VGREEN] = 255;
mV[VZ] = 255; mV[VBLUE] = 255;
mV[VW] = 255; mV[VALPHA] = 255;
return (*this); return (*this);
} }
inline const LLColor4U& LLColor4U::set(const U8 x, const U8 y, const U8 z) inline const LLColor4U& LLColor4U::set(const U8 x, const U8 y, const U8 z)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
// no change to alpha! // no change to alpha!
// mV[VW] = 255; // mV[VALPHA] = 255;
return (*this); return (*this);
} }
@ -220,31 +220,31 @@ inline const LLColor4U& LLColor4U::set(const U8 r, const U8 g, const U8 b, U8 a)
inline const LLColor4U& LLColor4U::set(const LLColor4U &vec) inline const LLColor4U& LLColor4U::set(const LLColor4U &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = vec.mV[VW]; mV[VALPHA] = vec.mV[VALPHA];
return (*this); return (*this);
} }
inline const LLColor4U& LLColor4U::set(const U8 *vec) inline const LLColor4U& LLColor4U::set(const U8 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
return (*this); return (*this);
} }
// deprecated // deprecated
inline const LLColor4U& LLColor4U::setVec(const U8 x, const U8 y, const U8 z) inline const LLColor4U& LLColor4U::setVec(const U8 x, const U8 y, const U8 z)
{ {
mV[VX] = x; mV[VRED] = x;
mV[VY] = y; mV[VGREEN] = y;
mV[VZ] = z; mV[VBLUE] = z;
// no change to alpha! // no change to alpha!
// mV[VW] = 255; // mV[VALPHA] = 255;
return (*this); return (*this);
} }
@ -262,26 +262,26 @@ inline const LLColor4U& LLColor4U::setVec(const U8 r, const U8 g, const U8 b, U8
// deprecated // deprecated
inline const LLColor4U& LLColor4U::setVec(const LLColor4U &vec) inline const LLColor4U& LLColor4U::setVec(const LLColor4U &vec)
{ {
mV[VX] = vec.mV[VX]; mV[VRED] = vec.mV[VRED];
mV[VY] = vec.mV[VY]; mV[VGREEN] = vec.mV[VGREEN];
mV[VZ] = vec.mV[VZ]; mV[VBLUE] = vec.mV[VBLUE];
mV[VW] = vec.mV[VW]; mV[VALPHA] = vec.mV[VALPHA];
return (*this); return (*this);
} }
// deprecated // deprecated
inline const LLColor4U& LLColor4U::setVec(const U8 *vec) inline const LLColor4U& LLColor4U::setVec(const U8 *vec)
{ {
mV[VX] = vec[VX]; mV[VRED] = vec[VRED];
mV[VY] = vec[VY]; mV[VGREEN] = vec[VGREEN];
mV[VZ] = vec[VZ]; mV[VBLUE] = vec[VBLUE];
mV[VW] = vec[VW]; mV[VALPHA] = vec[VALPHA];
return (*this); return (*this);
} }
inline const LLColor4U& LLColor4U::setAlpha(U8 a) inline const LLColor4U& LLColor4U::setAlpha(U8 a)
{ {
mV[VW] = a; mV[VALPHA] = a;
return (*this); return (*this);
} }
@ -289,159 +289,159 @@ inline const LLColor4U& LLColor4U::setAlpha(U8 a)
inline F32 LLColor4U::length(void) const inline F32 LLColor4U::length(void) const
{ {
return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] ); return (F32) sqrt( ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE] );
} }
inline F32 LLColor4U::lengthSquared(void) const inline F32 LLColor4U::lengthSquared(void) const
{ {
return ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ]; return ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE];
} }
// deprecated // deprecated
inline F32 LLColor4U::magVec(void) const inline F32 LLColor4U::magVec(void) const
{ {
return (F32) sqrt( ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ] ); return (F32) sqrt( ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE] );
} }
// deprecated // deprecated
inline F32 LLColor4U::magVecSquared(void) const inline F32 LLColor4U::magVecSquared(void) const
{ {
return ((F32)mV[VX]) * mV[VX] + ((F32)mV[VY]) * mV[VY] + ((F32)mV[VZ]) * mV[VZ]; return ((F32)mV[VRED]) * mV[VRED] + ((F32)mV[VGREEN]) * mV[VGREEN] + ((F32)mV[VBLUE]) * mV[VBLUE];
} }
inline LLColor4U operator+(const LLColor4U &a, const LLColor4U &b) inline LLColor4U operator+(const LLColor4U &a, const LLColor4U &b)
{ {
return LLColor4U( return LLColor4U(
a.mV[VX] + b.mV[VX], a.mV[VRED] + b.mV[VRED],
a.mV[VY] + b.mV[VY], a.mV[VGREEN] + b.mV[VGREEN],
a.mV[VZ] + b.mV[VZ], a.mV[VBLUE] + b.mV[VBLUE],
a.mV[VW] + b.mV[VW]); a.mV[VALPHA] + b.mV[VALPHA]);
} }
inline LLColor4U operator-(const LLColor4U &a, const LLColor4U &b) inline LLColor4U operator-(const LLColor4U &a, const LLColor4U &b)
{ {
return LLColor4U( return LLColor4U(
a.mV[VX] - b.mV[VX], a.mV[VRED] - b.mV[VRED],
a.mV[VY] - b.mV[VY], a.mV[VGREEN] - b.mV[VGREEN],
a.mV[VZ] - b.mV[VZ], a.mV[VBLUE] - b.mV[VBLUE],
a.mV[VW] - b.mV[VW]); a.mV[VALPHA] - b.mV[VALPHA]);
} }
inline LLColor4U operator*(const LLColor4U &a, const LLColor4U &b) inline LLColor4U operator*(const LLColor4U &a, const LLColor4U &b)
{ {
return LLColor4U( return LLColor4U(
a.mV[VX] * b.mV[VX], a.mV[VRED] * b.mV[VRED],
a.mV[VY] * b.mV[VY], a.mV[VGREEN] * b.mV[VGREEN],
a.mV[VZ] * b.mV[VZ], a.mV[VBLUE] * b.mV[VBLUE],
a.mV[VW] * b.mV[VW]); a.mV[VALPHA] * b.mV[VALPHA]);
} }
inline LLColor4U LLColor4U::addClampMax(const LLColor4U &color) inline LLColor4U LLColor4U::addClampMax(const LLColor4U &color)
{ {
return LLColor4U(llmin((S32)mV[VX] + color.mV[VX], 255), return LLColor4U(llmin((S32)mV[VRED] + color.mV[VRED], 255),
llmin((S32)mV[VY] + color.mV[VY], 255), llmin((S32)mV[VGREEN] + color.mV[VGREEN], 255),
llmin((S32)mV[VZ] + color.mV[VZ], 255), llmin((S32)mV[VBLUE] + color.mV[VBLUE], 255),
llmin((S32)mV[VW] + color.mV[VW], 255)); llmin((S32)mV[VALPHA] + color.mV[VALPHA], 255));
} }
inline LLColor4U LLColor4U::multAll(const F32 k) inline LLColor4U LLColor4U::multAll(const F32 k)
{ {
// Round to nearest // Round to nearest
return LLColor4U( return LLColor4U(
(U8)ll_round(mV[VX] * k), (U8)ll_round(mV[VRED] * k),
(U8)ll_round(mV[VY] * k), (U8)ll_round(mV[VGREEN] * k),
(U8)ll_round(mV[VZ] * k), (U8)ll_round(mV[VBLUE] * k),
(U8)ll_round(mV[VW] * k)); (U8)ll_round(mV[VALPHA] * k));
} }
/* /*
inline LLColor4U operator*(const LLColor4U &a, U8 k) inline LLColor4U operator*(const LLColor4U &a, U8 k)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
return LLColor4U( return LLColor4U(
a.mV[VX] * k, a.mV[VRED] * k,
a.mV[VY] * k, a.mV[VGREEN] * k,
a.mV[VZ] * k, a.mV[VBLUE] * k,
a.mV[VW]); a.mV[VALPHA]);
} }
inline LLColor4U operator*(U8 k, const LLColor4U &a) inline LLColor4U operator*(U8 k, const LLColor4U &a)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
return LLColor4U( return LLColor4U(
a.mV[VX] * k, a.mV[VRED] * k,
a.mV[VY] * k, a.mV[VGREEN] * k,
a.mV[VZ] * k, a.mV[VBLUE] * k,
a.mV[VW]); a.mV[VALPHA]);
} }
inline LLColor4U operator%(U8 k, const LLColor4U &a) inline LLColor4U operator%(U8 k, const LLColor4U &a)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
return LLColor4U( return LLColor4U(
a.mV[VX], a.mV[VRED],
a.mV[VY], a.mV[VGREEN],
a.mV[VZ], a.mV[VBLUE],
a.mV[VW] * k ); a.mV[VALPHA] * k );
} }
inline LLColor4U operator%(const LLColor4U &a, U8 k) inline LLColor4U operator%(const LLColor4U &a, U8 k)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
return LLColor4U( return LLColor4U(
a.mV[VX], a.mV[VRED],
a.mV[VY], a.mV[VGREEN],
a.mV[VZ], a.mV[VBLUE],
a.mV[VW] * k ); a.mV[VALPHA] * k );
} }
*/ */
inline bool operator==(const LLColor4U &a, const LLColor4U &b) inline bool operator==(const LLColor4U &a, const LLColor4U &b)
{ {
return ( (a.mV[VX] == b.mV[VX]) return ( (a.mV[VRED] == b.mV[VRED])
&&(a.mV[VY] == b.mV[VY]) &&(a.mV[VGREEN] == b.mV[VGREEN])
&&(a.mV[VZ] == b.mV[VZ]) &&(a.mV[VBLUE] == b.mV[VBLUE])
&&(a.mV[VW] == b.mV[VW])); &&(a.mV[VALPHA] == b.mV[VALPHA]));
} }
inline bool operator!=(const LLColor4U &a, const LLColor4U &b) inline bool operator!=(const LLColor4U &a, const LLColor4U &b)
{ {
return ( (a.mV[VX] != b.mV[VX]) return ( (a.mV[VRED] != b.mV[VRED])
||(a.mV[VY] != b.mV[VY]) ||(a.mV[VGREEN] != b.mV[VGREEN])
||(a.mV[VZ] != b.mV[VZ]) ||(a.mV[VBLUE] != b.mV[VBLUE])
||(a.mV[VW] != b.mV[VW])); ||(a.mV[VALPHA] != b.mV[VALPHA]));
} }
inline const LLColor4U& operator+=(LLColor4U &a, const LLColor4U &b) inline const LLColor4U& operator+=(LLColor4U &a, const LLColor4U &b)
{ {
a.mV[VX] += b.mV[VX]; a.mV[VRED] += b.mV[VRED];
a.mV[VY] += b.mV[VY]; a.mV[VGREEN] += b.mV[VGREEN];
a.mV[VZ] += b.mV[VZ]; a.mV[VBLUE] += b.mV[VBLUE];
a.mV[VW] += b.mV[VW]; a.mV[VALPHA] += b.mV[VALPHA];
return a; return a;
} }
inline const LLColor4U& operator-=(LLColor4U &a, const LLColor4U &b) inline const LLColor4U& operator-=(LLColor4U &a, const LLColor4U &b)
{ {
a.mV[VX] -= b.mV[VX]; a.mV[VRED] -= b.mV[VRED];
a.mV[VY] -= b.mV[VY]; a.mV[VGREEN] -= b.mV[VGREEN];
a.mV[VZ] -= b.mV[VZ]; a.mV[VBLUE] -= b.mV[VBLUE];
a.mV[VW] -= b.mV[VW]; a.mV[VALPHA] -= b.mV[VALPHA];
return a; return a;
} }
inline const LLColor4U& operator*=(LLColor4U &a, U8 k) inline const LLColor4U& operator*=(LLColor4U &a, U8 k)
{ {
// only affects rgb (not a!) // only affects rgb (not a!)
a.mV[VX] *= k; a.mV[VRED] *= k;
a.mV[VY] *= k; a.mV[VGREEN] *= k;
a.mV[VZ] *= k; a.mV[VBLUE] *= k;
return a; return a;
} }
inline const LLColor4U& operator%=(LLColor4U &a, U8 k) inline const LLColor4U& operator%=(LLColor4U &a, U8 k)
{ {
// only affects alpha (not rgb!) // only affects alpha (not rgb!)
a.mV[VW] *= k; a.mV[VALPHA] *= k;
return a; return a;
} }

View File

@ -1125,7 +1125,7 @@ S32 LLAssetStorage::getNumPending(LLAssetStorage::ERequestType rt) const
S32 num_pending = -1; S32 num_pending = -1;
if (requests) if (requests)
{ {
num_pending = requests->size(); num_pending = static_cast<S32>(requests->size());
} }
return num_pending; return num_pending;
} }

View File

@ -248,7 +248,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
// Same logic as error response case // Same logic as error response case
const LLSD& unresolved_agents = data["bad_ids"]; const LLSD& unresolved_agents = data["bad_ids"];
S32 num_unresolved = unresolved_agents.size(); auto num_unresolved = unresolved_agents.size();
if (num_unresolved > 0) if (num_unresolved > 0)
{ {
LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; " LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; "

View File

@ -562,13 +562,13 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name)
{ {
//boost::regexp was showing up in the crashreporter, so doing //boost::regexp was showing up in the crashreporter, so doing
//painfully manual parsing using substr. LF //painfully manual parsing using substr. LF
S32 open_paren = complete_name.rfind(" ("); auto open_paren = complete_name.rfind(" (");
S32 close_paren = complete_name.rfind(')'); auto close_paren = complete_name.rfind(')');
if (open_paren != std::string::npos && if (open_paren != std::string::npos &&
close_paren == complete_name.length()-1) close_paren == complete_name.length()-1)
{ {
S32 length = close_paren - open_paren - 2; auto length = close_paren - open_paren - 2;
std::string legacy_name = complete_name.substr(open_paren+2, length); std::string legacy_name = complete_name.substr(open_paren+2, length);
if (legacy_name.length() > 0) if (legacy_name.length() > 0)
@ -577,7 +577,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name)
LLStringUtil::toUpper(cap_letter); LLStringUtil::toUpper(cap_letter);
legacy_name = cap_letter + legacy_name.substr(1); legacy_name = cap_letter + legacy_name.substr(1);
S32 separator = legacy_name.find('.'); auto separator = legacy_name.find('.');
if (separator != std::string::npos) if (separator != std::string::npos)
{ {

View File

@ -781,8 +781,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, bool receive_resent)
void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys)
{ {
F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds();
S32 count = mPingSet.size(); size_t count = mPingSet.size();
S32 cur = 0; size_t cur = 0;
// Only process each circuit once at most, stop processing if no circuits // Only process each circuit once at most, stop processing if no circuits
while((cur < count) && !mPingSet.empty()) while((cur < count) && !mPingSet.empty())

View File

@ -87,7 +87,7 @@ public:
/// ///
inline S32 count() const inline S32 count() const
{ {
return countPending() + countActive(); return static_cast<S32>(countPending() + countActive());
} }
void close(); void close();

View File

@ -237,7 +237,7 @@ bool LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name)
bool LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name) bool LLDataPackerBinaryBuffer::packString(const std::string& value, const char *name)
{ {
S32 length = value.length()+1; S32 length = static_cast<S32>(value.length()) + 1;
if (!verifyLength(length, name)) if (!verifyLength(length, name))
{ {
@ -740,7 +740,7 @@ bool LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n
} }
else else
{ {
numCopied = value.length() + 1; /*Flawfinder: ignore*/ numCopied = static_cast<S32>(value.length()) + 1; /*Flawfinder: ignore*/
} }
// snprintf returns number of bytes that would have been written // snprintf returns number of bytes that would have been written

View File

@ -274,12 +274,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
if(!buffer.empty()) if(!buffer.empty())
{ {
// *TODO: convert to LLBase64 // *TODO: convert to LLBase64
int b64_buffer_length = apr_base64_encode_len(buffer.size()); int b64_buffer_length = apr_base64_encode_len(static_cast<int>(buffer.size()));
char* b64_buffer = new char[b64_buffer_length]; char* b64_buffer = new char[b64_buffer_length];
b64_buffer_length = apr_base64_encode_binary( b64_buffer_length = apr_base64_encode_binary(
b64_buffer, b64_buffer,
&buffer[0], &buffer[0],
buffer.size()); static_cast<int>(buffer.size()));
ostr.write(b64_buffer, b64_buffer_length - 1); ostr.write(b64_buffer, b64_buffer_length - 1);
delete[] b64_buffer; delete[] b64_buffer;
} }

View File

@ -494,7 +494,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
LLChangeChannel change(channels.in(), channels.out()); LLChangeChannel change(channels.in(), channels.out());
std::for_each(buffer->beginSegment(), buffer->endSegment(), change); std::for_each(buffer->beginSegment(), buffer->endSegment(), change);
std::string header = ostr.str(); std::string header = ostr.str();
buffer->prepend(channels.out(), (U8*)header.c_str(), header.size()); buffer->prepend(channels.out(), (U8*)header.c_str(), static_cast<S32>(header.size()));
PUMP_DEBUG; PUMP_DEBUG;
return STATUS_DONE; return STATUS_DONE;
} }

View File

@ -346,7 +346,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
PUMP_DEBUG; PUMP_DEBUG;
len = READ_BUFFER_SIZE; len = READ_BUFFER_SIZE;
status = apr_socket_recv(mSource->getSocket(), read_buf, &len); status = apr_socket_recv(mSource->getSocket(), read_buf, &len);
buffer->append(channels.out(), (U8*)read_buf, len); buffer->append(channels.out(), (U8*)read_buf, static_cast<S32>(len));
} while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len)); } while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len));
LL_DEBUGS() << "socket read status: " << status << LL_ENDL; LL_DEBUGS() << "socket read status: " << status << LL_ENDL;
LLIOPipe::EStatus rv = STATUS_OK; LLIOPipe::EStatus rv = STATUS_OK;

View File

@ -273,7 +273,7 @@ bool LLMail::send(
std::string good_string = "\n..\n"; std::string good_string = "\n..\n";
while (1) while (1)
{ {
int index = message.find(bad_string); auto index = message.find(bad_string);
if (index == std::string::npos) break; if (index == std::string::npos) break;
message.replace(index, bad_string.size(), good_string); message.replace(index, bad_string.size(), good_string);
} }

View File

@ -289,14 +289,14 @@ bool LLPartSysData::unpack(LLDataPacker &dp)
//skip to LLPartData block //skip to LLPartData block
U8 feh = 0; U8 feh = 0;
for (U32 i = 0; i < size; ++i) for (S32 i = 0; i < size; ++i)
{ {
dp.unpackU8(feh, "whippang"); dp.unpackU8(feh, "whippang");
} }
dp.unpackS32(size, "partsize"); dp.unpackS32(size, "partsize");
//skip LLPartData block //skip LLPartData block
for (U32 i = 0; i < size; ++i) for (S32 i = 0; i < size; ++i)
{ {
dp.unpackU8(feh, "whippang"); dp.unpackU8(feh, "whippang");
} }

View File

@ -123,7 +123,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy)
// The server has requested a username/password combination // The server has requested a username/password combination
std::string socks_username(getSocksUser()); std::string socks_username(getSocksUser());
std::string socks_password(getSocksPwd()); std::string socks_password(getSocksPwd());
U32 request_size = socks_username.size() + socks_password.size() + 3; U32 request_size = static_cast<S32>(socks_username.size() + socks_password.size() + 3);
char * password_auth = new char[request_size]; char * password_auth = new char[request_size];
password_auth[0] = 0x01; password_auth[0] = 0x01;
password_auth[1] = (char)(socks_username.size()); password_auth[1] = (char)(socks_username.size());

View File

@ -818,7 +818,7 @@ void LLPumpIO::rebuildPollset()
running_chains_t::iterator run_end = mRunningChains.end(); running_chains_t::iterator run_end = mRunningChains.end();
for(; run_it != run_end; ++run_it) for(; run_it != run_end; ++run_it)
{ {
size += (*run_it).mDescriptors.size(); size += static_cast<U32>((*run_it).mDescriptors.size());
} }
//LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL; //LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL;
if(size) if(size)

View File

@ -28,83 +28,83 @@
#define LL_LLREGIONFLAGS_H #define LL_LLREGIONFLAGS_H
// Can you be hurt here? Should health be on? // Can you be hurt here? Should health be on?
const U64 REGION_FLAGS_ALLOW_DAMAGE = (1 << 0); constexpr U64 REGION_FLAGS_ALLOW_DAMAGE = (1ULL << 0);
// Can you make landmarks here? // Can you make landmarks here?
const U64 REGION_FLAGS_ALLOW_LANDMARK = (1 << 1); constexpr U64 REGION_FLAGS_ALLOW_LANDMARK = (1ULL << 1);
// Do we reset the home position when someone teleports away from here? // Do we reset the home position when someone teleports away from here?
const U64 REGION_FLAGS_ALLOW_SET_HOME = (1 << 2); constexpr U64 REGION_FLAGS_ALLOW_SET_HOME = (1ULL << 2);
// Do we reset the home position when someone teleports away from here? // Do we reset the home position when someone teleports away from here?
const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1 << 3); constexpr U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1ULL << 3);
// Does the sun move? // Does the sun move?
const U64 REGION_FLAGS_SUN_FIXED = (1 << 4); constexpr U64 REGION_FLAGS_SUN_FIXED = (1ULL << 4);
// Does the estate owner allow private parcels? // Does the estate owner allow private parcels?
const U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1 << 5); constexpr U64 REGION_FLAGS_ALLOW_ACCESS_OVERRIDE = (1ULL << 5);
// Can't change the terrain heightfield, even on owned parcels, // Can't change the terrain heightfield, even on owned parcels,
// but can plant trees and grass. // but can plant trees and grass.
const U64 REGION_FLAGS_BLOCK_TERRAFORM = (1 << 6); constexpr U64 REGION_FLAGS_BLOCK_TERRAFORM = (1ULL << 6);
// Can't release, sell, or buy land. // Can't release, sell, or buy land.
const U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); constexpr U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1ULL << 7);
// All content wiped once per night // All content wiped once per night
const U64 REGION_FLAGS_SANDBOX = (1 << 8); constexpr U64 REGION_FLAGS_SANDBOX = (1ULL << 8);
const U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1 << 9); constexpr U64 REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE = (1ULL << 9);
const U64 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies constexpr U64 REGION_FLAGS_SKIP_COLLISIONS = (1ULL << 12); // Pin all non agent rigid bodies
const U64 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); constexpr U64 REGION_FLAGS_SKIP_SCRIPTS = (1ULL << 13);
const U64 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics constexpr U64 REGION_FLAGS_SKIP_PHYSICS = (1ULL << 14); // Skip all physics
const U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15); constexpr U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1ULL << 15);
const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1ULL << 16);
const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1ULL << 17);
const U64 REGION_FLAGS_BLOCK_DWELL = (1 << 18); constexpr U64 REGION_FLAGS_BLOCK_DWELL = (1ULL << 18);
// Is flight allowed? // Is flight allowed?
const U64 REGION_FLAGS_BLOCK_FLY = (1 << 19); constexpr U64 REGION_FLAGS_BLOCK_FLY = (1ULL << 19);
// Is direct teleport (p2p) allowed? // Is direct teleport (p2p) allowed?
const U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1 << 20); constexpr U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT = (1ULL << 20);
// Is there an administrative override on scripts in the region at the // Is there an administrative override on scripts in the region at the
// moment. This is the similar skip scripts, except this flag is // moment. This is the similar skip scripts, except this flag is
// presisted in the database on an estate level. // presisted in the database on an estate level.
const U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1 << 21); constexpr U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1ULL << 21);
const U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1 << 22); constexpr U64 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1ULL << 22);
const U64 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23); constexpr U64 REGION_FLAGS_DENY_ANONYMOUS = (1ULL << 23);
const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26); constexpr U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1ULL << 26);
const U64 REGION_FLAGS_BLOCK_FLYOVER = (1 << 27); constexpr U64 REGION_FLAGS_BLOCK_FLYOVER = (1ULL << 27);
const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28); constexpr U64 REGION_FLAGS_ALLOW_VOICE = (1ULL << 28);
const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); constexpr U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1ULL << 29);
const U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); constexpr U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1ULL << 30);
const U64 REGION_FLAGS_DENY_BOTS = (1 << 31); constexpr U64 REGION_FLAGS_DENY_BOTS = (1ULL << 31);
const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | constexpr U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
REGION_FLAGS_ALLOW_SET_HOME | REGION_FLAGS_ALLOW_SET_HOME |
REGION_FLAGS_ALLOW_PARCEL_CHANGES | REGION_FLAGS_ALLOW_PARCEL_CHANGES |
REGION_FLAGS_ALLOW_VOICE; REGION_FLAGS_ALLOW_VOICE;
const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; constexpr U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT;
const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK constexpr U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK |
| REGION_FLAGS_ALLOW_SET_HOME; REGION_FLAGS_ALLOW_SET_HOME;
const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE constexpr U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE |
| REGION_FLAGS_SUN_FIXED REGION_FLAGS_SUN_FIXED |
| REGION_FLAGS_DENY_ANONYMOUS REGION_FLAGS_DENY_ANONYMOUS |
| REGION_FLAGS_DENY_AGEUNVERIFIED; REGION_FLAGS_DENY_AGEUNVERIFIED;
inline bool is_flag_set(U64 flags, U64 flag) inline bool is_flag_set(U64 flags, U64 flag)
{ {
@ -133,79 +133,75 @@ inline U64 unset_prelude_flags(U64 flags)
} }
// Region protocols // Region protocols
const U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1 << 0); constexpr U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1ULL << 0);
// estate constants. Need to match first few etries in indra.estate table. // estate constants. Need to match first few etries in indra.estate table.
const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic constexpr U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic
const U32 ESTATE_MAINLAND = 1; constexpr U32 ESTATE_MAINLAND = 1;
const U32 ESTATE_ORIENTATION = 2; constexpr U32 ESTATE_ORIENTATION = 2;
const U32 ESTATE_INTERNAL = 3; constexpr U32 ESTATE_INTERNAL = 3;
const U32 ESTATE_SHOWCASE = 4; constexpr U32 ESTATE_SHOWCASE = 4;
const U32 ESTATE_TEEN = 5; constexpr U32 ESTATE_TEEN = 5;
const U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate constexpr U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate
// for EstateOwnerRequest, setaccess message // for EstateOwnerRequest, setaccess message
const U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; constexpr U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0;
const U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; constexpr U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1;
const U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; constexpr U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2;
const U32 ESTATE_ACCESS_MANAGERS = 1 << 3; constexpr U32 ESTATE_ACCESS_MANAGERS = 1 << 3;
//maximum number of access list entries we can fit in one packet //maximum number of access list entries we can fit in one packet
const S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63; constexpr S32 ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET = 63;
// for reply to "getinfo", don't need to forward to all sims in estate // for reply to "getinfo", don't need to forward to all sims in estate
const U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4; constexpr U32 ESTATE_ACCESS_SEND_TO_AGENT_ONLY = 1 << 4;
const U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS constexpr U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS
| ESTATE_ACCESS_ALLOWED_GROUPS | ESTATE_ACCESS_ALLOWED_GROUPS
| ESTATE_ACCESS_BANNED_AGENTS | ESTATE_ACCESS_BANNED_AGENTS
| ESTATE_ACCESS_MANAGERS; | ESTATE_ACCESS_MANAGERS;
// for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages // for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages
const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; constexpr U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0;
const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; constexpr U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5;
const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; constexpr U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6;
const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; constexpr U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7;
const U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; constexpr U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8;
const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; constexpr U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9;
const U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; constexpr U32 ESTATE_ACCESS_NO_REPLY = 1U << 10;
const U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; constexpr U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11;
const S32 ESTATE_MAX_MANAGERS = 20; constexpr S32 ESTATE_MAX_MANAGERS = 20;
const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access constexpr S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access
const S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned constexpr S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned
const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; constexpr S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET;
// 'Sim Wide Delete' flags // 'Sim Wide Delete' flags
const U32 SWD_OTHERS_LAND_ONLY = (1 << 0); constexpr U32 SWD_OTHERS_LAND_ONLY = (1 << 0);
const U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); constexpr U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1);
const U32 SWD_SCRIPTED_ONLY = (1 << 2); constexpr U32 SWD_SCRIPTED_ONLY = (1 << 2);
// Controls experience key validity in the estate // Controls experience key validity in the estate
const U32 EXPERIENCE_KEY_TYPE_NONE = 0; constexpr U32 EXPERIENCE_KEY_TYPE_NONE = 0;
const U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; constexpr U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1;
const U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; constexpr U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2;
const U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; constexpr U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3;
const U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; constexpr U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED;
const U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; constexpr U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED;
// //
const U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; constexpr U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2;
const U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; constexpr U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3;
const U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; constexpr U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4;
const U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; constexpr U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5;
const U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; constexpr U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6;
const U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; constexpr U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7;
const S32 ESTATE_MAX_EXPERIENCE_IDS = 8;
constexpr S32 ESTATE_MAX_EXPERIENCE_IDS = 8;
#endif #endif

View File

@ -242,7 +242,7 @@ void LLSDMessageReader::getString(const char *block, const char *var,
return; return;
} }
std::string data = getLLSD(mMessage, block, var, blocknum); std::string data = getLLSD(mMessage, block, var, blocknum);
S32 data_size = data.size(); auto data_size = data.size();
if (data_size >= buffer_size) if (data_size >= buffer_size)
{ {
data_size = buffer_size - 1; data_size = buffer_size - 1;
@ -261,7 +261,7 @@ void LLSDMessageReader::getString(const char *block, const char *var,
//virtual //virtual
S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname)
{ {
return mMessage[blockname].size(); return static_cast<S32>(mMessage[blockname].size());
} }
S32 getElementSize(const LLSD& llsd) S32 getElementSize(const LLSD& llsd)
@ -276,7 +276,7 @@ S32 getElementSize(const LLSD& llsd)
case LLSD::TypeReal: case LLSD::TypeReal:
return sizeof(F64); return sizeof(F64);
case LLSD::TypeString: case LLSD::TypeString:
return llsd.size(); return static_cast<S32>(llsd.size());
case LLSD::TypeUUID: case LLSD::TypeUUID:
return sizeof(LLUUID); return sizeof(LLUUID);
case LLSD::TypeDate: case LLSD::TypeDate:
@ -286,7 +286,7 @@ S32 getElementSize(const LLSD& llsd)
case LLSD::TypeBinary: case LLSD::TypeBinary:
{ {
std::vector<U8> data = llsd; std::vector<U8> data = llsd;
return data.size() * sizeof(U8); return static_cast<S32>(data.size() * sizeof(U8));
} }
case LLSD::TypeMap: case LLSD::TypeMap:
case LLSD::TypeArray: case LLSD::TypeArray:

View File

@ -44,7 +44,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,
LLHTTPNode::ResponsePtr responsep) LLHTTPNode::ResponsePtr responsep)
{ {
std::vector<U8> data = message["body"]["binary-template-data"].asBinary(); std::vector<U8> data = message["body"]["binary-template-data"].asBinary();
U32 size = data.size(); auto size = data.size();
if(size == 0) if(size == 0)
{ {
return; return;
@ -53,7 +53,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,
LLHost host; LLHost host;
host = gMessageSystem->getSender(); host = gMessageSystem->getSender();
bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), data.size(), host, true); bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), static_cast<S32>(size), host, true);
if (validate_message) if (validate_message)
{ {

View File

@ -317,7 +317,7 @@ S32 LLXfer_File::flush()
if (mFp) if (mFp)
{ {
S32 write_size = fwrite(mBuffer,1,mBufferLength,mFp); S32 write_size = static_cast<S32>(fwrite(mBuffer,1,mBufferLength,mFp));
if (write_size != mBufferLength) if (write_size != mBufferLength)
{ {
LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength

View File

@ -2172,7 +2172,7 @@ S32 LLMessageSystem::sendError(
if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) == if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) ==
LLMessageConfig::TEMPLATE_FLAVOR) LLMessageConfig::TEMPLATE_FLAVOR)
{ {
S32 msg_size = temp.size() + mMessageBuilder->getMessageSize(); S32 msg_size = static_cast<S32>(temp.size()) + mMessageBuilder->getMessageSize();
if(msg_size >= ETHERNET_MTU_BYTES) if(msg_size >= ETHERNET_MTU_BYTES)
{ {
pack_data = false; pack_data = false;
@ -2180,7 +2180,7 @@ S32 LLMessageSystem::sendError(
} }
if(pack_data) if(pack_data)
{ {
addBinaryData("Data", (void*)temp.c_str(), temp.size()); addBinaryData("Data", (void*)temp.c_str(), static_cast<S32>(temp.size()));
} }
else else
{ {

View File

@ -262,10 +262,10 @@ void LLPluginClassMedia::idle(void)
message.setValueS32("height", mRequestedMediaHeight); message.setValueS32("height", mRequestedMediaHeight);
message.setValueS32("texture_width", mRequestedTextureWidth); message.setValueS32("texture_width", mRequestedTextureWidth);
message.setValueS32("texture_height", mRequestedTextureHeight); message.setValueS32("texture_height", mRequestedTextureHeight);
message.setValueReal("background_r", mBackgroundColor.mV[VX]); message.setValueReal("background_r", mBackgroundColor.mV[VRED]);
message.setValueReal("background_g", mBackgroundColor.mV[VY]); message.setValueReal("background_g", mBackgroundColor.mV[VGREEN]);
message.setValueReal("background_b", mBackgroundColor.mV[VZ]); message.setValueReal("background_b", mBackgroundColor.mV[VBLUE]);
message.setValueReal("background_a", mBackgroundColor.mV[VW]); message.setValueReal("background_a", mBackgroundColor.mV[VALPHA]);
mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue. mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue.
LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL; LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL;

View File

@ -371,7 +371,7 @@ bool LLPluginMessagePipe::pumpInput(F64 timeout)
void LLPluginMessagePipe::processInput(void) void LLPluginMessagePipe::processInput(void)
{ {
// Look for input delimiter(s) in the input buffer. // Look for input delimiter(s) in the input buffer.
int delim; size_t delim;
mInputMutex.lock(); mInputMutex.lock();
while((delim = mInput.find(MESSAGE_DELIMITER)) != std::string::npos) while((delim = mInput.find(MESSAGE_DELIMITER)) != std::string::npos)
{ {

View File

@ -450,7 +450,7 @@ bool LLPluginSharedMemory::create(size_t size)
NULL, // default security NULL, // default security
PAGE_READWRITE, // read/write access PAGE_READWRITE, // read/write access
0, // max. object size 0, // max. object size
mSize, // buffer size static_cast<DWORD>(mSize), // buffer size
mName.c_str()); // name of mapping object mName.c_str()); // name of mapping object
if(mImpl->mMapFile == NULL) if(mImpl->mMapFile == NULL)

View File

@ -258,7 +258,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(
// Don't share verts within the same tri, degenerate // Don't share verts within the same tri, degenerate
// //
U32 indx_size = indices.size(); U32 indx_size = static_cast<U32>(indices.size());
U32 verts_new_tri = indx_size % 3; U32 verts_new_tri = indx_size % 3;
if ((verts_new_tri < 1 || indices[indx_size - 1] != shared_index) if ((verts_new_tri < 1 || indices[indx_size - 1] != shared_index)
&& (verts_new_tri < 2 || indices[indx_size - 2] != shared_index)) && (verts_new_tri < 2 || indices[indx_size - 2] != shared_index))
@ -732,7 +732,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
{ //for each vertex { //for each vertex
if (j > 2) if (j > 2)
{ {
U32 size = verts.size(); auto size = verts.size();
LLVolumeFace::VertexData v0 = verts[size-3]; LLVolumeFace::VertexData v0 = verts[size-3];
LLVolumeFace::VertexData v1 = verts[size-1]; LLVolumeFace::VertexData v1 = verts[size-1];
@ -1000,9 +1000,9 @@ bool LLDAELoader::OpenFile(const std::string& filename)
//Verify some basic properties of the dae //Verify some basic properties of the dae
//1. Basic validity check on controller //1. Basic validity check on controller
U32 controllerCount = (int) db->getElementCount( NULL, "controller" ); U32 controllerCount = db->getElementCount(NULL, "controller");
bool result = false; bool result = false;
for ( int i=0; i<controllerCount; ++i ) for (U32 i = 0; i < controllerCount; ++i)
{ {
domController* pController = NULL; domController* pController = NULL;
db->getElement( (daeElement**) &pController, i , NULL, "controller" ); db->getElement( (daeElement**) &pController, i , NULL, "controller" );
@ -1098,7 +1098,7 @@ bool LLDAELoader::OpenFile(const std::string& filename)
while (model_iter != mModelList.end()) while (model_iter != mModelList.end())
{ {
LLModel* mdl = *model_iter; LLModel* mdl = *model_iter;
U32 material_count = mdl->mMaterialList.size(); U32 material_count = static_cast<U32>(mdl->mMaterialList.size());
LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL; LL_INFOS() << "Importing " << mdl->mLabel << " model with " << material_count << " material references" << LL_ENDL;
std::vector<std::string>::iterator mat_iter = mdl->mMaterialList.begin(); std::vector<std::string>::iterator mat_iter = mdl->mMaterialList.begin();
std::vector<std::string>::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT std::vector<std::string>::iterator end_iter = material_count > LIMIT_MATERIALS_OUTPUT
@ -1255,7 +1255,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//Some collada setup for accessing the skeleton //Some collada setup for accessing the skeleton
U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" ); U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" );
std::vector<domInstance_controller::domSkeleton*> skeletons; std::vector<domInstance_controller::domSkeleton*> skeletons;
for (S32 i=0; i<skeleton_count; i++) for (U32 i = 0; i < skeleton_count; i++)
{ {
daeElement* pElement = 0; daeElement* pElement = 0;
dae->getDatabase()->getElement( &pElement, i, 0, "skeleton" ); dae->getDatabase()->getElement( &pElement, i, 0, "skeleton" );
@ -1287,11 +1287,11 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
{ {
//Get the children at this level //Get the children at this level
daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren(); daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren();
S32 childCount = children.getCount(); auto childCount = children.getCount();
//Process any children that are joints //Process any children that are joints
//Not all children are joints, some could be ambient lights, cameras, geometry etc.. //Not all children are joints, some could be ambient lights, cameras, geometry etc..
for (S32 i = 0; i < childCount; ++i) for (size_t i = 0; i < childCount; ++i)
{ {
domNode* pNode = daeSafeCast<domNode>(children[i]); domNode* pNode = daeSafeCast<domNode>(children[i]);
if (pNode) if (pNode)
@ -1312,7 +1312,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
if ( pSkeletonRootNode ) if ( pSkeletonRootNode )
{ {
//Once we have the root node - start acccessing it's joint components //Once we have the root node - start acccessing it's joint components
const int jointCnt = mJointMap.size(); const int jointCnt = static_cast<int>(mJointMap.size());
JointMap :: const_iterator jointIt = mJointMap.begin(); JointMap :: const_iterator jointIt = mJointMap.begin();
//Loop over all the possible joints within the .dae - using the allowed joint list in the ctor. //Loop over all the possible joints within the .dae - using the allowed joint list in the ctor.
@ -1453,9 +1453,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
if (t) if (t)
{ {
domListOfFloats& transform = t->getValue(); domListOfFloats& transform = t->getValue();
S32 count = transform.getCount()/16; auto count = transform.getCount()/16;
for (S32 k = 0; k < count; ++k) for (size_t k = 0; k < count; ++k)
{ {
LLMatrix4 mat; LLMatrix4 mat;
@ -1531,7 +1531,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//with the skeleton are not stored in the same order as they are in the exported joint buffer. //with the skeleton are not stored in the same order as they are in the exported joint buffer.
//This remaps the skeletal joints to be in the same order as the joints stored in the model. //This remaps the skeletal joints to be in the same order as the joints stored in the model.
std::vector<std::string> :: const_iterator jointIt = model->mSkinInfo.mJointNames.begin(); std::vector<std::string> :: const_iterator jointIt = model->mSkinInfo.mJointNames.begin();
const int jointCnt = model->mSkinInfo.mJointNames.size(); const int jointCnt = static_cast<int>(model->mSkinInfo.mJointNames.size());
for ( int i=0; i<jointCnt; ++i, ++jointIt ) for ( int i=0; i<jointCnt; ++i, ++jointIt )
{ {
std::string lookingForJoint = (*jointIt).c_str(); std::string lookingForJoint = (*jointIt).c_str();
@ -1550,7 +1550,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
} }
} }
U32 bind_count = model->mSkinInfo.mAlternateBindMatrix.size(); auto bind_count = model->mSkinInfo.mAlternateBindMatrix.size();
if (bind_count > 0 && bind_count != jointCnt) if (bind_count > 0 && bind_count != jointCnt)
{ {
LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL; LL_WARNS("Mesh") << "Model " << model->mLabel << " has invalid joint bind matrix list." << LL_ENDL;
@ -1699,8 +1699,8 @@ void LLDAELoader::buildJointToNodeMappingFromScene( daeElement* pRoot )
if ( pScene ) if ( pScene )
{ {
daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren(); daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren();
S32 childCount = children.getCount(); auto childCount = children.getCount();
for (S32 i = 0; i < childCount; ++i) for (size_t i = 0; i < childCount; ++i)
{ {
domNode* pNode = daeSafeCast<domNode>(children[i]); domNode* pNode = daeSafeCast<domNode>(children[i]);
processJointToNodeMapping( pNode ); processJointToNodeMapping( pNode );
@ -1745,8 +1745,8 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode )
void LLDAELoader::processChildJoints( domNode* pParentNode ) void LLDAELoader::processChildJoints( domNode* pParentNode )
{ {
daeTArray< daeSmartRef<daeElement> > childOfChild = pParentNode->getChildren(); daeTArray< daeSmartRef<daeElement> > childOfChild = pParentNode->getChildren();
S32 childOfChildCount = childOfChild.getCount(); auto childOfChildCount = childOfChild.getCount();
for (S32 i = 0; i < childOfChildCount; ++i) for (size_t i = 0; i < childOfChildCount; ++i)
{ {
domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] ); domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] );
if ( pChildNode ) if ( pChildNode )
@ -1847,7 +1847,7 @@ bool LLDAELoader::verifyController( domController* pController )
{ {
sum += pVertexWeights->getVcount()->getValue()[i]; sum += pVertexWeights->getVcount()->getValue()[i];
} }
result = verifyCount( sum * inputs.getCount(), (domInt) pVertexWeights->getV()->getValue().getCount() ); result = verifyCount( sum * static_cast<U32>(inputs.getCount()), (domInt) static_cast<int>(pVertexWeights->getV()->getValue().getCount()) );
} }
} }
@ -1980,9 +1980,9 @@ void LLDAELoader::processJointNode( domNode* pNode, JointTransformMap& jointTran
//Gather and handle the incoming nodes children //Gather and handle the incoming nodes children
daeTArray< daeSmartRef<daeElement> > childOfChild = pNode->getChildren(); daeTArray< daeSmartRef<daeElement> > childOfChild = pNode->getChildren();
S32 childOfChildCount = childOfChild.getCount(); auto childOfChildCount = childOfChild.getCount();
for (S32 i = 0; i < childOfChildCount; ++i) for (size_t i = 0; i < childOfChildCount; ++i)
{ {
domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] ); domNode* pChildNode = daeSafeCast<domNode>( childOfChild[i] );
if ( pChildNode ) if ( pChildNode )
@ -2192,8 +2192,8 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
//process children //process children
daeTArray< daeSmartRef<daeElement> > children = element->getChildren(); daeTArray< daeSmartRef<daeElement> > children = element->getChildren();
int childCount = children.getCount(); auto childCount = children.getCount();
for (S32 i = 0; i < childCount; i++) for (size_t i = 0; i < childCount; i++)
{ {
processElement(children[i],badElement, dae); processElement(children[i],badElement, dae);
} }
@ -2568,7 +2568,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
ret->remapVolumeFaces(); ret->remapVolumeFaces();
} }
volume_faces = remainder.size(); volume_faces = static_cast<U32>(remainder.size());
models_out.push_back(ret); models_out.push_back(ret);

View File

@ -231,7 +231,7 @@ bool LLGLTFLoader::parseMaterials()
image.numChannels = in_image.component; image.numChannels = in_image.component;
image.bytesPerChannel = in_image.bits >> 3; // Convert bits to bytes image.bytesPerChannel = in_image.bits >> 3; // Convert bits to bytes
image.pixelType = in_image.pixel_type; // Maps exactly, i.e. TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE == GL_UNSIGNED_BYTE, etc image.pixelType = in_image.pixel_type; // Maps exactly, i.e. TINYGLTF_COMPONENT_TYPE_UNSIGNED_BYTE == GL_UNSIGNED_BYTE, etc
image.size = in_image.image.size(); image.size = static_cast<U32>(in_image.image.size());
image.height = in_image.height; image.height = in_image.height;
image.width = in_image.width; image.width = in_image.width;
image.data = in_image.image.data(); image.data = in_image.image.data();

View File

@ -189,7 +189,7 @@ bool LLGLTFMaterial::fromJSON(const std::string& json, std::string& warn_msg, st
tinygltf::Model model_in; tinygltf::Model model_in;
if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), json.length(), "")) if (gltf.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, json.c_str(), static_cast<unsigned int>(json.length()), ""))
{ {
setFromModel(model_in, 0); setFromModel(model_in, 0);

Some files were not shown because too many files have changed in this diff Show More