diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 1e2031b430a6fadd2616a88f78604ca41a912565..e37c97b13894f262f81a5d832075ecfed5b08afe 100644 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -568,7 +568,7 @@ void LLCamera::calculateFrustumPlanes() calculateFrustumPlanes(left, right, top, bottom); } -LLPlane planeFromPoints(LLVector3 p1, LLVector3 p2, LLVector3 p3) +LLPlane planeFromPoints(const LLVector3& p1, const LLVector3& p2, const LLVector3& p3) { LLVector3 n = ((p2-p1)%(p3-p1)); n.normVec(); diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index f6d254d157101e61fb9e6dc0224b3f08027b2c1f..127d041b4a764ce0724b4f64223e19f94a5a8c7a 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -107,7 +107,9 @@ class LLOctreeNode : public LLTreeNode<T> const LLVector4a& size, BaseType* parent, U8 octant = 255) - : mParent((oct_node*)parent), + : mCenter(center), + mSize(size), + mParent((oct_node*)parent), mOctant(octant) { llassert(size[0] >= gOctreeMinSize*0.5f); @@ -115,9 +117,6 @@ class LLOctreeNode : public LLTreeNode<T> mData.push_back(NULL); mDataEnd = &mData[0]; - mCenter = center; - mSize = size; - updateMinMax(); if ((mOctant == 255) && mParent) { diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 185a10088cf264abc09e90b5041aa527bb2c69fd..ae29ceeaf7262a3dd3bb8c46ce36f0ac6952eb1c 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1373,9 +1373,10 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + lerp(0,params.getShear().mV[0],s) + const LLVector2& shearval = params.getShear(); + pt->mPos.set(0 + lerp(0,shearval.mV[0],s) + lerp(-skew ,skew, t) * 0.5f, - c + lerp(0,params.getShear().mV[1],s), + c + lerp(0,shearval.mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), hole_y * lerp(taper_y_begin, taper_y_end, t), @@ -3556,7 +3557,7 @@ bool LLVolumeParams::setSkew(const F32 skew_value) return valid; } -bool LLVolumeParams::setSculptID(const LLUUID sculpt_id, U8 sculpt_type) +bool LLVolumeParams::setSculptID(LLUUID sculpt_id, U8 sculpt_type) { mSculptID = std::move(sculpt_id); mSculptType = sculpt_type; @@ -3763,19 +3764,19 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, LLVector4a t; mat.affineTransform(v[v1], t); - vertices.push_back(LLVector3(t[0], t[1], t[2])); + vertices.emplace_back(LLVector3(t[0], t[1], t[2])); norm_mat.rotate(n[v1], t); t.normalize3fast(); - normals.push_back(LLVector3(t[0], t[1], t[2])); + normals.emplace_back(LLVector3(t[0], t[1], t[2])); mat.affineTransform(v[v2], t); - vertices.push_back(LLVector3(t[0], t[1], t[2])); + vertices.emplace_back(LLVector3(t[0], t[1], t[2])); norm_mat.rotate(n[v2], t); t.normalize3fast(); - normals.push_back(LLVector3(t[0], t[1], t[2])); + normals.emplace_back(LLVector3(t[0], t[1], t[2])); } } } @@ -3947,19 +3948,19 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, LLVector4a t; mat.affineTransform(v[v1], t); - vertices.push_back(LLVector3(t[0], t[1], t[2])); + vertices.emplace_back(LLVector3(t[0], t[1], t[2])); norm_mat.rotate(n[v1], t); t.normalize3fast(); - normals.push_back(LLVector3(t[0], t[1], t[2])); + normals.emplace_back(LLVector3(t[0], t[1], t[2])); mat.affineTransform(v[v2], t); - vertices.push_back(LLVector3(t[0], t[1], t[2])); + vertices.emplace_back(LLVector3(t[0], t[1], t[2])); norm_mat.rotate(n[v2], t); t.normalize3fast(); - normals.push_back(LLVector3(t[0], t[1], t[2])); + normals.emplace_back(LLVector3(t[0], t[1], t[2])); } } } @@ -4131,10 +4132,8 @@ class LLVertexIndexPair }; LLVertexIndexPair::LLVertexIndexPair(const LLVector3 &vertex, const S32 index) -{ - mVertex = vertex; - mIndex = index; -} + : mVertex(vertex), mIndex(index) +{ } const F32 VERTEX_SLOP = 0.00001f; @@ -5692,12 +5691,13 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build) BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) { + const LLPathParams& path_params = volume->getParams().getPathParams(); if (!(mTypeMask & HOLLOW_MASK) && !(mTypeMask & OPEN_MASK) && - ((volume->getParams().getPathParams().getBegin()==0.0f)&& - (volume->getParams().getPathParams().getEnd()==1.0f))&& + ((path_params.getBegin()==0.0f)&& + (path_params.getEnd()==1.0f))&& (volume->getParams().getProfileParams().getCurveType()==LL_PCODE_PROFILE_SQUARE && - volume->getParams().getPathParams().getCurveType()==LL_PCODE_PATH_LINE) + path_params.getCurveType()==LL_PCODE_PATH_LINE) ){ return createUnCutCubeCap(volume, partial_build); } diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index f389119c47ddf0f2ee95ffa79acdfe44cc0f931a..5284b1aaaeb08163a36d30506e621d74db473b01 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -619,7 +619,7 @@ class LLVolumeParams bool setRevolutions(const F32 revolutions); // 1 to 4 bool setRadiusOffset(const F32 radius_offset); bool setSkew(const F32 skew); - bool setSculptID(const LLUUID sculpt_id, U8 sculpt_type); + bool setSculptID(LLUUID sculpt_id, U8 sculpt_type); static bool validate(U8 prof_curve, F32 prof_begin, F32 prof_end, F32 hollow, U8 path_curve, F32 path_begin, F32 path_end, diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 89cdb1c6b9176cb4c42e5774c0632d69bd217147..a8e9ce69f304eb10db8b2a0c08a6aae67b74bd6b 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -68,7 +68,7 @@ BOOL LLVolumeMgr::cleanup() } for (volume_lod_group_map_t::iterator iter = mVolumeLODGroups.begin(), end = mVolumeLODGroups.end(); - iter != end; iter++) + iter != end; ++iter) { LLVolumeLODGroup *volgroupp = iter->second; if (volgroupp->cleanupRefs() == false) @@ -196,7 +196,7 @@ void LLVolumeMgr::dump() } for (volume_lod_group_map_t::iterator iter = mVolumeLODGroups.begin(), end = mVolumeLODGroups.end(); - iter != end; iter++) + iter != end; ++iter) { LLVolumeLODGroup *volgroupp = iter->second; avg += volgroupp->dump(); diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp index 65eb3348de4620f1d8ebc80b3500facee31c491b..8e5fcb82b9b029d49cef9b04a86122f77037e69f 100644 --- a/indra/llmath/m3math.cpp +++ b/indra/llmath/m3math.cpp @@ -244,7 +244,6 @@ LLQuaternion LLMatrix3::quaternion() const LLQuaternion quat; F32 tr, s, q[4]; U32 i, j, k; - U32 nxt[3] = {1, 2, 0}; tr = mMatrix[0][0] + mMatrix[1][1] + mMatrix[2][2]; @@ -260,6 +259,8 @@ LLQuaternion LLMatrix3::quaternion() const } else { + const U32 nxt[3] = { 1, 2, 0 }; + // diagonal is negative i = 0; if (mMatrix[1][1] > mMatrix[0][0]) diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index fa774263b6817c629d6689ef9bca6d8f52916a60..7cd9625ed4a090e8613743b54de045c5662bd309 100644 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -308,7 +308,6 @@ LLQuaternion LLMatrix4::quaternion() const LLQuaternion quat; F32 tr, s, q[4]; U32 i, j, k; - U32 nxt[3] = {1, 2, 0}; tr = mMatrix[0][0] + mMatrix[1][1] + mMatrix[2][2]; @@ -324,6 +323,8 @@ LLQuaternion LLMatrix4::quaternion() const } else { + const U32 nxt[3] = { 1, 2, 0 }; + // diagonal is negative i = 0; if (mMatrix[1][1] > mMatrix[0][0]) diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp index f38fe49bcbf48df9f6fc2606f8f2c0f544c138ea..bf161fbccf4b93d27f158d7d700d605673c399c0 100644 --- a/indra/llmath/raytrace.cpp +++ b/indra/llmath/raytrace.cpp @@ -35,7 +35,7 @@ BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, - const LLVector3 &plane_point, const LLVector3 plane_normal, + const LLVector3 &plane_point, const LLVector3 &plane_normal, LLVector3 &intersection) { F32 N = line_direction * plane_normal; @@ -55,7 +55,7 @@ BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, - const LLVector3 &plane_point, const LLVector3 plane_normal, + const LLVector3 &plane_point, const LLVector3 &plane_normal, LLVector3 &intersection) { F32 N = ray_direction * plane_normal; @@ -81,7 +81,7 @@ BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, - const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, + const LLVector3 &circle_center, const LLVector3 &plane_normal, F32 circle_radius, LLVector3 &intersection) { if (ray_plane(ray_point, ray_direction, circle_center, plane_normal, intersection)) @@ -1105,7 +1105,7 @@ BOOL ray_pyramid(const LLVector3 &ray_point, const LLVector3 &ray_direction, BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, - const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, + const LLVector3 &circle_center, const LLVector3 &plane_normal, F32 circle_radius, LLVector3 &intersection) { LLVector3 ray_direction = point_b - point_a; diff --git a/indra/llmath/raytrace.h b/indra/llmath/raytrace.h index 2d32af0c86653a86661db7d0d5b4fca01589357a..c482a4b41695f5d8c005b13475feb7310ec9b320 100644 --- a/indra/llmath/raytrace.h +++ b/indra/llmath/raytrace.h @@ -63,18 +63,18 @@ class LLQuaternion; // returns TRUE iff line is not parallel to plane. BOOL line_plane(const LLVector3 &line_point, const LLVector3 &line_direction, - const LLVector3 &plane_point, const LLVector3 plane_normal, + const LLVector3 &plane_point, const LLVector3 &plane_normal, LLVector3 &intersection); // returns TRUE iff line is not parallel to plane. BOOL ray_plane(const LLVector3 &ray_point, const LLVector3 &ray_direction, - const LLVector3 &plane_point, const LLVector3 plane_normal, + const LLVector3 &plane_point, const LLVector3 &plane_normal, LLVector3 &intersection); BOOL ray_circle(const LLVector3 &ray_point, const LLVector3 &ray_direction, - const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, + const LLVector3 &circle_center, const LLVector3 &plane_normal, F32 circle_radius, LLVector3 &intersection); // point_0 through point_2 define the plane_normal via the right-hand rule: @@ -171,7 +171,7 @@ BOOL ray_hemicone(const LLVector3 &ray_point, const LLVector3 &ray_direction, BOOL linesegment_circle(const LLVector3 &point_a, const LLVector3 &point_b, - const LLVector3 &circle_center, const LLVector3 plane_normal, F32 circle_radius, + const LLVector3 &circle_center, const LLVector3 &plane_normal, F32 circle_radius, LLVector3 &intersection); // point_0 through point_2 define the plane_normal via the right-hand rule: diff --git a/indra/llmessage/llavatarname.cpp b/indra/llmessage/llavatarname.cpp index 7e1246f88578549f9b337be08c1ace0aed262b9a..3e1545b71702205d56c29b73b03495db63b023c9 100644 --- a/indra/llmessage/llavatarname.cpp +++ b/indra/llmessage/llavatarname.cpp @@ -152,7 +152,7 @@ void LLAvatarName::fromString(const std::string& full_name) else { mLegacyFirstName = full_name; - mLegacyLastName = ""; + mLegacyLastName.clear(); mUsername = full_name; mDisplayName = full_name; } diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index c7931befecfd90e47ac56b182a53a685c3e2134a..117d1c2da6a49f36a2f8cce093ee8480f354f474 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -402,7 +402,6 @@ void LLAvatarNameCache::requestNamesViaLegacy() { static const S32 MAX_REQUESTS = 100; F64 now = LLFrameTimer::getTotalSeconds(); - std::string full_name; ask_queue_t::const_iterator it; for (S32 requests = 0; !mAskQueue.empty() && requests < MAX_REQUESTS; ++requests) { diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 0064b10fefb4505f2b315444e45c37fd3abf3089..47762946292ee2bed2274016ee501ac222df929d 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -434,7 +434,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin // static void LLCacheName::localizeCacheName(std::string key, std::string value) { - if (key!="" && value!= "" ) + if (!key.empty() && !value.empty()) sCacheName[key]=value; else LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL; diff --git a/indra/llmessage/llchainio.h b/indra/llmessage/llchainio.h index 6e4d6c2013868de590fb649554e17d8a2523ae9a..db5a907d1e43ef0c5d49bd2017200938efec3788 100644 --- a/indra/llmessage/llchainio.h +++ b/indra/llmessage/llchainio.h @@ -104,7 +104,7 @@ class LLSimpleIOFactory : public LLChainIOFactory public: virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - chain.push_back(LLIOPipe::ptr_t(new Pipe)); + chain.emplace_back(LLIOPipe::ptr_t(new Pipe)); return true; } }; @@ -123,7 +123,7 @@ class LLCloneIOFactory : public LLChainIOFactory virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - chain.push_back(LLIOPipe::ptr_t(new Pipe(*mOriginal))); + chain.emplace_back(LLIOPipe::ptr_t(new Pipe(*mOriginal))); return true; } diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 337b34922d9a0e29c06252ab7c2040b177d779c8..00b32a676ab064f2b907713094a5fc5da0a5b635 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -43,7 +43,7 @@ LLHost::LLHost(const std::string& ip_and_port) { - std::string::size_type colon_index = ip_and_port.find(":"); + std::string::size_type colon_index = ip_and_port.find(':'); if (colon_index == std::string::npos) { mIP = ip_string_to_u32(ip_and_port.c_str()); diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index d9042fa8b0320d01a0be63eb6b8a42fc4c17e8ca..d85d802f8d32168e4039a7964bdf95904bb7c894 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -725,7 +725,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( if (delimiter == std::string::npos) { mPath = mAbsPathAndQuery; - mQuery = ""; + mQuery.clear(); } else { diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 5c5245f591365a983920b4a45b00a146c50c5211..06fe866dbfdae26897f7444e9f8c829c6b991f43 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -400,7 +400,7 @@ bool LLMessageSystem::isTrustedSender() const static LLMessageSystem::message_template_name_map_t::const_iterator findTemplate(const LLMessageSystem::message_template_name_map_t& templates, - std::string name) + const std::string& name) { const char* namePrehash = LLMessageStringTable::getInstance()->getString(name.c_str()); if(NULL == namePrehash) {return templates.end();} @@ -2054,7 +2054,7 @@ void LLMessageSystem::dispatch( return; } - std::string path = "/message/" + msg_name; + std::string path = absl::StrCat("/message/", msg_name); LLSD context; const LLHTTPNode* handler = messageRootNode().traverse(path, context); if (!handler) @@ -2112,7 +2112,7 @@ void LLMessageSystem::setMessageBans( { LLMessageTemplate* mt = iter->second; - std::string name(mt->mName); + std::string_view name(mt->mName); bool ban_from_trusted = trusted.has(name) && trusted.get(name).asBoolean(); bool ban_from_untrusted @@ -2254,8 +2254,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) return; } - LLUUID local_id; - local_id = cdp->getLocalEndPointID(); + const LLUUID& local_id = cdp->getLocalEndPointID(); if (remote_id == local_id) { // Don't respond to requests that use the same end point ID @@ -2328,8 +2327,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) return; } - LLUUID local_id; - local_id = cdp->getLocalEndPointID(); + const LLUUID& local_id = cdp->getLocalEndPointID(); if (remote_id == local_id) { // Don't respond to requests that use the same end point ID