diff options
author | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
commit | 7c42711ca3a4e67b95473aa5129dce5ff19bea15 (patch) | |
tree | 593c0bedf07bffc79ec4640b157839edf61260f5 /indra/llmessage | |
parent | e0e6e7fd747121442370fc811c84aa34ed612f64 (diff) | |
parent | 9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff) |
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into project/gltf_development
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llassetstorage.cpp | 134 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llcachename.cpp | 8 | ||||
-rw-r--r-- | indra/llmessage/llcircuit.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/llcoproceduremanager.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 122 | ||||
-rw-r--r-- | indra/llmessage/lldatapacker.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/llfiltersd2xmlrpc.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/lliohttpserver.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/lliosocket.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llmail.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llpartdata.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/llproxy.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llpumpio.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/llregionflags.h | 188 | ||||
-rw-r--r-- | indra/llmessage/llsdmessagereader.cpp | 8 | ||||
-rw-r--r-- | indra/llmessage/lltemplatemessagedispatcher.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/llxfer_file.cpp | 2 | ||||
-rw-r--r-- | indra/llmessage/message.cpp | 4 |
19 files changed, 248 insertions, 252 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 13fda24e62..70a7a34a70 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llassetstorage.cpp * @brief Implementation of the base asset storage system. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -74,18 +74,18 @@ namespace return false; } -// Rider: This is the general case of the operator declared above. The code compares the callback -// passed into the LLAssetStorage functions to determine if there are duplicated requests for an -// asset. Unfortunately std::function does not provide a direct way to compare two variables so -// we define the operator here. -// XCode is not very happy with the variadic temples in use below so we will just define the specific +// Rider: This is the general case of the operator declared above. The code compares the callback +// passed into the LLAssetStorage functions to determine if there are duplicated requests for an +// asset. Unfortunately std::function does not provide a direct way to compare two variables so +// we define the operator here. +// XCode is not very happy with the variadic temples in use below so we will just define the specific // case of comparing two LLGetAssetCallback objects since that is all we really use. -// +// // template<typename T, typename... U> // bool operator == (const std::function<T(U...)> &a, const std::function <T(U...)> &b) // { // typedef T(fnType)(U...); -// +// // auto fnPtrA = a.target<T(*)(U...)>(); // auto fnPtrB = b.target<T(*)(U...)>(); // if (fnPtrA && fnPtrB) @@ -112,8 +112,8 @@ LLAssetInfo::LLAssetInfo( void ) LLAssetInfo::LLAssetInfo( const LLUUID& object_id, const LLUUID& creator_id, LLAssetType::EType type, const char* name, const char* desc ) - : mUuid( object_id ), - mCreatorID( creator_id ), + : mUuid( object_id ), + mCreatorID( creator_id ), mType( type ) { setName( name ); @@ -355,7 +355,7 @@ void LLAssetStorage::_init(LLMessageSystem *msg, LLAssetStorage::~LLAssetStorage() { mShutDown = true; - + _cleanupRequests(true, LL_ERR_CIRCUIT_GONE); if (gMessageSystem) @@ -372,7 +372,7 @@ LLAssetStorage::~LLAssetStorage() void LLAssetStorage::setUpstream(const LLHost &upstream_host) { LL_DEBUGS("AppInit") << "AssetStorage: Setting upstream provider to " << upstream_host << LL_ENDL; - + mUpstreamHost = upstream_host; } @@ -398,7 +398,7 @@ void LLAssetStorage::_cleanupRequests(bool all, S32 error) // if all is true, we want to clean up everything // otherwise just check for timed out requests // EXCEPT for upload timeouts - if (all + if (all || ((RT_DOWNLOAD == rt) && LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime))) { @@ -406,7 +406,7 @@ void LLAssetStorage::_cleanupRequests(bool all, S32 error) << (all ? "aborted" : "timed out") << " for " << tmp->getUUID() << "." << LLAssetType::lookup(tmp->getType()) << LL_ENDL; - + timed_out.push_front(tmp); iter = requests->erase(curiter); } @@ -477,11 +477,11 @@ bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetTyp // GET routines /////////////////////////////////////////////////////////////////////////// -// IW - uuid is passed by value to avoid side effects, please don't re-add & +// IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, - LLAssetType::EType type, + LLAssetType::EType type, LLAssetStorage::LLGetAssetCallback callback, - void *user_data, + void *user_data, bool is_priority) { LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL; @@ -546,9 +546,9 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LL_WARNS("AssetStorage") << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL; file.remove(); } - + bool duplicate = false; - + // check to see if there's a pending download of this uuid already for (request_list_t::iterator iter = mPendingDownloads.begin(); iter != mPendingDownloads.end(); ++iter ) @@ -563,7 +563,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, << "." << LLAssetType::lookup(type) << LL_ENDL; return; } - + // this is a duplicate request // queue the request, but don't actually ask for it again duplicate = true; @@ -571,11 +571,11 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, } if (duplicate) { - LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid + LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid << "." << LLAssetType::lookup(type) << LL_ENDL; } - - _queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority); + + _queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority); } } @@ -645,7 +645,7 @@ void LLAssetStorage::downloadCompleteCallback( // Inefficient since we're doing a find through a list that may have thousands of elements. // This is due for refactoring; we will probably change mPendingDownloads into a set. - request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(), + request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(), gAssetStorage->mPendingDownloads.end(), req); @@ -668,7 +668,7 @@ void LLAssetStorage::downloadCompleteCallback( if (vfile.getSize() <= 0) { LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL; - + result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; vfile.remove(); } @@ -693,13 +693,13 @@ void LLAssetStorage::downloadCompleteCallback( void LLAssetStorage::getEstateAsset( const LLHost &object_sim, - const LLUUID &agent_id, + const LLUUID &agent_id, const LLUUID &session_id, - const LLUUID &asset_id, - LLAssetType::EType atype, + const LLUUID &asset_id, + LLAssetType::EType atype, EstateAssetType etype, - LLGetAssetCallback callback, - void *user_data, + LLGetAssetCallback callback, + void *user_data, bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL; @@ -723,7 +723,7 @@ void LLAssetStorage::getEstateAsset( { return; } - + bool exists = LLFileSystem::getExists(asset_id, atype); LLFileSystem file(asset_id, atype); U32 size = exists ? file.getSize() : 0; @@ -836,21 +836,21 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( } void LLAssetStorage::getInvItemAsset( - const LLHost &object_sim, - const LLUUID &agent_id, + const LLHost &object_sim, + const LLUUID &agent_id, const LLUUID &session_id, const LLUUID &owner_id, - const LLUUID &task_id, + const LLUUID &task_id, const LLUUID &item_id, - const LLUUID &asset_id, + const LLUUID &asset_id, LLAssetType::EType atype, - LLGetAssetCallback callback, - void *user_data, + LLGetAssetCallback callback, + void *user_data, bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL; - bool exists = false; + bool exists = false; U32 size = 0; if(asset_id.notNull()) @@ -910,7 +910,7 @@ void LLAssetStorage::getInvItemAsset( spi.setAsset(asset_id, atype); LL_DEBUGS("ViewerAsset") << "requesting inv item id " << item_id << " asset_id " << asset_id << " type " << LLAssetType::lookup(atype) << LL_ENDL; - + // Set our destination file, and the completion callback. LLTransferTargetParamsVFile tpvf; tpvf.setAsset(asset_id, atype); @@ -984,9 +984,9 @@ void LLAssetStorage::downloadInvItemCompleteCallback( // static void LLAssetStorage::uploadCompleteCallback( - const LLUUID& uuid, - void *user_data, - S32 result, + const LLUUID& uuid, + void *user_data, + S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { if (!gAssetStorage) @@ -1125,7 +1125,7 @@ S32 LLAssetStorage::getNumPending(LLAssetStorage::ERequestType rt) const S32 num_pending = -1; if (requests) { - num_pending = requests->size(); + num_pending = static_cast<S32>(requests->size()); } return num_pending; } @@ -1190,7 +1190,7 @@ const LLAssetRequest* LLAssetStorage::findRequest(const LLAssetStorage::request_ LLAssetType::EType asset_type, const LLUUID& asset_id) { - if (requests) + if (requests) { // Search the requests list for the asset. request_list_t::const_iterator iter = requests->begin(); @@ -1213,7 +1213,7 @@ LLAssetRequest* LLAssetStorage::findRequest(LLAssetStorage::request_list_t* requ LLAssetType::EType asset_type, const LLUUID& asset_id) { - if (requests) + if (requests) { // Search the requests list for the asset. request_list_t::iterator iter = requests->begin(); @@ -1296,7 +1296,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re delete req; return true; } - + return false; } @@ -1340,14 +1340,14 @@ const char* LLAssetStorage::getErrorString(S32 status) } } -void LLAssetStorage::getAssetData(const LLUUID uuid, - LLAssetType::EType type, - void (*callback)(const char*, - const LLUUID&, - void *, - S32, - LLExtStat), - void *user_data, +void LLAssetStorage::getAssetData(const LLUUID uuid, + LLAssetType::EType type, + void (*callback)(const char*, + const LLUUID&, + void *, + S32, + LLExtStat), + void *user_data, bool is_priority) { // check for duplicates here, since we're about to fool the normal duplicate checker @@ -1358,7 +1358,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, auto cbptr = tmp->mDownCallback.target<void(*)(const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat)>(); - if (type == tmp->getType() && + if (type == tmp->getType() && uuid == tmp->getUUID() && (cbptr && (*cbptr == legacyGetDataCallback)) && callback == ((LLLegacyAssetRequest *)tmp->mUserData)->mDownCallback && @@ -1369,8 +1369,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, return; } } - - + + LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest; legacy->mDownCallback = callback; @@ -1381,10 +1381,10 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, } // static -void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid, +void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid, LLAssetType::EType type, - void *user_data, - S32 status, + void *user_data, + S32 status, LLExtStat ext_status) { LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data; @@ -1403,7 +1403,7 @@ void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid, uuid.toString(uuid_str); filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type)); - LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ + LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ if (fp) { const S32 buf_size = 65536; @@ -1458,7 +1458,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET std::string filename(in_filename); if (filename.empty()) filename = ll_safe_string(file); - + // Create revised message - new_message = "in_message :: file:line" std::stringstream new_message; new_message << in_message << " :: " << filename << ":" << line; @@ -1531,7 +1531,7 @@ void LLAssetStorage::flushOldToxicAssets( bool force_it ) // Add an item to the toxic asset map void LLAssetStorage::markAssetToxic( const LLUUID& uuid ) -{ +{ if ( !uuid.isNull() ) { // Set the value to the current time. Creates a new entry if needed diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 9910e19499..9b4454a847 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -248,7 +248,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h // Same logic as error response case const LLSD& unresolved_agents = data["bad_ids"]; - S32 num_unresolved = unresolved_agents.size(); + auto num_unresolved = unresolved_agents.size(); if (num_unresolved > 0) { LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; " diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 6fb21957e0..63ac46722a 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -562,13 +562,13 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) { //boost::regexp was showing up in the crashreporter, so doing //painfully manual parsing using substr. LF - S32 open_paren = complete_name.rfind(" ("); - S32 close_paren = complete_name.rfind(')'); + auto open_paren = complete_name.rfind(" ("); + auto close_paren = complete_name.rfind(')'); if (open_paren != std::string::npos && 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); if (legacy_name.length() > 0) @@ -577,7 +577,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) LLStringUtil::toUpper(cap_letter); legacy_name = cap_letter + legacy_name.substr(1); - S32 separator = legacy_name.find('.'); + auto separator = legacy_name.find('.'); if (separator != std::string::npos) { diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index fa206d9282..bf22f3d3f0 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -781,8 +781,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, bool receive_resent) void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) { F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); - S32 count = mPingSet.size(); - S32 cur = 0; + size_t count = mPingSet.size(); + size_t cur = 0; // Only process each circuit once at most, stop processing if no circuits while((cur < count) && !mPingSet.empty()) diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index 959cfb2762..263670bdac 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -87,7 +87,7 @@ public: /// inline S32 count() const { - return countPending() + countActive(); + return static_cast<S32>(countPending() + countActive()); } void close(); diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 7619b46fed..684e96883f 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llcorehttputil.cpp * @date 2014-08-25 * @brief Implementation of adapter and utility classes expanding the llcorehttp interfaces. @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2014, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -48,7 +48,7 @@ namespace LLCoreHttpUtil const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f; -namespace +namespace { const std::string HTTP_LOGBODY_KEY("HTTPLogBodyOnError"); @@ -87,9 +87,9 @@ void logMessageFail(std::string logAuth, std::string url, std::string message) } //========================================================================= -/// The HttpRequestPumper is a utility class. When constructed it will poll the +/// The HttpRequestPumper is a utility class. When constructed it will poll the /// supplied HttpRequest once per frame until it is destroyed. -/// +/// class HttpRequestPumper { public: @@ -261,7 +261,7 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons LLCore::HttpStatus status = response->getStatus(); if (status == LLCore::HttpStatus(LLCore::HttpStatus::LLCORE, LLCore::HE_HANDLE_NOT_FOUND)) - { // A response came in for a canceled request and we have not processed the + { // A response came in for a canceled request and we have not processed the // cancel yet. Patience! return; } @@ -273,9 +273,9 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons LLCore::HttpStatus::type_enum_t errType = status.getType(); LL_INFOS() - << "Possible failure [" << status.toTerseString() << "] cannot "<< response->getRequestMethod() + << "Possible failure [" << status.toTerseString() << "] cannot "<< response->getRequestMethod() << " url '" << response->getRequestURL() - << "' because " << status.toString() + << "' because " << status.toString() << LL_ENDL; if ((errType >= 400) && (errType < 500)) { @@ -360,13 +360,13 @@ void HttpCoroHandler::writeStatusCodes(LLCore::HttpStatus status, const std::str } //========================================================================= -/// The HttpCoroLLSDHandler is a specialization of the LLCore::HttpHandler for -/// interacting with coroutines. When the request is completed the response +/// The HttpCoroLLSDHandler is a specialization of the LLCore::HttpHandler for +/// interacting with coroutines. When the request is completed the response /// will be posted onto the supplied Event Pump. -/// +/// /// If the LLSD retrieved from through the HTTP connection is not in the form /// of a LLSD::map it will be returned as in an llsd["content"] element. -/// +/// /// The LLSD posted back to the coroutine will have the following additions: /// llsd["http_result"] -+- ["message"] - An error message returned from the HTTP status /// +- ["status"] - The status code associated with the HTTP call @@ -374,7 +374,7 @@ void HttpCoroHandler::writeStatusCodes(LLCore::HttpStatus status, const std::str /// +- ["type"] - The LLCore::HttpStatus type associted with the HTTP call /// +- ["url"] - The URL used to make the call. /// +- ["headers"] - A map of name name value pairs with the HTTP headers. -/// +/// class HttpCoroLLSDHandler : public HttpCoroHandler { public: @@ -390,7 +390,7 @@ HttpCoroLLSDHandler::HttpCoroLLSDHandler(LLEventStream &reply): HttpCoroHandler(reply) { } - + LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::HttpStatus &status) { @@ -424,7 +424,7 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: #endif if (!success) - { + { #if 1 // Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml' LLCore::HttpHeaders::ptr_t headers(response->getHeaders()); @@ -440,13 +440,13 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: status = LLCore::HttpStatus(499, "Failed to deserialize LLSD."); } #endif - // If we've gotten to this point and the result LLSD is still undefined + // If we've gotten to this point and the result LLSD is still undefined // either there was an issue deserializing the body or the response was // blank. Create an empty map to hold the result either way. result = LLSD::emptyMap(); } else if (!result.isMap()) - { // The results are not themselves a map. Move them down so that + { // The results are not themselves a map. Move them down so that // this method can return a map to the caller. // *TODO: Should it always do this? LLSD newResult = LLSD::emptyMap(); @@ -476,13 +476,13 @@ LLSD HttpCoroLLSDHandler::parseBody(LLCore::HttpResponse *response, bool &succes //======================================================================== -/// The HttpCoroRawHandler is a specialization of the LLCore::HttpHandler for -/// interacting with coroutines. -/// -/// In addition to the normal "http_results" the returned LLSD will contain +/// The HttpCoroRawHandler is a specialization of the LLCore::HttpHandler for +/// interacting with coroutines. +/// +/// In addition to the normal "http_results" the returned LLSD will contain /// an entry keyed with "raw" containing the unprocessed results of the HTTP /// call. -/// +/// class HttpCoroRawHandler : public HttpCoroHandler { public: @@ -515,9 +515,9 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:: #if 1 // This is the slower implementation. It is safe vis-a-vi the const_cast<> and modification // of a LLSD managed array but contains an extra (potentially large) copy. - // + // // *TODO: https://jira.secondlife.com/browse/MAINT-5221 - + LLSD::Binary data; data.reserve(size); bas >> std::noskipws; @@ -526,12 +526,12 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:: result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = data; #else - // This is disabled because it's dangerous. See the other case for an + // This is disabled because it's dangerous. See the other case for an // alternate implementation. // We create a new LLSD::Binary object and assign it to the result map. - // The LLSD has created it's own copy so we retrieve it asBinary and const cast + // The LLSD has created it's own copy so we retrieve it asBinary and const cast // the reference so that we can modify it. - // *TODO: This is potentially dangerous... but I am trying to avoid a potentially + // *TODO: This is potentially dangerous... but I am trying to avoid a potentially // large copy. result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = LLSD::Binary(); LLSD::Binary &data = const_cast<LLSD::Binary &>( result[HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary() ); @@ -551,13 +551,13 @@ LLSD HttpCoroRawHandler::parseBody(LLCore::HttpResponse *response, bool &success } //======================================================================== -/// The HttpCoroJSONHandler is a specialization of the LLCore::HttpHandler for -/// interacting with coroutines. -/// -/// In addition to the normal "http_results" the returned LLSD will contain -/// JSON entries will be converted into an LLSD map. All results are considered +/// The HttpCoroJSONHandler is a specialization of the LLCore::HttpHandler for +/// interacting with coroutines. +/// +/// In addition to the normal "http_results" the returned LLSD will contain +/// JSON entries will be converted into an LLSD map. All results are considered /// strings -/// +/// class HttpCoroJSONHandler : public HttpCoroHandler { public: @@ -692,7 +692,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = requestPostWithLLSD(request, mPolicyId, url, body, options, headers, @@ -730,7 +730,7 @@ LLSD HttpCoroutineAdapter::postRawAndSuspend(LLCore::HttpRequest::ptr_t request, return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } -// *TODO: This functionality could be moved into the LLCore::Http library itself +// *TODO: This functionality could be moved into the LLCore::Http library itself // by having the CURL layer read the file directly. LLSD HttpCoroutineAdapter::postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, std::string fileName, @@ -759,7 +759,7 @@ LLSD HttpCoroutineAdapter::postFileAndSuspend(LLCore::HttpRequest::ptr_t request return postAndSuspend(request, url, fileData, options, headers); } -// *TODO: This functionality could be moved into the LLCore::Http library itself +// *TODO: This functionality could be moved into the LLCore::Http library itself // by having the CURL layer read the file directly. LLSD HttpCoroutineAdapter::postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, @@ -776,7 +776,7 @@ LLSD HttpCoroutineAdapter::postFileAndSuspend(LLCore::HttpRequest::ptr_t request U8* fileBuffer; fileBuffer = new U8[fileSize]; vfile.read(fileBuffer, fileSize); - + outs.write((char*)fileBuffer, fileSize); delete[] fileBuffer; } @@ -816,7 +816,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = request->requestPost(mPolicyId, url, rawbody.get(), options, headers, handler); @@ -873,7 +873,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = requestPutWithLLSD(request, mPolicyId, url, body, options, headers, @@ -900,7 +900,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = request->requestPut(mPolicyId, url, rawbody.get(), options, headers, handler); @@ -950,13 +950,13 @@ LLSD HttpCoroutineAdapter::getJsonAndSuspend(LLCore::HttpRequest::ptr_t request, LLSD HttpCoroutineAdapter::getAndSuspend_(LLCore::HttpRequest::ptr_t &request, const std::string & url, - LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, + LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) { HttpRequestPumper pumper(request); checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = request->requestGet(mPolicyId, url, options, headers, handler); @@ -985,7 +985,7 @@ LLSD HttpCoroutineAdapter::deleteAndSuspend(LLCore::HttpRequest::ptr_t request, } LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request, - const std::string & url, + const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); @@ -996,13 +996,13 @@ LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t reque LLSD HttpCoroutineAdapter::deleteAndSuspend_(LLCore::HttpRequest::ptr_t &request, - const std::string & url, LLCore::HttpOptions::ptr_t &options, + const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) { HttpRequestPumper pumper(request); checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = request->requestDelete(mPolicyId, url, options, headers, handler); @@ -1039,7 +1039,7 @@ LLSD HttpCoroutineAdapter::patchAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. LLCore::HttpHandle hhandle = requestPatchWithLLSD(request, mPolicyId, url, body, options, headers, @@ -1073,7 +1073,7 @@ LLSD HttpCoroutineAdapter::copyAndSuspend(LLCore::HttpRequest::ptr_t request, LLSD HttpCoroutineAdapter::copyAndSuspend_(LLCore::HttpRequest::ptr_t &request, - const std::string & url, + const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) { @@ -1081,9 +1081,9 @@ LLSD HttpCoroutineAdapter::copyAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. - // + // LLCore::HttpHandle hhandle = request->requestCopy(mPolicyId, url, options, headers, handler); @@ -1123,9 +1123,9 @@ LLSD HttpCoroutineAdapter::moveAndSuspend_(LLCore::HttpRequest::ptr_t &request, checkDefaultHeaders(headers); - // The HTTPCoroHandler does not self delete, so retrieval of a the contained + // The HTTPCoroHandler does not self delete, so retrieval of a the contained // pointer from the smart pointer is safe in this case. - // + // LLCore::HttpHandle hhandle = request->requestMove(mPolicyId, url, options, headers, handler); @@ -1174,7 +1174,7 @@ void HttpCoroutineAdapter::cancelSuspendedOperation() } } -void HttpCoroutineAdapter::saveState(LLCore::HttpHandle yieldingHandle, +void HttpCoroutineAdapter::saveState(LLCore::HttpHandle yieldingHandle, LLCore::HttpRequest::ptr_t &request, HttpCoroHandler::ptr_t &handler) { mWeakRequest = request; @@ -1190,15 +1190,15 @@ void HttpCoroutineAdapter::cleanState() } /*static*/ -LLSD HttpCoroutineAdapter::buildImmediateErrorResult(const LLCore::HttpRequest::ptr_t &request, - const std::string &url) +LLSD HttpCoroutineAdapter::buildImmediateErrorResult(const LLCore::HttpRequest::ptr_t &request, + const std::string &url) { LLCore::HttpStatus status = request->getStatus(); LL_WARNS("CoreHTTP") << "Error posting to " << url << " Status=" << status.getStatus() << " message = " << status.getMessage() << LL_ENDL; - // Mimic the status results returned from an http error that we had - // to wait on + // Mimic the status results returned from an http error that we had + // to wait on LLSD httpresults = LLSD::emptyMap(); HttpCoroHandler::writeStatusCodes(status, url, httpresults); @@ -1228,7 +1228,7 @@ void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpR /*static*/ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::string &success, const std::string &failure) { - completionCallback_t cbSuccess = (success.empty()) ? NULL : + completionCallback_t cbSuccess = (success.empty()) ? NULL : static_cast<completionCallback_t>(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success)); completionCallback_t cbFailure = (failure.empty()) ? NULL : static_cast<completionCallback_t>(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure)); @@ -1253,7 +1253,7 @@ void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest:: LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) - { + { if (failure) { failure(httpResults); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 134f34aafa..e911150787 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -237,7 +237,7 @@ bool LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, 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)) { @@ -740,7 +740,7 @@ bool LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n } 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 diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index df78652361..84b56d54bf 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -274,12 +274,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) if(!buffer.empty()) { // *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]; b64_buffer_length = apr_base64_encode_binary( b64_buffer, &buffer[0], - buffer.size()); + static_cast<int>(buffer.size())); ostr.write(b64_buffer, b64_buffer_length - 1); delete[] b64_buffer; } diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 9791a20743..e562f09844 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -494,7 +494,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( LLChangeChannel change(channels.in(), channels.out()); std::for_each(buffer->beginSegment(), buffer->endSegment(), change); 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; return STATUS_DONE; } diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index a14d10fe5f..f2192acee0 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -346,7 +346,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( PUMP_DEBUG; len = READ_BUFFER_SIZE; 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)); LL_DEBUGS() << "socket read status: " << status << LL_ENDL; LLIOPipe::EStatus rv = STATUS_OK; diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index ca027d7675..9e10a356db 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -273,7 +273,7 @@ bool LLMail::send( std::string good_string = "\n..\n"; while (1) { - int index = message.find(bad_string); + auto index = message.find(bad_string); if (index == std::string::npos) break; message.replace(index, bad_string.size(), good_string); } diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 296f4b5464..d4cf95c1e3 100644 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -289,14 +289,14 @@ bool LLPartSysData::unpack(LLDataPacker &dp) //skip to LLPartData block U8 feh = 0; - for (U32 i = 0; i < size; ++i) + for (S32 i = 0; i < size; ++i) { dp.unpackU8(feh, "whippang"); } dp.unpackS32(size, "partsize"); //skip LLPartData block - for (U32 i = 0; i < size; ++i) + for (S32 i = 0; i < size; ++i) { dp.unpackU8(feh, "whippang"); } diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 3e1e5daa02..864e68998c 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -123,7 +123,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy) // The server has requested a username/password combination std::string socks_username(getSocksUser()); 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]; password_auth[0] = 0x01; password_auth[1] = (char)(socks_username.size()); diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index d3b75cf86b..e1cd70b216 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -818,7 +818,7 @@ void LLPumpIO::rebuildPollset() running_chains_t::iterator run_end = mRunningChains.end(); 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; if(size) diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 4f23c4d160..2b7ba80a78 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -28,83 +28,83 @@ #define LL_LLREGIONFLAGS_H // 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? -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? -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? -const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1 << 3); +constexpr U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT = (1ULL << 3); // 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? -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, // 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. -const U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7); +constexpr U64 REGION_FLAGS_BLOCK_LAND_RESELL = (1ULL << 7); // 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 -const U64 REGION_FLAGS_SKIP_SCRIPTS = (1 << 13); -const U64 REGION_FLAGS_SKIP_PHYSICS = (1 << 14); // Skip all physics -const U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1 << 15); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); -const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); -const U64 REGION_FLAGS_BLOCK_DWELL = (1 << 18); +constexpr U64 REGION_FLAGS_SKIP_COLLISIONS = (1ULL << 12); // Pin all non agent rigid bodies +constexpr U64 REGION_FLAGS_SKIP_SCRIPTS = (1ULL << 13); +constexpr U64 REGION_FLAGS_SKIP_PHYSICS = (1ULL << 14); // Skip all physics +constexpr U64 REGION_FLAGS_EXTERNALLY_VISIBLE = (1ULL << 15); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1ULL << 16); +constexpr U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1ULL << 17); +constexpr U64 REGION_FLAGS_BLOCK_DWELL = (1ULL << 18); // Is flight allowed? -const U64 REGION_FLAGS_BLOCK_FLY = (1 << 19); +constexpr U64 REGION_FLAGS_BLOCK_FLY = (1ULL << 19); // 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 // moment. This is the similar skip scripts, except this flag is // 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); -const U64 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); +constexpr U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1ULL << 29); +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 | - REGION_FLAGS_ALLOW_SET_HOME | - REGION_FLAGS_ALLOW_PARCEL_CHANGES | - REGION_FLAGS_ALLOW_VOICE; +constexpr U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME | + REGION_FLAGS_ALLOW_PARCEL_CHANGES | + REGION_FLAGS_ALLOW_VOICE; -const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; -const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK - | REGION_FLAGS_ALLOW_SET_HOME; +constexpr U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; +constexpr U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK | + REGION_FLAGS_ALLOW_SET_HOME; -const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE - | REGION_FLAGS_SUN_FIXED - | REGION_FLAGS_DENY_ANONYMOUS - | REGION_FLAGS_DENY_AGEUNVERIFIED; +constexpr U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE | + REGION_FLAGS_SUN_FIXED | + REGION_FLAGS_DENY_ANONYMOUS | + REGION_FLAGS_DENY_AGEUNVERIFIED; inline bool is_flag_set(U64 flags, U64 flag) { @@ -133,79 +133,75 @@ inline U64 unset_prelude_flags(U64 flags) } // 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. -const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic -const U32 ESTATE_MAINLAND = 1; -const U32 ESTATE_ORIENTATION = 2; -const U32 ESTATE_INTERNAL = 3; -const U32 ESTATE_SHOWCASE = 4; -const U32 ESTATE_TEEN = 5; -const U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate +constexpr U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic +constexpr U32 ESTATE_MAINLAND = 1; +constexpr U32 ESTATE_ORIENTATION = 2; +constexpr U32 ESTATE_INTERNAL = 3; +constexpr U32 ESTATE_SHOWCASE = 4; +constexpr U32 ESTATE_TEEN = 5; +constexpr U32 ESTATE_LAST_LINDEN = 5; // last linden owned/managed estate // for EstateOwnerRequest, setaccess message -const U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; -const U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; -const U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; -const U32 ESTATE_ACCESS_MANAGERS = 1 << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENTS = 1 << 0; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUPS = 1 << 1; +constexpr U32 ESTATE_ACCESS_BANNED_AGENTS = 1 << 2; +constexpr U32 ESTATE_ACCESS_MANAGERS = 1 << 3; //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 -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 - | ESTATE_ACCESS_ALLOWED_GROUPS - | ESTATE_ACCESS_BANNED_AGENTS - | ESTATE_ACCESS_MANAGERS; +constexpr U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS + | ESTATE_ACCESS_ALLOWED_GROUPS + | ESTATE_ACCESS_BANNED_AGENTS + | ESTATE_ACCESS_MANAGERS; // for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages -const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; -const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; - -const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; -const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; -const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; -const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; -const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; -const U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; -const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; -const U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; -const U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; - -const S32 ESTATE_MAX_MANAGERS = 20; -const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access -const S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned -const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; +constexpr U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0; +constexpr U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1; + +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2; +constexpr U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4; +constexpr U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6; +constexpr U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7; +constexpr U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8; +constexpr U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9; +constexpr U32 ESTATE_ACCESS_NO_REPLY = 1U << 10; +constexpr U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11; + +constexpr S32 ESTATE_MAX_MANAGERS = 20; +constexpr S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access +constexpr S32 ESTATE_MAX_BANNED_IDS = 750; // max for banned +constexpr S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; // 'Sim Wide Delete' flags -const U32 SWD_OTHERS_LAND_ONLY = (1 << 0); -const U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); -const U32 SWD_SCRIPTED_ONLY = (1 << 2); +constexpr U32 SWD_OTHERS_LAND_ONLY = (1 << 0); +constexpr U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1); +constexpr U32 SWD_SCRIPTED_ONLY = (1 << 2); // Controls experience key validity in the estate -const U32 EXPERIENCE_KEY_TYPE_NONE = 0; -const U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; -const U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; -const U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; +constexpr U32 EXPERIENCE_KEY_TYPE_NONE = 0; +constexpr U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1; +constexpr U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2; +constexpr U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3; -const U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; -const U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; +constexpr U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED; +constexpr U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED; // -const U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; -const U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; -const U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; -const U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; -const U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; -const U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; - -const S32 ESTATE_MAX_EXPERIENCE_IDS = 8; - - +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2; +constexpr U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4; +constexpr U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6; +constexpr U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7; + +constexpr S32 ESTATE_MAX_EXPERIENCE_IDS = 8; #endif - - diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 8be6158d82..6ade7c0dad 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -242,7 +242,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, return; } std::string data = getLLSD(mMessage, block, var, blocknum); - S32 data_size = data.size(); + auto data_size = data.size(); if (data_size >= buffer_size) { data_size = buffer_size - 1; @@ -261,7 +261,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, //virtual S32 LLSDMessageReader::getNumberOfBlocks(const char *blockname) { - return mMessage[blockname].size(); + return static_cast<S32>(mMessage[blockname].size()); } S32 getElementSize(const LLSD& llsd) @@ -276,7 +276,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeReal: return sizeof(F64); case LLSD::TypeString: - return llsd.size(); + return static_cast<S32>(llsd.size()); case LLSD::TypeUUID: return sizeof(LLUUID); case LLSD::TypeDate: @@ -286,7 +286,7 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeBinary: { std::vector<U8> data = llsd; - return data.size() * sizeof(U8); + return static_cast<S32>(data.size() * sizeof(U8)); } case LLSD::TypeMap: case LLSD::TypeArray: diff --git a/indra/llmessage/lltemplatemessagedispatcher.cpp b/indra/llmessage/lltemplatemessagedispatcher.cpp index 267c201705..0e709d6c75 100644 --- a/indra/llmessage/lltemplatemessagedispatcher.cpp +++ b/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -44,7 +44,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHTTPNode::ResponsePtr responsep) { std::vector<U8> data = message["body"]["binary-template-data"].asBinary(); - U32 size = data.size(); + auto size = data.size(); if(size == 0) { return; @@ -53,7 +53,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name, LLHost host; 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) { diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index ad15d5969b..71b910297b 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -317,7 +317,7 @@ S32 LLXfer_File::flush() 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) { LL_WARNS("Xfer") << "Non-matching write size, requested " << mBufferLength diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index e705c36ff8..cfa5178fc6 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -2172,7 +2172,7 @@ S32 LLMessageSystem::sendError( if (LLMessageConfig::getMessageFlavor(ERROR_MESSAGE_NAME) == 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) { pack_data = false; @@ -2180,7 +2180,7 @@ S32 LLMessageSystem::sendError( } if(pack_data) { - addBinaryData("Data", (void*)temp.c_str(), temp.size()); + addBinaryData("Data", (void*)temp.c_str(), static_cast<S32>(temp.size())); } else { |