diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-07-27 15:17:57 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-07-28 08:24:59 +0800 |
commit | 96a81b5ecbe3bffb582ded930752c0523df5e80a (patch) | |
tree | a87a0bd09fd980562e88150dbfea3819d28d9f12 /indra/llmessage | |
parent | 06e8f0c443c1ba7858d000c6d695b7e988e02053 (diff) | |
parent | ed73208eb96b862b97fa285036edea1e792ca3c6 (diff) |
Merge remote-tracking branch 'secondlife/release/2024.06-atlasaurus' into 2024.06-atlasaurus
Diffstat (limited to 'indra/llmessage')
90 files changed, 1366 insertions, 1360 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index c1e4967b24..56c93ca5af 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -12,7 +12,6 @@ if (LL_TESTS) include(LLAddBuildTest) endif () include(Python) -include(JsonCpp) set(llmessage_SOURCE_FILES llassetstorage.cpp diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 734b7a8a63..70a7a34a70 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -198,14 +198,14 @@ LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetTy mDownCallback(), mUserData(NULL), mHost(), - mIsTemp(FALSE), - mIsPriority(FALSE), - mDataSentInFirstPacket(FALSE), - mDataIsInCache(FALSE) + mIsTemp(false), + mIsPriority(false), + mDataSentInFirstPacket(false), + mDataIsInCache(false) { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. - mTime = LLMessageSystem::getMessageTimeSeconds(TRUE); + mTime = LLMessageSystem::getMessageTimeSeconds(true); } // virtual @@ -228,8 +228,8 @@ LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type : LLBaseDownloadRequest(uuid, type), mUpCallback(), mInfoCallback( NULL ), - mIsLocal(FALSE), - mIsUserWaiting(FALSE), + mIsLocal(false), + mIsUserWaiting(false), mTimeout(LL_ASSET_STORAGE_TIMEOUT), mBytesFetched(0) { @@ -344,7 +344,7 @@ void LLAssetStorage::_init(LLMessageSystem *msg, LLXferManager *xfer, const LLHost &upstream_host) { - mShutDown = FALSE; + mShutDown = false; mMessageSys = msg; mXferManager = xfer; @@ -354,9 +354,9 @@ void LLAssetStorage::_init(LLMessageSystem *msg, LLAssetStorage::~LLAssetStorage() { - mShutDown = TRUE; + mShutDown = true; - _cleanupRequests(TRUE, LL_ERR_CIRCUIT_GONE); + _cleanupRequests(true, LL_ERR_CIRCUIT_GONE); if (gMessageSystem) { @@ -378,10 +378,10 @@ void LLAssetStorage::setUpstream(const LLHost &upstream_host) void LLAssetStorage::checkForTimeouts() { - _cleanupRequests(FALSE, LL_ERR_TCP_TIMEOUT); + _cleanupRequests(false, LL_ERR_TCP_TIMEOUT); } -void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) +void LLAssetStorage::_cleanupRequests(bool all, S32 error) { F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds(); @@ -436,7 +436,7 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) } -BOOL LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) +bool LLAssetStorage::hasLocalAsset(const LLUUID &uuid, const LLAssetType::EType type) { return LLFileSystem::getExists(uuid, type); } @@ -450,7 +450,7 @@ bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetTyp llassert(callback != NULL); } - BOOL exists = LLFileSystem::getExists(uuid, type); + bool exists = LLFileSystem::getExists(uuid, type); if (exists) { LLFileSystem file(uuid, type); @@ -482,7 +482,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLAssetStorage::LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL; @@ -523,7 +523,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, return; } - BOOL exists = LLFileSystem::getExists(uuid, type); + bool exists = LLFileSystem::getExists(uuid, type); LLFileSystem file(uuid, type); U32 size = exists ? file.getSize() : 0; @@ -547,7 +547,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, file.remove(); } - BOOL duplicate = FALSE; + bool duplicate = false; // check to see if there's a pending download of this uuid already for (request_list_t::iterator iter = mPendingDownloads.begin(); @@ -566,7 +566,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, // this is a duplicate request // queue the request, but don't actually ask for it again - duplicate = TRUE; + duplicate = true; } } if (duplicate) @@ -700,7 +700,7 @@ void LLAssetStorage::getEstateAsset( EstateAssetType etype, LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL; @@ -724,7 +724,7 @@ void LLAssetStorage::getEstateAsset( return; } - BOOL exists = LLFileSystem::getExists(asset_id, atype); + bool exists = LLFileSystem::getExists(asset_id, atype); LLFileSystem file(asset_id, atype); U32 size = exists ? file.getSize() : 0; @@ -846,7 +846,7 @@ void LLAssetStorage::getInvItemAsset( LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, - BOOL is_priority) + bool is_priority) { LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL; @@ -995,12 +995,12 @@ void LLAssetStorage::uploadCompleteCallback( return; } LLAssetRequest *req = (LLAssetRequest *)user_data; - BOOL success = TRUE; + bool success = true; if (result) { LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL; - success = FALSE; + success = false; } // we're done grabbing the file, tell the client @@ -1020,7 +1020,7 @@ void LLAssetStorage::processUploadComplete(LLMessageSystem *msg, void **user_dat LLUUID uuid; S8 asset_type_s8; LLAssetType::EType asset_type; - BOOL success = FALSE; + bool success = false; msg->getUUIDFast(_PREHASH_AssetBlock, _PREHASH_UUID, uuid); msg->getS8Fast(_PREHASH_AssetBlock, _PREHASH_Type, asset_type_s8); @@ -1030,7 +1030,7 @@ void LLAssetStorage::processUploadComplete(LLMessageSystem *msg, void **user_dat this_ptr->_callUploadCallbacks(uuid, asset_type, success, LLExtStat::NONE); } -void LLAssetStorage::_callUploadCallbacks(const LLUUID &uuid, LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status ) +void LLAssetStorage::_callUploadCallbacks(const LLUUID &uuid, LLAssetType::EType asset_type, bool success, LLExtStat ext_status ) { // SJB: We process the callbacks in reverse order, I do not know if this is important, // but I didn't want to mess with it. @@ -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; } @@ -1348,7 +1348,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, S32, LLExtStat), void *user_data, - BOOL is_priority) + bool is_priority) { // check for duplicates here, since we're about to fool the normal duplicate checker for (request_list_t::iterator iter = mPendingDownloads.begin(); @@ -1391,7 +1391,7 @@ void LLAssetStorage::legacyGetDataCallback(const LLUUID &uuid, std::string filename; // Check if the asset is marked toxic, and don't load bad stuff - BOOL toxic = gAssetStorage->isAssetToxic( uuid ); + bool toxic = gAssetStorage->isAssetToxic( uuid ); if ( !status && !toxic ) @@ -1489,9 +1489,9 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET // Check if an asset is in the toxic map. If it is, the entry is updated -BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) +bool LLAssetStorage::isAssetToxic( const LLUUID& uuid ) { - BOOL is_toxic = FALSE; + bool is_toxic = false; if ( !uuid.isNull() ) { @@ -1499,7 +1499,7 @@ BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) if ( iter != mToxicAssetMap.end() ) { // Found toxic asset (*iter).second = LLFrameTimer::getTotalTime() + TOXIC_ASSET_LIFETIME; - is_toxic = TRUE; + is_toxic = true; } } return is_toxic; @@ -1509,7 +1509,7 @@ BOOL LLAssetStorage::isAssetToxic( const LLUUID& uuid ) // Clean the toxic asset list, remove old entries -void LLAssetStorage::flushOldToxicAssets( BOOL force_it ) +void LLAssetStorage::flushOldToxicAssets( bool force_it ) { // Scan and look for old entries U64 now = LLFrameTimer::getTotalTime(); diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 8a22f3f031..88fa572092 100644 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -122,11 +122,11 @@ public: void *mUserData; LLHost mHost; - BOOL mIsTemp; + bool mIsTemp; F64Seconds mTime; // Message system time - BOOL mIsPriority; - BOOL mDataSentInFirstPacket; - BOOL mDataIsInCache; + bool mIsPriority; + bool mDataSentInFirstPacket; + bool mDataIsInCache; }; class LLAssetRequest : public LLBaseDownloadRequest @@ -143,8 +143,8 @@ public: // void (*mUpCallback)(const LLUUID&, void *, S32, LLExtStat); void (*mInfoCallback)(LLAssetInfo *, void *, S32); - BOOL mIsLocal; - BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. + bool mIsLocal; + bool mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. F64Seconds mTimeout; // Amount of time before timing out. LLUUID mRequestingAgentID; // Only valid for uploads from an agent F64 mBytesFetched; @@ -209,7 +209,7 @@ public: }; protected: - BOOL mShutDown; + bool mShutDown; LLHost mUpstreamHost; LLMessageSystem *mMessageSys; @@ -232,11 +232,11 @@ public: void setUpstream(const LLHost &upstream_host); - BOOL hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type); + bool hasLocalAsset(const LLUUID &uuid, LLAssetType::EType type); // public interface methods // note that your callback may get called BEFORE the function returns - void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); + void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, bool is_priority = false); /* * TransactionID version @@ -259,19 +259,19 @@ public: void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, - LLGetAssetCallback callback, void *user_data, BOOL is_priority); + LLGetAssetCallback callback, void *user_data, bool is_priority); void getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id, const LLUUID &asset_id, LLAssetType::EType atype, - LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE); // Get a particular inventory item. + LLGetAssetCallback cb, void *user_data, bool is_priority = false); // Get a particular inventory item. // Check if an asset is in the toxic map. If it is, the entry is updated - BOOL isAssetToxic( const LLUUID& uuid ); + bool isAssetToxic( const LLUUID& uuid ); // Clean the toxic asset list, remove old entries - void flushOldToxicAssets( BOOL force_it ); + void flushOldToxicAssets( bool force_it ); // Add an item to the toxic asset map void markAssetToxic( const LLUUID& uuid ); @@ -352,7 +352,7 @@ public: // deprecated file-based methods // Not overriden - void getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, BOOL is_priority = FALSE); + void getAssetData(const LLUUID uuid, LLAssetType::EType type, void (*callback)(const char*, const LLUUID&, void *, S32, LLExtStat), void *user_data, bool is_priority = false); /* * TransactionID version @@ -374,12 +374,12 @@ public: // add extra methods to handle metadata protected: - void _cleanupRequests(BOOL all, S32 error); - void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, BOOL success, LLExtStat ext_status); + void _cleanupRequests(bool all, S32 error); + void _callUploadCallbacks(const LLUUID &uuid, const LLAssetType::EType asset_type, bool success, LLExtStat ext_status); virtual void _queueDataRequest(const LLUUID& uuid, LLAssetType::EType type, LLGetAssetCallback callback, - void *user_data, BOOL duplicate, - BOOL is_priority) = 0; + void *user_data, bool duplicate, + bool is_priority) = 0; private: void _init(LLMessageSystem *msg, diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index a0cd6f93c1..9b4454a847 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -45,6 +45,7 @@ #include "llcorehttputil.h" #include "llexception.h" #include "stringize.h" +#include "workqueue.h" #include <map> #include <set> @@ -179,19 +180,26 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU if (LLAvatarNameCache::instanceExists()) { - if (!success) - { // on any sort of failure add dummy records for any agent IDs - // in this request that we do not have cached already - std::vector<LLUUID>::const_iterator it = agentIds.begin(); - for (; it != agentIds.end(); ++it) - { - const LLUUID& agent_id = *it; - LLAvatarNameCache::getInstance()->handleAgentError(agent_id); - } - return; - } + // dispatch handler execution back to mainloop + auto workqueue = LL::WorkQueue::getInstance("mainloop"); - LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); + if (workqueue) + { + workqueue->post([=]() + { + if (!success) + { // on any sort of failure add dummy records for any agent IDs + // in this request that we do not have cached already + for (const auto& agent_id : agentIds) + { + LLAvatarNameCache::getInstance()->handleAgentError(agent_id); + } + return; + } + + LLAvatarNameCache::getInstance()->handleAvNameCacheSuccess(results, httpResults); + }); + } } } catch (const LLCoros::Stop&) @@ -240,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/llblowfishcipher.h b/indra/llmessage/llblowfishcipher.h index 2343882cee..53dc94cce9 100644 --- a/indra/llmessage/llblowfishcipher.h +++ b/indra/llmessage/llblowfishcipher.h @@ -46,7 +46,7 @@ public: /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const; #ifdef _DEBUG - static BOOL testHarness(); + static bool testHarness(); #endif private: diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index d5b967a8e9..63ac46722a 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -99,7 +99,7 @@ public: } void done() { mID.setNull(); } - bool isDone() const { return mID.isNull() != FALSE; } + bool isDone() const { return mID.isNull(); } }; class ReplySender @@ -215,7 +215,7 @@ public: Impl(LLMessageSystem* msg); ~Impl(); - BOOL getName(const LLUUID& id, std::string& first, std::string& last); + bool getName(const LLUUID& id, std::string& first, std::string& last); boost::signals2::connection addPending(const LLUUID& id, const LLCacheNameCallback& callback); void addPending(const LLUUID& id, const LLHost& host); @@ -402,13 +402,13 @@ void LLCacheName::exportFile(std::ostream& ostr) } -BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) +bool LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) { if(id.isNull()) { first = sCacheName["nobody"]; last.clear(); - return TRUE; + return true; } LLCacheNameEntry* entry = get_ptr_in_map(mCache, id ); @@ -416,7 +416,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin { first = entry->mFirstName; last = entry->mLastName; - return TRUE; + return true; } else { @@ -426,7 +426,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin { mAskNameQueue.insert(id); } - return FALSE; + return false; } } @@ -440,22 +440,22 @@ void LLCacheName::localizeCacheName(std::string key, std::string value) LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL; } -BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) +bool LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; - BOOL res = impl.getName(id, first_name, last_name); + bool res = impl.getName(id, first_name, last_name); fullname = buildFullName(first_name, last_name); return res; } -BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) +bool LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) { group = sCacheName["none"]; - return TRUE; + return true; } LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache,id); @@ -471,7 +471,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) if (entry) { group = entry->mGroupName; - return TRUE; + return true; } else { @@ -480,27 +480,27 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { impl.mAskGroupQueue.insert(id); } - return FALSE; + return false; } } -BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) +bool LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { std::string full_name = buildFullName(first, last); return getUUID(full_name, id); } -BOOL LLCacheName::getUUID(const std::string& full_name, LLUUID& id) +bool LLCacheName::getUUID(const std::string& full_name, LLUUID& id) { ReverseCache::iterator iter = impl.mReverseCache.find(full_name); if (iter != impl.mReverseCache.end()) { id = iter->second; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -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/llcachename.h b/indra/llmessage/llcachename.h index 401f52a579..1df713c7c7 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -70,12 +70,12 @@ public: // If available, copies name ("bobsmith123" or "James Linden") into string // If not available, copies the string "waiting". - // Returns TRUE iff available. - BOOL getFullName(const LLUUID& id, std::string& full_name); + // Returns true if available. + bool getFullName(const LLUUID& id, std::string& full_name); // Reverse lookup of UUID from name - BOOL getUUID(const std::string& first, const std::string& last, LLUUID& id); - BOOL getUUID(const std::string& fullname, LLUUID& id); + bool getUUID(const std::string& first, const std::string& last, LLUUID& id); + bool getUUID(const std::string& fullname, LLUUID& id); // IDEVO Temporary code // Clean up new-style "bobsmith123 Resident" names to "bobsmith123" for display @@ -99,8 +99,8 @@ public: // If available, this method copies the group name into the string // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this - // method copies the string "waiting". Returns TRUE iff available. - BOOL getGroupName(const LLUUID& id, std::string& group); + // method copies the string "waiting". Returns true if available. + bool getGroupName(const LLUUID& id, std::string& group); // Call the callback with the group or avatar name. // If the data is currently available, may call the callback immediatly diff --git a/indra/llmessage/llcipher.h b/indra/llmessage/llcipher.h index 4bbc6466a9..bbd7eae1d5 100644 --- a/indra/llmessage/llcipher.h +++ b/indra/llmessage/llcipher.h @@ -38,7 +38,7 @@ class LLCipher public: virtual ~LLCipher() {} - // encrypt src and place result into dst. returns TRUE if + // encrypt src and place result into dst. returns true if // Returns number of bytes written into dst, or 0 on error. virtual U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) = 0; diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index d6125fd321..bf22f3d3f0 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -73,10 +73,10 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mHighestPacketID(in_id), mTimeoutCallback(NULL), mTimeoutUserData(NULL), - mTrusted(FALSE), - mbAllowTimeout(TRUE), - mbAlive(TRUE), - mBlocked(FALSE), + mTrusted(false), + mbAllowTimeout(true), + mbAlive(true), + mBlocked(false), mPingTime(0.0), mLastPingSendTime(0.0), mLastPingReceivedTime(0.0), @@ -111,7 +111,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. - F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(true); F32 distribution_offset = ll_frand(); mPingTime = mt_sec; @@ -282,7 +282,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64Seconds now) // reliable_iter iter; - BOOL have_resend_overflow = FALSE; + bool have_resend_overflow = false; for (iter = mUnackedPackets.begin(); iter != mUnackedPackets.end();) { packetp = iter->second; @@ -488,7 +488,7 @@ void LLCircuit::removeCircuitData(const LLHost &host) mLastCircuit = NULL; } -void LLCircuitData::setAlive(BOOL b_alive) +void LLCircuitData::setAlive(bool b_alive) { if (mbAlive != b_alive) { @@ -500,12 +500,12 @@ void LLCircuitData::setAlive(BOOL b_alive) { mLastPingReceivedTime = LLMessageSystem::getMessageTimeSeconds(); mPingsInTransit = 0; - mBlocked = FALSE; + mBlocked = false; } } -void LLCircuitData::setAllowTimeout(BOOL allow) +void LLCircuitData::setAllowTimeout(bool allow) { mbAllowTimeout = allow; @@ -513,7 +513,7 @@ void LLCircuitData::setAllowTimeout(BOOL allow) { // resuming circuit // make sure it's alive - setAlive(TRUE); + setAlive(true); } } @@ -599,7 +599,7 @@ void LLCircuit::resendUnackedPackets(S32& unacked_list_length, S32& unacked_list } -BOOL LLCircuitData::isDuplicateResend(TPACKETID packetnum) +bool LLCircuitData::isDuplicateResend(TPACKETID packetnum) { return (mRecentlyReceivedReliablePackets.find(packetnum) != mRecentlyReceivedReliablePackets.end()); } @@ -632,7 +632,7 @@ LLCircuitData* LLCircuit::findCircuit(const LLHost& host) const } -BOOL LLCircuit::isCircuitAlive(const LLHost& host) const +bool LLCircuit::isCircuitAlive(const LLHost& host) const { LLCircuitData *cdp = findCircuit(host); if(cdp) @@ -640,7 +640,7 @@ BOOL LLCircuit::isCircuitAlive(const LLHost& host) const return cdp->mbAlive; } - return FALSE; + return false; } void LLCircuitData::setTimeoutCallback(void (*callback_func)(const LLHost &host, void *user_data), void *user_data) @@ -649,7 +649,7 @@ void LLCircuitData::setTimeoutCallback(void (*callback_func)(const LLHost &host, mTimeoutUserData = user_data; } -void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) +void LLCircuitData::checkPacketInID(TPACKETID id, bool receive_resent) { // Done as floats so we don't have to worry about running out of room // with U32 getting poked into an S32. @@ -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()) @@ -844,7 +844,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) } -BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) +bool LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) { F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); mLastPingSendTime = cur_time; @@ -852,7 +852,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) if (!checkCircuitTimeout()) { // Pass this back to the calling LLCircuit, this circuit needs to be cleaned up. - return FALSE; + return false; } // WARNING! @@ -866,7 +866,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // This is to handle the case if we actually manage to wrap our // packet IDs - the oldest will actually have a higher packet ID // than the current. - BOOL wrapped = FALSE; + bool wrapped = false; reliable_iter iter; iter = mUnackedPackets.upper_bound(getPacketOutID()); if (iter == mUnackedPackets.end()) @@ -874,19 +874,19 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // Nothing AFTER this one, so we want the lowest packet ID // then. iter = mUnackedPackets.begin(); - wrapped = TRUE; + wrapped = true; } TPACKETID packet_id = 0; // Check against the "final" packets - BOOL wrapped_final = FALSE; + bool wrapped_final = false; reliable_iter iter_final; iter_final = mFinalRetryPackets.upper_bound(getPacketOutID()); if (iter_final == mFinalRetryPackets.end()) { iter_final = mFinalRetryPackets.begin(); - wrapped_final = TRUE; + wrapped_final = true; } //LL_INFOS() << mHost << " - unacked count " << mUnackedPackets.size() << LL_ENDL; @@ -922,12 +922,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) } else { - BOOL had_unacked = FALSE; + bool had_unacked = false; if (iter != mUnackedPackets.end()) { // Unacked list has the lowest so far packet_id = iter->first; - had_unacked = TRUE; + had_unacked = true; //LL_INFOS() << mHost << ": Unacked" << LL_ENDL; } @@ -989,7 +989,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) } } - return TRUE; + return true; } @@ -1041,7 +1041,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) //LL_INFOS() << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL; } -BOOL LLCircuitData::checkCircuitTimeout() +bool LLCircuitData::checkCircuitTimeout() { F64Seconds time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; @@ -1049,7 +1049,7 @@ BOOL LLCircuitData::checkCircuitTimeout() if (time_since_last_ping > mHeartbeatTimeout) { LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<LL_ENDL; - setAlive(FALSE); + setAlive(false); if (mTimeoutCallback) { LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << LL_ENDL; @@ -1059,16 +1059,16 @@ BOOL LLCircuitData::checkCircuitTimeout() { // The callback didn't try and resurrect the circuit. We should kill it. LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } // Call this method when a reliable message comes in - this will // correctly place the packet in the correct list to be acked later. -BOOL LLCircuitData::collectRAck(TPACKETID packet_num) +bool LLCircuitData::collectRAck(TPACKETID packet_num) { if (mAcks.empty()) { @@ -1081,7 +1081,7 @@ BOOL LLCircuitData::collectRAck(TPACKETID packet_num) { mAckCreationTime = getAgeInSeconds(); } - return TRUE; + return true; } // this method is called during the message system processAcks() to @@ -1273,7 +1273,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) { // Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise // all of our ping calculations will be skewed. - mt_secs = LLMessageSystem::getMessageTimeSeconds(TRUE); + mt_secs = LLMessageSystem::getMessageTimeSeconds(true); } mLastPingReceivedTime = mt_secs; @@ -1291,7 +1291,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) mPingsInTransit = delta_ping; if (mBlocked && (mPingsInTransit <= PING_RELEASE_BLOCK)) { - mBlocked = FALSE; + mBlocked = false; } } @@ -1303,7 +1303,7 @@ void LLCircuitData::pingTimerStart() if (!mBlocked && (mPingsInTransit > PING_START_BLOCK)) { - mBlocked = TRUE; + mBlocked = true; } } @@ -1344,19 +1344,19 @@ U32 LLCircuitData::getPacketsLost() const } -BOOL LLCircuitData::isAlive() const +bool LLCircuitData::isAlive() const { return mbAlive; } -BOOL LLCircuitData::isBlocked() const +bool LLCircuitData::isBlocked() const { return mBlocked; } -BOOL LLCircuitData::getAllowTimeout() const +bool LLCircuitData::getAllowTimeout() const { return mbAllowTimeout; } @@ -1402,13 +1402,13 @@ F32Milliseconds LLCircuitData::getPingDelayAveraged() } -BOOL LLCircuitData::getTrusted() const +bool LLCircuitData::getTrusted() const { return mTrusted; } -void LLCircuitData::setTrusted(BOOL t) +void LLCircuitData::setTrusted(bool t) { mTrusted = t; } diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h index 7a5a5c65f5..521982d7b1 100644 --- a/indra/llmessage/llcircuit.h +++ b/indra/llmessage/llcircuit.h @@ -100,7 +100,7 @@ public: void setRemoteID(const LLUUID& id) { mRemoteID = id; } void setRemoteSessionID(const LLUUID& id) { mRemoteSessionID = id; } - void setTrusted(BOOL t); + void setTrusted(bool t); // The local end point ID is used when establishing a trusted circuit. // no matching set function for getLocalEndPointID() @@ -111,9 +111,9 @@ public: S32 getPingsInTransit() const { return mPingsInTransit; } // ACCESSORS - BOOL isAlive() const; - BOOL isBlocked() const; - BOOL getAllowTimeout() const; + bool isAlive() const; + bool isBlocked() const; + bool getAllowTimeout() const; F32Milliseconds getPingDelayAveraged(); F32Milliseconds getPingInTransitTime(); U32 getPacketsIn() const; @@ -122,7 +122,7 @@ public: U32 getPacketsOut() const; U32 getPacketsLost() const; TPACKETID getPacketOutID() const; - BOOL getTrusted() const; + bool getTrusted() const; F32 getAgeInSeconds() const; S32 getUnackedPacketCount() const { return mUnackedPacketCount; } S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } @@ -164,31 +164,31 @@ public: protected: TPACKETID nextPacketOutID(); void setPacketInID(TPACKETID id); - void checkPacketInID(TPACKETID id, BOOL receive_resent); + void checkPacketInID(TPACKETID id, bool receive_resent); void setPingDelay(U32Milliseconds ping); - BOOL checkCircuitTimeout(); // Return FALSE if the circuit is dead and should be cleaned up + bool checkCircuitTimeout(); // Return false if the circuit is dead and should be cleaned up void addBytesIn(S32Bytes bytes); void addBytesOut(S32Bytes bytes); U8 nextPingID() { mLastPingID++; return mLastPingID; } - BOOL updateWatchDogTimers(LLMessageSystem *msgsys); // Return FALSE if the circuit is dead and should be cleaned up + bool updateWatchDogTimers(LLMessageSystem *msgsys); // Return false if the circuit is dead and should be cleaned up void addReliablePacket(S32 mSocket, U8 *buf_ptr, S32 buf_len, LLReliablePacketParams *params); - BOOL isDuplicateResend(TPACKETID packetnum); + bool isDuplicateResend(TPACKETID packetnum); // Call this method when a reliable message comes in - this will // correctly place the packet in the correct list to be acked // later. RAack = requested ack - BOOL collectRAck(TPACKETID packet_num); + bool collectRAck(TPACKETID packet_num); void setTimeoutCallback(void (*callback_func)(const LLHost &host, void *user_data), void *user_data); - void setAlive(BOOL b_alive); - void setAllowTimeout(BOOL allow); + void setAlive(bool b_alive); + void setAllowTimeout(bool allow); protected: // Identification for this circuit. @@ -212,12 +212,12 @@ protected: void (*mTimeoutCallback)(const LLHost &host, void *user_data); void *mTimeoutUserData; - BOOL mTrusted; // Is this circuit trusted? - BOOL mbAllowTimeout; // Machines can "pause" circuits, forcing them not to be dropped + bool mTrusted; // Is this circuit trusted? + bool mbAllowTimeout; // Machines can "pause" circuits, forcing them not to be dropped - BOOL mbAlive; // Indicates whether a circuit is "alive", i.e. responded to pings + bool mbAlive; // Indicates whether a circuit is "alive", i.e. responded to pings - BOOL mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings + bool mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings // Not sure what the difference between this and mLastPingSendTime is F64Seconds mPingTime; // Time at which a ping was sent. @@ -293,7 +293,7 @@ public: // ACCESSORS LLCircuitData* findCircuit(const LLHost& host) const; - BOOL isCircuitAlive(const LLHost& host) const; + bool isCircuitAlive(const LLHost& host) const; // MANIPULATORS LLCircuitData *addCircuitData(const LLHost &host, TPACKETID in_id); diff --git a/indra/llmessage/llclassifiedflags.cpp b/indra/llmessage/llclassifiedflags.cpp index 748b6f2355..0df249d035 100644 --- a/indra/llmessage/llclassifiedflags.cpp +++ b/indra/llmessage/llclassifiedflags.cpp @@ -36,7 +36,7 @@ #include "llclassifiedflags.h" -ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +ClassifiedFlags pack_classified_flags_request(bool auto_renew, bool inc_pg, bool inc_mature, bool inc_adult) { U8 rv = 0; if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; @@ -47,7 +47,7 @@ ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL return rv; } -ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult) +ClassifiedFlags pack_classified_flags(bool auto_renew, bool inc_pg, bool inc_mature, bool inc_adult) { U8 rv = 0; if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG; diff --git a/indra/llmessage/llclassifiedflags.h b/indra/llmessage/llclassifiedflags.h index 9c6c268b39..ee29e4ed13 100644 --- a/indra/llmessage/llclassifiedflags.h +++ b/indra/llmessage/llclassifiedflags.h @@ -51,9 +51,9 @@ const S32 MAX_CLASSIFIEDS = 100; // This function is used in AO viewers to pack old query flags into the request // so that they can talk to old dataservers properly. When the AO servers are deployed on agni // we can revert back to ClassifiedFlags pack_classified_flags and get rider of this one. -ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); +ClassifiedFlags pack_classified_flags_request(bool auto_renew, bool is_pg, bool is_mature, bool is_adult); -ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL is_pg, BOOL is_mature, BOOL is_adult); +ClassifiedFlags pack_classified_flags(bool auto_renew, bool is_pg, bool is_mature, bool is_adult); bool is_cf_mature(ClassifiedFlags flags); //bool is_cf_enabled(ClassifiedFlags flags); bool is_cf_update_time(ClassifiedFlags flags); 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 dcc0b59d07..684e96883f 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -35,8 +35,7 @@ #include "llsd.h" #include "llsdjson.h" #include "llsdserialize.h" -#include "json/reader.h" // JSON -#include "json/writer.h" // JSON +#include "boost/json.hpp" // Boost.Json #include "llfilesystem.h" #include "message.h" // for getting the port @@ -585,15 +584,12 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: } LLCore::BufferArrayStream bas(body); - Json::Value jsonRoot; - try - { - bas >> jsonRoot; - } - catch (std::runtime_error& e) + boost::json::error_code ec; + boost::json::value jsonRoot = boost::json::parse(bas, ec); + if(ec.failed()) { // deserialization failed. Record the reason and pass back an empty map for markup. - status = LLCore::HttpStatus(499, std::string(e.what())); + status = LLCore::HttpStatus(499, std::string(ec.what())); return result; } @@ -613,13 +609,10 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes } LLCore::BufferArrayStream bas(body); - Json::Value jsonRoot; - try - { - bas >> jsonRoot; - } - catch (std::runtime_error&) + boost::json::error_code ec; + boost::json::value jsonRoot = boost::json::parse(bas, ec); + if (ec.failed()) { success = false; return LLSD(); @@ -802,12 +795,12 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request { LLCore::BufferArrayStream outs(rawbody.get()); - Json::Value root = LlsdToJson(body); - Json::FastWriter writer; + auto root = LlsdToJson(body); + std::string value = boost::json::serialize(root); - LL_WARNS("Http::post") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL; + LL_WARNS("Http::post") << "JSON Generates: \"" << value << "\"" << LL_ENDL; - outs << writer.write(root); + outs << value; } return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); @@ -861,11 +854,11 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, { LLCore::BufferArrayStream outs(rawbody.get()); - Json::Value root = LlsdToJson(body); - Json::FastWriter writer; + auto root = LlsdToJson(body); + std::string value = boost::json::serialize(root); - LL_WARNS("Http::put") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL; - outs << writer.write(root); + LL_WARNS("Http::put") << "JSON Generates: \"" << value << "\"" << LL_ENDL; + outs << value; } return putAndSuspend_(request, url, rawbody, options, headers, httpHandler); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 71862b9aa4..e911150787 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -45,7 +45,7 @@ const S32 DP_BUFSIZE = 512; static char DUMMY_BUFFER[128]; /*Flawfinder: ignore*/ -LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(FALSE) +LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(false) { } @@ -61,10 +61,10 @@ void LLDataPacker::dumpBufferToLog() LL_ERRS() << "dumpBufferToLog not implemented for this type!" << LL_ENDL; } -BOOL LLDataPacker::packFixed(const F32 value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits) +bool LLDataPacker::packFixed(const F32 value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits) { - BOOL success = TRUE; + bool success = true; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -113,10 +113,10 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name, return success; } -BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits) +bool LLDataPacker::unpackFixed(F32 &value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits) { - BOOL success = TRUE; + bool success = true; //LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -166,82 +166,82 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, return success; } -BOOL LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) +bool LLDataPacker::unpackU16s(U16 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackU16(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Unsigned 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackS16s(S16 *values, S32 count, const char *name) +bool LLDataPacker::unpackS16s(S16 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackS16(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Signed 16s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackF32s(F32 *values, S32 count, const char *name) +bool LLDataPacker::unpackF32s(F32 *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackF32(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackColor4Us(LLColor4U *values, S32 count, const char *name) +bool LLDataPacker::unpackColor4Us(LLColor4U *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackColor4U(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading Float 32s \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) +bool LLDataPacker::unpackUUIDs(LLUUID *values, S32 count, const char *name) { for (S32 idx = 0; idx < count; ++idx) { if (!unpackUUID(values[idx], name)) { LL_WARNS("DATAPACKER") << "Buffer overflow reading UUIDs \"" << name << "\" at index " << idx << "!" << LL_ENDL; - return FALSE; + return false; } } - return TRUE; + return true; } //--------------------------------------------------------------------------- // LLDataPackerBinaryBuffer implementation //--------------------------------------------------------------------------- -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)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -249,30 +249,30 @@ BOOL LLDataPackerBinaryBuffer::packString(const std::string& value, const char * htolememcpy(mCurBufferp, value.c_str(), MVT_VARIABLE, length); } mCurBufferp += length; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) +bool LLDataPackerBinaryBuffer::unpackString(std::string& value, const char *name) { S32 length = (S32)strlen((char *)mCurBufferp) + 1; /*Flawfinder: ignore*/ if (!verifyLength(length, name)) { - return FALSE; + return false; } value = std::string((char*)mCurBufferp); // We already assume NULL termination calling strlen() mCurBufferp += length; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const char *name) { if (!verifyLength(size + 4, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -285,16 +285,16 @@ BOOL LLDataPackerBinaryBuffer::packBinaryData(const U8 *value, S32 size, const c htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) { if (!verifyLength(4, name)) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; - return FALSE; + return false; } htolememcpy(&size, mCurBufferp, MVT_S32, 4); @@ -302,7 +302,7 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char if (size < 0) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData unpacked invalid size, aborting!" << LL_ENDL; - return FALSE; + return false; } mCurBufferp += 4; @@ -310,21 +310,21 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char if (!verifyLength(size, name)) { LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; - return FALSE; + return false; } htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { if (!verifyLength(size, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -332,27 +332,27 @@ BOOL LLDataPackerBinaryBuffer::packBinaryDataFixed(const U8 *value, S32 size, co htolememcpy(mCurBufferp, value, MVT_VARIABLE, size); } mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerBinaryBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { if (!verifyLength(size, name)) { - return FALSE; + return false; } htolememcpy(value, mCurBufferp, MVT_VARIABLE, size); mCurBufferp += size; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) +bool LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) { if (!verifyLength(sizeof(U8), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -360,28 +360,28 @@ BOOL LLDataPackerBinaryBuffer::packU8(const U8 value, const char *name) *mCurBufferp = value; } mCurBufferp++; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU8(U8 &value, const char *name) { if (!verifyLength(sizeof(U8), name)) { - return FALSE; + return false; } value = *mCurBufferp; mCurBufferp++; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) +bool LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) { if (!verifyLength(sizeof(U16), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -389,25 +389,25 @@ BOOL LLDataPackerBinaryBuffer::packU16(const U16 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_U16, 2); } mCurBufferp += 2; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU16(U16 &value, const char *name) { if (!verifyLength(sizeof(U16), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_U16, 2); mCurBufferp += 2; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) +bool LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) { - BOOL success = verifyLength(sizeof(S16), name); + bool success = verifyLength(sizeof(S16), name); if (mWriteEnabled && success) { @@ -417,9 +417,9 @@ BOOL LLDataPackerBinaryBuffer::packS16(const S16 value, const char *name) return success; } -BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) { - BOOL success = verifyLength(sizeof(S16), name); + bool success = verifyLength(sizeof(S16), name); if (success) { @@ -429,11 +429,11 @@ BOOL LLDataPackerBinaryBuffer::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) +bool LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) { if (!verifyLength(sizeof(U32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -441,28 +441,28 @@ BOOL LLDataPackerBinaryBuffer::packU32(const U32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_U32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackU32(U32 &value, const char *name) { if (!verifyLength(sizeof(U32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_U32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) +bool LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) { if (!verifyLength(sizeof(S32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -470,28 +470,28 @@ BOOL LLDataPackerBinaryBuffer::packS32(const S32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_S32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackS32(S32 &value, const char *name) { if(!verifyLength(sizeof(S32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_S32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) +bool LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) { if (!verifyLength(sizeof(F32), name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -499,28 +499,28 @@ BOOL LLDataPackerBinaryBuffer::packF32(const F32 value, const char *name) htolememcpy(mCurBufferp, &value, MVT_F32, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackF32(F32 &value, const char *name) { if (!verifyLength(sizeof(F32), name)) { - return FALSE; + return false; } htolememcpy(&value, mCurBufferp, MVT_F32, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -528,28 +528,28 @@ BOOL LLDataPackerBinaryBuffer::packColor4(const LLColor4 &value, const char *nam htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackColor4(LLColor4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *name) { if (!verifyLength(4, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -557,29 +557,29 @@ BOOL LLDataPackerBinaryBuffer::packColor4U(const LLColor4U &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_VARIABLE, 4); } mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackColor4U(LLColor4U &value, const char *name) { if (!verifyLength(4, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_VARIABLE, 4); mCurBufferp += 4; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *name) { if (!verifyLength(8, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -588,29 +588,29 @@ BOOL LLDataPackerBinaryBuffer::packVector2(const LLVector2 &value, const char *n htolememcpy(mCurBufferp+4, &value.mV[1], MVT_F32, 4); } mCurBufferp += 8; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector2(LLVector2 &value, const char *name) { if (!verifyLength(8, name)) { - return FALSE; + return false; } htolememcpy(&value.mV[0], mCurBufferp, MVT_F32, 4); htolememcpy(&value.mV[1], mCurBufferp+4, MVT_F32, 4); mCurBufferp += 8; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *name) { if (!verifyLength(12, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -618,27 +618,27 @@ BOOL LLDataPackerBinaryBuffer::packVector3(const LLVector3 &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_LLVector3, 12); } mCurBufferp += 12; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector3(LLVector3 &value, const char *name) { if (!verifyLength(12, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector3, 12); mCurBufferp += 12; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -646,27 +646,27 @@ BOOL LLDataPackerBinaryBuffer::packVector4(const LLVector4 &value, const char *n htolememcpy(mCurBufferp, value.mV, MVT_LLVector4, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackVector4(LLVector4 &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mV, mCurBufferp, MVT_LLVector4, 16); mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } if (mWriteEnabled) @@ -674,20 +674,20 @@ BOOL LLDataPackerBinaryBuffer::packUUID(const LLUUID &value, const char *name) htolememcpy(mCurBufferp, value.mData, MVT_LLUUID, 16); } mCurBufferp += 16; - return TRUE; + return true; } -BOOL LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerBinaryBuffer::unpackUUID(LLUUID &value, const char *name) { if (!verifyLength(16, name)) { - return FALSE; + return false; } htolememcpy(value.mData, mCurBufferp, MVT_LLUUID, 16); mCurBufferp += 16; - return TRUE; + return true; } const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLDataPackerBinaryBuffer &a) @@ -729,9 +729,9 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() //--------------------------------------------------------------------------- // LLDataPackerAsciiBuffer implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) +bool LLDataPackerAsciiBuffer::packString(const std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -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 @@ -759,21 +759,21 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n return success; } -BOOL LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) +bool LLDataPackerAsciiBuffer::unpackString(std::string& value, const char *name) { char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) // NULL terminated { - return FALSE; + return false; } value = valuestr; - return TRUE; + return true; } -BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; @@ -796,7 +796,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch S32 i; - BOOL bBufferFull = FALSE; + bool bBufferFull = false; for (i = 0; i < size && !bBufferFull; i++) { numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]); /* Flawfinder: ignore */ @@ -804,7 +804,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << LL_ENDL; - bBufferFull = TRUE; + bBufferFull = true; } mCurBufferp += numCopied; } @@ -836,13 +836,13 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch } -BOOL LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -861,16 +861,16 @@ BOOL LLDataPackerAsciiBuffer::unpackBinaryData(U8 *value, S32 &size, const char } -BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mWriteEnabled) { S32 i; int numCopied = 0; - BOOL bBufferFull = FALSE; + bool bBufferFull = false; for (i = 0; i < size && !bBufferFull; i++) { numCopied = snprintf(mCurBufferp, getBufferSize()-getCurrentSize(), "%02x ", value[i]); /* Flawfinder: ignore */ @@ -878,7 +878,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << LL_ENDL; - bBufferFull = TRUE; + bBufferFull = true; } mCurBufferp += numCopied; @@ -908,13 +908,13 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con } -BOOL LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -932,9 +932,9 @@ BOOL LLDataPackerAsciiBuffer::unpackBinaryDataFixed(U8 *value, S32 size, const c -BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) +bool LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -965,13 +965,13 @@ BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -980,9 +980,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU8(U8 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) +bool LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1012,13 +1012,13 @@ BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1027,9 +1027,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU16(U16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) +bool LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1059,13 +1059,13 @@ BOOL LLDataPackerAsciiBuffer::packS16(const S16 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1074,9 +1074,9 @@ BOOL LLDataPackerAsciiBuffer::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) +bool LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1104,13 +1104,13 @@ BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%u", &value); @@ -1118,9 +1118,9 @@ BOOL LLDataPackerAsciiBuffer::unpackU32(U32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) +bool LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1148,13 +1148,13 @@ BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%d", &value); @@ -1162,9 +1162,9 @@ BOOL LLDataPackerAsciiBuffer::unpackS32(S32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) +bool LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1192,13 +1192,13 @@ BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) } -BOOL LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f", &value); @@ -1206,9 +1206,9 @@ BOOL LLDataPackerAsciiBuffer::unpackF32(F32 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1236,22 +1236,22 @@ BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name } -BOOL LLDataPackerAsciiBuffer::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackColor4(LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); return success; } -BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1279,13 +1279,13 @@ BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 r, g, b, a; @@ -1299,9 +1299,9 @@ BOOL LLDataPackerAsciiBuffer::unpackColor4U(LLColor4U &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1329,13 +1329,13 @@ BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f", &value.mV[0], &value.mV[1]); @@ -1343,9 +1343,9 @@ BOOL LLDataPackerAsciiBuffer::unpackVector2(LLVector2 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1373,22 +1373,22 @@ BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector3(LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f", &value.mV[0], &value.mV[1], &value.mV[2]); return success; } -BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; if (mWriteEnabled) @@ -1416,13 +1416,13 @@ BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *na } -BOOL LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); @@ -1430,9 +1430,9 @@ BOOL LLDataPackerAsciiBuffer::unpackVector4(LLVector4 &value, const char *name) } -BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); int numCopied = 0; @@ -1456,20 +1456,20 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) { numCopied = getBufferSize()-getCurrentSize(); LL_WARNS() << "LLDataPackerAsciiBuffer::packUUID: truncated: " << LL_ENDL; - success = FALSE; + success = false; } mCurBufferp += numCopied; return success; } -BOOL LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char tmp_str[64]; /* Flawfinder: ignore */ @@ -1514,9 +1514,9 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name) } } -BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 value_len) +bool LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 value_len) { - BOOL success = TRUE; + bool success = true; char buffer[DP_BUFSIZE]; /* Flawfinder: ignore */ char keyword[DP_BUFSIZE]; /* Flawfinder: ignore */ char value[DP_BUFSIZE]; /* Flawfinder: ignore */ @@ -1537,7 +1537,7 @@ BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; - return FALSE; + return false; } } else @@ -1572,9 +1572,9 @@ std::string convertF32ToString(F32 val) //--------------------------------------------------------------------------- // LLDataPackerAsciiFile implementation //--------------------------------------------------------------------------- -BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *name) +bool LLDataPackerAsciiFile::packString(const std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1587,22 +1587,22 @@ BOOL LLDataPackerAsciiFile::packString(const std::string& value, const char *nam return success; } -BOOL LLDataPackerAsciiFile::unpackString(std::string& value, const char *name) +bool LLDataPackerAsciiFile::unpackString(std::string& value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /* Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } value = valuestr; return success; } -BOOL LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) @@ -1634,13 +1634,13 @@ BOOL LLDataPackerAsciiFile::packBinaryData(const U8 *value, S32 size, const char } -BOOL LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *name) +bool LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -1659,9 +1659,9 @@ BOOL LLDataPackerAsciiFile::unpackBinaryData(U8 *value, S32 &size, const char *n } -BOOL LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) @@ -1688,13 +1688,13 @@ BOOL LLDataPackerAsciiFile::packBinaryDataFixed(const U8 *value, S32 size, const } -BOOL LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) +bool LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore*/ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char *cur_pos = &valuestr[0]; @@ -1712,9 +1712,9 @@ BOOL LLDataPackerAsciiFile::unpackBinaryDataFixed(U8 *value, S32 size, const cha -BOOL LLDataPackerAsciiFile::packU8(const U8 value, const char *name) +bool LLDataPackerAsciiFile::packU8(const U8 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1730,13 +1730,13 @@ BOOL LLDataPackerAsciiFile::packU8(const U8 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1745,9 +1745,9 @@ BOOL LLDataPackerAsciiFile::unpackU8(U8 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packU16(const U16 value, const char *name) +bool LLDataPackerAsciiFile::packU16(const U16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1761,13 +1761,13 @@ BOOL LLDataPackerAsciiFile::packU16(const U16 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1776,9 +1776,9 @@ BOOL LLDataPackerAsciiFile::unpackU16(U16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packS16(const S16 value, const char *name) +bool LLDataPackerAsciiFile::packS16(const S16 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1792,13 +1792,13 @@ BOOL LLDataPackerAsciiFile::packS16(const S16 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) +bool LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 in_val; @@ -1807,9 +1807,9 @@ BOOL LLDataPackerAsciiFile::unpackS16(S16 &value, const char *name) return success; } -BOOL LLDataPackerAsciiFile::packU32(const U32 value, const char *name) +bool LLDataPackerAsciiFile::packU32(const U32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1823,13 +1823,13 @@ BOOL LLDataPackerAsciiFile::packU32(const U32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%u", &value); @@ -1837,9 +1837,9 @@ BOOL LLDataPackerAsciiFile::unpackU32(U32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packS32(const S32 value, const char *name) +bool LLDataPackerAsciiFile::packS32(const S32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1853,13 +1853,13 @@ BOOL LLDataPackerAsciiFile::packS32(const S32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%d", &value); @@ -1867,9 +1867,9 @@ BOOL LLDataPackerAsciiFile::unpackS32(S32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packF32(const F32 value, const char *name) +bool LLDataPackerAsciiFile::packF32(const F32 value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1883,13 +1883,13 @@ BOOL LLDataPackerAsciiFile::packF32(const F32 value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) +bool LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f", &value); @@ -1897,9 +1897,9 @@ BOOL LLDataPackerAsciiFile::unpackF32(F32 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) +bool LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1913,22 +1913,22 @@ BOOL LLDataPackerAsciiFile::packColor4(const LLColor4 &value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackColor4(LLColor4 &value, const char *name) +bool LLDataPackerAsciiFile::unpackColor4(LLColor4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); return success; } -BOOL LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name) +bool LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1942,13 +1942,13 @@ BOOL LLDataPackerAsciiFile::packColor4U(const LLColor4U &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) +bool LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } S32 r, g, b, a; @@ -1962,9 +1962,9 @@ BOOL LLDataPackerAsciiFile::unpackColor4U(LLColor4U &value, const char *name) } -BOOL LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name) +bool LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -1978,13 +1978,13 @@ BOOL LLDataPackerAsciiFile::packVector2(const LLVector2 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f", &value.mV[0], &value.mV[1]); @@ -1992,9 +1992,9 @@ BOOL LLDataPackerAsciiFile::unpackVector2(LLVector2 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name) +bool LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -2008,22 +2008,22 @@ BOOL LLDataPackerAsciiFile::packVector3(const LLVector3 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector3(LLVector3 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector3(LLVector3 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f", &value.mV[0], &value.mV[1], &value.mV[2]); return success; } -BOOL LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name) +bool LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); if (mFP) { @@ -2037,13 +2037,13 @@ BOOL LLDataPackerAsciiFile::packVector4(const LLVector4 &value, const char *name } -BOOL LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) +bool LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } sscanf(valuestr,"%f %f %f %f", &value.mV[0], &value.mV[1], &value.mV[2], &value.mV[3]); @@ -2051,9 +2051,9 @@ BOOL LLDataPackerAsciiFile::unpackVector4(LLVector4 &value, const char *name) } -BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) +bool LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; writeIndentedName(name); std::string tmp_str; value.toString(tmp_str); @@ -2069,13 +2069,13 @@ BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name) } -BOOL LLDataPackerAsciiFile::unpackUUID(LLUUID &value, const char *name) +bool LLDataPackerAsciiFile::unpackUUID(LLUUID &value, const char *name) { - BOOL success = TRUE; + bool success = true; char valuestr[DP_BUFSIZE]; /*Flawfinder: ignore */ if (!getValueStr(name, valuestr, DP_BUFSIZE)) { - return FALSE; + return false; } char tmp_str[64]; /*Flawfinder: ignore */ @@ -2107,9 +2107,9 @@ void LLDataPackerAsciiFile::writeIndentedName(const char *name) } } -BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 value_len) +bool LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 value_len) { - BOOL success = FALSE; + bool success = false; char buffer[DP_BUFSIZE]; /*Flawfinder: ignore*/ char keyword[DP_BUFSIZE]; /*Flawfinder: ignore*/ char value[DP_BUFSIZE]; /*Flawfinder: ignore*/ @@ -2124,7 +2124,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos { LL_WARNS() << "Data packer failed to fgetpos" << LL_ENDL; - return FALSE; + return false; } if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) @@ -2138,20 +2138,20 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v { LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; fsetpos(mFP, &last_pos); - return FALSE; + return false; } if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; fsetpos(mFP, &last_pos); - return FALSE; + return false; } S32 in_value_len = (S32)strlen(value)+1; /*Flawfinder: ignore*/ S32 min_len = llmin(in_value_len, value_len); memcpy(out_value, value, min_len); /*Flawfinder: ignore*/ out_value[min_len-1] = 0; - success = TRUE; + success = true; } else if (mInputStream) { @@ -2161,19 +2161,19 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (!keyword[0]) { LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; - return FALSE; + return false; } if (strcmp(keyword, name)) { LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; - return FALSE; + return false; } S32 in_value_len = (S32)strlen(value)+1; /*Flawfinder: ignore*/ S32 min_len = llmin(in_value_len, value_len); memcpy(out_value, value, min_len); /*Flawfinder: ignore*/ out_value[min_len-1] = 0; - success = TRUE; + success = true; } return success; diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 9869326c12..167c102b43 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -43,72 +43,72 @@ public: virtual void reset(); virtual void dumpBufferToLog(); - virtual BOOL hasNext() const = 0; + virtual bool hasNext() const = 0; - virtual BOOL packString(const std::string& value, const char *name) = 0; - virtual BOOL unpackString(std::string& value, const char *name) = 0; + virtual bool packString(const std::string& value, const char *name) = 0; + virtual bool unpackString(std::string& value, const char *name) = 0; - virtual BOOL packBinaryData(const U8 *value, S32 size, const char *name) = 0; - virtual BOOL unpackBinaryData(U8 *value, S32 &size, const char *name) = 0; + virtual bool packBinaryData(const U8 *value, S32 size, const char *name) = 0; + virtual bool unpackBinaryData(U8 *value, S32 &size, const char *name) = 0; // Constant size binary data packing - virtual BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name) = 0; - virtual BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name) = 0; + virtual bool packBinaryDataFixed(const U8 *value, S32 size, const char *name) = 0; + virtual bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name) = 0; - virtual BOOL packU8(const U8 value, const char *name) = 0; - virtual BOOL unpackU8(U8 &value, const char *name) = 0; + virtual bool packU8(const U8 value, const char *name) = 0; + virtual bool unpackU8(U8 &value, const char *name) = 0; - virtual BOOL packU16(const U16 value, const char *name) = 0; - virtual BOOL unpackU16(U16 &value, const char *name) = 0; - BOOL unpackU16s(U16 *value, S32 count, const char *name); + virtual bool packU16(const U16 value, const char *name) = 0; + virtual bool unpackU16(U16 &value, const char *name) = 0; + bool unpackU16s(U16 *value, S32 count, const char *name); - virtual BOOL packS16(const S16 value, const char *name) = 0; - virtual BOOL unpackS16(S16 &value, const char *name) = 0; - BOOL unpackS16s(S16 *value, S32 count, const char *name); + virtual bool packS16(const S16 value, const char *name) = 0; + virtual bool unpackS16(S16 &value, const char *name) = 0; + bool unpackS16s(S16 *value, S32 count, const char *name); - virtual BOOL packU32(const U32 value, const char *name) = 0; - virtual BOOL unpackU32(U32 &value, const char *name) = 0; + virtual bool packU32(const U32 value, const char *name) = 0; + virtual bool unpackU32(U32 &value, const char *name) = 0; - virtual BOOL packS32(const S32 value, const char *name) = 0; - virtual BOOL unpackS32(S32 &value, const char *name) = 0; + virtual bool packS32(const S32 value, const char *name) = 0; + virtual bool unpackS32(S32 &value, const char *name) = 0; - virtual BOOL packF32(const F32 value, const char *name) = 0; - virtual BOOL unpackF32(F32 &value, const char *name) = 0; - BOOL unpackF32s(F32 *values, S32 count, const char *name); + virtual bool packF32(const F32 value, const char *name) = 0; + virtual bool unpackF32(F32 &value, const char *name) = 0; + bool unpackF32s(F32 *values, S32 count, const char *name); // Packs a float into an integer, using the given size // and picks the right U* data type to pack into. - BOOL packFixed(const F32 value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits); - BOOL unpackFixed(F32 &value, const char *name, - const BOOL is_signed, const U32 int_bits, const U32 frac_bits); + bool packFixed(const F32 value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits); + bool unpackFixed(F32 &value, const char *name, + const bool is_signed, const U32 int_bits, const U32 frac_bits); - virtual BOOL packColor4(const LLColor4 &value, const char *name) = 0; - virtual BOOL unpackColor4(LLColor4 &value, const char *name) = 0; + virtual bool packColor4(const LLColor4 &value, const char *name) = 0; + virtual bool unpackColor4(LLColor4 &value, const char *name) = 0; - virtual BOOL packColor4U(const LLColor4U &value, const char *name) = 0; - virtual BOOL unpackColor4U(LLColor4U &value, const char *name) = 0; - BOOL unpackColor4Us(LLColor4U *values, S32 count, const char *name); + virtual bool packColor4U(const LLColor4U &value, const char *name) = 0; + virtual bool unpackColor4U(LLColor4U &value, const char *name) = 0; + bool unpackColor4Us(LLColor4U *values, S32 count, const char *name); - virtual BOOL packVector2(const LLVector2 &value, const char *name) = 0; - virtual BOOL unpackVector2(LLVector2 &value, const char *name) = 0; + virtual bool packVector2(const LLVector2 &value, const char *name) = 0; + virtual bool unpackVector2(LLVector2 &value, const char *name) = 0; - virtual BOOL packVector3(const LLVector3 &value, const char *name) = 0; - virtual BOOL unpackVector3(LLVector3 &value, const char *name) = 0; + virtual bool packVector3(const LLVector3 &value, const char *name) = 0; + virtual bool unpackVector3(LLVector3 &value, const char *name) = 0; - virtual BOOL packVector4(const LLVector4 &value, const char *name) = 0; - virtual BOOL unpackVector4(LLVector4 &value, const char *name) = 0; + virtual bool packVector4(const LLVector4 &value, const char *name) = 0; + virtual bool unpackVector4(LLVector4 &value, const char *name) = 0; - virtual BOOL packUUID(const LLUUID &value, const char *name) = 0; - virtual BOOL unpackUUID(LLUUID &value, const char *name) = 0; - BOOL unpackUUIDs(LLUUID *values, S32 count, const char *name); + virtual bool packUUID(const LLUUID &value, const char *name) = 0; + virtual bool unpackUUID(LLUUID &value, const char *name) = 0; + bool unpackUUIDs(LLUUID *values, S32 count, const char *name); U32 getPassFlags() const { return mPassFlags; } void setPassFlags(U32 flags) { mPassFlags = flags; } protected: LLDataPacker(); protected: U32 mPassFlags; - BOOL mWriteEnabled; // disable this to do things like determine filesize without actually copying data + bool mWriteEnabled; // disable this to do things like determine filesize without actually copying data }; class LLDataPackerBinaryBuffer : public LLDataPacker @@ -120,7 +120,7 @@ public: mCurBufferp(bufferp), mBufferSize(size) { - mWriteEnabled = TRUE; + mWriteEnabled = true; } LLDataPackerBinaryBuffer() @@ -131,58 +131,58 @@ public: { } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); // Constant size binary data packing - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp); } S32 getBufferSize() const { return mBufferSize; } const U8* getBuffer() const { return mBufferp; } void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } void shift(S32 offset) { reset(); mCurBufferp += offset;} - void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; } + void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = false; } void assignBuffer(U8 *bufferp, S32 size) { if(mBufferp && mBufferp != bufferp) @@ -192,31 +192,31 @@ public: mBufferp = bufferp; mCurBufferp = bufferp; mBufferSize = size; - mWriteEnabled = TRUE; + mWriteEnabled = true; } const LLDataPackerBinaryBuffer& operator=(const LLDataPackerBinaryBuffer &a); - /*virtual*/ BOOL hasNext() const { return getCurrentSize() < getBufferSize(); } + /*virtual*/ bool hasNext() const { return getCurrentSize() < getBufferSize(); } /*virtual*/ void dumpBufferToLog(); protected: - inline BOOL verifyLength(const S32 data_size, const char *name); + inline bool verifyLength(const S32 data_size, const char *name); U8 *mBufferp; U8 *mCurBufferp; S32 mBufferSize; }; -inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const char *name) +inline bool LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const char *name) { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { LL_WARNS() << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << LL_ENDL; LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } class LLDataPackerAsciiBuffer : public LLDataPacker @@ -228,8 +228,8 @@ public: mCurBufferp = bufferp; mBufferSize = size; mPassFlags = 0; - mIncludeNames = FALSE; - mWriteEnabled = TRUE; + mIncludeNames = false; + mWriteEnabled = true; } LLDataPackerAsciiBuffer() @@ -238,57 +238,57 @@ public: mCurBufferp = NULL; mBufferSize = 0; mPassFlags = 0; - mIncludeNames = FALSE; - mWriteEnabled = FALSE; + mIncludeNames = false; + mWriteEnabled = false; } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); // Constant size binary data packing - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); - void setIncludeNames(BOOL b) { mIncludeNames = b; } + void setIncludeNames(bool b) { mIncludeNames = b; } // Include the trailing NULL so it's always a valid string S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp) + 1; } @@ -296,7 +296,7 @@ public: S32 getBufferSize() const { return mBufferSize; } /*virtual*/ void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } - /*virtual*/ BOOL hasNext() const { return getCurrentSize() < getBufferSize(); } + /*virtual*/ bool hasNext() const { return getCurrentSize() < getBufferSize(); } inline void freeBuffer(); inline void assignBuffer(char* bufferp, S32 size); @@ -304,15 +304,15 @@ public: protected: void writeIndentedName(const char *name); - BOOL getValueStr(const char *name, char *out_value, const S32 value_len); + bool getValueStr(const char *name, char *out_value, const S32 value_len); protected: - inline BOOL verifyLength(const S32 data_size, const char *name); + inline bool verifyLength(const S32 data_size, const char *name); char *mBufferp; char *mCurBufferp; S32 mBufferSize; - BOOL mIncludeNames; // useful for debugging, print the name of each field + bool mIncludeNames; // useful for debugging, print the name of each field }; inline void LLDataPackerAsciiBuffer::freeBuffer() @@ -320,7 +320,7 @@ inline void LLDataPackerAsciiBuffer::freeBuffer() delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; - mWriteEnabled = FALSE; + mWriteEnabled = false; } inline void LLDataPackerAsciiBuffer::assignBuffer(char* bufferp, S32 size) @@ -328,19 +328,19 @@ inline void LLDataPackerAsciiBuffer::assignBuffer(char* bufferp, S32 size) mBufferp = bufferp; mCurBufferp = bufferp; mBufferSize = size; - mWriteEnabled = TRUE; + mWriteEnabled = true; } -inline BOOL LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const char *name) +inline bool LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const char *name) { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { LL_WARNS() << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << LL_ENDL; LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } class LLDataPackerAsciiFile : public LLDataPacker @@ -362,7 +362,7 @@ public: mOutputStream(&output_stream), mInputStream(NULL) { - mWriteEnabled = TRUE; + mWriteEnabled = true; } LLDataPackerAsciiFile(std::istream& input_stream, const S32 indent = 2) @@ -374,55 +374,55 @@ public: { } - /*virtual*/ BOOL packString(const std::string& value, const char *name); - /*virtual*/ BOOL unpackString(std::string& value, const char *name); + /*virtual*/ bool packString(const std::string& value, const char *name); + /*virtual*/ bool unpackString(std::string& value, const char *name); - /*virtual*/ BOOL packBinaryData(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryData(U8 *value, S32 &size, const char *name); + /*virtual*/ bool packBinaryData(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryData(U8 *value, S32 &size, const char *name); - /*virtual*/ BOOL packBinaryDataFixed(const U8 *value, S32 size, const char *name); - /*virtual*/ BOOL unpackBinaryDataFixed(U8 *value, S32 size, const char *name); + /*virtual*/ bool packBinaryDataFixed(const U8 *value, S32 size, const char *name); + /*virtual*/ bool unpackBinaryDataFixed(U8 *value, S32 size, const char *name); - /*virtual*/ BOOL packU8(const U8 value, const char *name); - /*virtual*/ BOOL unpackU8(U8 &value, const char *name); + /*virtual*/ bool packU8(const U8 value, const char *name); + /*virtual*/ bool unpackU8(U8 &value, const char *name); - /*virtual*/ BOOL packU16(const U16 value, const char *name); - /*virtual*/ BOOL unpackU16(U16 &value, const char *name); + /*virtual*/ bool packU16(const U16 value, const char *name); + /*virtual*/ bool unpackU16(U16 &value, const char *name); - /*virtual*/ BOOL packS16(const S16 value, const char *name); - /*virtual*/ BOOL unpackS16(S16 &value, const char *name); + /*virtual*/ bool packS16(const S16 value, const char *name); + /*virtual*/ bool unpackS16(S16 &value, const char *name); - /*virtual*/ BOOL packU32(const U32 value, const char *name); - /*virtual*/ BOOL unpackU32(U32 &value, const char *name); + /*virtual*/ bool packU32(const U32 value, const char *name); + /*virtual*/ bool unpackU32(U32 &value, const char *name); - /*virtual*/ BOOL packS32(const S32 value, const char *name); - /*virtual*/ BOOL unpackS32(S32 &value, const char *name); + /*virtual*/ bool packS32(const S32 value, const char *name); + /*virtual*/ bool unpackS32(S32 &value, const char *name); - /*virtual*/ BOOL packF32(const F32 value, const char *name); - /*virtual*/ BOOL unpackF32(F32 &value, const char *name); + /*virtual*/ bool packF32(const F32 value, const char *name); + /*virtual*/ bool unpackF32(F32 &value, const char *name); - /*virtual*/ BOOL packColor4(const LLColor4 &value, const char *name); - /*virtual*/ BOOL unpackColor4(LLColor4 &value, const char *name); + /*virtual*/ bool packColor4(const LLColor4 &value, const char *name); + /*virtual*/ bool unpackColor4(LLColor4 &value, const char *name); - /*virtual*/ BOOL packColor4U(const LLColor4U &value, const char *name); - /*virtual*/ BOOL unpackColor4U(LLColor4U &value, const char *name); + /*virtual*/ bool packColor4U(const LLColor4U &value, const char *name); + /*virtual*/ bool unpackColor4U(LLColor4U &value, const char *name); - /*virtual*/ BOOL packVector2(const LLVector2 &value, const char *name); - /*virtual*/ BOOL unpackVector2(LLVector2 &value, const char *name); + /*virtual*/ bool packVector2(const LLVector2 &value, const char *name); + /*virtual*/ bool unpackVector2(LLVector2 &value, const char *name); - /*virtual*/ BOOL packVector3(const LLVector3 &value, const char *name); - /*virtual*/ BOOL unpackVector3(LLVector3 &value, const char *name); + /*virtual*/ bool packVector3(const LLVector3 &value, const char *name); + /*virtual*/ bool unpackVector3(LLVector3 &value, const char *name); - /*virtual*/ BOOL packVector4(const LLVector4 &value, const char *name); - /*virtual*/ BOOL unpackVector4(LLVector4 &value, const char *name); + /*virtual*/ bool packVector4(const LLVector4 &value, const char *name); + /*virtual*/ bool unpackVector4(LLVector4 &value, const char *name); - /*virtual*/ BOOL packUUID(const LLUUID &value, const char *name); - /*virtual*/ BOOL unpackUUID(LLUUID &value, const char *name); + /*virtual*/ bool packUUID(const LLUUID &value, const char *name); + /*virtual*/ bool unpackUUID(LLUUID &value, const char *name); protected: void writeIndentedName(const char *name); - BOOL getValueStr(const char *name, char *out_value, const S32 value_len); + bool getValueStr(const char *name, char *out_value, const S32 value_len); - /*virtual*/ BOOL hasNext() const { return true; } + /*virtual*/ bool hasNext() const { return true; } protected: S32 mIndent; 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/llhost.cpp b/indra/llmessage/llhost.cpp index fe0b594d39..ace316512f 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -103,7 +103,7 @@ std::string LLHost::getHostName() const } } -BOOL LLHost::setHostByName(const std::string& hostname) +bool LLHost::setHostByName(const std::string& hostname) { hostent *he; std::string local_name(hostname); @@ -123,7 +123,7 @@ BOOL LLHost::setHostByName(const std::string& hostname) if (he) { mIP = *(U32 *)he->h_addr_list[0]; - return TRUE; + return true; } else { @@ -147,7 +147,7 @@ BOOL LLHost::setHostByName(const std::string& hostname) LL_WARNS() << "LLHost::setAddress(): unknown error - " << error_number << LL_ENDL; break; } - return FALSE; + return false; } } diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h index 613c81168f..6824fa3d78 100644 --- a/indra/llmessage/llhost.h +++ b/indra/llmessage/llhost.h @@ -80,7 +80,7 @@ public: void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); } void setAddress( U32 ip ) { mIP = ip; } void setPort( U32 port ) { mPort = port; } - BOOL setHostByName(const std::string& hname); + bool setHostByName(const std::string& hname); LLHost& operator=(const LLHost &rhs); void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;}; diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 8708552122..4c62c07fcb 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -54,7 +54,7 @@ const S32 IM_TTL = 1; void pack_instant_message( LLMessageSystem* msg, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, @@ -93,7 +93,7 @@ void pack_instant_message( void pack_instant_message_block( LLMessageSystem* msg, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index feb07c6b0f..d413e81c90 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -180,7 +180,7 @@ extern const S32 IM_TTL; void pack_instant_message( LLMessageSystem* msgsystem, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, @@ -198,7 +198,7 @@ void pack_instant_message( void pack_instant_message_block( LLMessageSystem* msgsystem, const LLUUID& from_id, - BOOL from_group, + bool from_group, const LLUUID& session_id, const LLUUID& to_id, const std::string& name, 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 4e5cf8ed48..9e10a356db 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -99,10 +99,10 @@ void disconnect_smtp() } } -// Returns TRUE on success. +// Returns true on success. // message should NOT be SMTP escaped. // static -BOOL LLMail::send( +bool LLMail::send( const char* from_name, const char* from_address, const char* to_name, @@ -120,7 +120,7 @@ BOOL LLMail::send( headers); if(header.empty()) { - return FALSE; + return false; } std::string message_str; @@ -129,8 +129,8 @@ BOOL LLMail::send( message_str = message; } bool rv = send(header, message_str, to_address, from_address); - if(rv) return TRUE; - return FALSE; + if(rv) return true; + return false; } // static @@ -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/llmail.h b/indra/llmessage/llmail.h index f437eb4db8..d67b89d1ea 100644 --- a/indra/llmessage/llmail.h +++ b/indra/llmessage/llmail.h @@ -48,7 +48,7 @@ public: * @param to_address The email recipient address * @param subject The subject of the email * @param headers optional X-Foo headers in an llsd map. - * @return Returns TRUE if the call succeeds, FALSE otherwise. + * @return Returns true if the call succeeds, false otherwise. * * Results in: * From: "from_name" <from_address> @@ -57,7 +57,7 @@ public: * * message */ - static BOOL send( + static bool send( const char* from_name, const char* from_address, const char* to_name, diff --git a/indra/llmessage/llmessagebuilder.h b/indra/llmessage/llmessagebuilder.h index b35e973192..3f04857945 100644 --- a/indra/llmessage/llmessagebuilder.h +++ b/indra/llmessage/llmessagebuilder.h @@ -49,14 +49,14 @@ public: virtual void newMessage(const char* name) = 0; virtual void nextBlock(const char* blockname) = 0; - virtual BOOL removeLastBlock() = 0; // TODO: babbage: remove this horror + virtual bool removeLastBlock() = 0; // TODO: babbage: remove this horror /** All add* methods expect pointers to canonical strings. */ virtual void addBinaryData( const char* varname, const void* data, S32 size) = 0; - virtual void addBOOL(const char* varname, BOOL b) = 0; + virtual void addBOOL(const char* varname, bool b) = 0; virtual void addS8(const char* varname, S8 s) = 0; virtual void addU8(const char* varname, U8 u) = 0; virtual void addS16(const char* varname, S16 i) = 0; @@ -76,12 +76,12 @@ public: virtual void addString(const char* varname, const char* s) = 0; virtual void addString(const char* varname, const std::string& s) = 0; - virtual BOOL isMessageFull(const char* blockname) const = 0; + virtual bool isMessageFull(const char* blockname) const = 0; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length) = 0; virtual S32 getMessageSize() = 0; - virtual BOOL isBuilt() const = 0; - virtual BOOL isClear() const = 0; + virtual bool isBuilt() const = 0; + virtual bool isClear() const = 0; virtual U32 buildMessage( U8* buffer, U32 buffer_size, @@ -90,7 +90,7 @@ public: virtual void clearMessage() = 0; // TODO: babbage: remove this horror - virtual void setBuilt(BOOL b) = 0; + virtual void setBuilt(bool b) = 0; virtual const char* getMessageName() const = 0; diff --git a/indra/llmessage/llmessagereader.cpp b/indra/llmessage/llmessagereader.cpp index bed8655cf7..4d4bf679ed 100644 --- a/indra/llmessage/llmessagereader.cpp +++ b/indra/llmessage/llmessagereader.cpp @@ -27,7 +27,7 @@ #include "linden_common.h" #include "llmessagereader.h" -static BOOL sTimeDecodes = FALSE; +static bool sTimeDecodes = false; static F32 sTimeDecodesSpamThreshold = 0.05f; @@ -38,7 +38,7 @@ LLMessageReader::~LLMessageReader() } //static -void LLMessageReader::setTimeDecodes(BOOL b) +void LLMessageReader::setTimeDecodes(bool b) { sTimeDecodes = b; } @@ -50,7 +50,7 @@ void LLMessageReader::setTimeDecodesSpamThreshold(F32 seconds) } //static -BOOL LLMessageReader::getTimeDecodes() +bool LLMessageReader::getTimeDecodes() { return sTimeDecodes; } diff --git a/indra/llmessage/llmessagereader.h b/indra/llmessage/llmessagereader.h index f4d5a4ce83..5bc9aea5e4 100644 --- a/indra/llmessage/llmessagereader.h +++ b/indra/llmessage/llmessagereader.h @@ -52,7 +52,7 @@ class LLMessageReader /** All get* methods expect pointers to canonical strings. */ virtual void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX) = 0; - virtual void getBOOL(const char *block, const char *var, BOOL &data, S32 blocknum = 0) = 0; + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0) = 0; virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0) = 0; virtual void getU8(const char *block, const char *var, U8 &data, S32 blocknum = 0) = 0; virtual void getS16(const char *block, const char *var, S16 &data, S32 blocknum = 0) = 0; @@ -84,8 +84,9 @@ class LLMessageReader virtual void copyToBuilder(LLMessageBuilder&) const = 0; - static void setTimeDecodes(BOOL b); - static BOOL getTimeDecodes(); + + static void setTimeDecodes(bool b); + static bool getTimeDecodes(); static void setTimeDecodesSpamThreshold(F32 seconds); static F32 getTimeDecodesSpamThreshold(); }; diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 91d143b11e..e91d4346b6 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -361,14 +361,14 @@ public: mUserData = user_data; } - BOOL callHandlerFunc(LLMessageSystem *msgsystem) const + bool callHandlerFunc(LLMessageSystem *msgsystem) const { if (mHandlerFunc) { mHandlerFunc(msgsystem, mUserData); - return TRUE; + return true; } - return FALSE; + return false; } bool isUdpBanned() const diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index 4fb9257e90..cf1f49116e 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -42,7 +42,7 @@ // * - repeat last check // checks 'a' -BOOL b_return_alphanumeric_ok(char c) +bool b_return_alphanumeric_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -51,26 +51,26 @@ BOOL b_return_alphanumeric_ok(char c) &&( (c < '0') ||(c > '9'))) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'c' -BOOL b_return_character_ok(char c) +bool b_return_character_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) &&( (c < 'a') ||(c > 'z'))) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'f' -BOOL b_return_first_variable_ok(char c) +bool b_return_first_variable_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -78,13 +78,13 @@ BOOL b_return_first_variable_ok(char c) ||(c > 'z')) &&(c != '_')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'v' -BOOL b_return_variable_ok(char c) +bool b_return_variable_ok(char c) { if ( ( (c < 'A') ||(c > 'Z')) @@ -94,35 +94,35 @@ BOOL b_return_variable_ok(char c) ||(c > '9')) &&(c != '_')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 's' -BOOL b_return_signed_integer_ok(char c) +bool b_return_signed_integer_ok(char c) { if ( ( (c < '0') ||(c > '9')) &&(c != '-')) { - return FALSE; + return false; } - return TRUE; + return true; } // checks 'd' -BOOL b_return_integer_ok(char c) +bool b_return_integer_ok(char c) { if ( (c < '0') ||(c > '9')) { - return FALSE; + return false; } - return TRUE; + return true; } -BOOL (*gParseCheckCharacters[])(char c) = +bool (*gParseCheckCharacters[])(char c) = { b_return_alphanumeric_ok, b_return_character_ok, @@ -156,7 +156,7 @@ S32 get_checker_number(char checker) } // check token based on passed simplified regular expression -BOOL b_check_token(const char *token, const char *regexp) +bool b_check_token(const char *token, const char *regexp) { S32 tptr, rptr = 0; S32 current_checker, next_checker = 0; @@ -166,13 +166,13 @@ BOOL b_check_token(const char *token, const char *regexp) if (current_checker == -1) { LL_ERRS() << "Invalid regular expression value!" << LL_ENDL; - return FALSE; + return false; } if (current_checker == 9999) { LL_ERRS() << "Regular expression can't start with *!" << LL_ENDL; - return FALSE; + return false; } for (tptr = 0; token[tptr]; tptr++) @@ -180,12 +180,12 @@ BOOL b_check_token(const char *token, const char *regexp) if (current_checker == -1) { LL_ERRS() << "Input exceeds regular expression!\nDid you forget a *?" << LL_ENDL; - return FALSE; + return false; } if (!gParseCheckCharacters[current_checker](token[tptr])) { - return FALSE; + return false; } if (next_checker != 9999) { @@ -196,40 +196,40 @@ BOOL b_check_token(const char *token, const char *regexp) } } } - return TRUE; + return true; } // C variable can be made up of upper or lower case letters, underscores, or numbers, but can't start with a number -BOOL b_variable_ok(const char *token) +bool b_variable_ok(const char *token) { if (!b_check_token(token, "fv*")) { LL_WARNS() << "Token '" << token << "' isn't a variable!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } // An integer is made up of the digits 0-9 and may be preceded by a '-' -BOOL b_integer_ok(const char *token) +bool b_integer_ok(const char *token) { if (!b_check_token(token, "sd*")) { LL_WARNS() << "Token isn't an integer!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } // An integer is made up of the digits 0-9 -BOOL b_positive_integer_ok(const char *token) +bool b_positive_integer_ok(const char *token) { if (!b_check_token(token, "d*")) { LL_WARNS() << "Token isn't an integer!" << LL_ENDL; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index ef4f3702fc..abcb1085ba 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -66,13 +66,13 @@ void LLMessageThrottle::pruneEntries() // Look for the first entry younger than the maximum age. F32 max_age = (F32)MAX_MESSAGE_AGE[cat]; - BOOL found = FALSE; + bool found = false; while (r_iterator != r_last && !found) { if ( LLFrameTimer::getTotalTime() - (*r_iterator).getEntryTime() < max_age ) { // We found a young enough entry. - found = TRUE; + found = true; // Did we find at least one entry to remove? if (r_iterator != message_list->rbegin()) @@ -95,7 +95,7 @@ void LLMessageThrottle::pruneEntries() } } -BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) +bool LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_VIEWER_ALERT]); @@ -114,16 +114,16 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg { // This message was not found. Add it to the list. message_list->push_front(entry); - return TRUE; + return true; } else { // This message was already in the list. - return FALSE; + return false; } } -BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) +bool LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, const std::string& mesg) { message_list_t* message_list = &(mMessageList[MTC_AGENT_ALERT]); @@ -142,12 +142,12 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c { // This message was not found. Add it to the list. message_list->push_front(entry); - return TRUE; + return true; } else { // This message was already in the list. - return FALSE; + return false; } } diff --git a/indra/llmessage/llmessagethrottle.h b/indra/llmessage/llmessagethrottle.h index 8a96a6b589..295bddbd8c 100644 --- a/indra/llmessage/llmessagethrottle.h +++ b/indra/llmessage/llmessagethrottle.h @@ -59,8 +59,8 @@ public: LLMessageThrottle(); ~LLMessageThrottle(); - BOOL addViewerAlert (const LLUUID& to, const std::string& mesg); - BOOL addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); + bool addViewerAlert (const LLUUID& to, const std::string& mesg); + bool addAgentAlert (const LLUUID& agent, const LLUUID& task, const std::string& mesg); void pruneEntries(); diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 0e31a6d6e6..05ea3f26a1 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -676,13 +676,13 @@ LLVector3 *LLNameValue::getVec3() } -BOOL LLNameValue::sendToData() const +bool LLNameValue::sendToData() const { return (mSendto == NVS_DATA_SIM || mSendto == NVS_DATA_SIM_VIEWER); } -BOOL LLNameValue::sendToViewer() const +bool LLNameValue::sendToViewer() const { return (mSendto == NVS_SIM_VIEWER || mSendto == NVS_DATA_SIM_VIEWER); } diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 4016c268d2..3c442df009 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -139,8 +139,8 @@ public: const char *getClass() const { return mStringClass; } const char *getSendto() const { return mStringSendto; } - BOOL sendToData() const; - BOOL sendToViewer() const; + bool sendToData() const; + bool sendToViewer() const; void callCallback(); std::string printNameValue() const; diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp index 98302111ca..e66e8b0285 100644 --- a/indra/llmessage/llpacketack.cpp +++ b/indra/llmessage/llpacketack.cpp @@ -58,7 +58,7 @@ LLReliablePacket::LLReliablePacket( else { mRetries = 0; - mPingBasedRetry = TRUE; + mPingBasedRetry = true; mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index b60861eac7..0903c01e14 100644 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -35,7 +35,7 @@ class LLReliablePacketParams public: LLHost mHost; S32 mRetries; - BOOL mPingBasedRetry; + bool mPingBasedRetry; F32Seconds mTimeout; void (*mCallback)(void **,S32); void** mCallbackData; @@ -53,7 +53,7 @@ public: { mHost.invalidate(); mRetries = 0; - mPingBasedRetry = TRUE; + mPingBasedRetry = true; mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; @@ -63,7 +63,7 @@ public: void set( const LLHost& host, S32 retries, - BOOL ping_based_retry, + bool ping_based_retry, F32Seconds timeout, void (*callback)(void**,S32), void** callback_data, char* name) @@ -98,7 +98,7 @@ protected: S32 mSocket; LLHost mHost; S32 mRetries; - BOOL mPingBasedRetry; + bool mPingBasedRetry; F32Seconds mTimeout; void (*mCallback)(void**,S32); void** mCallbackData; diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index 122f7a8b5b..be838770a8 100644 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -45,8 +45,8 @@ /////////////////////////////////////////////////////////// LLPacketRing::LLPacketRing () : - mUseInThrottle(FALSE), - mUseOutThrottle(FALSE), + mUseInThrottle(false), + mUseOutThrottle(false), mInThrottle(256000.f), mOutThrottle(64000.f), mActualBitsIn(0), @@ -97,12 +97,12 @@ void LLPacketRing::setDropPercentage (F32 percent_to_drop) mDropPercentage = percent_to_drop; } -void LLPacketRing::setUseInThrottle(const BOOL use_throttle) +void LLPacketRing::setUseInThrottle(const bool use_throttle) { mUseInThrottle = use_throttle; } -void LLPacketRing::setUseOutThrottle(const BOOL use_throttle) +void LLPacketRing::setUseOutThrottle(const bool use_throttle) { mUseOutThrottle = use_throttle; } @@ -161,7 +161,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) // If using the throttle, simulate a limited size input buffer. if (mUseInThrottle) { - BOOL done = FALSE; + bool done = false; // push any current net packet (if any) onto delay ring while (!done) @@ -270,9 +270,9 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) return packet_size; } -BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host) +bool LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host) { - BOOL status = TRUE; + bool status = true; if (!mUseOutThrottle) { return sendPacketImpl(h_socket, send_buffer, buf_size, host ); @@ -344,7 +344,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL return status; } -BOOL LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host) +bool LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host) { if (!LLProxy::isSOCKSProxyEnabled()) diff --git a/indra/llmessage/llpacketring.h b/indra/llmessage/llpacketring.h index 4f90112412..f0e95f8524 100644 --- a/indra/llmessage/llpacketring.h +++ b/indra/llmessage/llpacketring.h @@ -46,14 +46,14 @@ public: void dropPackets(U32); void setDropPercentage (F32 percent_to_drop); - void setUseInThrottle(const BOOL use_throttle); - void setUseOutThrottle(const BOOL use_throttle); + void setUseInThrottle(const bool use_throttle); + void setUseOutThrottle(const bool use_throttle); void setInBandwidth(const F32 bps); void setOutBandwidth(const F32 bps); S32 receivePacket (S32 socket, char *datap); S32 receiveFromRing (S32 socket, char *datap); - BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); + bool sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); inline LLHost getLastSender(); inline LLHost getLastReceivingInterface(); @@ -61,8 +61,8 @@ public: S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} protected: - BOOL mUseInThrottle; - BOOL mUseOutThrottle; + bool mUseInThrottle; + bool mUseOutThrottle; // For simulating a lower-bandwidth connection - BPS LLThrottle mInThrottle; @@ -84,7 +84,7 @@ protected: LLHost mLastReceivingIF; private: - BOOL sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host); + bool sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host); }; diff --git a/indra/llmessage/llpartdata.cpp b/indra/llmessage/llpartdata.cpp index 320b61b905..d4cf95c1e3 100644 --- a/indra/llmessage/llpartdata.cpp +++ b/indra/llmessage/llpartdata.cpp @@ -71,31 +71,31 @@ S32 LLPartData::getSize() const } -BOOL LLPartData::unpackLegacy(LLDataPacker &dp) +bool LLPartData::unpackLegacy(LLDataPacker &dp) { LLColor4U coloru; dp.unpackU32(mFlags, "pdflags"); - dp.unpackFixed(mMaxAge, "pdmaxage", FALSE, 8, 8); + dp.unpackFixed(mMaxAge, "pdmaxage", false, 8, 8); dp.unpackColor4U(coloru, "pdstartcolor"); mStartColor.setVec(coloru); dp.unpackColor4U(coloru, "pdendcolor"); mEndColor.setVec(coloru); - dp.unpackFixed(mStartScale.mV[0], "pdstartscalex", FALSE, 3, 5); - dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", FALSE, 3, 5); - dp.unpackFixed(mEndScale.mV[0], "pdendscalex", FALSE, 3, 5); - dp.unpackFixed(mEndScale.mV[1], "pdendscaley", FALSE, 3, 5); + dp.unpackFixed(mStartScale.mV[0], "pdstartscalex", false, 3, 5); + dp.unpackFixed(mStartScale.mV[1], "pdstartscaley", false, 3, 5); + dp.unpackFixed(mEndScale.mV[0], "pdendscalex", false, 3, 5); + dp.unpackFixed(mEndScale.mV[1], "pdendscaley", false, 3, 5); mStartGlow = 0.f; mEndGlow = 0.f; mBlendFuncSource = LLPartData::LL_PART_BF_SOURCE_ALPHA; mBlendFuncDest = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; - return TRUE; + return true; } -BOOL LLPartData::unpack(LLDataPacker &dp) +bool LLPartData::unpack(LLDataPacker &dp) { S32 size = 0; dp.unpackS32(size, "partsize"); @@ -105,7 +105,7 @@ BOOL LLPartData::unpack(LLDataPacker &dp) if (mFlags & LL_PART_DATA_GLOW) { - if (size < PS_PART_DATA_GLOW_SIZE) return FALSE; + if (size < PS_PART_DATA_GLOW_SIZE) return false; U8 tmp_glow = 0; dp.unpackU8(tmp_glow,"pdstartglow"); @@ -123,7 +123,7 @@ BOOL LLPartData::unpack(LLDataPacker &dp) if (mFlags & LL_PART_DATA_BLEND) { - if (size < PS_PART_DATA_BLEND_SIZE) return FALSE; + if (size < PS_PART_DATA_BLEND_SIZE) return false; dp.unpackU8(mBlendFuncSource,"pdblendsource"); dp.unpackU8(mBlendFuncDest,"pdblenddest"); size -= PS_PART_DATA_BLEND_SIZE; @@ -144,11 +144,11 @@ BOOL LLPartData::unpack(LLDataPacker &dp) } //this particle system won't display properly, better to not show anything - return FALSE; + return false; } - return TRUE; + return true; } void LLPartData::setFlags(const U32 flags) @@ -240,44 +240,44 @@ LLPartSysData::LLPartSysData() mNumParticles = 0; } -BOOL LLPartSysData::unpackSystem(LLDataPacker &dp) +bool LLPartSysData::unpackSystem(LLDataPacker &dp) { dp.unpackU32(mCRC, "pscrc"); dp.unpackU32(mFlags, "psflags"); dp.unpackU8(mPattern, "pspattern"); - dp.unpackFixed(mMaxAge, "psmaxage", FALSE, 8, 8); - dp.unpackFixed(mStartAge, "psstartage", FALSE, 8, 8); - dp.unpackFixed(mInnerAngle, "psinnerangle", FALSE, 3, 5); - dp.unpackFixed(mOuterAngle, "psouterangle", FALSE, 3, 5); - dp.unpackFixed(mBurstRate, "psburstrate", FALSE, 8, 8); + dp.unpackFixed(mMaxAge, "psmaxage", false, 8, 8); + dp.unpackFixed(mStartAge, "psstartage", false, 8, 8); + dp.unpackFixed(mInnerAngle, "psinnerangle", false, 3, 5); + dp.unpackFixed(mOuterAngle, "psouterangle", false, 3, 5); + dp.unpackFixed(mBurstRate, "psburstrate", false, 8, 8); mBurstRate = llmax(0.01f, mBurstRate); - dp.unpackFixed(mBurstRadius, "psburstradius", FALSE, 8, 8); - dp.unpackFixed(mBurstSpeedMin, "psburstspeedmin", FALSE, 8, 8); - dp.unpackFixed(mBurstSpeedMax, "psburstspeedmax", FALSE, 8, 8); + dp.unpackFixed(mBurstRadius, "psburstradius", false, 8, 8); + dp.unpackFixed(mBurstSpeedMin, "psburstspeedmin", false, 8, 8); + dp.unpackFixed(mBurstSpeedMax, "psburstspeedmax", false, 8, 8); dp.unpackU8(mBurstPartCount, "psburstpartcount"); - dp.unpackFixed(mAngularVelocity.mV[0], "psangvelx", TRUE, 8, 7); - dp.unpackFixed(mAngularVelocity.mV[1], "psangvely", TRUE, 8, 7); - dp.unpackFixed(mAngularVelocity.mV[2], "psangvelz", TRUE, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[0], "psangvelx", true, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[1], "psangvely", true, 8, 7); + dp.unpackFixed(mAngularVelocity.mV[2], "psangvelz", true, 8, 7); - dp.unpackFixed(mPartAccel.mV[0], "psaccelx", TRUE, 8, 7); - dp.unpackFixed(mPartAccel.mV[1], "psaccely", TRUE, 8, 7); - dp.unpackFixed(mPartAccel.mV[2], "psaccelz", TRUE, 8, 7); + dp.unpackFixed(mPartAccel.mV[0], "psaccelx", true, 8, 7); + dp.unpackFixed(mPartAccel.mV[1], "psaccely", true, 8, 7); + dp.unpackFixed(mPartAccel.mV[2], "psaccelz", true, 8, 7); dp.unpackUUID(mPartImageID, "psuuid"); dp.unpackUUID(mTargetUUID, "pstargetuuid"); - return TRUE; + return true; } -BOOL LLPartSysData::unpackLegacy(LLDataPacker &dp) +bool LLPartSysData::unpackLegacy(LLDataPacker &dp) { unpackSystem(dp); mPartData.unpackLegacy(dp); - return TRUE; + return true; } -BOOL LLPartSysData::unpack(LLDataPacker &dp) +bool LLPartSysData::unpack(LLDataPacker &dp) { // syssize is currently unused. Adding now when modifying the 'version to make extensible in the future S32 size = 0; @@ -289,18 +289,18 @@ 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"); } - return FALSE; + return false; } unpackSystem(dp); @@ -324,7 +324,7 @@ std::ostream& operator<<(std::ostream& s, const LLPartSysData &data) return s; } -BOOL LLPartSysData::isNullPS(const S32 block_num) +bool LLPartSysData::isNullPS(const S32 block_num) { U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE]; U32 crc; @@ -335,13 +335,13 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (!size) { - return TRUE; + return true; } if (size > PS_MAX_DATA_BLOCK_SIZE) { //size is too big, newer particle version unsupported - return TRUE; + return true; } gMessageSystem->getBinaryData("ObjectData", "PSBlock", ps_data_block, size, block_num, PS_MAX_DATA_BLOCK_SIZE); @@ -355,7 +355,7 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (tmp > PS_SYS_DATA_BLOCK_SIZE) { //unknown system data block size, don't know how to parse it, treat as NULL - return TRUE; + return true; } } @@ -363,12 +363,12 @@ BOOL LLPartSysData::isNullPS(const S32 block_num) if (crc == 0) { - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLPartSysData::unpackBlock(const S32 block_num) +bool LLPartSysData::unpackBlock(const S32 block_num) { U8 ps_data_block[PS_MAX_DATA_BLOCK_SIZE]; @@ -378,7 +378,7 @@ BOOL LLPartSysData::unpackBlock(const S32 block_num) if (size > PS_MAX_DATA_BLOCK_SIZE) { // Larger packets are newer and unsupported - return FALSE; + return false; } // Get from message diff --git a/indra/llmessage/llpartdata.h b/indra/llmessage/llpartdata.h index 35602dc949..49b9e51a3d 100644 --- a/indra/llmessage/llpartdata.h +++ b/indra/llmessage/llpartdata.h @@ -88,10 +88,10 @@ public: mParameter(0.f) { } - BOOL unpackLegacy(LLDataPacker &dp); - BOOL unpack(LLDataPacker &dp); + bool unpackLegacy(LLDataPacker &dp); + bool unpack(LLDataPacker &dp); - BOOL pack(LLDataPacker &dp); + bool pack(LLDataPacker &dp); bool hasGlow() const; bool hasBlendFunc() const; @@ -183,11 +183,11 @@ class LLPartSysData public: LLPartSysData(); - BOOL unpack(LLDataPacker &dp); - BOOL unpackLegacy(LLDataPacker &dp); - BOOL unpackBlock(const S32 block_num); + bool unpack(LLDataPacker &dp); + bool unpackLegacy(LLDataPacker &dp); + bool unpackBlock(const S32 block_num); - static BOOL isNullPS(const S32 block_num); // Returns FALSE if this is a "NULL" particle system (i.e. no system) + static bool isNullPS(const S32 block_num); // Returns false if this is a "NULL" particle system (i.e. no system) bool isLegacyCompatible() const; @@ -227,7 +227,7 @@ public: S32 getdataBlockSize() const; private: - BOOL unpackSystem(LLDataPacker &dp); + bool unpackSystem(LLDataPacker &dp); public: // Public because I'm lazy.... diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 8a395c26a8..d713cb20d9 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 ec0d7fe4e4..e1cd70b216 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -181,12 +181,13 @@ bool LLPumpIO::prime(apr_pool_t* pool) { cleanup(); initialize(pool); - return ((pool == NULL) ? false : true); + return pool != nullptr; } bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request) { - if(chain.empty()) return false; + if (chain.empty()) + return false; LLChainInfo info; info.mHasCurlRequest = has_curl_request; @@ -218,12 +219,13 @@ bool LLPumpIO::addChain( LLSD context, F32 timeout) { - // remember that if the caller is providing a full link // description, we need to have that description matched to a // particular buffer. - if(!data) return false; - if(links.empty()) return false; + if (!data) + return false; + if (links.empty()) + return false; #if LL_DEBUG_PIPE_TYPE_IN_PUMP LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '" @@ -243,10 +245,11 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(mRunningChains.end() == mCurrentChain) + if (mRunningChains.end() == mCurrentChain) { return false; } + (*mCurrentChain).setTimeoutSeconds(timeout); return true; } @@ -254,7 +257,7 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout) void LLPumpIO::adjustTimeoutSeconds(F32 delta) { // Ensure a chain is running - if(mRunningChains.end() != mCurrentChain) + if (mRunningChains.end() != mCurrentChain) { (*mCurrentChain).adjustTimeoutSeconds(delta); } @@ -263,27 +266,27 @@ void LLPumpIO::adjustTimeoutSeconds(F32 delta) static std::string events_2_string(apr_int16_t events) { std::ostringstream ostr; - if(events & APR_POLLIN) + if (events & APR_POLLIN) { ostr << "read,"; } - if(events & APR_POLLPRI) + if (events & APR_POLLPRI) { ostr << "priority,"; } - if(events & APR_POLLOUT) + if (events & APR_POLLOUT) { ostr << "write,"; } - if(events & APR_POLLERR) + if (events & APR_POLLERR) { ostr << "error,"; } - if(events & APR_POLLHUP) + if (events & APR_POLLHUP) { ostr << "hangup,"; } - if(events & APR_POLLNVAL) + if (events & APR_POLLNVAL) { ostr << "invalid,"; } @@ -292,7 +295,8 @@ static std::string events_2_string(apr_int16_t events) bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll) { - if(!pipe) return false; + if (!pipe) + return false; ll_debug_poll_fd("Set conditional", poll); LL_DEBUGS() << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null") @@ -814,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 71a7672337..2b7ba80a78 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -28,89 +28,94 @@ #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_prelude( U64 flags ) +inline bool is_flag_set(U64 flags, U64 flag) +{ + return (flags & flag) != 0; +} + +inline bool is_prelude( U64 flags ) { // definition of prelude does not depend on fixed-sun - return 0 == (flags & REGION_FLAGS_PRELUDE_UNSET) - && 0 != (flags & REGION_FLAGS_PRELUDE_SET); + return !is_flag_set(flags, REGION_FLAGS_PRELUDE_UNSET) && + is_flag_set(flags, REGION_FLAGS_PRELUDE_SET); } inline U64 set_prelude_flags(U64 flags) @@ -128,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/llregionhandle.h b/indra/llmessage/llregionhandle.h index 9982a8260e..d68cd4d202 100644 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -63,13 +63,13 @@ inline U64 to_region_handle_global(const F32 x_global, const F32 y_global) return region_handle; } -inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handle) +inline bool to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handle) { U32 x_int, y_int; if (x_pos < 0.f) { // LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL; - return FALSE; + return false; } else { @@ -78,14 +78,14 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl if (y_pos < 0.f) { // LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL; - return FALSE; + return false; } else { y_int = (U32)ll_round(y_pos); } *region_handle = to_region_handle(x_int, y_int); - return TRUE; + return true; } // stuff the word-frame XY location of sim's SouthWest corner in x_pos, y_pos diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 4c678b235b..8d7d51e13f 100644 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -44,8 +44,8 @@ LLSDMessageBuilder::LLSDMessageBuilder() : mCurrentBlock(NULL), mCurrentMessageName(""), mCurrentBlockName(""), - mbSBuilt(FALSE), - mbSClear(TRUE) + mbSBuilt(false), + mbSClear(true) { } @@ -58,8 +58,8 @@ LLSDMessageBuilder::~LLSDMessageBuilder() // virtual void LLSDMessageBuilder::newMessage(const char* name) { - mbSBuilt = FALSE; - mbSClear = FALSE; + mbSBuilt = false; + mbSClear = false; mCurrentMessage = LLSD::emptyMap(); mCurrentMessageName = (char*)name; @@ -68,8 +68,8 @@ void LLSDMessageBuilder::newMessage(const char* name) // virtual void LLSDMessageBuilder::clearMessage() { - mbSBuilt = FALSE; - mbSClear = TRUE; + mbSBuilt = false; + mbSClear = true; mCurrentMessage = LLSD::emptyMap(); mCurrentMessageName = ""; @@ -96,10 +96,10 @@ void LLSDMessageBuilder::nextBlock(const char* blockname) } // TODO: Remove this horror... -BOOL LLSDMessageBuilder::removeLastBlock() +bool LLSDMessageBuilder::removeLastBlock() { /* TODO: finish implementing this */ - return FALSE; + return false; } void LLSDMessageBuilder::addBinaryData( @@ -168,9 +168,9 @@ void LLSDMessageBuilder::addIPPort(const char* varname, U16 v) (*mCurrentBlock)[varname] = v; } -void LLSDMessageBuilder::addBOOL(const char* varname, BOOL v) +void LLSDMessageBuilder::addBOOL(const char* varname, bool v) { - (*mCurrentBlock)[varname] = (v == TRUE); + (*mCurrentBlock)[varname] = v; } void LLSDMessageBuilder::addString(const char* varname, const char* v) @@ -218,9 +218,9 @@ void LLSDMessageBuilder::compressMessage(U8*& buf_ptr, U32& buffer_length) { } -BOOL LLSDMessageBuilder::isMessageFull(const char* blockname) const +bool LLSDMessageBuilder::isMessageFull(const char* blockname) const { - return FALSE; + return false; } U32 LLSDMessageBuilder::buildMessage(U8*, U32, U8) @@ -354,7 +354,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) break; case MVT_BOOL: - addBOOL(varname, *(BOOL*)mvci.getData()); + addBOOL(varname, *(bool*)mvci.getData()); break; case MVT_IP_ADDR: @@ -400,13 +400,13 @@ const LLSD& LLSDMessageBuilder::getMessage() const } //virtual -void LLSDMessageBuilder::setBuilt(BOOL b) { mbSBuilt = b; } +void LLSDMessageBuilder::setBuilt(bool b) { mbSBuilt = b; } //virtual -BOOL LLSDMessageBuilder::isBuilt() const {return mbSBuilt;} +bool LLSDMessageBuilder::isBuilt() const {return mbSBuilt;} //virtual -BOOL LLSDMessageBuilder::isClear() const {return mbSClear;} +bool LLSDMessageBuilder::isClear() const {return mbSClear;} //virtual S32 LLSDMessageBuilder::getMessageSize() diff --git a/indra/llmessage/llsdmessagebuilder.h b/indra/llmessage/llsdmessagebuilder.h index 82c70202ee..72ea6d0dd6 100644 --- a/indra/llmessage/llsdmessagebuilder.h +++ b/indra/llmessage/llsdmessagebuilder.h @@ -48,14 +48,14 @@ public: virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); - virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... + virtual bool removeLastBlock(); // TODO: babbage: remove this horror... /** All add* methods expect pointers to canonical varname strings. */ virtual void addBinaryData( const char* varname, const void* data, S32 size); - virtual void addBOOL(const char* varname, BOOL b); + virtual void addBOOL(const char* varname, bool b); virtual void addS8(const char* varname, S8 s); virtual void addU8(const char* varname, U8 u); virtual void addS16(const char* varname, S16 i); @@ -75,18 +75,18 @@ public: virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); - virtual BOOL isMessageFull(const char* blockname) const; + virtual bool isMessageFull(const char* blockname) const; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length); - virtual BOOL isBuilt() const; - virtual BOOL isClear() const; + virtual bool isBuilt() const; + virtual bool isClear() const; virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); /**< Null implementation which returns 0. */ virtual void clearMessage(); // TODO: babbage: remove this horror. - virtual void setBuilt(BOOL b); + virtual void setBuilt(bool b); virtual S32 getMessageSize(); virtual const char* getMessageName() const; @@ -119,8 +119,8 @@ private: LLSD* mCurrentBlock; std::string mCurrentMessageName; std::string mCurrentBlockName; - BOOL mbSBuilt; - BOOL mbSClear; + bool mbSBuilt; + bool mbSClear; }; #endif // LL_LLSDMESSAGEBUILDER_H diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 00d962357b..6ade7c0dad 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -114,7 +114,7 @@ void LLSDMessageReader::getBinaryData(const char *block, const char *var, //virtual void LLSDMessageReader::getBOOL(const char *block, const char *var, - BOOL &data, + bool &data, S32 blocknum) { data = getLLSD(mMessage, block, var, blocknum); @@ -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/llsdmessagereader.h b/indra/llmessage/llsdmessagereader.h index 8f84c679ba..6f4256380b 100644 --- a/indra/llmessage/llsdmessagereader.h +++ b/indra/llmessage/llsdmessagereader.h @@ -46,7 +46,7 @@ public: virtual void getBinaryData(const char *block, const char *var, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - virtual void getBOOL(const char *block, const char *var, BOOL &data, + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0); virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0); diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index be5dcadb28..758d6d343f 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -42,8 +42,8 @@ LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_m mCurrentSDataBlock(NULL), mCurrentSMessageName(NULL), mCurrentSBlockName(NULL), - mbSBuilt(FALSE), - mbSClear(TRUE), + mbSBuilt(false), + mbSClear(true), mCurrentSendTotal(0), mMessageTemplates(name_template_map) { @@ -59,8 +59,8 @@ LLTemplateMessageBuilder::~LLTemplateMessageBuilder() // virtual void LLTemplateMessageBuilder::newMessage(const char *name) { - mbSBuilt = FALSE; - mbSClear = FALSE; + mbSBuilt = false; + mbSClear = false; mCurrentSendTotal = 0; @@ -103,8 +103,8 @@ void LLTemplateMessageBuilder::newMessage(const char *name) // virtual void LLTemplateMessageBuilder::clearMessage() { - mbSBuilt = FALSE; - mbSClear = TRUE; + mbSBuilt = false; + mbSClear = true; mCurrentSendTotal = 0; @@ -220,7 +220,7 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) } // TODO: Remove this horror... -BOOL LLTemplateMessageBuilder::removeLastBlock() +bool LLTemplateMessageBuilder::removeLastBlock() { if (mCurrentSBlockName) { @@ -262,24 +262,24 @@ BOOL LLTemplateMessageBuilder::removeLastBlock() if (num_blocks <= 1) { - // we just blew away the last one, so return FALSE + // we just blew away the last one, so return false LL_WARNS() << "not blowing away the only block of message " << mCurrentSMessageName << ". Block: " << block_name << ". Number: " << num_blocks << LL_ENDL; - return FALSE; + return false; } else { // Decrement the counter. block_data->mBlockNumber--; - return TRUE; + return true; } } } } - return FALSE; + return false; } // add data to variable in current block @@ -445,10 +445,8 @@ void LLTemplateMessageBuilder::addIPPort(const char *varname, U16 u) addData(varname, &u, MVT_IP_PORT, sizeof(u)); } -void LLTemplateMessageBuilder::addBOOL(const char* varname, BOOL b) +void LLTemplateMessageBuilder::addBOOL(const char* varname, bool b) { - // Can't just cast a BOOL (actually a U32) to a U8. - // In some cases the low order bits will be zero. U8 temp = (b != 0); addData(varname, &temp, MVT_BOOL, sizeof(temp)); } @@ -584,15 +582,15 @@ void LLTemplateMessageBuilder::compressMessage(U8*& buf_ptr, U32& buffer_length) } } -BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const +bool LLTemplateMessageBuilder::isMessageFull(const char* blockname) const { if(mCurrentSendTotal > MTUBYTES) { - return TRUE; + return true; } if(!blockname) { - return FALSE; + return false; } char* bnamep = (char*)blockname; S32 max; @@ -614,9 +612,9 @@ BOOL LLTemplateMessageBuilder::isMessageFull(const char* blockname) const } if(mCurrentSMessageData->mMemberBlocks[bnamep]->mBlockNumber >= max) { - return TRUE; + return true; } - return FALSE; + return false; } static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* template_data, LLMsgData* message_data) @@ -823,7 +821,7 @@ U32 LLTemplateMessageBuilder::buildMessage( { result += buildBlock(buffer + result, buffer_size - result, *iter, mCurrentSMessageData); } - mbSBuilt = TRUE; + mbSBuilt = true; return result; } @@ -877,13 +875,13 @@ void LLTemplateMessageBuilder::copyFromLLSD(const LLSD&) } //virtual -void LLTemplateMessageBuilder::setBuilt(BOOL b) { mbSBuilt = b; } +void LLTemplateMessageBuilder::setBuilt(bool b) { mbSBuilt = b; } //virtual -BOOL LLTemplateMessageBuilder::isBuilt() const {return mbSBuilt;} +bool LLTemplateMessageBuilder::isBuilt() const {return mbSBuilt;} //virtual -BOOL LLTemplateMessageBuilder::isClear() const {return mbSClear;} +bool LLTemplateMessageBuilder::isClear() const {return mbSClear;} //virtual S32 LLTemplateMessageBuilder::getMessageSize() {return mCurrentSendTotal;} diff --git a/indra/llmessage/lltemplatemessagebuilder.h b/indra/llmessage/lltemplatemessagebuilder.h index f399dc8acc..b86ec4d87d 100644 --- a/indra/llmessage/lltemplatemessagebuilder.h +++ b/indra/llmessage/lltemplatemessagebuilder.h @@ -49,12 +49,12 @@ public: virtual void newMessage(const char* name); virtual void nextBlock(const char* blockname); - virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror... + virtual bool removeLastBlock(); // TODO: babbage: remove this horror... /** All add* methods expect pointers to canonical varname strings. */ virtual void addBinaryData(const char *varname, const void *data, S32 size); - virtual void addBOOL(const char* varname, BOOL b); + virtual void addBOOL(const char* varname, bool b); virtual void addS8(const char* varname, S8 s); virtual void addU8(const char* varname, U8 u); virtual void addS16(const char* varname, S16 i); @@ -74,18 +74,18 @@ public: virtual void addString(const char* varname, const char* s); virtual void addString(const char* varname, const std::string& s); - virtual BOOL isMessageFull(const char* blockname) const; + virtual bool isMessageFull(const char* blockname) const; virtual void compressMessage(U8*& buf_ptr, U32& buffer_length); - virtual BOOL isBuilt() const; - virtual BOOL isClear() const; + virtual bool isBuilt() const; + virtual bool isClear() const; virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data); /**< Return built message size */ virtual void clearMessage(); // TODO: babbage: remove this horror. - virtual void setBuilt(BOOL b); + virtual void setBuilt(bool b); virtual S32 getMessageSize(); virtual const char* getMessageName() const; @@ -106,8 +106,8 @@ private: LLMsgBlkData* mCurrentSDataBlock; char* mCurrentSMessageName; char* mCurrentSBlockName; - BOOL mbSBuilt; - BOOL mbSClear; + bool mbSBuilt; + bool mbSClear; S32 mCurrentSendTotal; const message_template_name_map_t& mMessageTemplates; }; 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/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index c24c850a86..1432fd1efd 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -287,11 +287,11 @@ void LLTemplateMessageReader::getU8(const char *block, const char *var, } void LLTemplateMessageReader::getBOOL(const char *block, const char *var, - BOOL &b, S32 blocknum ) + bool &b, S32 blocknum ) { U8 value(0); getData(block, var, &value, sizeof(U8), blocknum); - b = (BOOL) value; + b = (bool)value; } void LLTemplateMessageReader::getS16(const char *block, const char *var, @@ -446,7 +446,7 @@ S32 LLTemplateMessageReader::getMessageSize() const } // Returns template for the message contained in buffer -BOOL LLTemplateMessageReader::decodeTemplate( +bool LLTemplateMessageReader::decodeTemplate( const U8* buffer, S32 buffer_size, // inputs LLMessageTemplate** msg_template, bool custom ) // outputs { @@ -456,7 +456,7 @@ BOOL LLTemplateMessageReader::decodeTemplate( if (buffer_size <= 0) { LL_WARNS() << "No message waiting for decode!" << LL_ENDL; - return(FALSE); + return(false); } U32 num = 0; @@ -493,7 +493,7 @@ BOOL LLTemplateMessageReader::decodeTemplate( if (!custom) LL_WARNS() << "Packet with unusable length received (too short): " << buffer_size << LL_ENDL; - return(FALSE); + return(false); } LLMessageTemplate* temp = get_ptr_in_map(mMessageNumbers,num); @@ -508,10 +508,11 @@ BOOL LLTemplateMessageReader::decodeTemplate( LL_WARNS_ONCE() << "Message #" << std::hex << num << std::dec << " received but not registered!" << LL_ENDL; } - return(FALSE); + //gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE); + return(false); } - return(TRUE); + return(true); } void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ) @@ -536,7 +537,7 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3 static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages"); // decode a given message -BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom ) +bool LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom ) { LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); @@ -598,7 +599,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, { if (!custom) LL_ERRS() << "Unknown block type" << LL_ENDL; - return FALSE; + return false; } LLMsgBlkData* cur_data_block = NULL; @@ -706,7 +707,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, && !mCurrentRMessageTemplate->mMemberBlocks.empty()) { LL_WARNS() << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << LL_ENDL; - return FALSE; + return false; } if (!custom) @@ -756,10 +757,10 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, } } } - return TRUE; + return true; } -BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, +bool LLTemplateMessageReader::validateMessage(const U8* buffer, S32 buffer_size, const LLHost& sender, bool trusted, @@ -783,7 +784,7 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, << " from " << ((trusted) ? "trusted " : "untrusted ") << sender << LL_ENDL; - valid = FALSE; + valid = false; } if(valid && isUdpBanned()) @@ -791,12 +792,12 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, LL_WARNS() << "Received UDP black listed message " << getMessageName() << " from " << sender << LL_ENDL; - valid = FALSE; + valid = false; } return valid; } -BOOL LLTemplateMessageReader::readMessage(const U8* buffer, +bool LLTemplateMessageReader::readMessage(const U8* buffer, const LLHost& sender) { return decodeData(buffer, sender); diff --git a/indra/llmessage/lltemplatemessagereader.h b/indra/llmessage/lltemplatemessagereader.h index 772b8fd607..0f7160d328 100644 --- a/indra/llmessage/lltemplatemessagereader.h +++ b/indra/llmessage/lltemplatemessagereader.h @@ -47,7 +47,7 @@ public: virtual void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - virtual void getBOOL(const char *block, const char *var, BOOL &data, + virtual void getBOOL(const char *block, const char *var, bool &data, S32 blocknum = 0); virtual void getS8(const char *block, const char *var, S8 &data, S32 blocknum = 0); @@ -98,15 +98,15 @@ public: virtual void copyToBuilder(LLMessageBuilder&) const; - BOOL validateMessage(const U8* buffer, S32 buffer_size, + bool validateMessage(const U8* buffer, S32 buffer_size, const LLHost& sender, bool trusted = false, bool custom = false); - BOOL readMessage(const U8* buffer, const LLHost& sender); + bool readMessage(const U8* buffer, const LLHost& sender); bool isTrusted() const; bool isBanned(bool trusted_source) const; bool isUdpBanned() const; - BOOL decodeData(const U8* buffer, const LLHost& sender, bool custom = false); + bool decodeData(const U8* buffer, const LLHost& sender, bool custom = false ); LLMessageTemplate* getTemplate(); private: @@ -114,13 +114,11 @@ private: void getData(const char *blockname, const char *varname, void *datap, S32 size = 0, S32 blocknum = 0, S32 max_size = S32_MAX); - BOOL decodeTemplate(const U8* buffer, S32 buffer_size, // inputs + bool decodeTemplate(const U8* buffer, S32 buffer_size, // inputs LLMessageTemplate** msg_template, bool custom = false ); // outputs void logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ); - //BOOL decodeData(const U8* buffer, const LLHost& sender ); - S32 mReceiveSize; LLMessageTemplate* mCurrentRMessageTemplate; LLMsgData* mCurrentRMessageData; diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 0113414d1b..5ce96fc551 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -37,7 +37,7 @@ LLThrottle::LLThrottle(const F32 rate) mRate = rate; mAvailable = 0.f; mLookaheadSecs = 0.25f; - mLastSendTime = LLMessageSystem::getMessageTimeSeconds(TRUE); + mLastSendTime = LLMessageSystem::getMessageTimeSeconds(true); } @@ -57,9 +57,9 @@ F32 LLThrottle::getAvailable() return mAvailable + (mRate * elapsed_time.value()); } -BOOL LLThrottle::checkOverflow(const F32 amount) +bool LLThrottle::checkOverflow(const F32 amount) { - BOOL retval = TRUE; + bool retval = true; F32 lookahead_amount = mRate * mLookaheadSecs; @@ -72,17 +72,17 @@ BOOL LLThrottle::checkOverflow(const F32 amount) { // ...enough space to send this message // Also do if > lookahead so we can use if amount > capped amount. - retval = FALSE; + retval = false; } return retval; } -BOOL LLThrottle::throttleOverflow(const F32 amount) +bool LLThrottle::throttleOverflow(const F32 amount) { F32Seconds elapsed_time; F32 lookahead_amount; - BOOL retval = TRUE; + bool retval = true; lookahead_amount = mRate * mLookaheadSecs; @@ -97,12 +97,12 @@ BOOL LLThrottle::throttleOverflow(const F32 amount) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mAvailable = lookahead_amount; - retval = FALSE; + retval = false; } else if (mAvailable > amount) { // ...enough space to send this message - retval = FALSE; + retval = false; } // We actually already sent the bits. @@ -236,15 +236,15 @@ void LLThrottleGroup::resetDynamicAdjust() } -BOOL LLThrottleGroup::setNominalBPS(F32* throttle_vec) +bool LLThrottleGroup::setNominalBPS(F32* throttle_vec) { - BOOL changed = FALSE; + bool changed = false; S32 i; for (i = 0; i < TC_EOF; i++) { if (mNominalBPS[i] != throttle_vec[i]) { - changed = TRUE; + changed = true; mNominalBPS[i] = throttle_vec[i]; } } @@ -285,9 +285,9 @@ S32 LLThrottleGroup::getAvailable(S32 throttle_cat) } -BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) +bool LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) { - BOOL retval = TRUE; + bool retval = true; F32 category_bps = mCurrentBPS[throttle_cat]; F32 lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; @@ -302,23 +302,23 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mBitsAvailable[throttle_cat] = lookahead_bits; - retval = FALSE; + retval = false; } else if ( bits_available > bits ) { // ...enough space to send this message - retval = FALSE; + retval = false; } return retval; } -BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) +bool LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) { F32Seconds elapsed_time; F32 category_bps; F32 lookahead_bits; - BOOL retval = TRUE; + bool retval = true; category_bps = mCurrentBPS[throttle_cat]; lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; @@ -333,12 +333,12 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) // ...channel completely open, so allow send regardless // of size. This allows sends on very low BPS channels. mBitsAvailable[throttle_cat] = lookahead_bits; - retval = FALSE; + retval = false; } else if ( mBitsAvailable[throttle_cat] > bits ) { // ...enough space to send this message - retval = FALSE; + retval = false; } // We actually already sent the bits. @@ -354,7 +354,7 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) } -BOOL LLThrottleGroup::dynamicAdjust() +bool LLThrottleGroup::dynamicAdjust() { const F32Seconds DYNAMIC_ADJUST_TIME(1.0f); const F32 CURRENT_PERIOD_WEIGHT = .25f; // how much weight to give to last period while determining BPS utilization @@ -370,7 +370,7 @@ BOOL LLThrottleGroup::dynamicAdjust() // Only dynamically adjust every few seconds if ((mt_sec - mDynamicAdjustTime) < DYNAMIC_ADJUST_TIME) { - return FALSE; + return false; } mDynamicAdjustTime = mt_sec; @@ -394,11 +394,11 @@ BOOL LLThrottleGroup::dynamicAdjust() // Look for busy channels // TODO: Fold into loop above. - BOOL channels_busy = FALSE; + bool channels_busy = false; F32 busy_nominal_sum = 0; - BOOL channel_busy[TC_EOF]; - BOOL channel_idle[TC_EOF]; - BOOL channel_over_nominal[TC_EOF]; + bool channel_busy[TC_EOF]; + bool channel_idle[TC_EOF]; + bool channel_over_nominal[TC_EOF]; for (i = 0; i < TC_EOF; i++) { @@ -406,34 +406,34 @@ BOOL LLThrottleGroup::dynamicAdjust() if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) { // this channel is busy - channels_busy = TRUE; + channels_busy = true; busy_nominal_sum += mNominalBPS[i]; // use for allocation of pooled idle bandwidth - channel_busy[i] = TRUE; + channel_busy[i] = true; } else { - channel_busy[i] = FALSE; + channel_busy[i] = false; } // Is this an idle channel? if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) && (mBitsAvailable[i] > 0)) { - channel_idle[i] = TRUE; + channel_idle[i] = true; } else { - channel_idle[i] = FALSE; + channel_idle[i] = false; } // Is this an overpumped channel? if (mCurrentBPS[i] > mNominalBPS[i]) { - channel_over_nominal[i] = TRUE; + channel_over_nominal[i] = true; } else { - channel_over_nominal[i] = FALSE; + channel_over_nominal[i] = false; } } @@ -573,5 +573,5 @@ BOOL LLThrottleGroup::dynamicAdjust() } } } - return TRUE; + return true; } diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h index 9450f4de88..b8a8c9f1f7 100644 --- a/indra/llmessage/llthrottle.h +++ b/indra/llmessage/llthrottle.h @@ -41,8 +41,8 @@ public: ~LLThrottle() { } void setRate(const F32 rate); - BOOL checkOverflow(const F32 amount); // I'm about to add an amount, TRUE if would overflow throttle - BOOL throttleOverflow(const F32 amount); // I just sent amount, TRUE if that overflowed the throttle + bool checkOverflow(const F32 amount); // I'm about to add an amount, true if would overflow throttle + bool throttleOverflow(const F32 amount); // I just sent amount, true if that overflowed the throttle F32 getAvailable(); // Return the available bits F32 getRate() const { return mRate; } @@ -73,10 +73,10 @@ public: ~LLThrottleGroup() { } void resetDynamicAdjust(); - BOOL checkOverflow(S32 throttle_cat, F32 bits); // I'm about to send bits, TRUE if would overflow channel - BOOL throttleOverflow(S32 throttle_cat, F32 bits); // I just sent bits, TRUE if that overflowed the channel - BOOL dynamicAdjust(); // Shift bandwidth from idle channels to busy channels, TRUE if adjustment occurred - BOOL setNominalBPS(F32* throttle_vec); // TRUE if any value was different, resets adjustment system if was different + bool checkOverflow(S32 throttle_cat, F32 bits); // I'm about to send bits, true if would overflow channel + bool throttleOverflow(S32 throttle_cat, F32 bits); // I just sent bits, true if that overflowed the channel + bool dynamicAdjust(); // Shift bandwidth from idle channels to busy channels, true if adjustment occurred + bool setNominalBPS(F32* throttle_vec); // true if any value was different, resets adjustment system if was different S32 getAvailable(S32 throttle_cat); // Return bits available in the channel diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 7f6ff3b025..72d623ea42 100644 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -49,7 +49,7 @@ LLTransferSource::stype_scfunc_map LLTransferSource::sSourceCreateMap; // LLTransferManager::LLTransferManager() : - mValid(FALSE) + mValid(false) { S32 i; for (i = 0; i < LLTTT_NUM_TYPES; i++) @@ -78,7 +78,7 @@ void LLTransferManager::init() { LL_ERRS() << "Double initializing LLTransferManager!" << LL_ENDL; } - mValid = TRUE; + mValid = true; // Register message system handlers gMessageSystem->setHandlerFunc("TransferRequest", processTransferRequest, NULL); @@ -90,7 +90,7 @@ void LLTransferManager::init() void LLTransferManager::cleanup() { - mValid = FALSE; + mValid = false; host_tc_map::iterator iter; for (iter = mTransferConnections.begin(); iter != mTransferConnections.end(); iter++) @@ -254,7 +254,7 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) msgp->getBinaryData("TransferInfo", "Params", tmp, size); LLDataPackerBinaryBuffer dpb(tmp, MAX_PARAMS_SIZE); - BOOL unpack_ok = tsp->unpackParams(dpb); + bool unpack_ok = tsp->unpackParams(dpb); if (!unpack_ok) { // This should only happen if the data is corrupt or @@ -342,7 +342,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) //LL_INFOS() << "Receiving " << transfer_id << ", size " << size << " bytes" << LL_ENDL; ttp->setSize(size); - ttp->setGotInfo(TRUE); + ttp->setGotInfo(true); // OK, at this point we to handle any delayed transfer packets (which could happen // if this packet was lost) @@ -505,7 +505,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) // NOTE: THERE IS A CUT AND PASTE OF THIS CODE IN THE TRANSFERINFO HANDLER // SO WE CAN PLAY BACK DELAYED PACKETS THERE!!!!!!!!!!!!!!!!!!!!!!!!! // - BOOL done = FALSE; + bool done = false; while (!done) { LLTSCode ret_code = ttp->dataCallback(packet_id, tmp_data, size); @@ -557,7 +557,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) else { // No matching delayed packet, abort it. - done = TRUE; + done = true; } } } @@ -780,7 +780,7 @@ void LLTransferSourceChannel::updateTransfers() LLPriQueueMap<LLTransferSource *>::pqm_iter iter, next; - BOOL done = FALSE; + bool done = false; for (iter = mTransferSources.mMap.begin(); (iter != mTransferSources.mMap.end()) && !done;) { //LL_INFOS() << "LLTransferSourceChannel::updateTransfers()" << LL_ENDL; @@ -791,7 +791,7 @@ void LLTransferSourceChannel::updateTransfers() LLTransferSource *tsp = iter->second; U8 *datap = NULL; S32 data_size = 0; - BOOL delete_data = FALSE; + bool delete_data = false; S32 packet_id = 0; S32 sent_bytes = 0; LLTSCode status = LLTS_OK; @@ -822,7 +822,7 @@ void LLTransferSourceChannel::updateTransfers() gMessageSystem->addS32("Status", status); gMessageSystem->addBinaryData("Data", datap, data_size); sent_bytes = gMessageSystem->getCurrentSendTotal(); - gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, F32Seconds(0.f), + gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, true, F32Seconds(0.f), LLTransferManager::reliablePacketCallback, (void**)cb_uuid); // Do bookkeeping for the throttle @@ -1207,7 +1207,7 @@ LLTransferTarget::LLTransferTarget( mSourceType(source_type), mID(transfer_id), mChannelp(NULL), - mGotInfo(FALSE), + mGotInfo(false), mSize(0), mLastPacketID(-1) { @@ -1335,7 +1335,7 @@ void LLTransferSourceParamsInvItem::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) { S32 tmp_at; @@ -1349,7 +1349,7 @@ BOOL LLTransferSourceParamsInvItem::unpackParams(LLDataPacker &dp) mAssetType = (LLAssetType::EType)tmp_at; - return TRUE; + return true; } LLTransferSourceParamsEstate::LLTransferSourceParamsEstate() : @@ -1387,7 +1387,7 @@ void LLTransferSourceParamsEstate::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) { S32 tmp_et; @@ -1397,5 +1397,5 @@ BOOL LLTransferSourceParamsEstate::unpackParams(LLDataPacker &dp) mEstateAssetType = (EstateAssetType)tmp_et; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfermanager.h b/indra/llmessage/lltransfermanager.h index 9e42797c31..ada5528b49 100644 --- a/indra/llmessage/lltransfermanager.h +++ b/indra/llmessage/lltransfermanager.h @@ -121,7 +121,7 @@ public: LLTransferSource *findTransferSource(const LLUUID &transfer_id); - BOOL isValid() const { return mValid; } + bool isValid() const { return mValid; } static void processTransferRequest(LLMessageSystem *mesgsys, void **); static void processTransferInfo(LLMessageSystem *mesgsys, void **); @@ -138,13 +138,13 @@ public: void addTransferBitsOut(const LLTransferChannelType tctype, const S32 bits) { mTransferBitsOut[tctype] += bits; } protected: LLTransferConnection *getTransferConnection(const LLHost &host); - BOOL removeTransferConnection(const LLHost &host); + bool removeTransferConnection(const LLHost &host); protected: // Convenient typedefs typedef std::map<LLHost, LLTransferConnection *> host_tc_map; - BOOL mValid; + bool mValid; LLHost mHost; S32 mTransferBitsIn[LLTTT_NUM_TYPES]; @@ -263,7 +263,7 @@ public: virtual ~LLTransferSourceParams(); virtual void packParams(LLDataPacker &dp) const = 0; - virtual BOOL unpackParams(LLDataPacker &dp) = 0; + virtual bool unpackParams(LLDataPacker &dp) = 0; LLTransferSourceType getType() const { return mType; } @@ -300,13 +300,13 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned) = 0; + bool &delete_returned) = 0; // The completionCallback is GUARANTEED to be called before the destructor. virtual void completionCallback(const LLTSCode status) = 0; virtual void packParams(LLDataPacker& dp) const = 0; - virtual BOOL unpackParams(LLDataPacker& dp) = 0; + virtual bool unpackParams(LLDataPacker& dp) = 0; virtual S32 getNextPacketID() { return mLastPacketID + 1; } virtual void setLastPacketID(const S32 packet_id) { mLastPacketID = packet_id; } @@ -408,8 +408,8 @@ protected: virtual S32 getNextPacketID() { return mLastPacketID + 1; } virtual void setLastPacketID(const S32 packet_id) { mLastPacketID = packet_id; } void setSize(const S32 size) { mSize = size; } - void setGotInfo(const BOOL got_info) { mGotInfo = got_info; } - BOOL gotInfo() const { return mGotInfo; } + void setGotInfo(const bool got_info) { mGotInfo = got_info; } + bool gotInfo() const { return mGotInfo; } bool addDelayedPacket( const S32 packet_id, @@ -425,7 +425,7 @@ protected: LLTransferSourceType mSourceType; LLUUID mID; LLTransferTargetChannel *mChannelp; - BOOL mGotInfo; + bool mGotInfo; S32 mSize; S32 mLastPacketID; @@ -440,7 +440,7 @@ public: LLTransferSourceParamsInvItem(); virtual ~LLTransferSourceParamsInvItem() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAgentSession(const LLUUID &agent_id, const LLUUID &session_id); void setInvItem(const LLUUID &owner_id, const LLUUID &task_id, const LLUUID &item_id); @@ -472,7 +472,7 @@ public: LLTransferSourceParamsEstate(); virtual ~LLTransferSourceParamsEstate() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAgentSession(const LLUUID &agent_id, const LLUUID &session_id); void setEstateAssetType(const EstateAssetType etype); diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 3ffade9bdc..082f12b8bf 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -36,7 +36,7 @@ LLTransferSourceAsset::LLTransferSourceAsset(const LLUUID &request_id, const F32 priority) : LLTransferSource(LLTST_ASSET, request_id, priority), - mGotResponse(FALSE), + mGotResponse(false), mCurPos(0) { } @@ -62,7 +62,7 @@ void LLTransferSourceAsset::initTransfer() mParams.getAssetType(), LLTransferSourceAsset::responderCallback, tidp, - FALSE); + false); } else { @@ -91,7 +91,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, const S32 max_bytes, U8 **data_handle, S32 &returned_bytes, - BOOL &delete_returned) + bool &delete_returned) { //LL_INFOS() << "LLTransferSourceAsset::dataCallback" << LL_ENDL; if (!mGotResponse) @@ -120,7 +120,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, return LLTS_ERROR; } - delete_returned = TRUE; + delete_returned = true; U8 *tmpp = new U8[max_bytes]; *data_handle = tmpp; if (!vf.read(tmpp, max_bytes)) /* Flawfinder: Ignore */ @@ -129,7 +129,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; return LLTS_ERROR; } @@ -144,7 +144,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; } return LLTS_DONE; } @@ -164,7 +164,7 @@ void LLTransferSourceAsset::packParams(LLDataPacker& dp) const mParams.packParams(dp); } -BOOL LLTransferSourceAsset::unpackParams(LLDataPacker &dp) +bool LLTransferSourceAsset::unpackParams(LLDataPacker &dp) { //LL_INFOS() << "LLTransferSourceAsset::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); @@ -194,7 +194,7 @@ void LLTransferSourceAsset::responderCallback(const LLUUID& uuid, LLAssetType::E LLTSCode status; - tsap->mGotResponse = TRUE; + tsap->mGotResponse = true; if (LL_ERR_NOERR == result) { // Everything's OK. @@ -240,7 +240,7 @@ void LLTransferSourceParamsAsset::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) { S32 tmp_at; @@ -249,6 +249,6 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp) mAssetType = (LLAssetType::EType)tmp_at; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h index f241a1e4a1..6c4c39011a 100644 --- a/indra/llmessage/lltransfersourceasset.h +++ b/indra/llmessage/lltransfersourceasset.h @@ -38,7 +38,7 @@ public: LLTransferSourceParamsAsset(); virtual ~LLTransferSourceParamsAsset() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setAsset(const LLUUID &asset_id, const LLAssetType::EType asset_type); @@ -65,15 +65,15 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned); + bool &delete_returned); /*virtual*/ void completionCallback(const LLTSCode status); virtual void packParams(LLDataPacker& dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); protected: LLTransferSourceParamsAsset mParams; - BOOL mGotResponse; + bool mGotResponse; S32 mCurPos; }; diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index ee0f176b9d..77a6c466c7 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -86,7 +86,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, const S32 max_bytes, U8 **data_handle, S32 &returned_bytes, - BOOL &delete_returned) + bool &delete_returned) { //LL_INFOS() << "LLTransferSourceFile::dataCallback" << LL_ENDL; @@ -102,7 +102,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, } // Grab up until the max number of bytes from the file. - delete_returned = TRUE; + delete_returned = true; U8 *tmpp = new U8[max_bytes]; *data_handle = tmpp; returned_bytes = (S32)fread(tmpp, 1, max_bytes, mFP); @@ -111,7 +111,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, delete[] tmpp; *data_handle = NULL; returned_bytes = 0; - delete_returned = FALSE; + delete_returned = false; return LLTS_DONE; } @@ -141,7 +141,7 @@ void LLTransferSourceFile::packParams(LLDataPacker& dp) const mParams.packParams(dp); } -BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) +bool LLTransferSourceFile::unpackParams(LLDataPacker &dp) { //LL_INFOS() << "LLTransferSourceFile::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); @@ -150,7 +150,7 @@ BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) LLTransferSourceParamsFile::LLTransferSourceParamsFile() : LLTransferSourceParams(LLTST_FILE), - mDeleteOnCompletion(FALSE) + mDeleteOnCompletion(false) { } @@ -162,7 +162,7 @@ void LLTransferSourceParamsFile::packParams(LLDataPacker &dp) const } -BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) +bool LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) { dp.unpackString(mFilename, "Filename"); U8 delete_flag; @@ -170,5 +170,5 @@ BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) mDeleteOnCompletion = delete_flag; LL_INFOS() << "Unpacked filename: " << mFilename << LL_ENDL; - return TRUE; + return true; } diff --git a/indra/llmessage/lltransfersourcefile.h b/indra/llmessage/lltransfersourcefile.h index a84e5066e3..a447ab091b 100644 --- a/indra/llmessage/lltransfersourcefile.h +++ b/indra/llmessage/lltransfersourcefile.h @@ -35,17 +35,17 @@ public: LLTransferSourceParamsFile(); virtual ~LLTransferSourceParamsFile() {} /*virtual*/ void packParams(LLDataPacker &dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); void setFilename(const std::string &filename) { mFilename = filename; } std::string getFilename() const { return mFilename; } - void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; } - BOOL getDeleteOnCompletion() { return mDeleteOnCompletion; } + void setDeleteOnCompletion(bool enabled) { mDeleteOnCompletion = enabled; } + bool getDeleteOnCompletion() { return mDeleteOnCompletion; } protected: std::string mFilename; // ONLY DELETE THINGS OFF THE SIM IF THE FILENAME BEGINS IN 'TEMP' - BOOL mDeleteOnCompletion; + bool mDeleteOnCompletion; }; class LLTransferSourceFile : public LLTransferSource @@ -61,11 +61,11 @@ protected: const S32 max_bytes, U8 **datap, S32 &returned_bytes, - BOOL &delete_returned); + bool &delete_returned); /*virtual*/ void completionCallback(const LLTSCode status); virtual void packParams(LLDataPacker& dp) const; - /*virtual*/ BOOL unpackParams(LLDataPacker &dp); + /*virtual*/ bool unpackParams(LLDataPacker &dp); protected: LLTransferSourceParamsFile mParams; diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index 53962b6633..fcf853845b 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -94,7 +94,7 @@ LLTransferTargetVFile::LLTransferTargetVFile( const LLUUID& uuid, LLTransferSourceType src_type) : LLTransferTarget(LLTTT_VFILE, uuid, src_type), - mNeedsCreate(TRUE) + mNeedsCreate(true) { mTempID.generate(); } @@ -141,7 +141,7 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, LLFileSystem vf(mTempID, mParams.getAssetType(), LLFileSystem::APPEND); if (mNeedsCreate) { - mNeedsCreate = FALSE; + mNeedsCreate = false; } if (!in_size) diff --git a/indra/llmessage/lltransfertargetvfile.h b/indra/llmessage/lltransfertargetvfile.h index 83cfd5fc5d..4a78c3c522 100644 --- a/indra/llmessage/lltransfertargetvfile.h +++ b/indra/llmessage/lltransfertargetvfile.h @@ -86,7 +86,7 @@ protected: LLTransferTargetParamsVFile mParams; - BOOL mNeedsCreate; + bool mNeedsCreate; LLUUID mTempID; }; diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index c7c9ccd3bd..36ab87086d 100644 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -41,7 +41,7 @@ LLUserOperationMgr* gUserOperationMgr = NULL; LLUserOperation::LLUserOperation(const LLUUID& agent_id) : mAgentID(agent_id), mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { mTransactionID.generate(); } @@ -51,7 +51,7 @@ LLUserOperation::LLUserOperation(const LLUUID& agent_id, mAgentID(agent_id), mTransactionID(transaction_id), mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { } @@ -59,7 +59,7 @@ LLUserOperation::LLUserOperation(const LLUUID& agent_id, // transaction, agent, et. after construction. LLUserOperation::LLUserOperation() : mTimer(), - mNoExpire(FALSE) + mNoExpire(false) { } @@ -67,19 +67,19 @@ LLUserOperation::~LLUserOperation() { } -void LLUserOperation::SetNoExpireFlag(const BOOL flag) +void LLUserOperation::SetNoExpireFlag(const bool flag) { mNoExpire = flag; } -BOOL LLUserOperation::isExpired() +bool LLUserOperation::isExpired() { if (!mNoExpire) { const F32 EXPIRE_TIME_SECS = 10.f; return mTimer.getElapsedTimeF32() > EXPIRE_TIME_SECS; } - return FALSE; + return false; } void LLUserOperation::expire() @@ -128,7 +128,7 @@ LLUserOperation* LLUserOperationMgr::findOperation(const LLUUID& tid) } -BOOL LLUserOperationMgr::deleteOperation(LLUserOperation* op) +bool LLUserOperationMgr::deleteOperation(LLUserOperation* op) { size_t rv = 0; if(op) @@ -138,7 +138,7 @@ BOOL LLUserOperationMgr::deleteOperation(LLUserOperation* op) delete op; op = NULL; } - return rv ? TRUE : FALSE; + return rv != 0; } void LLUserOperationMgr::deleteExpiredOperations() diff --git a/indra/llmessage/lluseroperation.h b/indra/llmessage/lluseroperation.h index 953e36d7c0..c3ac2e350c 100644 --- a/indra/llmessage/lluseroperation.h +++ b/indra/llmessage/lluseroperation.h @@ -44,17 +44,17 @@ public: const LLUUID& getAgentID() const { return mAgentID; } // Operation never got necessary data, so expired - virtual BOOL isExpired(); + virtual bool isExpired(); // ability to mark this operation as never expiring. - void SetNoExpireFlag(const BOOL flag); + void SetNoExpireFlag(const bool flag); // Send request to the dataserver virtual void sendRequest() = 0; // Run the operation. This will only be called in the case of an // actual success or failure of the operation. - virtual BOOL execute(BOOL transaction_success) = 0; + virtual bool execute(bool transaction_success) = 0; // This method is called when the user op has expired, and is // about to be deleted by the manager. This gives the user op the @@ -68,7 +68,7 @@ protected: LLUUID mAgentID; LLUUID mTransactionID; LLFrameTimer mTimer; - BOOL mNoExpire; // this is used for operations that expect an answer and will wait till it gets one. + bool mNoExpire; // this is used for operations that expect an answer and will wait till it gets one. }; @@ -80,7 +80,7 @@ public: void addOperation(LLUserOperation* op); LLUserOperation* findOperation(const LLUUID& transaction_id); - BOOL deleteOperation(LLUserOperation* op); + bool deleteOperation(LLUserOperation* op); // Call this method every once in a while to clean up old // transactions. diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index ea2309fbba..358c8be671 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -63,13 +63,13 @@ void LLXfer::init (S32 chunk_size) mXferSize = 0; mStatus = e_LL_XFER_UNINITIALIZED; - mWaitingForACK = FALSE; + mWaitingForACK = false; mCallback = NULL; mCallbackDataHandle = NULL; mCallbackResult = 0; - mBufferContainsEOF = FALSE; + mBufferContainsEOF = false; mBuffer = NULL; mBufferLength = 0; mBufferStartOffset = 0; @@ -187,7 +187,7 @@ void LLXfer::sendPacket(S32 packet_num) { char fdata_buf[LL_XFER_LARGE_PAYLOAD+4]; /* Flawfinder: ignore */ S32 fdata_size = mChunkSize; - BOOL last_packet = FALSE; + bool last_packet = false; S32 num_copy = 0; // if the desired packet is not in our current buffered excerpt from the file. . . @@ -217,7 +217,7 @@ void LLXfer::sendPacket(S32 packet_num) if (((U32)(desired_read_position + fdata_size) >= (U32)mBufferLength) && (mBufferContainsEOF)) { - last_packet = TRUE; + last_packet = true; } if (packet_num) @@ -270,7 +270,7 @@ void LLXfer::sendPacket(S32 packet_num) } ACKTimer.reset(); - mWaitingForACK = TRUE; + mWaitingForACK = true; } if (last_packet) { @@ -327,7 +327,7 @@ S32 LLXfer::processEOF() /////////////////////////////////////////////////////////// -S32 LLXfer::encodePacketNum(S32 packet_num, BOOL is_EOF) +S32 LLXfer::encodePacketNum(S32 packet_num, bool is_EOF) { if (is_EOF) { diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index 2f880381d5..9a0901a84a 100644 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -63,11 +63,11 @@ class LLXfer char *mBuffer; U32 mBufferLength; // Size of valid data, not actual allocated buffer size U32 mBufferStartOffset; - BOOL mBufferContainsEOF; + bool mBufferContainsEOF; ELLXferStatus mStatus; - BOOL mWaitingForACK; + bool mWaitingForACK; void (*mCallback)(void **,S32,LLExtStat); void **mCallbackDataHandle; @@ -103,7 +103,7 @@ class LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof); + virtual S32 encodePacketNum(S32 packet_num, bool is_eof); virtual void setXferSize (S32 data_size); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index bdd7e35fd5..71b910297b 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -49,10 +49,10 @@ S32 copy_file(const std::string& from, const std::string& to); LLXfer_File::LLXfer_File (S32 chunk_size) : LLXfer(chunk_size) { - init(LLStringUtil::null, FALSE, chunk_size); + init(LLStringUtil::null, false, chunk_size); } -LLXfer_File::LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +LLXfer_File::LLXfer_File (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size) : LLXfer(chunk_size) { init(local_filename, delete_local_on_completion, chunk_size); @@ -67,7 +67,7 @@ LLXfer_File::~LLXfer_File () /////////////////////////////////////////////////////////// -void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size) +void LLXfer_File::init (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size) { mFp = NULL; @@ -75,8 +75,8 @@ void LLXfer_File::init (const std::string& local_filename, BOOL delete_local_on_ mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; mTempFilename.clear(); - mDeleteLocalOnCompletion = FALSE; - mDeleteRemoteOnCompletion = FALSE; + mDeleteLocalOnCompletion = false; + mDeleteRemoteOnCompletion = false; if (!local_filename.empty()) { @@ -120,7 +120,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data) { @@ -174,7 +174,7 @@ S32 LLXfer_File::startDownload() gMessageSystem->addStringFast(_PREHASH_Filename, mRemoteFilename); gMessageSystem->addU8("FilePath", (U8) mRemotePath); gMessageSystem->addBOOL("DeleteOnCompletion", mDeleteRemoteOnCompletion); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, LLUUID::null); gMessageSystem->addS16Fast(_PREHASH_VFileType, -1); @@ -287,11 +287,11 @@ S32 LLXfer_File::suck(S32 start_position) if (feof(mFp)) { - mBufferContainsEOF = TRUE; + mBufferContainsEOF = true; } else { - mBufferContainsEOF = FALSE; + mBufferContainsEOF = false; } } else @@ -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 @@ -412,14 +412,14 @@ S32 LLXfer_File::processEOF() /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesLocalFilename(const std::string& filename) +bool LLXfer_File::matchesLocalFilename(const std::string& filename) { return (filename == mLocalFilename); } /////////////////////////////////////////////////////////// -BOOL LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) +bool LLXfer_File::matchesRemoteFilename(const std::string& filename, ELLPath remote_path) { return ((filename == mRemoteFilename) && (remote_path == mRemotePath)); } diff --git a/indra/llmessage/llxfer_file.h b/indra/llmessage/llxfer_file.h index cb2da47e44..f30ef3eed6 100644 --- a/indra/llmessage/llxfer_file.h +++ b/indra/llmessage/llxfer_file.h @@ -39,15 +39,15 @@ class LLXfer_File : public LLXfer ELLPath mRemotePath; std::string mTempFilename; - BOOL mDeleteLocalOnCompletion; - BOOL mDeleteRemoteOnCompletion; + bool mDeleteLocalOnCompletion; + bool mDeleteRemoteOnCompletion; public: LLXfer_File (S32 chunk_size); - LLXfer_File (const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + LLXfer_File (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size); virtual ~LLXfer_File(); - virtual void init(const std::string& local_filename, BOOL delete_local_on_completion, S32 chunk_size); + virtual void init(const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size); virtual void cleanup(); virtual S32 initializeRequest(U64 xfer_id, @@ -55,7 +55,7 @@ class LLXfer_File : public LLXfer const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data); virtual S32 startDownload(); @@ -69,8 +69,8 @@ class LLXfer_File : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFilename(const std::string& filename); - virtual BOOL matchesRemoteFilename(const std::string& filename, ELLPath remote_path); + virtual bool matchesLocalFilename(const std::string& filename); + virtual bool matchesRemoteFilename(const std::string& filename, ELLPath remote_path); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index 100a67e422..b619974270 100644 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -52,7 +52,7 @@ void LLXfer_Mem::init () { mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; - mDeleteRemoteOnCompletion = FALSE; + mDeleteRemoteOnCompletion = false; } /////////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ void LLXfer_Mem::setXferSize (S32 xfer_size) mBufferLength = 0; mBufferStartOffset = 0; - mBufferContainsEOF = TRUE; + mBufferContainsEOF = true; // cout << "starting transfer of size: " << xfer_size << endl; } @@ -124,7 +124,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*,S32,void**,S32,LLExtStat), void** user_data) { @@ -164,7 +164,7 @@ S32 LLXfer_Mem::startDownload() gMessageSystem->addStringFast(_PREHASH_Filename, mRemoteFilename); gMessageSystem->addU8("FilePath", (U8) mRemotePath); gMessageSystem->addBOOL("DeleteOnCompletion", mDeleteRemoteOnCompletion); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, LLUUID::null); gMessageSystem->addS16Fast(_PREHASH_VFileType, -1); diff --git a/indra/llmessage/llxfer_mem.h b/indra/llmessage/llxfer_mem.h index ef8e9e2483..4e87b0ca5a 100644 --- a/indra/llmessage/llxfer_mem.h +++ b/indra/llmessage/llxfer_mem.h @@ -39,7 +39,7 @@ class LLXfer_Mem : public LLXfer void (*mCallback)(void *, S32, void **, S32, LLExtStat); std::string mRemoteFilename; ELLPath mRemotePath; - BOOL mDeleteRemoteOnCompletion; + bool mDeleteRemoteOnCompletion; public: @@ -59,7 +59,7 @@ class LLXfer_Mem : public LLXfer const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*,S32,void**,S32,LLExtStat), void** user_data); virtual S32 startDownload(); diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index fbe880d05d..4f31973f3d 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -138,7 +138,7 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mBufferLength = 0; mPacketNum = 0; mTempID.generate(); - mDeleteTempFile = TRUE; + mDeleteTempFile = true; mStatus = e_LL_XFER_PENDING; return retval; } @@ -156,8 +156,8 @@ S32 LLXfer_VFile::startDownload() gMessageSystem->addU64Fast(_PREHASH_ID, mID); gMessageSystem->addStringFast(_PREHASH_Filename, ""); gMessageSystem->addU8("FilePath", (U8) LL_PATH_NONE); - gMessageSystem->addBOOL("DeleteOnCompletion", FALSE); - gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD)); + gMessageSystem->addBOOL("DeleteOnCompletion", false); + gMessageSystem->addBOOL("UseBigPackets", mChunkSize == LL_XFER_LARGE_PAYLOAD); gMessageSystem->addUUIDFast(_PREHASH_VFileID, mRemoteID); gMessageSystem->addS16Fast(_PREHASH_VFileType, (S16)mType); @@ -345,7 +345,7 @@ S32 LLXfer_VFile::processEOF() { // Rename worked: the original file is gone. Clear mDeleteTempFile // so we don't attempt to delete the file in cleanup() - mDeleteTempFile = FALSE; + mDeleteTempFile = false; } } else @@ -367,14 +367,14 @@ S32 LLXfer_VFile::processEOF() //////////////////////////////////////////////////////////// -BOOL LLXfer_VFile::matchesLocalFile(const LLUUID &id, LLAssetType::EType type) +bool LLXfer_VFile::matchesLocalFile(const LLUUID &id, LLAssetType::EType type) { return (id == mLocalID && type == mType); } ////////////////////////////////////////////////////////// -BOOL LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) +bool LLXfer_VFile::matchesRemoteFile(const LLUUID &id, LLAssetType::EType type) { return (id == mRemoteID && type == mType); } diff --git a/indra/llmessage/llxfer_vfile.h b/indra/llmessage/llxfer_vfile.h index 5ab767b052..f62da815f8 100644 --- a/indra/llmessage/llxfer_vfile.h +++ b/indra/llmessage/llxfer_vfile.h @@ -44,7 +44,7 @@ class LLXfer_VFile : public LLXfer std::string mName; - BOOL mDeleteTempFile; + bool mDeleteTempFile; public: LLXfer_VFile (); @@ -72,8 +72,8 @@ class LLXfer_VFile : public LLXfer virtual S32 suck(S32 start_position); virtual S32 flush(); - virtual BOOL matchesLocalFile(const LLUUID &id, LLAssetType::EType type); - virtual BOOL matchesRemoteFile(const LLUUID &id, LLAssetType::EType type); + virtual bool matchesLocalFile(const LLUUID &id, LLAssetType::EType type); + virtual bool matchesRemoteFile(const LLUUID &id, LLAssetType::EType type); virtual void setXferSize(S32 xfer_size); virtual S32 getMaxBufferSize(); diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index ea1fe0a963..f6ed43a4e4 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -79,7 +79,7 @@ void LLXferManager::init() setMaxIncomingXfers(LL_DEFAULT_MAX_REQUEST_FIFO_XFERS); // Turn on or off ack throttling - mUseAckThrottling = FALSE; + mUseAckThrottling = false; setAckThrottleBPS(100000); } @@ -116,7 +116,7 @@ void LLXferManager::setHardLimitOutgoingXfersPerCircuit(S32 max_num) mHardLimitOutgoingXfersPerCircuit = max_num; } -void LLXferManager::setUseAckThrottling(const BOOL use) +void LLXferManager::setUseAckThrottling(const bool use) { mUseAckThrottling = use; } @@ -367,7 +367,7 @@ U64 LLXferManager::getNextID () /////////////////////////////////////////////////////////// -S32 LLXferManager::encodePacketNum(S32 packet_num, BOOL is_EOF) +S32 LLXferManager::encodePacketNum(S32 packet_num, bool is_EOF) { if (is_EOF) { @@ -385,7 +385,7 @@ S32 LLXferManager::decodePacketNum(S32 packet_num) /////////////////////////////////////////////////////////// -BOOL LLXferManager::isLastPacket(S32 packet_num) +bool LLXferManager::isLastPacket(S32 packet_num) { return(packet_num & 0x80000000); } @@ -396,11 +396,11 @@ U64 LLXferManager::requestFile(const std::string& local_filename, const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority, - BOOL use_big_packets) + bool is_priority, + bool use_big_packets) { LLXfer_File* file_xfer_p = NULL; @@ -464,7 +464,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, const LLHost& remote_host, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority) + bool is_priority) { LLXfer_VFile * xfer_p = NULL; @@ -757,7 +757,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user LLUUID uuid; LLAssetType::EType type; S16 type_s16; - BOOL b_use_big_packets; + bool b_use_big_packets; mesgsys->getBOOL("XferID", "UseBigPackets", b_use_big_packets); @@ -853,7 +853,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } LL_INFOS("Xfer") << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << LL_ENDL; - BOOL delete_local_on_completion = FALSE; + bool delete_local_on_completion = false; mesgsys->getBOOL("XferID", "DeleteOnCompletion", delete_local_on_completion); // -1 chunk_size causes it to use the default @@ -1005,7 +1005,7 @@ void LLXferManager::processConfirmation (LLMessageSystem *mesgsys, void ** /*use if (xferp) { // cout << "confirmed packet #" << packetNum << " ping: "<< xferp->ACKTimer.getElapsedTimeF32() << endl; - xferp->mWaitingForACK = FALSE; + xferp->mWaitingForACK = false; if (xferp->mStatus == e_LL_XFER_IN_PROGRESS) { xferp->sendNextPacket(); @@ -1235,7 +1235,7 @@ void LLXferManager::startPendingDownloads() /////////////////////////////////////////////////////////// -void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, BOOL is_priority) +void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, bool is_priority) { if(is_priority) { diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index 3999b41862..3be5f5a228 100644 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -76,7 +76,7 @@ class LLXferManager S32 mHardLimitOutgoingXfersPerCircuit; // At this limit, kill off the connection S32 mMaxIncomingXfers; - BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth + bool mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth std::deque<LLXferAckInfo> mXferAckQueue; LLThrottle mAckThrottle; public: @@ -85,8 +85,8 @@ class LLXferManager // an xfer must happen asap. enum { - LOW_PRIORITY = FALSE, - HIGH_PRIORITY = TRUE, + LOW_PRIORITY = false, + HIGH_PRIORITY = true, }; // Linked FIFO list, add to the front and pull from back @@ -100,7 +100,7 @@ class LLXferManager protected: // implementation methods virtual void startPendingDownloads(); - virtual void addToList(LLXfer* xferp, xfer_list_t & xfer_list, BOOL is_priority); + virtual void addToList(LLXfer* xferp, xfer_list_t & xfer_list, bool is_priority); std::multiset<std::string> mExpectedTransfers; // files that are authorized to transfer out std::multiset<std::string> mExpectedRequests; // files that are authorized to be downloaded on top of std::multiset<std::string> mExpectedVFileTransfers; // files that are authorized to transfer out @@ -113,7 +113,7 @@ class LLXferManager virtual void init(); virtual void cleanup(); - void setUseAckThrottling(const BOOL use); + void setUseAckThrottling(const bool use); void setAckThrottleBPS(const F32 bps); // list management routines @@ -135,9 +135,9 @@ class LLXferManager // general utility routines virtual void registerCallbacks(LLMessageSystem *mesgsys); virtual U64 getNextID (); - virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof); + virtual S32 encodePacketNum(S32 packet_num, bool is_eof); virtual S32 decodePacketNum(S32 packet_num); - virtual BOOL isLastPacket(S32 packet_num); + virtual bool isLastPacket(S32 packet_num); // file requesting routines // .. to file @@ -145,19 +145,19 @@ class LLXferManager const std::string& remote_filename, ELLPath remote_path, const LLHost& remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority = FALSE, - BOOL use_big_packets = FALSE); + bool is_priority = false, + bool use_big_packets = false); /* // .. to memory virtual void requestFile(const std::string& remote_filename, ELLPath remote_path, const LLHost &remote_host, - BOOL delete_remote_on_completion, + bool delete_remote_on_completion, void (*callback)(void*, S32, void**, S32, LLExtStat), void** user_data, - BOOL is_priority = FALSE); + bool is_priority = false); */ // vfile requesting // .. to vfile @@ -165,7 +165,7 @@ class LLXferManager LLAssetType::EType type, const LLHost& remote_host, void (*callback)(void**,S32,LLExtStat), void** user_data, - BOOL is_priority = FALSE); + bool is_priority = false); /** When arbitrary files are requested to be transfered (by giving a dir of LL_PATH_NONE) they must be "expected", but having something pre-authorize them. This pair of functions diff --git a/indra/llmessage/llxorcipher.cpp b/indra/llmessage/llxorcipher.cpp index dc92fb7f85..8db4fca629 100644 --- a/indra/llmessage/llxorcipher.cpp +++ b/indra/llmessage/llxorcipher.cpp @@ -109,7 +109,7 @@ void LLXORCipher::init(const U8* pad, U32 pad_len) #ifdef _DEBUG // static -BOOL LLXORCipher::testHarness() +bool LLXORCipher::testHarness() { const U32 PAD_LEN = 3; const U8 PAD[] = "abc"; @@ -122,7 +122,7 @@ BOOL LLXORCipher::testHarness() cipher.encrypt((U8*)MESSAGE, MSG_LENGTH, encrypted, MSG_LENGTH); cipher.decrypt(encrypted, MSG_LENGTH, decrypted, MSG_LENGTH); - if(0 != memcmp((void*)MESSAGE, decrypted, MSG_LENGTH)) return FALSE; - return TRUE; + if(0 != memcmp((void*)MESSAGE, decrypted, MSG_LENGTH)) return false; + return true; } #endif diff --git a/indra/llmessage/llxorcipher.h b/indra/llmessage/llxorcipher.h index fa1fb11b78..50ea997b4d 100644 --- a/indra/llmessage/llxorcipher.h +++ b/indra/llmessage/llxorcipher.h @@ -43,18 +43,18 @@ public: LLXORCipher& operator=(const LLXORCipher& cipher); // Cipher functions - /*virtual*/ U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len); - /*virtual*/ U32 requiredEncryptionSpace(U32 src_len) const; + U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) override; + U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) override; + U32 requiredEncryptionSpace(U32 src_len) const override; // special syntactic-sugar since xor can be performed in place. - BOOL encrypt(U8* buf, U32 len) { return encrypt((const U8*)buf, len, buf, len); } - BOOL decrypt(U8* buf, U32 len) { return decrypt((const U8*)buf, len, buf, len); } + bool encrypt(U8* buf, U32 len) { return encrypt((const U8*)buf, len, buf, len) > 0; } + bool decrypt(U8* buf, U32 len) { return decrypt((const U8*)buf, len, buf, len) > 0; } #ifdef _DEBUG // This function runs tests to make sure the crc is - // working. Returns TRUE if it is. - static BOOL testHarness(); + // working. Returns true if it is. + static bool testHarness(); #endif protected: diff --git a/indra/llmessage/machine.h b/indra/llmessage/machine.h index 17cfd9771f..05d366cbc3 100644 --- a/indra/llmessage/machine.h +++ b/indra/llmessage/machine.h @@ -65,7 +65,7 @@ public: // The control port is the listen port of the parent process that // launched this machine. 0 means none or not known. const S32 &getControlPort() const { return mControlPort; } - BOOL isValid() const { return (mHost.getPort() != 0); } // TRUE if corresponds to functioning machine + bool isValid() const { return (mHost.getPort() != 0); } // true if corresponds to functioning machine // set functions void setMachineType(EMachineType machine_type) { mMachineType = machine_type; } diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 398b3ac757..cfa5178fc6 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -148,11 +148,11 @@ static const char* nullToEmpty(const char* s) void LLMessageSystem::init() { // initialize member variables - mVerboseLog = FALSE; + mVerboseLog = false; - mbError = FALSE; + mbError = false; mErrorCode = 0; - mSendReliable = FALSE; + mSendReliable = false; mUnackedListDepth = 0; mUnackedListSize = 0; @@ -214,7 +214,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mVersionFlags = 0x0; // default to not accepting packets from not alive circuits - mbProtected = TRUE; + mbProtected = true; // default to blocking trusted connections on a public interface if one is specified mBlockUntrustedInterface = true; @@ -239,7 +239,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 error = start_net(mSocket, mPort); if (error != 0) { - mbError = TRUE; + mbError = true; mErrorCode = error; } // LL_DEBUGS("Messaging") << << "*** port: " << mPort << LL_ENDL; @@ -288,7 +288,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure if(filename.empty()) { LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL; - mbError = TRUE; + mbError = true; return; } @@ -300,19 +300,22 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure } else { LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL; } - mbError = TRUE; + mbError = true; return; } LLTemplateTokenizer tokens(template_body); LLTemplateParser parsed(tokens); mMessageFileVersionNumber = parsed.getVersion(); + S32 count = 0; for(LLTemplateParser::message_iterator iter = parsed.getMessagesBegin(); iter != parsed.getMessagesEnd(); iter++) { addTemplate(*iter); + count++; } + LL_INFOS("Messaging") << "Read " << count << " messages from " << filename << LL_ENDL; } @@ -359,7 +362,7 @@ void LLMessageSystem::clearReceiveState() } -BOOL LLMessageSystem::poll(F32 seconds) +bool LLMessageSystem::poll(F32 seconds) { S32 num_socks; apr_status_t status; @@ -370,11 +373,11 @@ BOOL LLMessageSystem::poll(F32 seconds) } if (num_socks) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -465,7 +468,7 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, else { // wake up the circuit - cdp->setAlive(TRUE); + cdp->setAlive(true); if(resetPacketId) { @@ -478,13 +481,13 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, return cdp; } -// Returns TRUE if a valid, on-circuit message has been received. +// Returns true if a valid, on-circuit message has been received. // Requiring a non-const LockMessageChecker reference ensures that // mMessageReader has been set to mTemplateMessageReader. -BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) +bool LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { // Pump - BOOL valid_packet = FALSE; + bool valid_packet = false; LLTransferTargetVFile::updateQueue(); @@ -503,8 +506,8 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { clearReceiveState(); - BOOL recv_reliable = FALSE; - BOOL recv_resent = FALSE; + bool recv_reliable = false; + bool recv_resent = false; S32 acks = 0; S32 true_rcv_size = 0; @@ -528,7 +531,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) callExceptionFunc(MX_PACKET_TOO_SHORT); } // no data in packet receive buffer - valid_packet = FALSE; + valid_packet = false; } else { @@ -551,7 +554,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) LL_WARNS("Messaging") << "Malformed packet received. Packet size " << receive_size << " with invalid no. of acks " << acks << LL_ENDL; - valid_packet = FALSE; + valid_packet = false; continue; } } @@ -590,11 +593,11 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) if (buffer[0] & LL_RELIABLE_FLAG) { - recv_reliable = TRUE; + recv_reliable = true; } if (buffer[0] & LL_RESENT_FLAG) { - recv_resent = TRUE; + recv_resent = true; if (cdp && cdp->isDuplicateResend(mCurrentRecvPacketID)) { // We need to ACK here to suppress @@ -632,7 +635,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) LL_INFOS("Messaging") << str.str() << LL_ENDL; } mPacketsIn++; - valid_packet = FALSE; + valid_packet = false; continue; } } @@ -661,7 +664,7 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) { logMsgFromInvalidCircuit( host, recv_reliable ); clearReceiveState(); - valid_packet = FALSE; + valid_packet = false; } if( @@ -674,12 +677,12 @@ BOOL LLMessageSystem::checkMessages(LockMessageChecker&, S64 frame_count ) clearReceiveState(); sendDenyTrustedCircuit(host); - valid_packet = FALSE; + valid_packet = false; } if( valid_packet ) { - logValidMsg(cdp, host, recv_reliable, recv_resent, (BOOL)(acks>0) ); + logValidMsg(cdp, host, recv_reliable, recv_resent, acks>0 ); valid_packet = mTemplateMessageReader->readMessage(buffer, host); } @@ -765,7 +768,7 @@ void LLMessageSystem::processAcks(LockMessageChecker&, F32 collect_time) } } - BOOL dump = FALSE; + bool dump = false; { // Check the status of circuits mCircuitInfo.updateWatchDogTimers(this); @@ -790,17 +793,17 @@ void LLMessageSystem::processAcks(LockMessageChecker&, F32 collect_time) { if (mNumMessageCounts >= mMaxMessageCounts) { - dump = TRUE; + dump = true; } } if (mMaxMessageTime >= F32Seconds(0.f)) { // This is one of the only places where we're required to get REAL message system time. - mReceiveTime = getMessageTimeSeconds(TRUE) - mMessageCountTime; + mReceiveTime = getMessageTimeSeconds(true) - mMessageCountTime; if (mReceiveTime > mMaxMessageTime) { - dump = TRUE; + dump = true; } } } @@ -830,7 +833,7 @@ void LLMessageSystem::copyMessageReceivedToSend() { mMessageBuilder = mLLSDMessageBuilder; } - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->newMessage(mMessageReader->getMessageName()); mMessageReader->copyToBuilder(*mMessageBuilder); } @@ -925,7 +928,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host, LLStoredMessagePtr message) void LLMessageSystem::clearMessage() { - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->clearMessage(); } @@ -940,7 +943,7 @@ void LLMessageSystem::nextBlock(const char *blockname) nextBlockFast(LLMessageStringTable::getInstance()->getString(blockname)); } -BOOL LLMessageSystem::isSendFull(const char* blockname) +bool LLMessageSystem::isSendFull(const char* blockname) { char* stringTableName = NULL; if(NULL != blockname) @@ -950,22 +953,22 @@ BOOL LLMessageSystem::isSendFull(const char* blockname) return isSendFullFast(stringTableName); } -BOOL LLMessageSystem::isSendFullFast(const char* blockname) +bool LLMessageSystem::isSendFullFast(const char* blockname) { return mMessageBuilder->isMessageFull(blockname); } -// blow away the last block of a message, return FALSE if that leaves no blocks or there wasn't a block to remove +// blow away the last block of a message, return false if that leaves no blocks or there wasn't a block to remove // TODO: Babbage: Remove this horror. -BOOL LLMessageSystem::removeLastBlock() +bool LLMessageSystem::removeLastBlock() { return mMessageBuilder->removeLastBlock(); } S32 LLMessageSystem::sendReliable(const LLHost &host) { - return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, TRUE, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); + return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, true, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); } @@ -984,15 +987,15 @@ S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void timeout = LL_SEMIRELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX; } - const S32 retries = 0; - const BOOL ping_based_timeout = FALSE; + constexpr S32 retries = 0; + constexpr bool ping_based_timeout = false; return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data); } // send the message via a UDP packet S32 LLMessageSystem::sendReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) @@ -1010,7 +1013,7 @@ S32 LLMessageSystem::sendReliable( const LLHost &host, } } - mSendReliable = TRUE; + mSendReliable = true; mReliablePacketParams.set(host, retries, ping_based_timeout, timeout, callback, callback_data, const_cast<char*>(mMessageBuilder->getMessageName())); @@ -1037,7 +1040,7 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code) S32 LLMessageSystem::forwardReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) @@ -1064,9 +1067,9 @@ S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void S32 send_bytes = 0; if (mMessageBuilder->getMessageSize()) { - mSendReliable = TRUE; + mSendReliable = true; // No need for ping-based retry as not going to retry - mReliablePacketParams.set(host, 0, FALSE, timeout, callback, + mReliablePacketParams.set(host, 0, false, timeout, callback, callback_data, const_cast<char*>(mMessageBuilder->getMessageName())); send_bytes = sendMessage(host); @@ -1166,7 +1169,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) host.getUntrustedSimulatorCap(), mLLSDMessageBuilder->getMessageName(), message, cb)); - mSendReliable = FALSE; + mSendReliable = false; mReliablePacketParams.clear(); return 1; } @@ -1215,7 +1218,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // tack packet acks onto the end of this message S32 space_left = (MTUBYTES - buffer_length) / sizeof(TPACKETID); // space left for packet ids S32 ack_count = (S32)cdp->mAcks.size(); - BOOL is_ack_appended = FALSE; + bool is_ack_appended = false; std::vector<TPACKETID> acks; if((space_left > 0) && (ack_count > 0) && (mMessageBuilder->getMessageName() != _PREHASH_PacketAck)) @@ -1266,10 +1269,10 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // tack the count in the final byte U8 count = (U8)append_ack_count; buf_ptr[buffer_length++] = count; - is_ack_appended = TRUE; + is_ack_appended = true; } - BOOL success; + bool success; success = mPacketRing.sendPacket(mSocket, (char *)buf_ptr, buffer_length, host); if (!success) @@ -1304,12 +1307,12 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) mPacketsOut++; mTotalBytesOut += buffer_length; - mSendReliable = FALSE; + mSendReliable = false; mReliablePacketParams.clear(); return buffer_length; } -void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_reliable ) +void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, bool recv_reliable ) { if(mVerboseLog) { @@ -1336,7 +1339,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re // TODO: babbage: work out if we need these // mMessageCountList[mNumMessageCounts].mMessageNum = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = TRUE; + mMessageCountList[mNumMessageCounts].mInvalid = true; mNumMessageCounts++; } } @@ -1389,12 +1392,12 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) // = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = TRUE; + mMessageCountList[mNumMessageCounts].mInvalid = true; mNumMessageCounts++; } } -void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL recv_reliable, BOOL recv_resent, BOOL recv_acks ) +void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, bool recv_reliable, bool recv_resent, bool recv_acks ) { if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { @@ -1405,7 +1408,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r // TODO: babbage: work out if we need these //mMessageCountList[mNumMessageCounts].mMessageNum = mCurrentRMessageTemplate->mMessageNumber; mMessageCountList[mNumMessageCounts].mMessageBytes = mMessageReader->getMessageSize(); - mMessageCountList[mNumMessageCounts].mInvalid = FALSE; + mMessageCountList[mNumMessageCounts].mInvalid = false; mNumMessageCounts++; } @@ -1499,7 +1502,7 @@ void LLMessageSystem::getCircuitInfo(LLSD& info) const } // returns whether the given host is on a trusted circuit -BOOL LLMessageSystem::getCircuitTrust(const LLHost &host) +bool LLMessageSystem::getCircuitTrust(const LLHost &host) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1507,12 +1510,12 @@ BOOL LLMessageSystem::getCircuitTrust(const LLHost &host) return cdp->getTrusted(); } - return FALSE; + return false; } -// Activate a circuit, and set its trust level (TRUE if trusted, -// FALSE if not). -void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) +// Activate a circuit, and set its trust level (true if trusted, +// false if not). +void LLMessageSystem::enableCircuit(const LLHost &host, bool trusted) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (!cdp) @@ -1521,7 +1524,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) } else { - cdp->setAlive(TRUE); + cdp->setAlive(true); } cdp->setTrusted(trusted); } @@ -1573,7 +1576,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) } -void LLMessageSystem::setCircuitAllowTimeout(const LLHost &host, BOOL allow) +void LLMessageSystem::setCircuitAllowTimeout(const LLHost &host, bool allow) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1592,14 +1595,14 @@ void LLMessageSystem::setCircuitTimeoutCallback(const LLHost &host, void (*callb } -BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) +bool LLMessageSystem::checkCircuitBlocked(const U32 circuit) { LLHost host = findHost(circuit); if (!host.isOk()) { LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL; - return TRUE; + return true; } LLCircuitData *cdp = mCircuitInfo.findCircuit(host); @@ -1610,18 +1613,18 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) else { LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) +bool LLMessageSystem::checkCircuitAlive(const U32 circuit) { LLHost host = findHost(circuit); if (!host.isOk()) { LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL; - return FALSE; + return false; } LLCircuitData *cdp = mCircuitInfo.findCircuit(host); @@ -1632,11 +1635,11 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) else { LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) +bool LLMessageSystem::checkCircuitAlive(const LLHost &host) { LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) @@ -1646,12 +1649,12 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) else { LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL; - return FALSE; + return false; } } -void LLMessageSystem::setCircuitProtection(BOOL b_protect) +void LLMessageSystem::setCircuitProtection(bool b_protect) { mbProtected = b_protect; } @@ -1779,7 +1782,7 @@ void open_circuit(LLMessageSystem *msgsystem, void** /*user_data*/) msgsystem->getIPPortFast(_PREHASH_CircuitInfo, _PREHASH_Port, port); // By default, OpenCircuit's are untrusted - msgsystem->enableCircuit(LLHost(ip, port), FALSE); + msgsystem->enableCircuit(LLHost(ip, port), false); } void close_circuit(LLMessageSystem *msgsystem, void** /*user_data*/) @@ -1944,9 +1947,9 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // passed the circuit code and session id check, so we will go // ahead and persist the ID associated. LLCircuitData *cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); - BOOL had_circuit_already = cdp ? TRUE : FALSE; + bool had_circuit_already = cdp != nullptr; - msg->enableCircuit(msg->getSender(), FALSE); + msg->enableCircuit(msg->getSender(), false); cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); if(cdp) { @@ -1970,7 +1973,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // doesn't get properly duplicate suppressed. Not a BIG deal, but it's somewhat confusing // (and bad from a state point of view). DJS 9/23/04 // - cdp->checkPacketInID(gMessageSystem->mCurrentRecvPacketID, FALSE ); // Since this is the first message on the circuit, by definition it's not resent. + cdp->checkPacketInID(gMessageSystem->mCurrentRecvPacketID, false ); // Since this is the first message on the circuit, by definition it's not resent. } msg->mIPPortToCircuitCode[ip_port_in] = circuit_code_in; @@ -2169,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; @@ -2177,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 { @@ -2288,7 +2291,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) their_digest[MD5HEX_STR_SIZE - 1] = '\0'; if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id)) { - cdp->setTrusted(TRUE); + cdp->setTrusted(true); LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL; return; } @@ -2457,13 +2460,13 @@ bool start_messaging_system( if (!gMessageSystem) { LL_ERRS("AppInit") << "Messaging system initialization failed." << LL_ENDL; - return FALSE; + return false; } // bail if system encountered an error. if(!gMessageSystem->isOK()) { - return FALSE; + return false; } if (b_dump_prehash_file) @@ -2514,12 +2517,12 @@ bool start_messaging_system( // Initialize the transfer manager gTransferManager.init(); - return TRUE; + return true; } void LLMessageSystem::startLogging() { - mVerboseLog = TRUE; + mVerboseLog = true; std::ostringstream str; str << "START MESSAGE LOG" << std::endl; str << "Legend:" << std::endl; @@ -2533,7 +2536,7 @@ void LLMessageSystem::stopLogging() { if(mVerboseLog) { - mVerboseLog = FALSE; + mVerboseLog = false; LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL; } } @@ -2712,7 +2715,7 @@ void LLMessageSystem::dumpReceiveCounts() -BOOL LLMessageSystem::isClear() const +bool LLMessageSystem::isClear() const { return mMessageBuilder->isClear(); } @@ -2754,7 +2757,7 @@ S32 LLMessageSystem::zeroCodeAdjustCurrentSendTotal() 0); } // TODO: babbage: remove this horror - mMessageBuilder->setBuilt(FALSE); + mMessageBuilder->setBuilt(false); S32 count = mSendSize; @@ -2978,12 +2981,12 @@ void LLMessageSystem::setExceptionFunc(EMessageException e, } } -BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) +bool LLMessageSystem::callExceptionFunc(EMessageException exception) { callbacks_t::iterator it = mExceptionCallbacks.find(exception); if(it == mExceptionCallbacks.end()) { - return FALSE; + return false; } exception_t& ex = it->second; @@ -2992,12 +2995,12 @@ BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) if (!ex_cb) { LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << LL_ENDL; - return FALSE; + return false; } (ex_cb)(this, ex.second, exception); - return TRUE; + return true; } void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data) @@ -3006,14 +3009,14 @@ void LLMessageSystem::setTimingFunc(msg_timing_callback func, void* data) mTimingCallbackData = data; } -BOOL LLMessageSystem::isCircuitCodeKnown(U32 code) const +bool LLMessageSystem::isCircuitCodeKnown(U32 code) const { if(mCircuitCodes.find(code) == mCircuitCodes.end()) - return FALSE; - return TRUE; + return false; + return true; } -BOOL LLMessageSystem::isMessageFast(const char *msg) +bool LLMessageSystem::isMessageFast(const char *msg) { return msg == mMessageReader->getMessageName(); } @@ -3354,7 +3357,7 @@ void LLMessageSystem::dumpPacketToLog() //static -U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update) +U64Microseconds LLMessageSystem::getMessageTimeUsecs(const bool update) { if (gMessageSystem) { @@ -3371,7 +3374,7 @@ U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update) } //static -F64Seconds LLMessageSystem::getMessageTimeSeconds(const BOOL update) +F64Seconds LLMessageSystem::getMessageTimeSeconds(const bool update) { if (gMessageSystem) { @@ -3429,7 +3432,7 @@ void LLMessageSystem::newMessageFast(const char *name) mMessageBuilder = mTemplateMessageBuilder; } } - mSendReliable = FALSE; + mSendReliable = false; mMessageBuilder->newMessage(name); } @@ -3558,12 +3561,12 @@ void LLMessageSystem::addIPPort(const char *varname, U16 v) mMessageBuilder->addIPPort(LLMessageStringTable::getInstance()->getString(varname), v); } -void LLMessageSystem::addBOOLFast(const char* varname, BOOL v) +void LLMessageSystem::addBOOLFast(const char* varname, bool v) { mMessageBuilder->addBOOL(varname, v); } -void LLMessageSystem::addBOOL(const char* varname, BOOL v) +void LLMessageSystem::addBOOL(const char* varname, bool v) { mMessageBuilder->addBOOL(LLMessageStringTable::getInstance()->getString(varname), v); } @@ -3670,13 +3673,13 @@ void LLMessageSystem::getU8(const char *block, const char *var, U8 &u, LLMessageStringTable::getInstance()->getString(var), u, blocknum); } -void LLMessageSystem::getBOOLFast(const char *block, const char *var, BOOL &b, +void LLMessageSystem::getBOOLFast(const char *block, const char *var, bool &b, S32 blocknum) { mMessageReader->getBOOL(block, var, b, blocknum); } -void LLMessageSystem::getBOOL(const char *block, const char *var, BOOL &b, +void LLMessageSystem::getBOOL(const char *block, const char *var, bool &b, S32 blocknum) { getBOOLFast(LLMessageStringTable::getInstance()->getString(block), @@ -3920,7 +3923,7 @@ void LLMessageSystem::getString(const char *block, const char *var, blocknum); } -BOOL LLMessageSystem::has(const char *blockname) const +bool LLMessageSystem::has(const char *blockname) const { return getNumberOfBlocks(blockname) > 0; } @@ -3966,7 +3969,7 @@ S32 LLMessageSystem::getReceiveSize() const } //static -void LLMessageSystem::setTimeDecodes( BOOL b ) +void LLMessageSystem::setTimeDecodes( bool b ) { LLMessageReader::setTimeDecodes(b); } diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 2d212c6b3c..b4b0d94021 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -74,7 +74,7 @@ public: char *getString(const char *str); U32 mUsed; - BOOL mEmpty[MESSAGE_NUMBER_OF_HASH_BUCKETS]; + bool mEmpty[MESSAGE_NUMBER_OF_HASH_BUCKETS]; char mString[MESSAGE_NUMBER_OF_HASH_BUCKETS][MESSAGE_MAX_STRINGS_LENGTH]; /* Flawfinder: ignore */ }; @@ -295,8 +295,8 @@ class LLMessageSystem : public LLMessageSenderInterface LLPacketRing mPacketRing; LLReliablePacketParams mReliablePacketParams; - // Set this flag to TRUE when you want *very* verbose logs. - BOOL mVerboseLog; + // Set this flag to true when you want *very* verbose logs. + bool mVerboseLog; F32 mMessageFileVersionNumber; @@ -314,7 +314,7 @@ public: S32 mSystemVersionServer; U32 mVersionFlags; - BOOL mbProtected; + bool mbProtected; U32 mNumberHighFreqMessages; U32 mNumberMediumFreqMessages; @@ -347,7 +347,7 @@ public: S64 mTotalBytesIn; // total size of all uncompressed packets in S64 mTotalBytesOut; // total size of all uncompressed packets out - BOOL mSendReliable; // does the outgoing message require a pos ack? + bool mSendReliable; // does the outgoing message require a pos ack? LLCircuit mCircuitInfo; F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes @@ -370,7 +370,7 @@ public: ~LLMessageSystem(); - BOOL isOK() const { return !mbError; } + bool isOK() const { return !mbError; } S32 getErrorCode() const { return mErrorCode; } // Read file and build message templates filename must point to a @@ -388,9 +388,9 @@ public: // Set a callback function for a message system exception. void setExceptionFunc(EMessageException exception, msg_exception_callback func, void* data = NULL); - // Call the specified exception func, and return TRUE if a - // function was found and called. Otherwise return FALSE. - BOOL callExceptionFunc(EMessageException exception); + // Call the specified exception func, and return true if a + // function was found and called. Otherwise return false. + bool callExceptionFunc(EMessageException exception); // Set a function that will be called once per packet processed with the // hashed message name and the time spent in the processing handler function @@ -407,18 +407,18 @@ public: } // This method returns true if the code is in the circuit codes map. - BOOL isCircuitCodeKnown(U32 code) const; + bool isCircuitCodeKnown(U32 code) const; // usually called in response to an AddCircuitCode message, but // may also be called by the login process. bool addCircuitCode(U32 code, const LLUUID& session_id); - BOOL poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received - BOOL checkMessages(LockMessageChecker&, S64 frame_count = 0 ); + bool poll(F32 seconds); // Number of seconds that we want to block waiting for data, returns if data was received + bool checkMessages(LockMessageChecker&, S64 frame_count = 0 ); void processAcks(LockMessageChecker&, F32 collect_time = 0.f); - BOOL isMessageFast(const char *msg); - BOOL isMessage(const char *msg) + bool isMessageFast(const char *msg); + bool isMessage(const char *msg) { return isMessageFast(LLMessageStringTable::getInstance()->getString(msg)); } @@ -482,8 +482,8 @@ public: void addBinaryDataFast(const char *varname, const void *data, S32 size); void addBinaryData(const char *varname, const void *data, S32 size); - void addBOOLFast( const char* varname, BOOL b); // typed, checks storage space - void addBOOL( const char* varname, BOOL b); // typed, checks storage space + void addBOOLFast( const char* varname, bool b); // typed, checks storage space + void addBOOL( const char* varname, bool b); // typed, checks storage space void addS8Fast( const char *varname, S8 s); // typed, checks storage space void addS8( const char *varname, S8 s); // typed, checks storage space void addU8Fast( const char *varname, U8 u); // typed, checks storage space @@ -528,10 +528,10 @@ public: // you need to go to the next block type or need to start a new // message. Specify the current blockname to check block counts, // otherwise the method only checks against MTU. - BOOL isSendFull(const char* blockname = NULL); - BOOL isSendFullFast(const char* blockname = NULL); + bool isSendFull(const char* blockname = NULL); + bool isSendFullFast(const char* blockname = NULL); - BOOL removeLastBlock(); + bool removeLastBlock(); //void buildMessage(); @@ -548,7 +548,7 @@ public: // Use this one if you DON'T want automatic ping-based retry. S32 sendReliable( const LLHost &host, S32 retries, - BOOL ping_based_retries, + bool ping_based_retries, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); @@ -568,7 +568,7 @@ public: S32 forwardReliable( const LLHost &host, S32 retries, - BOOL ping_based_timeout, + bool ping_based_timeout, F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); @@ -579,7 +579,7 @@ private: S32 sendMessage(const LLHost &host, const char* name, const LLSD& message); public: - // BOOL decodeData(const U8 *buffer, const LLHost &host); + // bool decodeData(const U8 *buffer, const LLHost &host); /** gets binary data from the current message. @@ -599,8 +599,8 @@ public: */ void getBinaryDataFast(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); void getBinaryData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum = 0, S32 max_size = S32_MAX); - void getBOOLFast( const char *block, const char *var, BOOL &data, S32 blocknum = 0); - void getBOOL( const char *block, const char *var, BOOL &data, S32 blocknum = 0); + void getBOOLFast( const char *block, const char *var, bool &data, S32 blocknum = 0); + void getBOOL( const char *block, const char *var, bool &data, S32 blocknum = 0); void getS8Fast( const char *block, const char *var, S8 &data, S32 blocknum = 0); void getS8( const char *block, const char *var, S8 &data, S32 blocknum = 0); void getU8Fast( const char *block, const char *var, U8 &data, S32 blocknum = 0); @@ -659,7 +659,7 @@ public: U32 getOurCircuitCode(); - void enableCircuit(const LLHost &host, BOOL trusted); + void enableCircuit(const LLHost &host, bool trusted); void disableCircuit(const LLHost &host); // Use this to establish trust on startup and in response to @@ -712,20 +712,20 @@ public: // returns whether the given host is on a trusted circuit // Note:DaveH/Babbage some trusted messages can be received without a circuit - BOOL getCircuitTrust(const LLHost &host); + bool getCircuitTrust(const LLHost &host); - void setCircuitAllowTimeout(const LLHost &host, BOOL allow); + void setCircuitAllowTimeout(const LLHost &host, bool allow); void setCircuitTimeoutCallback(const LLHost &host, void (*callback_func)(const LLHost &host, void *user_data), void *user_data); - BOOL checkCircuitBlocked(const U32 circuit); - BOOL checkCircuitAlive(const U32 circuit); - BOOL checkCircuitAlive(const LLHost &host); - void setCircuitProtection(BOOL b_protect); + bool checkCircuitBlocked(const U32 circuit); + bool checkCircuitAlive(const U32 circuit); + bool checkCircuitAlive(const LLHost &host); + void setCircuitProtection(bool b_protect); U32 findCircuitCode(const LLHost &host); LLHost findHost(const U32 circuit_code); void sanityCheck(); - BOOL has(const char *blockname) const; + bool has(const char *blockname) const; S32 getNumberOfBlocksFast(const char *blockname) const; S32 getNumberOfBlocks(const char *blockname) const; S32 getSizeFast(const char *blockname, const char *varname) const; @@ -738,7 +738,7 @@ public: void dumpReceiveCounts(); // dumps receive count for each message type to LL_INFOS() void dumpCircuitInfo(); // Circuit information to LL_INFOS() - BOOL isClear() const; // returns mbSClear; + bool isClear() const; // returns mbSClear; S32 flush(const LLHost &host); U32 getListenPort( void ) const; @@ -762,10 +762,10 @@ public: void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable) void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable) - static U64Microseconds getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds - static F64Seconds getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds + static U64Microseconds getMessageTimeUsecs(const bool update = false); // Get the current message system time in microseconds + static F64Seconds getMessageTimeSeconds(const bool update = false); // Get the current message system time in seconds - static void setTimeDecodes(BOOL b); + static void setTimeDecodes(bool b); static void setTimeDecodesSpamThreshold(F32 seconds); // message handlers internal to the message systesm @@ -839,11 +839,11 @@ private: LLUUID mSessionID; void addTemplate(LLMessageTemplate *templatep); - BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); + bool decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); - void logMsgFromInvalidCircuit( const LLHost& sender, BOOL recv_reliable ); + void logMsgFromInvalidCircuit( const LLHost& sender, bool recv_reliable ); void logTrustedMsgFromUntrustedCircuit( const LLHost& sender ); - void logValidMsg(LLCircuitData *cdp, const LLHost& sender, BOOL recv_reliable, BOOL recv_resent, BOOL recv_acks ); + void logValidMsg(LLCircuitData *cdp, const LLHost& sender, bool recv_reliable, bool recv_resent, bool recv_acks ); void logRanOffEndOfPacket( const LLHost& sender ); class LLMessageCountInfo @@ -851,7 +851,7 @@ private: public: U32 mMessageNum; U32 mMessageBytes; - BOOL mInvalid; + bool mInvalid; }; LLMessagePollInfo *mPollInfop; @@ -862,7 +862,7 @@ private: // Must be valid during decode - BOOL mbError; + bool mbError; S32 mErrorCode; F64Seconds mResendDumpTime; // The last time we dumped resends @@ -885,7 +885,7 @@ private: LLTimer mMessageSystemTimer; static F32 mTimeDecodesSpamThreshold; // If mTimeDecodes is on, all this many seconds for each msg decode before spamming - static BOOL mTimeDecodes; // Measure time for all message decodes if TRUE; + static bool mTimeDecodes; // Measure time for all message decodes if true; msg_timing_callback mTimingCallback; void* mTimingCallbackData; diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp index df4bfa29ad..6d2157eec9 100644 --- a/indra/llmessage/message_string_table.cpp +++ b/indra/llmessage/message_string_table.cpp @@ -47,7 +47,7 @@ LLMessageStringTable::LLMessageStringTable() { for (U32 i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) { - mEmpty[i] = TRUE; + mEmpty[i] = true; mString[i][0] = 0; } } @@ -75,7 +75,7 @@ char* LLMessageStringTable::getString(const char *str) // not found, so add! strncpy(mString[hash_value], str, MESSAGE_MAX_STRINGS_LENGTH); /* Flawfinder: ignore */ mString[hash_value][MESSAGE_MAX_STRINGS_LENGTH - 1] = 0; - mEmpty[hash_value] = FALSE; + mEmpty[hash_value] = false; mUsed++; if (mUsed >= MESSAGE_NUMBER_OF_HASH_BUCKETS - 1) { diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index c8552b3fb4..1c49f9be36 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -77,7 +77,7 @@ const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1"; const char* BROADCAST_ADDRESS_STRING = "255.255.255.255"; #if LL_DARWIN - // Mac OS X returns an error when trying to set these to 400000. Smaller values succeed. + // macOS returns an error when trying to set these to 400000. Smaller values succeed. const int SEND_BUFFER_SIZE = 200000; const int RECEIVE_BUFFER_SIZE = 200000; #else // LL_DARWIN @@ -338,8 +338,8 @@ S32 receive_packet(int hSocket, char * receiveBuffer) return nRet; } -// Returns TRUE on success. -BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) +// Returns true on success. +bool send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort) { // Sends a packet to the address set in initNet // @@ -364,7 +364,7 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i // assume it is. JNC 2002.01.18 if (WSAECONNRESET == WSAGetLastError()) { - return TRUE; + return true; } LL_INFOS() << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort << ", Error " << last_error << LL_ENDL; @@ -598,11 +598,11 @@ int receive_packet(int hSocket, char * receiveBuffer) return nRet; } -BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) +bool send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, int nPort) { int ret; - BOOL success; - BOOL resend; + bool success; + bool resend; S32 send_attempts = 0; stDstAddr.sin_addr.s_addr = recipient; @@ -616,34 +616,34 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (ret >= 0) { // successful send - success = TRUE; - resend = FALSE; + success = true; + resend = false; } else { // send failed, check to see if we should resend - success = FALSE; + success = false; if (errno == EAGAIN) { // say nothing, just repeat send LL_INFOS() << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else if (errno == ECONNREFUSED) { // response to ICMP connection refused message on earlier send LL_INFOS() << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = TRUE; + resend = true; } else { // some other error LL_INFOS() << "sendto() failed: " << errno << ", " << strerror(errno) << LL_ENDL; LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; - resend = FALSE; + resend = false; } } } @@ -652,7 +652,7 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (send_attempts >= 3) { LL_INFOS() << "sendPacket() bailed out of send!" << LL_ENDL; - return FALSE; + return false; } return success; diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index d647da2570..c41f3bb89f 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -43,7 +43,7 @@ void end_net(S32& socket_out); // returns size of packet or -1 in case of error S32 receive_packet(int hSocket, char * receiveBuffer); -BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort); // Returns TRUE on success. +bool send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, int nPort); // Returns true on success. //void get_sender(char * tmp); LLHost get_sender(); diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp index 84f3e2cc12..6113adbfcf 100644 --- a/indra/llmessage/partsyspacket.cpp +++ b/indra/llmessage/partsyspacket.cpp @@ -89,7 +89,7 @@ void gSetInitDataDefaults(LLPartInitData *setMe) setMe->mFlags[i] = 0x00; } - setMe->createMe = TRUE; + setMe->createMe = true; setMe->maxParticles = 25; setMe->initialParticles = 25; @@ -1052,7 +1052,7 @@ U32 LLPartSysCompressedPacket::readWindDiffusionFactor(LLPartInitData *in, U32 s return startByte; } -BOOL LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed) +bool LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed) { writeFlagByte(in); @@ -1168,10 +1168,10 @@ BOOL LLPartSysCompressedPacket::fromLLPartInitData(LLPartInitData *in, U32 &byte // llprintline("returning from \"fromLLPartInitData\" with %d bytes\n", bytesUsed); - return TRUE; + return true; } -BOOL LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed) +bool LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytesUsed) { U32 currByte = 4; @@ -1259,21 +1259,21 @@ BOOL LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytes } *bytesUsed = currByte; - return TRUE; + return true; } -BOOL LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) +bool LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) { if ((in != NULL) && (bytesUsed <= sizeof(mData))) { memcpy(mData, in, bytesUsed); /* Flawfinder: ignore */ mNumBytes = bytesUsed; - return TRUE; + return true; } else { LL_ERRS() << "NULL input data or number of bytes exceed mData size" << LL_ENDL; - return FALSE; + return false; } } @@ -1283,10 +1283,10 @@ U32 LLPartSysCompressedPacket::bufferSize() return mNumBytes; } -BOOL LLPartSysCompressedPacket::toUnsignedBytes(U8 *out) +bool LLPartSysCompressedPacket::toUnsignedBytes(U8 *out) { memcpy(out, mData, mNumBytes); /* Flawfinder: ignore */ - return TRUE; + return true; } U8 * LLPartSysCompressedPacket::getBytePtr() diff --git a/indra/llmessage/partsyspacket.h b/indra/llmessage/partsyspacket.h index 302d3b7cb8..23307f3409 100644 --- a/indra/llmessage/partsyspacket.h +++ b/indra/llmessage/partsyspacket.h @@ -102,7 +102,7 @@ struct LLPartInitData { //How much of an effect does gravity have F32 globalLifetime; //If particles re-spawn, a system can exist forever. - //If (ActionFlags & PART_SYS_GLOBAL_DIE) is TRUE this variable is used to determine how long the system lasts. + //If (ActionFlags & PART_SYS_GLOBAL_DIE) is true this variable is used to determine how long the system lasts. F32 individualLifetime; //How long does each particle last if nothing else happens to it F32 individualLifetimeRange; @@ -132,7 +132,7 @@ const int PART_SYS_SLOW_ANIM_BYTE = 0; // slow animation down by a factor of 10 const int PART_SYS_SLOW_ANIM_BIT = 1; // useful for tweaking anims during debugging const int PART_SYS_FOLLOW_VEL_BYTE = 0; // indicates whether to orient sprites towards -const int PART_SYS_FOLLOW_VEL_BIT = 4; // their velocity vector -- default is FALSE +const int PART_SYS_FOLLOW_VEL_BIT = 4; // their velocity vector -- default is false const int PART_SYS_IS_LIGHT_BYTE = 0; // indicates whether a particular particle system const int PART_SYS_IS_LIGHT_BIT = 8; // is also a light object -- for andrew @@ -202,10 +202,10 @@ class LLPartSysCompressedPacket public: LLPartSysCompressedPacket(); ~LLPartSysCompressedPacket(); - BOOL fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed); - BOOL toLLPartInitData(LLPartInitData *out, U32 *bytesUsed); - BOOL fromUnsignedBytes(U8 *in, U32 bytesUsed); - BOOL toUnsignedBytes(U8 *out); + bool fromLLPartInitData(LLPartInitData *in, U32 &bytesUsed); + bool toLLPartInitData(LLPartInitData *out, U32 *bytesUsed); + bool fromUnsignedBytes(U8 *in, U32 bytesUsed); + bool toUnsignedBytes(U8 *out); U32 bufferSize(); U8 *getBytePtr(); diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index ad5602e391..489b6ce6a6 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -130,7 +130,7 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant) { S32 i, j, patch_size = gPatchSize, wbits = gWordBits; S32 temp; - BOOL b_eob; + bool b_eob; if ( (postquant > patch_size*patch_size) ||(postquant < 0)) @@ -143,16 +143,16 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant) for (i = 0; i < patch_size*patch_size; i++) { - b_eob = FALSE; + b_eob = false; temp = patch[i]; if (!temp) { - b_eob = TRUE; + b_eob = true; for (j = i; j < patch_size*patch_size - postquant; j++) { if (patch[j]) { - b_eob = FALSE; + b_eob = false; break; } } diff --git a/indra/llmessage/patch_dct.cpp b/indra/llmessage/patch_dct.cpp index 66cb256529..728fe84537 100644 --- a/indra/llmessage/patch_dct.cpp +++ b/indra/llmessage/patch_dct.cpp @@ -85,8 +85,8 @@ S32 gCopyMatrix[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE]; void build_copy_matrix(S32 size) { S32 i, j, count; - BOOL b_diag = FALSE; - BOOL b_right = TRUE; + bool b_diag = false; + bool b_right = true; i = 0; j = 0; @@ -107,8 +107,8 @@ void build_copy_matrix(S32 size) i++; else j++; - b_right = FALSE; - b_diag = TRUE; + b_right = false; + b_diag = true; } else { @@ -116,8 +116,8 @@ void build_copy_matrix(S32 size) j++; else i++; - b_right = TRUE; - b_diag = TRUE; + b_right = true; + b_diag = true; } } else @@ -129,7 +129,7 @@ void build_copy_matrix(S32 size) if ( (i == size - 1) ||(j == 0)) { - b_diag = FALSE; + b_diag = false; } } else @@ -139,7 +139,7 @@ void build_copy_matrix(S32 size) if ( (i == 0) ||(j == size - 1)) { - b_diag = FALSE; + b_diag = false; } } } diff --git a/indra/llmessage/patch_idct.cpp b/indra/llmessage/patch_idct.cpp index 230b73726c..5483cf98c0 100644 --- a/indra/llmessage/patch_idct.cpp +++ b/indra/llmessage/patch_idct.cpp @@ -74,8 +74,8 @@ S32 gDeCopyMatrix[LARGE_PATCH_SIZE*LARGE_PATCH_SIZE]; void build_decopy_matrix(S32 size) { S32 i, j, count; - BOOL b_diag = FALSE; - BOOL b_right = TRUE; + bool b_diag = false; + bool b_right = true; i = 0; j = 0; @@ -96,8 +96,8 @@ void build_decopy_matrix(S32 size) i++; else j++; - b_right = FALSE; - b_diag = TRUE; + b_right = false; + b_diag = true; } else { @@ -105,8 +105,8 @@ void build_decopy_matrix(S32 size) j++; else i++; - b_right = TRUE; - b_diag = TRUE; + b_right = true; + b_diag = true; } } else @@ -118,7 +118,7 @@ void build_decopy_matrix(S32 size) if ( (i == size - 1) ||(j == 0)) { - b_diag = FALSE; + b_diag = false; } } else @@ -128,7 +128,7 @@ void build_decopy_matrix(S32 size) if ( (i == 0) ||(j == size - 1)) { - b_diag = FALSE; + b_diag = false; } } } @@ -658,8 +658,8 @@ void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph) F32 mult = ooq*range; F32 addval = mult*(F32)(1<<(prequant - 1))+hmin; -// BOOL b_diag = FALSE; -// BOOL b_right = TRUE; +// bool b_diag = false; +// bool b_right = true; for (i = 0; i < size*size; i++) { diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp index 911aef827d..c5b852453f 100644 --- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp @@ -47,15 +47,15 @@ void LLMessageSystem::clearReceiveState(void) char gUdpDispatchedData[MAX_BUFFER_SIZE]; bool gUdpDispatchWasCalled = false; -BOOL LLTemplateMessageReader::readMessage(const U8* data,class LLHost const &) +bool LLTemplateMessageReader::readMessage(const U8* data,class LLHost const &) { gUdpDispatchWasCalled = true; strcpy(gUdpDispatchedData, reinterpret_cast<const char*>(data)); return true; } -BOOL gValidateMessage = FALSE; -BOOL LLTemplateMessageReader::validateMessage(const U8*, S32 buffer_size, LLHost const &sender, bool trusted) +bool gValidateMessage = false; +bool LLTemplateMessageReader::validateMessage(const U8*, S32 buffer_size, LLHost const &sender, bool trusted) { return gValidateMessage; } @@ -84,7 +84,7 @@ namespace tut mMessageName = "MessageName"; gUdpDispatchWasCalled = false; gClearRecvWasCalled = false; - gValidateMessage = FALSE; + gValidateMessage = false; mMessage["body"]["binary-template-data"] = std::vector<U8>(); } @@ -121,7 +121,7 @@ namespace tut { LLTemplateMessageReader* pReader = NULL; LLTemplateMessageDispatcher t(*pReader); - gValidateMessage = TRUE; + gValidateMessage = true; std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; @@ -138,7 +138,7 @@ namespace tut std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; - gValidateMessage = FALSE; + gValidateMessage = false; t.dispatch(mMessageName, mMessage, mResponsePtr); ensure("clear received message was called", gClearRecvWasCalled); } @@ -149,7 +149,7 @@ namespace tut { LLTemplateMessageReader* pReader = NULL; LLTemplateMessageDispatcher t(*pReader); - gValidateMessage = TRUE; + gValidateMessage = true; std::vector<U8> vector_data; fillVector(vector_data, gBinaryTemplateData); mMessage["body"]["binary-template-data"] = vector_data; diff --git a/indra/llmessage/tests/llxfer_file_test.cpp b/indra/llmessage/tests/llxfer_file_test.cpp index af0cc5b5ab..358659a5b9 100644 --- a/indra/llmessage/tests/llxfer_file_test.cpp +++ b/indra/llmessage/tests/llxfer_file_test.cpp @@ -51,7 +51,7 @@ namespace tut oversized_filename += 'X'; } - LLXfer_File xff(oversized_filename, FALSE, 1); + LLXfer_File xff(oversized_filename, false, 1); ensure("oversized local_filename nul-terminated", xff.getFileName().length() < LL_MAX_PATH); } |