diff options
Diffstat (limited to 'indra/newview')
162 files changed, 620 insertions, 687 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 298ed82d92..759b73e486 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1312,7 +1312,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot //----------------------------------------------------------------------------- S32 LLAgent::getRegionsVisited() const { - return mRegionsVisited.size(); + return static_cast<S32>(mRegionsVisited.size()); } //----------------------------------------------------------------------------- @@ -3128,8 +3128,8 @@ bool LLAgent::isInGroup(const LLUUID& group_id, bool ignore_god_mode /* false */ if (!ignore_god_mode && isGodlike()) return true; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3148,8 +3148,8 @@ bool LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const // GP_NO_POWERS can also mean no power is enough to grant an ability. if (GP_NO_POWERS == power) return false; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3169,8 +3169,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3183,8 +3183,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3197,8 +3197,8 @@ bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3211,8 +3211,8 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3234,8 +3234,8 @@ bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) bool LLAgent::setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 17464dcef9..e2a2d2d8a9 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -123,5 +123,5 @@ void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks) return; } - setNumberOfPicks(picks->picks_list.size()); + setNumberOfPicks(static_cast<S32>(picks->picks_list.size())); } diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 46f7d84ace..faa5d801dd 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -964,7 +964,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { LL_INFOS() << "setWearableOutfit() start" << LL_ENDL; - S32 count = wearables.size(); + auto count = wearables.size(); llassert(items.size() == count); // Check for whether outfit already matches the one requested @@ -973,7 +973,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 type_counts[arr_size]; bool update_inventory{ false }; std::fill(type_counts,type_counts+arr_size,0); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; LLPointer<LLInventoryItem> new_item = items[i]; @@ -1407,7 +1407,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. - S32 obj_count = obj_item_array.size(); + auto obj_count = obj_item_array.size(); if (obj_count > 0) { LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL; diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 0dbd2d2ba3..ce4e8e9392 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -786,7 +786,7 @@ void AISAPI::FetchOrphans(completion_t callback) void AISAPI::EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); std::string procFullName = "AIS(" + procName + ")"; if (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES) { @@ -815,7 +815,7 @@ void AISAPI::onIdle(void *userdata) if (!sPostponedQuery.empty()) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); while (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES && !sPostponedQuery.empty()) { ais_query_item_t &item = sPostponedQuery.front(); @@ -1356,7 +1356,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1409,7 +1409,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for new category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1585,7 +1585,7 @@ void AISUpdate::doUpdate() checkTimeout(); // Do version/descendant accounting. - for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin(); + for (std::map<LLUUID,size_t>::const_iterator catit = mCatDescendentDeltas.begin(); catit != mCatDescendentDeltas.end(); ++catit) { LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL; @@ -1609,7 +1609,7 @@ void AISUpdate::doUpdate() LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); if (cat) { - S32 descendent_delta = catit->second; + S32 descendent_delta = static_cast<S32>(catit->second); S32 old_count = cat->getDescendentCount(); LL_DEBUGS("Inventory") << "Updating descendant count for " << cat->getName() << " " << cat_id @@ -1733,7 +1733,7 @@ void AISUpdate::doUpdate() ucv_it != mCatVersionsUpdated.end(); ++ucv_it) { const LLUUID id = ucv_it->first; - S32 version = ucv_it->second; + S32 version = static_cast<S32>(ucv_it->second); LLViewerInventoryCategory *cat = gInventory.getCategory(id); LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL; if (cat->getVersion() != version) diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 0dabd9f678..dd490c8268 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -134,7 +134,7 @@ private: // Todo: make throttle work over all fetch requests isntead of per-request const F32 AIS_EXPIRY_SECONDS = 0.008f; - typedef std::map<LLUUID,S32> uuid_int_map_t; + typedef std::map<LLUUID,size_t> uuid_int_map_t; uuid_int_map_t mCatDescendentDeltas; uuid_int_map_t mCatDescendentsKnown; uuid_int_map_t mCatVersionsUpdated; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 6efb200ed8..ff834a16b6 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -719,7 +719,7 @@ public: bool isMostRecent(); void handleLateArrivals(); void resetTime(F32 timeout); - static S32 countActive() { return sActiveHoldingPatterns.size(); } + static S32 countActive() { return static_cast<S32>(sActiveHoldingPatterns.size()); } S32 index() { return mIndex; } private: @@ -1374,7 +1374,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) // encountered, so we actually keep the *last* of each duplicate // item. This is needed to give the right priority when adding // duplicate items to an existing outfit. - for (S32 i=items.size()-1; i>=0; i--) + for (auto i=items.size()-1; i>=0; i--) { LLViewerInventoryItem *item = items.at(i); LLUUID item_id = item->getLinkedUUID(); @@ -2133,11 +2133,11 @@ void LLAppearanceMgr::filterWearableItems( items.clear(); for (S32 i=0; i<LLWearableType::WT_COUNT; i++) { - S32 size = items_by_type[i].size(); + auto size = items_by_type[i].size(); if (size <= 0) continue; - S32 start_index = llmax(0,size-max_per_type); - for (S32 j = start_index; j<size; j++) + auto start_index = llmax(0,size-max_per_type); + for (size_t j = start_index; j<size; j++) { items.push_back(items_by_type[i][j]); } @@ -3588,7 +3588,7 @@ struct WearablesOrderComparator LOG_CLASS(WearablesOrderComparator); WearablesOrderComparator(const LLWearableType::EType type) { - mControlSize = build_order_string(type, 0).size(); + mControlSize = static_cast<U32>(build_order_string(type, 0).size()); }; bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2) @@ -3623,7 +3623,7 @@ void LLAppearanceMgr::getWearableOrderingDescUpdates(LLInventoryModel::item_arra for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = items_by_type[type].size(); + U32 size = static_cast<U32>(items_by_type[type].size()); if (!size) continue; //sinking down invalid items which need reordering @@ -4577,7 +4577,7 @@ public: LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(mComplete.front(), cats, items); - S32 count = items->size(); + auto count = items->size(); if(!count) { LL_WARNS() << "Nothing fetched in category " << mComplete.front() @@ -4593,7 +4593,7 @@ public: S32 version = cat ? cat->getVersion() : -2; LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL; uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { ids.push_back(items->at(i)->getUUID()); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e6953c5dda..fd37980ef4 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1659,7 +1659,7 @@ bool LLAppViewer::doFrame() S32 LLAppViewer::updateTextureThreads(F32 max_time) { - S32 work_pending = 0; + size_t work_pending = 0; { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Texture Cache"); work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread @@ -1672,7 +1672,7 @@ S32 LLAppViewer::updateTextureThreads(F32 max_time) LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Fetch"); work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread } - return work_pending; + return static_cast<S32>(work_pending); } void LLAppViewer::flushLFSIO() @@ -2019,9 +2019,9 @@ bool LLAppViewer::cleanup() while(1) { S32 pending = 0; - pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread - pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread - pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + pending += static_cast<S32>(LLAppViewer::getTextureCache()->update(1)); // unpauses the worker thread + pending += static_cast<S32>(LLAppViewer::getImageDecodeThread()->update(1)); // unpauses the image thread + pending += static_cast<S32>(LLAppViewer::getTextureFetch()->update(1)); // unpauses the texture fetch thread pending += LLLFSThread::updateClass(0); F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) @@ -3478,7 +3478,7 @@ std::string LLAppViewer::getViewerInfoString(bool default_string) const else { // array value: build KEY_0, KEY_1 etc. entries - for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n) + for (LLSD::Integer n(0), size(static_cast<LLSD::Integer>(ii->second.size())); n < size; ++n) { args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString(); } @@ -3721,7 +3721,7 @@ void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) } // record the viewer version in the marker file - marker_file.write(marker_version.data(), marker_version.length()); + marker_file.write(marker_version.data(), static_cast<S32>(marker_version.length())); } bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const @@ -5164,7 +5164,7 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) if (have_capability) { // we have support for display names, use it - U32 url_size = name_lookup_url.size(); + auto url_size = name_lookup_url.size(); // capabilities require URLs with slashes before query params: // https://<host>:<port>/cap/<uuid>/?ids=<blah> // but the caps are granted like: diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 3d2964b930..5ae1e2f43c 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -964,7 +964,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; + cds.cbData = static_cast<DWORD>(url.length()) + 1; cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 8f5dd0dab8..deabcd9f42 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -296,7 +296,7 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - S32 remove_count = (*this).erase(inv_item_id); + auto remove_count = (*this).erase(inv_item_id); if (remove_count) { LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index e1d494f7c7..f200ca8e31 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -81,7 +81,7 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement replacement_start = word_start; replacement_length = word_end - word_start + 1; replacement_string = utf8str_to_wstring(replacement_word); - S32 size_change = replacement_string.size() - old_string.size(); + S32 size_change = static_cast<S32>(replacement_string.size() - old_string.size()); cursor_pos += size_change; } } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index aeed29b999..f3cdd366b3 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -653,8 +653,8 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) std::string url = "http://csr.lindenlab.com/agent/"; // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) + auto len = name.length(); + for (size_t i = 0; i < len; i++) { if (name[i] == ' ') { @@ -829,11 +829,11 @@ namespace action_give_inventory return; } - S32 count = LLShareInfo::instance().mAvatarNames.size(); + auto count = LLShareInfo::instance().mAvatarNames.size(); bool shared = count && !inventory_selected_uuids.empty(); // iterate through avatars - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i]; diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 61fc9d00f3..07a5c871ae 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -306,7 +306,7 @@ void LLHUDRenderNotifier::updateNotificationHUD(hud_complexity_list_t complexity } mHUDComplexityList = complexity; - mHUDsCount = mHUDComplexityList.size(); + mHUDsCount = static_cast<S32>(mHUDComplexityList.size()); static LLCachedControl<U32> show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); if (!show_my_complexity_changes) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 3821559b9e..89516a8a84 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -47,7 +47,7 @@ LLBlockList::LLBlockList(const Params& p) { LLMuteList::getInstance()->addObserver(this); - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Set up context menu. LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; @@ -92,7 +92,7 @@ void LLBlockList::createList() BlockListActionType LLBlockList::getCurrentMuteListActionType() { BlockListActionType type = NONE; - U32 curSize = LLMuteList::getInstance()->getMutes().size(); + U32 curSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); if( curSize > mMuteListSize) type = ADD; else if(curSize < mMuteListSize) @@ -266,7 +266,7 @@ void LLBlockList::refresh() selectItemPair(getItemPair(next_selected), true); } } - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Sort the list. sort(); diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 7fd29b297b..039164cd6e 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -26,16 +26,11 @@ #include "llviewerprecompiledheaders.h" -#if LL_WINDOWS -#pragma warning( disable : 4800 ) // performance warning in <functional> -#endif - #include "llcallingcard.h" #include <algorithm> #include "indra_constants.h" -//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 6205b44375..4f90db17c0 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -470,7 +470,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -518,7 +518,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // Select to end of line, starting from the character // after the last one the user typed. - self->mInputEditor->setSelection(length, outlength); + self->mInputEditor->setSelection(static_cast<S32>(length), outlength); } } diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 3893b21c2a..fc50691ece 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -725,8 +725,8 @@ public: mSourceType == CHAT_SOURCE_AGENT) { //if it's an avatar name with a username add formatting - S32 username_start = chat.mFromName.rfind(" ("); - S32 username_end = chat.mFromName.rfind(')'); + auto username_start = chat.mFromName.rfind(" ("); + auto username_end = chat.mFromName.rfind(')'); if (username_start != std::string::npos && username_end == (chat.mFromName.length() - 1)) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 313fd58624..ce8968253b 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -628,7 +628,7 @@ public: /** * Returns number of hosted chiclets. */ - S32 getChicletCount() {return mChicletList.size();}; + S32 getChicletCount() { return static_cast<S32>(mChicletList.size()); } /** * Returns index of chiclet in list. @@ -854,7 +854,7 @@ T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index) template<class T> T* LLChicletPanel::createChiclet(const LLUUID& session_id) { - return createChiclet<T>(session_id, mChicletList.size()); + return createChiclet<T>(session_id, static_cast<S32>(mChicletList.size())); } template<class T> diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index b42d217477..47803edc73 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -618,13 +618,13 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type) { - U32 size = clothing_by_type[type].size(); + auto size = clothing_by_type[type].size(); if (!size) continue; LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]); //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body) - for (U32 i = size; i != 0; --i) + for (size_t i = size; i != 0; --i) { LLViewerInventoryItem* item = clothing_by_type[type][i-1]; @@ -647,8 +647,8 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = clothing_by_type[type].size(); - if (size) continue; + if (clothing_by_type[type].empty()) + continue; LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type); LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 5b8d8b5480..f301af9511 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -378,8 +378,8 @@ bool LLCommandLineParser::parseCommandLineString(const std::string& str) if (!str.empty()) { bool add_last_c = true; - S32 last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately - for (S32 pos = 0; pos < last_c_pos; ++pos) + auto last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately + for (size_t pos = 0; pos < last_c_pos; ++pos) { cmd_line_string.append(&str[pos], 1); if (str[pos] == '\\') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 074d60d879..810b282722 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -54,7 +54,7 @@ bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) S32 LLCommunicationChannel::getHistorySize() const { - return mHistory.size(); + return static_cast<S32>(mHistory.size()); } LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index bb853a3ddc..716333b217 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -424,11 +424,11 @@ void LLControlAvatar::updateDebugText() S32 total_linkset_count = 0; if (mRootVolp) { - total_linkset_count = 1 + mRootVolp->getChildren().size(); + total_linkset_count = 1 + static_cast<S32>(mRootVolp->getChildren().size()); } std::vector<LLVOVolume*> volumes; getAnimatedVolumes(volumes); - S32 animated_volume_count = volumes.size(); + S32 animated_volume_count = static_cast<S32>(volumes.size()); std::string active_string; std::string type_string; std::string lod_string; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ab7255d34e..26fdf51485 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -339,7 +339,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -361,7 +361,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -384,7 +384,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setSpecularMap(specularp); @@ -417,7 +417,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerText else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -442,7 +442,7 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -455,10 +455,10 @@ void LLDrawable::mergeFaces(LLDrawable* src) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - U32 face_count = mFaces.size() + src->mFaces.size(); + auto face_count = mFaces.size() + src->mFaces.size(); mFaces.reserve(face_count); - for (U32 i = 0; i < src->mFaces.size(); i++) + for (size_t i = 0; i < src->mFaces.size(); i++) { LLFace* facep = src->mFaces[i]; facep->setDrawable(this); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 55479af047..ea623b93fc 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -315,7 +315,7 @@ void LLFacePool::addFaceReference(LLFace *facep) { if (-1 == facep->getReferenceIndex()) { - facep->setReferenceIndex(mReferences.size()); + facep->setReferenceIndex(static_cast<S32>(mReferences.size())); mReferences.push_back(facep); } } @@ -667,7 +667,7 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI return false; } const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 7093560644..eb48653849 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -918,7 +918,7 @@ bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params) return false; } const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar.get()->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 07834c58b4..bbc93c2af9 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -250,7 +250,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) if (params.mAvatar != lastAvatar) { const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 775bcb3535..9d02cd1d10 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -757,7 +757,7 @@ namespace LLEnvironment::DayInstance::ptr_t getBaseDayInstance() const { return mBaseDayInstance; } void setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday); - S32 countExperiencesActive() const { return mActiveExperiences.size(); } + S32 countExperiencesActive() const { return static_cast<S32>(mActiveExperiences.size()); } bool isOverriddenSky() const { return !mSkyExperience.isNull(); } bool isOverriddenWater() const { return !mWaterExperience.isNull(); } diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 0658d84bb8..67d55c53e4 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -249,7 +249,7 @@ bool LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) TimerBar* hover_bar = NULL; F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; - for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); bar_index < end_index; ++bar_index) { @@ -706,7 +706,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t gGL.color3fv(base_col.mV); U32 count = 0; - U32 total_count = base_execution.size(); + U32 total_count = static_cast<U32>(base_execution.size()); last_p.clear(); @@ -728,7 +728,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t LLGLEnable blend(GL_BLEND); gGL.color3fv(cur_col.mV); count = 0; - total_count = cur_execution.size(); + total_count = static_cast<U32>(cur_execution.size()); for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) { @@ -1020,7 +1020,7 @@ void LLFastTimerView::drawLineGraph() //highlight visible range { - S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex; + S32 first_frame = static_cast<S32>(mRecording.getNumRecordedPeriods()) - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); @@ -1083,7 +1083,7 @@ void LLFastTimerView::drawLineGraph() F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); - for (U32 j = mRecording.getNumRecordedPeriods(); + for (U32 j = static_cast<U32>(mRecording.getNumRecordedPeriods()); j > 0; j--) { @@ -1651,7 +1651,7 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, bool children_visible = visible && !time_block->getTreeNode().mCollapsed; bar_index++; - const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) { bool is_last = false; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 906d04691f..377710c170 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1250,7 +1250,7 @@ void LLFavoritesBarCtrl::fitLabelWidth(LLMenuItemCallGL* menu_item) // Check whether item name wider than menu if (menu_item->getNominalWidth() > max_width) { - S32 chars_total = item_name.length(); + S32 chars_total = static_cast<S32>(item_name.length()); S32 chars_fitted = 1; menu_item->setLabel(LLStringExplicit("")); S32 label_space = max_width - menu_item->getFont()->getWidth("...") - @@ -1375,7 +1375,7 @@ bool LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } void copy_slurl_to_clipboard_cb(std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1522,8 +1522,8 @@ bool LLFavoritesBarCtrl::isClipboardPasteable() const std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + auto count = objects.size(); + for(size_t i = 0; i < count; i++) { const LLUUID &item_id = objects.at(i); @@ -1551,9 +1551,9 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const LLInventoryItem* item = NULL; std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); + auto count = objects.size(); LLUUID parent_id(mFavoriteFolderId); - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { item = model->getItem(objects.at(i)); if (item) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 046bfc2f3e..c595b2253c 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -196,7 +196,7 @@ static const std::vector<std::string> sGraphicsLevelNames = boost::assign::list_ U32 LLFeatureManager::getMaxGraphicsLevel() const { - return sGraphicsLevelNames.size() - 1; + return static_cast<U32>(sGraphicsLevelNames.size()) - 1; } bool LLFeatureManager::isValidGraphicsLevel(U32 level) const diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 4d82611def..367803b78a 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -72,13 +72,13 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD mVO->mDrawable->makeActive() ; } - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); }//----------------------------------------------- LLVolumeImplFlexible::~LLVolumeImplFlexible() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 497fe3b9ba..c09c02d32b 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -223,7 +223,7 @@ bool LLFloaterBulkPermission::start() // Go to the next object and start if found. Returns false if no objects left, true otherwise. bool LLFloaterBulkPermission::nextObject() { - S32 count; + size_t count; bool successful_start = false; do { @@ -251,7 +251,7 @@ bool LLFloaterBulkPermission::popNext() { // get the head element from the container, and attempt to get its inventory. bool rv = false; - S32 count = mObjectIDs.size(); + auto count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { mCurrentObjectID = mObjectIDs.at(0); diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index d6bf410c55..837aa858f5 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -108,7 +108,7 @@ void LLFloaterConversationPreview::setPages(std::list<LLSD>* messages, const std delete mMessages; // Clean up temporary message list with "Loading..." text } mMessages = messages; - mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0); + mCurrentPage = (mMessages->size() ? (static_cast<int>(mMessages->size()) - 1) / mPageSize : 0); mPageSpinner->setEnabled(true); mPageSpinner->setMaxValue(mCurrentPage+1); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 4b3034f069..f1fd4edef2 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -103,16 +103,16 @@ public: F32 x = 4; // padding-left F32 y = getRect().getHeight() / 2; LLFontGL::getFontSansSerif()->render( - mText, // wstr - 0, // begin_offset - x, // x - y, // y - LLColor4::white, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - mText.size()); // max_chars + mText, // wstr + 0, // begin_offset + x, // x + y, // y + LLColor4::white, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(mText.size())); // max_chars } virtual void updatePanel(bool allow_modify) override {} @@ -235,17 +235,17 @@ protected: { std::string text = mTitle.substr(0, mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -254,17 +254,17 @@ protected: { std::string text = mTitle.substr(mBegin, mEnd - mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - LLColor4::yellow6, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + LLColor4::yellow6, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -273,17 +273,17 @@ protected: { std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels } } @@ -413,9 +413,9 @@ void LLFloaterEmojiPicker::initialize() showPreview(true); mSelectedGroupIndex = groupIndex == ALL_EMOJIS_GROUP_INDEX ? 0 : - (1 + std::distance(mFilteredEmojiGroups.begin(), + static_cast<U32>((1 + std::distance(mFilteredEmojiGroups.begin(), std::find(mFilteredEmojiGroups.begin(), mFilteredEmojiGroups.end(), groupIndex))) % - (1 + mFilteredEmojiGroups.size()); + (1 + mFilteredEmojiGroups.size())); mGroupButtons[mSelectedGroupIndex]->setToggleState(true); mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); @@ -991,15 +991,15 @@ bool LLFloaterEmojiPicker::moveFocusedIconUp() bool LLFloaterEmojiPicker::moveFocusedIconDown() { - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); if (row && row->mList->getPanelList().size() > mFocusedIconCol) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1027,7 +1027,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconPrev() if (row && row->mList->getPanelList().size()) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconCol = row->mList->getPanelList().size() - 1; + mFocusedIconCol = static_cast<S32>(row->mList->getPanelList().size()) - 1; mFocusedIconRow = i; selectFocusedIcon(); return true; @@ -1044,7 +1044,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() LLScrollingPanel* panel = mEmojiGrid->getPanelList()[mFocusedIconRow]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); - S32 colCount = row ? row->mList->getPanelList().size() : 0; + S32 colCount = row ? static_cast<S32>(row->mList->getPanelList().size()) : 0; if (mFocusedIconCol < colCount - 1) { mFocusedIconCol++; @@ -1052,8 +1052,8 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() return true; } - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); @@ -1061,7 +1061,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); mFocusedIconCol = 0; - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1112,10 +1112,10 @@ bool LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, bool called_from_parent switch (key) { case KEY_LEFT: - selectEmojiGroup((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size()); + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size())); return true; case KEY_RIGHT: - selectEmojiGroup((mSelectedGroupIndex + 1) % mGroupButtons.size()); + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + 1) % mGroupButtons.size())); return true; } } diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a02ecaf293..2fd1a482e5 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -342,13 +342,13 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { - S32 count = gAgent.mGroups.size(); + auto count = gAgent.mGroups.size(); LLUUID id; if (!group_list) return; group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = gAgent.mGroups.at(i).mID; LLGroupData* group_datap = &gAgent.mGroups.at(i); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2d398de61a..add389748f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1787,8 +1787,8 @@ void LLFloaterIMContainer::setNearbyDistances() // Get the position of the agent const LLVector3d& me_pos = gAgent.getPositionGlobal(); // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) + auto avatar_count = positions.size(); + for (size_t i = 0; i < avatar_count; i++) { F64 dist = dist_vec_squared(positions[i], me_pos); item->setDistance(avatar_ids[i],dist); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 36c0d0833f..e11445d779 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -212,7 +212,7 @@ public: void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted); bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget); boost::signals2::connection mMicroChangedSignal; - S32 getConversationListItemSize() { return mConversationsWidgets.size(); } + S32 getConversationListItemSize() { return static_cast<S32>(mConversationsWidgets.size()); } typedef std::list<LLFloater*> floater_list_t; void getDetachedConversationFloaters(floater_list_t& floaters); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 26b0836301..28c651f0cd 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -431,7 +431,7 @@ bool LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) bool LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) { - U32 in_len = in_str.length(); + auto in_len = in_str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); bool string_was_found = false; @@ -470,7 +470,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -517,7 +517,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part // Select to end of line, starting from the character // after the last one the user typed. - mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size()); + mInputEditor->selectByCursorPosition(static_cast<S32>(utf8_out_str.size() - rest_of_match.size()), static_cast<S32>(utf8_out_str.size())); } } @@ -549,7 +549,7 @@ void LLFloaterIMNearbyChat::onChatBoxFocusReceived() EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) { - U32 length = str.length(); + auto length = str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); for (S32 n = 0; n < cnt; n++) @@ -560,7 +560,7 @@ EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::st if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) { - U32 trigger_length = sChatTypeTriggers[n].name.length(); + auto trigger_length = sChatTypeTriggers[n].name.length(); // It's to remove space after trigger name if (length > trigger_length && str[trigger_length] == ' ') @@ -754,8 +754,8 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses - S32 open_paren = name.find(" (", 0); - S32 close_paren = name.find(')', 0); + auto open_paren = name.find(" (", 0); + auto close_paren = name.find(')', 0); if (open_paren != std::string::npos && close_paren == name.length()-1) @@ -765,7 +765,7 @@ bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) else { //checking for a single space - S32 pos = name.find(' ', 0); + auto pos = name.find(' ', 0); return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos; } } diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index c5fca94169..abcaa13442 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -70,7 +70,7 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } std::string getCurrentChat(); - S32 getMessageArchiveLength() {return mMessageArchive.size();} + S32 getMessageArchiveLength() { return static_cast<S32>(mMessageArchive.size()); } virtual bool handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index d49352ec94..9b08ecd059 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -1190,7 +1190,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) if (is_region_exist) { - S32 count = ids.size(); + auto count = ids.size(); if( isInviteAllowed() && (count > 0) ) { @@ -1200,7 +1200,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) LLSD data; data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { data["params"].append(ids[i]); } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index a1951bc4a8..9a794d1775 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2512,7 +2512,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); - S32 count = parcel->mAccessList.size(); + auto count = parcel->mAccessList.size(); getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2560,7 +2560,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); - S32 count = parcel->mBanList.size(); + auto count = parcel->mBanList.size(); getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2760,13 +2760,13 @@ void LLPanelLandAccess::refresh_ui() getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); } getChildView("AccessList")->setEnabled(can_manage_allowed); - S32 allowed_list_count = parcel->mAccessList.size(); + auto allowed_list_count = parcel->mAccessList.size(); getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); getChildView("BannedList")->setEnabled(can_manage_banned); - S32 banned_list_count = parcel->mBanList.size(); + auto banned_list_count = parcel->mBanList.size(); getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index df602387b3..63c05b14f8 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -76,8 +76,8 @@ bool LLFloaterLandHoldings::postBuild() grant_list->sortByColumnIndex(0, true); grant_list->setDoubleClickCallback(onGrantList, this); - S32 count = gAgent.mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = gAgent.mGroups.size(); + for(size_t i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); LLUIString areastr = getString("area_string"); diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index b75012c44f..f20fea01c5 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -577,7 +577,7 @@ S32 LLFloaterMarketplaceListings::getFolderCount() LLInventoryModel::item_array_t * items; gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - return (cats->size() + items->size()); + return static_cast<S32>(cats->size() + items->size()); } else { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3a0e6dc05b..a91cdba5c0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1420,7 +1420,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) LLModel* model = instance.mModel; const LLMeshSkinInfo *skin = &model->mSkinInfo; U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed + U32 bind_count = highlight_overrides ? static_cast<U32>(skin->mAlternateBindMatrix.size()) : 0; // simply do not include overrides if data is not needed if (bind_count > 0 && bind_count != joint_count) { std::ostringstream out; @@ -1544,7 +1544,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash } LLWString text = utf8str_to_wstring(str); - S32 add_text_len = text.length() + 1; // newline + S32 add_text_len = static_cast<S32>(text.length()) + 1; // newline S32 editor_max_len = mUploadLogText->getMaxTextLength(); if (add_text_len > editor_max_len) { diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp index a84f479d02..0283855f15 100644 --- a/indra/newview/llfloatermyscripts.cpp +++ b/indra/newview/llfloatermyscripts.cpp @@ -137,7 +137,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) return; } - S32 number_attachments = content["attachments"].size(); + S32 number_attachments = static_cast<S32>(content["attachments"].size()); for(int i = 0; i < number_attachments; i++) { @@ -148,7 +148,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) humanReadableLocation = LLTrans::getString(actualLocation.c_str()); } - S32 number_objects = content["attachments"][i]["objects"].size(); + S32 number_objects = static_cast<S32>(content["attachments"][i]["objects"].size()); for(int j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index e0a234e3a2..848672b1fc 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -284,7 +284,7 @@ void LLFloaterPathfindingCharacters::showCapsule() const if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(), - character->isHorizontal(), character->getUUID()); + (BOOL)character->isHorizontal(), character->getUUID()); } } diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a097a3ee31..994a5c0c02 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,10 +30,6 @@ #include "llfloaterpathfindingconsole.h" -#include <vector> - -#include <boost/signals2.hpp> - #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -46,7 +42,6 @@ #include "llpanel.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" -#include "llpathinglib.h" #include "llsliderctrl.h" #include "llsd.h" #include "lltabcontainer.h" diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b4452d4c46..402da273c8 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -135,7 +135,7 @@ void LLFloaterPathfindingObjects::draw() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); S32 nameColumnIndex = getNameColumnIndex(); const LLColor4 &beaconColor = getBeaconColor(); const LLColor4 &beaconTextColor = getBeaconTextColor(); @@ -334,7 +334,7 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList(bool update_if_needed if (!mHasObjectsToBeSelected) { std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); if (numSelectedItems > 0) { mObjectsToBeSelected.reserve(selectedItems.size()); @@ -835,7 +835,7 @@ void LLFloaterPathfindingObjects::selectScrollListItemsInWorld() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); std::vector<LLViewerObject *>viewerObjects; viewerObjects.reserve(numSelectedItems); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index b5aa30e875..a9ec392129 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3726,7 +3726,7 @@ void LLPanelEstateAccess::copyListToClipboard(std::string list_name) } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, static_cast<S32>(list_to_copy.length())); } bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region) diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 1f4e95c229..b3452a25c5 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -403,7 +403,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) return; } - S32 number_parcels = content["parcels"].size(); + auto number_parcels = content["parcels"].size(); LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); @@ -418,10 +418,10 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) bool has_locations = false; bool has_local_ids = false; - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); - S32 number_objects = content["parcels"][i]["objects"].size(); + auto number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; if(content["parcels"][i].has("local_id")) @@ -431,7 +431,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) local_id = content["parcels"][i]["local_id"].asInteger(); } - for(S32 j = 0; j < number_objects; j++) + for(size_t j = 0; j < number_objects; j++) { S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; @@ -898,10 +898,10 @@ void LLPanelScriptLimitsRegionMemory::returnObjects() return; } - S32 number_parcels = mContent["parcels"].size(); + auto number_parcels = mContent["parcels"].size(); // a message per parcel containing all objects to be returned from that parcel - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { S32 local_id = 0; if(mContent["parcels"][i].has("local_id")) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2c28e80995..2a72a361d6 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -966,8 +966,8 @@ void LLFloaterWorldMap::buildLandmarkIDLists() mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size()); mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size()); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { LLInventoryItem* item = items.at(i); @@ -1552,7 +1552,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); - S32 name_length = mCompletingRegionName.length(); + auto name_length = mCompletingRegionName.length(); LLSD match; diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index b826b12bd3..f9252e0062 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -83,7 +83,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect gInventory.collectDescendentsIf(parentFolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); - S32 cats_count = cats.size(); + auto cats_count = cats.size(); if (cats_count > 1) { @@ -244,7 +244,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje { LLUUID creator_id = item->getCreatorUUID(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for ( auto i = items->size() - 1; i >= 0; --i ) { cur_item = items->at(i); if ( creator_id == cur_item->getCreatorUUID() ) @@ -261,7 +261,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for ( auto i = items->size() - 1; i >= 0; --i ) { cur_item = items->at(i); if ( obj->getType() != cur_item->getType() ) @@ -281,7 +281,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // then return true. Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryCategory* cur_cat = NULL; - for ( S32 i = cats->size() - 1; i >= 0; --i ) + for ( auto i = cats->size() - 1; i >= 0; --i ) { cur_cat = cats->at(i); if ( obj->getType() != cur_cat->getType() ) diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 2ac99a2f16..8ee11cdbd2 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -671,7 +671,7 @@ bool LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin { // choose one at random { - S32 random = ll_rand(matching.size()); + S32 random = ll_rand(static_cast<S32>(matching.size())); gesture = matching[random]; @@ -745,7 +745,7 @@ bool LLGestureMgr::triggerGesture(KEY key, MASK mask) // choose one and play it if (matching.size() > 0) { - U32 random = ll_rand(matching.size()); + U32 random = ll_rand(static_cast<S32>(matching.size())); LLMultiGesture* gesture = matching[random]; @@ -783,7 +783,7 @@ bool LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) S32 LLGestureMgr::getPlayingCount() const { - return mPlaying.size(); + return static_cast<S32>(mPlaying.size()); } @@ -1462,7 +1462,7 @@ void LLGestureMgr::notifyObservers() bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + auto in_len = in_str.length(); //return whole trigger, if received text equals to it item_map_t::iterator it; @@ -1490,7 +1490,7 @@ bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { const std::string& trigger = gesture->getTrigger(); - if (in_len > (S32)trigger.length()) + if (in_len > trigger.length()) { // too short, bail out continue; diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index c4e0e53bb5..1259b65ebe 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -242,9 +242,9 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, items, LLInventoryModel::EXCLUDE_TRASH, giveable); - S32 count = cats.size(); + auto count = cats.size(); bool complete = true; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { if (!gInventory.isCategoryComplete(cats.at(i)->getUUID())) { @@ -446,8 +446,8 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons items, LLInventoryModel::EXCLUDE_TRASH, remove); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { gInventory.deleteObject(items.at(i)->getUUID()); } @@ -503,7 +503,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. - S32 count = items.size() + cats.size(); + auto count = items.size() + cats.size(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); @@ -520,7 +520,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); - S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); + S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (static_cast<S32>(count) + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 505d7b1dea..f6ebc8eebc 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -939,7 +939,7 @@ public: { // takes (count, pointer) // &vector[0] gets pointer to contiguous array - LLImageGL::generateTextures(source.size(), &source[0]); + LLImageGL::generateTextures(static_cast<S32>(source.size()), &source[0]); } ~TextureHolder() @@ -950,7 +950,7 @@ public: texUnit->unbind(LLTexUnit::TT_TEXTURE); } // ensure that we delete these textures regardless of how we exit - LLImageGL::deleteTextures(source.size(), &source[0]); + LLImageGL::deleteTextures(static_cast<S32>(source.size()), &source[0]); } bool bind(U32 index) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 7ff9277d73..1ff1fb679a 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -207,8 +207,8 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s cache.mObjectId = id; cache.mRegionHandle = region->getHandle(); - U32 count = llmin(tes.size(), MAX_TES); - for (U32 i = 0; i < count; ++i) + auto count = llmin(tes.size(), MAX_TES); + for (size_t i = 0; i < count; ++i) { LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership mat->applyOverrideLLSD(od[i]); @@ -381,7 +381,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) { LLSD& data = sUpdates; - S32 i = data.size(); + auto i = data.size(); for (ModifyMaterialData& e : sModifyQueue) { @@ -492,7 +492,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp } buffer.resize(size); - file.read((U8*)&buffer[0], buffer.size()); + file.read((U8*)&buffer[0], static_cast<S32>(buffer.size())); } { @@ -501,7 +501,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LLSD asset; // read file into buffer - std::istrstream str(&buffer[0], buffer.size()); + std::istrstream str(&buffer[0], static_cast<S32>(buffer.size())); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { @@ -518,7 +518,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LL_PROFILE_ZONE_SCOPED; tinygltf::TinyGLTF gltf; - if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), static_cast<U32>(data.length()), "")) { LL_WARNS("GLTF") << "Failed to decode material asset: " << LL_NEWLINE diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 1952b5b8a1..7659e5f082 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -223,7 +223,7 @@ void LLGroupList::refresh() if (mForAgent) { const LLUUID& highlight_id = gAgent.getGroupID(); - S32 count = gAgent.mGroups.size(); + S32 count = static_cast<S32>(gAgent.mGroups.size()); LLUUID id; bool have_filter = !mNameFilter.empty(); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 32943a9bb7..100aacb8ac 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -168,7 +168,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, { // This is the everyone role, just return the size of members, // because everyone is in the everyone role. - return members.size(); + return static_cast<S32>(members.size()); } // Sort the members list, if needed. @@ -184,7 +184,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, } // Return the number of members in the intersection. - S32 max_size = llmin( members.size(), mMemberIDs.size() ); + auto max_size = llmin( members.size(), mMemberIDs.size() ); uuid_vec_t in_role( max_size ); uuid_vec_t::iterator in_role_end; in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(), diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 84adcd024f..18efae7654 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -151,7 +151,7 @@ public: const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } S32 getMembersInRole(uuid_vec_t members, bool needs_sort = true); - S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 + S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : static_cast<S32>(mMemberIDs.size()); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 LLRoleData getRoleData() const { return mRoleData; } void setRoleData(LLRoleData data) { mRoleData = data; } diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 4224f7d134..e1bf6c2077 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -443,7 +443,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality1" will end up as "QualityAssurance AssuresQua..." because we are enforcing single line do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + auto segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + line_length < wline.length()) // since we only draw one string, line_length should be 0 { // token does does not fit into signle line, need to draw "...". @@ -451,7 +451,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); // truncated string length - segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); const LLWString dots(utf8str_to_wstring(std::string("..."))); LLHUDTextSegment segment(iter->substr(line_length, segment_length) + dots, style, color, font); mTextSegments.push_back(segment); @@ -472,7 +472,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality 1" will be split into two lines "QualityAssurance" and "AssuresQuality" do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; @@ -511,7 +511,7 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels) do { S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), - max_pixels, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + max_pixels, static_cast<S32>(wstr.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp); mLabelSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 80d88702da..5608ab763f 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -138,7 +138,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index d087d538af..5ee0ab437d 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -274,7 +274,7 @@ void LLHUDText::addLine(const std::string &text_utf8, do { F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE; - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index ca800be580..d4c92ea5ae 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -203,7 +203,7 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; - int indx = msg.find(" ( http://slurl.com/secondlife/"); + auto indx = msg.find(" ( http://slurl.com/secondlife/"); if (indx == std::string::npos) { // try to find new slurl host @@ -701,7 +701,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } else { - S32 index = original_name.find(" Resident"); + auto index = original_name.find(" Resident"); if (index != std::string::npos) { original_name = original_name.substr(0, index); @@ -1651,7 +1651,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) message_data["region_id"].asUUID(), position, bin_bucket.data(), - bin_bucket.size(), + static_cast<S32>(bin_bucket.size()), sender, message_data["asset_id"].asUUID()); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 62bc95db82..667d11e194 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -741,7 +741,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) if (!av_name.isValidName()) { - S32 separator_index = mName.rfind(" "); + auto separator_index = mName.rfind(" "); std::string name = mName.substr(0, separator_index); ++separator_index; std::string conference_word = mName.substr(separator_index, mName.length()); @@ -1188,7 +1188,7 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, } } - S32 shifted_size = shift_msgs.size(); + auto shifted_size = shift_msgs.size(); while (shift_msgs.size() > 0) { // Finally add back any new messages, and tweak the index value to be correct. LLSD newer_message = shift_msgs.front(); @@ -1250,7 +1250,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids) { - S32 num = ids.size(); + auto num = ids.size(); if (!num) return NULL; if (mId2SessionMap.empty()) return NULL; @@ -1504,7 +1504,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_ return; } - int i = session->mMsgs.size() - start_index; + auto i = session->mMsgs.size() - start_index; for (chat_message_list_t::iterator iter = session->mMsgs.begin(); iter != session->mMsgs.end() && i > 0; @@ -1985,12 +1985,12 @@ void start_deprecated_conference_chat( { U8* bucket; U8* pos; - S32 count; + size_t count; S32 bucket_size; // *FIX: this could suffer from endian issues count = agents_to_invite.size(); - bucket_size = UUID_BYTES * count; + bucket_size = UUID_BYTES * static_cast<S32>(count); bucket = new U8[bucket_size]; pos = bucket; @@ -3830,7 +3830,7 @@ void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, const std::vector<LLUUID>& ids) { - S32 count = ids.size(); + auto count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); @@ -3868,7 +3868,7 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, return; } - S32 count = ids.size(); + auto count = ids.size(); if(count > 0) { LLIMModel* im_model = LLIMModel::getInstance(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 76323be3dc..36df29f6d1 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -454,8 +454,8 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - S32 count = batch.size(); - S32 i,j; + size_t count = batch.size(); + size_t i,j; for(i = 0; i < count; ++i) { bridge = (LLInvFVBridge*)(batch[i]); @@ -506,8 +506,8 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; - S32 count = batch.size(); - S32 i; + size_t count = batch.size(); + size_t i; // first, hide any 'preview' floaters that correspond to the items // being deleted. @@ -642,11 +642,8 @@ bool LLInvFVBridge::isClipboardPasteable() const // In normal mode, we need to check each element of the clipboard to know if we can paste or not std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID &item_id = objects.at(i); - // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); if (cat) @@ -682,10 +679,9 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLInventoryItem *item = model->getItem(objects.at(i)); + const LLInventoryItem *item = model->getItem(item_id); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) @@ -698,7 +694,7 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const return false; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); + const LLViewerInventoryCategory *cat = model->getCategory(item_id); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return false; @@ -2175,8 +2171,7 @@ bool LLItemBridge::removeItem() if (!item->getIsLinkType()) { LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); - const U32 num_links = item_array.size(); - if (num_links > 0) + if (!item_array.empty()) { // Warn if the user is will break any links when deleting this item. LLNotifications::instance().add(params); @@ -2375,8 +2370,8 @@ std::string LLFolderBridge::getLabelSuffix() const LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(getUUID(), cat_array, item_array, true); - S32 count = item_array.size(); - if(count > 0) + auto count = item_array.size(); + if (count > 0) { std::ostringstream oss; oss << count; @@ -2514,7 +2509,7 @@ bool LLFolderBridge::isClipboardPasteable() const // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.size() - 1; i >= 0; --i) + for(auto i = objects.size() - 1; i >= 0; --i) { const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) @@ -2548,10 +2543,8 @@ bool LLFolderBridge::isClipboardPasteableAsLink() const const LLUUID ¤t_cat_id = current_cat->getUUID(); std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& obj_id : objects) { - const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -3193,13 +3186,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); } - S32 cat_count(0); + size_t cat_count(0); if( cat_array ) { cat_count = cat_array->size(); @@ -3218,18 +3211,18 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Fetch the items if (item_count) { - for (S32 i = 0; i < item_count; ++i) + for (size_t i = 0; i < item_count; ++i) { - ids.push_back(item_array->at(i)->getUUID()); + ids.emplace_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } // Fetch the subfolders if (cat_count) { - for (S32 i = 0; i < cat_count; ++i) + for (size_t i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->at(i)->getUUID()); + ids.emplace_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -3614,7 +3607,7 @@ void LLFolderBridge::copyOutfitToClipboard() LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); @@ -3622,7 +3615,7 @@ void LLFolderBridge::copyOutfitToClipboard() if (item_count) { - for (S32 i = 0; i < item_count;) + for (size_t i = 0; i < item_count;) { LLSD uuid =item_array->at(i)->getUUID(); LLViewerInventoryItem* item = gInventory.getItem(uuid); @@ -3636,7 +3629,7 @@ void LLFolderBridge::copyOutfitToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } void LLFolderBridge::openItem() @@ -3929,11 +3922,11 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryItem *item = model->getItem(item_id); LLInventoryCategory *cat = model->getCategory(item_id); - if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size() - index, true)) + if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, static_cast<S32>(objects.size()) - index, true)) { break; } - if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size() - index, true, true)) + if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, static_cast<S32>(objects.size()) - index, true, true)) { break; } @@ -5193,7 +5186,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response { LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); - int contents_count = inventory_objects.size(); + int contents_count = static_cast<int>(inventory_objects.size()); LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded, cat_and_wear->mReplace); @@ -5822,8 +5815,8 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::item_array_t descendent_items; model->collectDescendents(cat_id, descendent_categories, descendent_items, true); - S32 num_descendent_categories = descendent_categories.size(); - S32 num_descendent_items = descendent_items.size(); + auto num_descendent_categories = descendent_categories.size(); + auto num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -5833,7 +5826,7 @@ bool check_category(LLInventoryModel* model, return check_item(cat_id, active_panel, filter); } - for (S32 i = 0; i < num_descendent_categories; ++i) + for (size_t i = 0; i < num_descendent_categories; ++i) { LLInventoryCategory* category = descendent_categories[i]; if(!check_category(model, category->getUUID(), active_panel, filter)) @@ -5842,7 +5835,7 @@ bool check_category(LLInventoryModel* model, } } - for (S32 i = 0; i < num_descendent_items; ++i) + for (size_t i = 0; i < num_descendent_items; ++i) { LLViewerInventoryItem* item = descendent_items[i]; if(!check_item(item->getUUID(), active_panel, filter)) @@ -6256,8 +6249,8 @@ void LLCallingCardBridge::checkSearchBySuffixChanges() // changes in mDisplayName are processed by rename function and here it will be always same // suffixes are also of fixed length, and we are processing change of one at a time, // so it should be safe to use length (note: mSearchableName is capitalized) - S32 old_length = mSearchableName.length(); - S32 new_length = mDisplayName.length() + getLabelSuffix().length(); + auto old_length = mSearchableName.length(); + auto new_length = mDisplayName.length() + getLabelSuffix().length(); if (old_length == new_length) { return; diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 6aca3947cf..114ccfdd3f 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -434,7 +434,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent LLInventoryModel::cat_array_t* cat_array = NULL; LLInventoryModel::item_array_t* item_array = NULL; gInventory.getDirectDescendentsOf(object_id,cat_array,item_array); - S32 descendents_actual = 0; + size_t descendents_actual = 0; if(cat_array && item_array) { descendents_actual = cat_array->size() + item_array->size(); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 5533c0328e..6e6448c0cd 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -156,7 +156,7 @@ S32 count_descendants_items(const LLUUID& cat_id) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - S32 count = item_array->size(); + S32 count = static_cast<S32>(item_array->size()); LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) @@ -1104,7 +1104,7 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); - return item_array->size(); + return static_cast<S32>(item_array->size()); } // When force_count is true, we do not do any verification of the marketplace status and simply compute @@ -1358,7 +1358,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<S32>(existing_categories.size()); // If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock) @@ -1430,7 +1430,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t descendent_items; gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false); - int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... + int dragged_folder_count = static_cast<int>(descendent_categories.size()) + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories); int dragged_stock_count = count_stock_items(descendent_items); int existing_item_count = 0; @@ -1452,7 +1452,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t existing_items; gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<int>(existing_categories.size()); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); } @@ -1882,7 +1882,7 @@ void validate_marketplacelistings( } // How many types of items? Which type is it if only one? - S32 count = items_vector.size(); + auto count = items_vector.size(); U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 8d3a795750..a72f669189 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -257,8 +257,8 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mItems[i]->getUUID()); } - S32 hidden_count = mHiddenItems.size(); - for (S32 i = hidden_count - 1; i >= 0; i--) + auto hidden_count = mHiddenItems.size(); + for (size_t i = hidden_count - 1; i >= 0; i--) { updateRemovedItem(mHiddenItems[i]->getUUID()); } @@ -343,7 +343,7 @@ void LLInventoryGallery::initGallery() { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -619,8 +619,8 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + size_t saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -1882,13 +1882,10 @@ bool LLInventoryGallery::canPaste() const } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - std::vector<LLUUID> objects; + uuid_vec_t objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for (S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID& item_id = objects.at(i); - // Each item must be copyable to be pastable if (!isItemCopyable(item_id)) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index f0e024605c..c7e0e9d702 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -657,12 +657,12 @@ LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const S32 LLInventoryModel::getItemCount() const { - return mItemMap.size(); + return static_cast<S32>(mItemMap.size()); } S32 LLInventoryModel::getCategoryCount() const { - return mCategoryMap.size(); + return static_cast<S32>(mCategoryMap.size()); } // Return the direct descendents of the id provided. The array @@ -822,17 +822,14 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if (cats) { - S32 count = cats->size(); - for (S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -891,17 +888,14 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); - if(cats) + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + if (cats) { - S32 count = cats->size(); - for(S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); - if(p_cat && p_cat->getPreferredType() == preferred_type) + if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -1286,10 +1280,8 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if(cat_array) { - S32 count = cat_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& cat : *cat_array) { - LLViewerInventoryCategory* cat = cat_array->at(i); if(add(cat,NULL)) { cats.push_back(cat); @@ -1298,16 +1290,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } - LLViewerInventoryItem* item = NULL; item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); // Move onto items if(item_array) { - S32 count = item_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& item : *item_array) { - item = item_array->at(i); if(add(NULL, item)) { items.push_back(item); @@ -1906,10 +1895,10 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo categories, items, LLInventoryModel::INCLUDE_TRASH); - S32 count = items.size(); + auto count = items.size(); LLUUID uu_id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { uu_id = items.at(i)->getUUID(); @@ -2689,8 +2678,8 @@ bool LLInventoryModel::loadSkeleton( } } - S32 cached_category_count = 0; - S32 cached_item_count = 0; + size_t cached_category_count = 0; + size_t cached_item_count = 0; if(!temp_cats.empty()) { update_map_t child_counts; @@ -2739,12 +2728,10 @@ bool LLInventoryModel::loadSkeleton( // found to generate a set of categories we should add. We // will go through each category loaded and if the version // does not match, invalidate the version. - S32 count = categories.size(); cat_set_t::iterator not_cached = temp_cats.end(); - std::set<LLUUID> cached_ids; - for(S32 i = 0; i < count; ++i) + uuid_set_t cached_ids; + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; cat_set_t::iterator cit = temp_cats.find(cat); if (cit == temp_cats.end()) { @@ -2990,13 +2977,11 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.size(); S32 i; S32 lost = 0; cat_array_t lost_cats; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp && // Only the two root folders should be children of null. @@ -3082,13 +3067,10 @@ void LLInventoryModel::buildParentChildMap() items.push_back(item); } } - count = items.size(); lost = 0; uuid_vec_t lost_item_ids; - for(i = 0; i < count; ++i) + for (auto& item : items) { - LLPointer<LLViewerInventoryItem> item; - item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { @@ -3469,12 +3451,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML << LLSDOStreamer<LLSDNotationFormatter>(cache_ver) << std::endl; - S32 count = categories.size(); S32 cat_count = 0; - S32 i; - for (i = 0; i < count; ++i) + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; if (cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { fileXML << LLSDOStreamer<LLSDNotationFormatter>(cat->exportLLSD()) << std::endl; @@ -3488,10 +3467,10 @@ bool LLInventoryModel::saveToFile(const std::string& filename, } } - S32 it_count = items.size(); - for (i = 0; i < it_count; ++i) + auto it_count = items.size(); + for (auto& item : items) { - fileXML << LLSDOStreamer<LLSDNotationFormatter>(items[i]->asLLSD()) << std::endl; + fileXML << LLSDOStreamer<LLSDNotationFormatter>(item->asLLSD()) << std::endl; if (fileXML.fail()) { @@ -3957,11 +3936,9 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) { - count = wearable_ids.size(); - for (i = 0; i < count; ++i) + for (const auto& wearable_id : wearable_ids) { - LLViewerInventoryItem* wearable_item; - wearable_item = gInventory.getItem(wearable_ids[i]); + LLViewerInventoryItem* wearable_item = gInventory.getItem(wearable_id); LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); } } @@ -4056,7 +4033,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(preferred_type); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants - S32 item_count = items.size() + cats.size(); + S32 item_count = static_cast<S32>(items.size() + cats.size()); args["COUNT"] = item_count; } LLNotificationsUtil::add(notification, args, LLSD(), @@ -4178,7 +4155,7 @@ void LLInventoryModel::checkTrashOverflow() LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); - S32 item_count = items.size() + cats.size(); + auto item_count = items.size() + cats.size(); if (item_count >= trash_max_capacity) { @@ -4987,7 +4964,7 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore: LLInventoryModel::update_map_t update; LLUUID folder_id; LLSD content_items(content["items"]); - const S32 count(content_items.size()); + const S32 count(static_cast<S32>(content_items.size())); // Does this loop ever execute more than once? for (S32 i(0); i < count; ++i) diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 9b0dc2fd50..049e1999d3 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -1496,7 +1496,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http return; } - S32 size = mRequestSD["folders"].size(); + auto size = mRequestSD["folders"].size(); if (size > 1) { @@ -1513,7 +1513,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { recursive_cats.push_back(folder_id); } - if (folders.size() == (S32)(size / 2)) + if (folders.size() == (size / 2)) { LLSD request_body; request_body["folders"] = folders; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 3aed82e259..ac791e224e 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -477,7 +477,7 @@ bool LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven // from memory. return true; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) @@ -715,7 +715,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) continue; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); bool cat_changed = false; @@ -795,7 +795,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t } else { - current_num_known_descendents = cats->size() + items->size(); + current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d338e308ab..642afd89b7 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1220,7 +1220,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // Make sure panel won't lock in a loop over existing items if // folder is enormous and at least some work gets done const S32 MIN_ITEMS_PER_CALL = 500; - const S32 starting_item_count = mItemMap.size(); + const S32 starting_item_count = static_cast<S32>(mItemMap.size()); LLFolderViewFolder *parentp = dynamic_cast<LLFolderViewFolder*>(folder_view_item); bool done = true; @@ -1251,7 +1251,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (!mBuildChildrenViews && mode == BUILD_TIMELIMIT - && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + && MIN_ITEMS_PER_CALL + starting_item_count < static_cast<S32>(mItemMap.size())) { // Single folder view, check if we still have time // @@ -1665,7 +1665,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.size(); + auto count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1674,7 +1674,7 @@ bool LLInventoryPanel::beginIMSession() // create the session LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) @@ -1761,7 +1761,7 @@ void LLInventoryPanel::purgeSelectedItems() const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); if (inventory_selected.empty()) return; LLSD args; - S32 count = inventory_selected.size(); + auto count = inventory_selected.size(); std::vector<LLUUID> selected_items; for (std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin(), end_it = inventory_selected.end(); it != end_it; @@ -1774,7 +1774,7 @@ void LLInventoryPanel::purgeSelectedItems() count += items.size() + cats.size(); selected_items.push_back(item_id); } - args["COUNT"] = count; + args["COUNT"] = static_cast<S32>(count); LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(callbackPurgeSelectedItems, _1, _2, selected_items)); } diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index af70025647..666ab4f5d0 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -476,8 +476,8 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) // so make sure to cleanup. // Also this helps in keeping file small. iter->second.mKeyBind.trimEmpty(); - U32 size = iter->second.mKeyBind.getDataCount(); - for (U32 i = 0; i < size; ++i) + auto size = iter->second.mKeyBind.getDataCount(); + for (size_t i = 0; i < size; ++i) { if (iter->first.empty()) { @@ -491,7 +491,7 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) continue; } - LLKeyData data = key.mKeyBind.getKeyData(i); + LLKeyData data = key.mKeyBind.getKeyData(static_cast<U32>(i)); // Still write empty LLKeyData to make sure we will maintain UI position if (data.mKey == KEY_NONE) { diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index b88986ce25..3fa0ab99f3 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -118,7 +118,7 @@ void LLLandmarkList::processGetAssetReply( file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; - LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], buffer.size()); + LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], static_cast<S32>(buffer.size())); if (landmark) { gLandmarkList.mList[uuid] = landmark; diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index cf0742299c..2fb8816960 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -340,19 +340,19 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) tinygltf::Model model; LLTinyGLTFHelper::loadModel(filename, model); - S32 materials_in_file = model.materials.size(); + auto materials_in_file = model.materials.size(); if (materials_in_file <= 0) { return 0; } S32 loaded_materials = 0; - for (S32 i = 0; i < materials_in_file; i++) + for (size_t i = 0; i < materials_in_file; i++) { // Todo: this is rather inefficient, files will be spammed with // separate loads and date checks, find a way to improve this. // May be doUpdates() should be checking individual files. - LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, i); + LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, static_cast<S32>(i)); // load material from file if (unit->updateSelf()) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index adced99a95..329fb881e3 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -452,11 +452,11 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m return; } - S32 save_num_messages = messages.size(); + auto save_num_messages = messages.size(); char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; + size_t len; bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) @@ -1142,7 +1142,7 @@ void LLLoadHistoryThread::run() if(mNewLoad) { loadHistory(mFileName, mMessages, mLoadParams); - int count = mMessages->size(); + auto count = mMessages->size(); LL_INFOS() << "mMessages->size(): " << count << LL_ENDL; setFinished(); } @@ -1189,7 +1189,7 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LL char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; + size_t len; bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 7b0e8d0e89..6bf495d10f 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1247,7 +1247,7 @@ bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer) tinygltf::Model model_in; - if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), static_cast<unsigned int>(data.length()), "")) { // assets are only supposed to have one item // *NOTE: This duplicates some functionality from diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 271a35ba42..ee5e5b438e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -431,7 +431,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -472,7 +472,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -539,7 +539,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -670,7 +670,7 @@ void LLMaterialMgr::processGetQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize <= 0) { LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; @@ -960,7 +960,7 @@ void LLMaterialMgr::processPutQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize > 0) { diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index be8d543711..0f3e0306af 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -692,7 +692,7 @@ void LLObjectMediaDataClient::sortQueue() mQueue.sort(compareRequestScores); // ...then cull items over the max - U32 size = mQueue.size(); + U32 size = static_cast<U32>(mQueue.size()); if (size > mMaxSortedQueueSize) { U32 num_to_cull = (size - mMaxSortedQueueSize); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f0fd731fb5..134bbc7b1d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -916,7 +916,7 @@ void LLMeshRepoThread::run() // Dispatch all HttpHandler notifications mHttpRequest->update(0L); } - sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update + sRequestWaterLevel = static_cast<S32>(mHttpRequestSet.size()); // Stats data update // NOTE: order of queue processing intentionally favors LOD requests over header requests // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests @@ -3082,7 +3082,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo LLCore::BufferArray * body(response->getBody()); S32 body_offset(0); U8 * data(NULL); - S32 data_size(body ? body->size() : 0); + auto data_size(body ? body->size() : 0); if (data_size > 0) { @@ -3143,7 +3143,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo if (data) { body->read(body_offset, (char *) data, data_size - body_offset); - LLMeshRepository::sBytesReceived += data_size; + LLMeshRepository::sBytesReceived += static_cast<U32>(data_size); } else { @@ -3152,7 +3152,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo } } - processData(body, body_offset, data, data_size - body_offset); + processData(body, body_offset, data, static_cast<S32>(data_size) - body_offset); delete [] data; } @@ -3624,8 +3624,8 @@ S32 LLMeshRepository::update() return 0 ; } - S32 size = mUploadWaitList.size() ; - for (S32 i = 0; i < size; ++i) + auto size = mUploadWaitList.size() ; + for (size_t i = 0; i < size; ++i) { mUploads.push_back(mUploadWaitList[i]); mUploadWaitList[i]->preStart() ; @@ -3633,7 +3633,7 @@ S32 LLMeshRepository::update() } mUploadWaitList.clear() ; - return size ; + return static_cast<S32>(size); } void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) @@ -4864,7 +4864,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) { mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexStrideBytes = 12; - mesh.mNumVertices = mCurRequest->mPositions.size(); + mesh.mNumVertices = static_cast<int>(mCurRequest->mPositions.size()); if(!vertex_based) { @@ -4872,7 +4872,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) mesh.mIndexBase = &(mCurRequest->mIndices[0]); mesh.mIndexStrideBytes = 6; - mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + mesh.mNumTriangles = static_cast<int>(mCurRequest->mIndices.size())/3; } if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) @@ -5283,10 +5283,10 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) { decomp.mMesh.resize(decomp.mHull.size()); - for (U32 i = 0; i < decomp.mHull.size(); ++i) + for (size_t i = 0; i < decomp.mHull.size(); ++i) { LLCDHull hull; - hull.mNumVertices = decomp.mHull[i].size(); + hull.mNumVertices = static_cast<int>(decomp.mHull[i].size()); hull.mVertexBase = decomp.mHull[i][0].mV; hull.mVertexStrideBytes = 12; @@ -5305,7 +5305,7 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty()) { //get mesh for base hull LLCDHull hull; - hull.mNumVertices = decomp.mBaseHull.size(); + hull.mNumVertices = static_cast<int>(decomp.mBaseHull.size()); hull.mVertexBase = decomp.mBaseHull[0].mV; hull.mVertexStrideBytes = 12; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index c73cffab5a..82c5e696cc 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2283,7 +2283,7 @@ void LLModelPreview::updateStatusMessages() mModelNoErrors = true; const U32 lod_high = LLModel::LOD_HIGH; - U32 high_submodel_count = mModel[lod_high].size() - countRootModels(mModel[lod_high]); + U32 high_submodel_count = static_cast<U32>(mModel[lod_high].size()) - countRootModels(mModel[lod_high]); for (S32 lod = 0; lod <= lod_high; ++lod) { @@ -2482,10 +2482,10 @@ void LLModelPreview::updateStatusMessages() if (!decomp.empty()) { - phys_hulls += decomp.size(); + phys_hulls += static_cast<S32>(decomp.size()); for (U32 i = 0; i < decomp.size(); ++i) { - phys_points += decomp[i].size(); + phys_points += static_cast<S32>(decomp[i].size()); } } else @@ -3437,8 +3437,8 @@ bool LLModelPreview::render() gGL.multMatrix((GLfloat*)mat.mMatrix); - U32 num_models = mVertexBuffer[mPreviewLOD][model].size(); - for (U32 i = 0; i < num_models; ++i) + auto num_models = mVertexBuffer[mPreviewLOD][model].size(); + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -3446,7 +3446,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -3584,9 +3584,9 @@ bool LLModelPreview::render() if (render_mesh) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); if (pass > 0){ - for (U32 i = 0; i < num_models; ++i) + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; @@ -3649,8 +3649,8 @@ bool LLModelPreview::render() if (physics.mHull.empty()) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); - for (U32 v = 0; v < num_models; ++v) + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + for (size_t v = 0; v < num_models; ++v) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v]; @@ -3717,7 +3717,7 @@ bool LLModelPreview::render() const LLMeshSkinInfo *skin = &model->mSkinInfo; LLSkinningUtil::initJointNums(&model->mSkinInfo, getPreviewAvatar());// inits skin->mJointNums if nessesary U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = skin->mAlternateBindMatrix.size(); + auto bind_count = skin->mAlternateBindMatrix.size(); if (joint_overrides && bind_count > 0 @@ -3762,7 +3762,7 @@ bool LLModelPreview::render() } } - for (U32 i = 0, e = mVertexBuffer[mPreviewLOD][model].size(); i < e; ++i) + for (U32 i = 0, e = static_cast<U32>(mVertexBuffer[mPreviewLOD][model].size()); i < e; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -3773,7 +3773,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 5d55816f94..96be917019 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -123,7 +123,7 @@ void LLOutfitGallery::onOpen(const LLSD& info) { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -601,8 +601,8 @@ void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + auto saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 94b32ceea9..0f5f7aebf8 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -376,7 +376,7 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const uuid_vec_t uuids; (*iter).second->getSelectedUUIDs(uuids); - S32 prev_size = selected_uuids.size(); + auto prev_size = selected_uuids.size(); selected_uuids.resize(prev_size + uuids.size()); std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); } diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp index 5cbc565a70..93e0b0d65b 100644 --- a/indra/newview/llpanelemojicomplete.cpp +++ b/indra/newview/llpanelemojicomplete.cpp @@ -94,13 +94,13 @@ void LLPanelEmojiComplete::draw() if (mVertical) { x = mRenderRect.mLeft; - y = mRenderRect.mTop - (mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; + y = mRenderRect.mTop - static_cast<S32>(mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; width = mRenderRect.getWidth(); height = mEmojiHeight; } else { - x = mRenderRect.mLeft + (mCurSelected - firstVisibleIdx) * mEmojiWidth; + x = mRenderRect.mLeft + static_cast<S32>(mCurSelected - firstVisibleIdx) * mEmojiWidth; y = mRenderRect.mBottom; width = mEmojiWidth; height = mRenderRect.getHeight(); @@ -113,7 +113,7 @@ void LLPanelEmojiComplete::draw() F32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; F32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0; - for (U32 curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) + for (size_t curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) { LLWString text(1, mEmojis[curIdx].Character); mIconFont->render(text, 0, iconCenterX, iconCenterY, @@ -129,7 +129,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(0, mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -138,7 +138,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].Begin, mEmojis[curIdx].End - mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::yellow6, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -147,7 +147,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].End); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); } iconCenterY -= mEmojiHeight; } @@ -373,11 +373,11 @@ void LLPanelEmojiComplete::onEmojisChanged() { width += mScrollbar->getThickness(); } - height = mVisibleEmojis * mEmojiHeight; + height = static_cast<S32>(mVisibleEmojis) * mEmojiHeight; } else { - width = mVisibleEmojis * mEmojiWidth; + width = static_cast<S32>(mVisibleEmojis) * mEmojiWidth; height = getRect().getHeight(); } LLUICtrl::reshape(width, height, false); @@ -445,8 +445,8 @@ void LLPanelEmojiComplete::updateConstraints() if (!mNoScroll && mVisibleEmojis < mTotalEmojis) { mRenderRect.mRight -= mScrollbar->getThickness(); - mScrollbar->setDocSize(mTotalEmojis); - mScrollbar->setPageSize(mVisibleEmojis); + mScrollbar->setDocSize(static_cast<S32>(mTotalEmojis)); + mScrollbar->setPageSize(static_cast<S32>(mVisibleEmojis)); mScrollbar->setOrigin(mRenderRect.mRight, 0); mScrollbar->reshape(mScrollbar->getThickness(), mRenderRect.mTop, true); mScrollbar->setVisible(true); @@ -459,7 +459,7 @@ void LLPanelEmojiComplete::updateConstraints() else { mEmojiHeight = mRenderRect.getHeight(); - mRenderRect.stretch((mRenderRect.getWidth() - mVisibleEmojis * mEmojiWidth) / -2, 0); + mRenderRect.stretch((mRenderRect.getWidth() - static_cast<S32>(mVisibleEmojis) * mEmojiWidth) / -2, 0); } updateScrollPos(); @@ -486,7 +486,7 @@ void LLPanelEmojiComplete::updateScrollPos() if (mScrollbar && mScrollbar->getVisible()) { - mScrollbar->setDocPos(mScrollPos); + mScrollbar->setDocPos(static_cast<S32>(mScrollPos)); } } diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index 176da130bb..1878a81926 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -126,7 +126,7 @@ void LLPanelExperienceLog::refresh() events_to_save.erase(day->first); continue; } - int size = dayArray.size(); + int size = static_cast<int>(dayArray.size()); if(itemsToSkip > size) { itemsToSkip -= size; @@ -137,7 +137,7 @@ void LLPanelExperienceLog::refresh() moreItems = true; break; } - for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--) + for(int i = static_cast<int>(dayArray.size()) - itemsToSkip - 1; i >= 0; i--) { if(items >= mPageSize) { diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index fd960c9e97..833de9b5e4 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -194,7 +194,7 @@ void LLPanelGroupCreate::onBtnCreate() // Validate the group name length. std::string gr_name = mGroupNameEditor->getText(); LLStringUtil::trim(gr_name); - S32 group_name_len = gr_name.size(); + S32 group_name_len = static_cast<S32>(gr_name.size()); if (group_name_len < DB_GROUP_NAME_MIN_LEN || group_name_len > DB_GROUP_NAME_STR_LEN) { diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index cb6d44f1e7..bc56b49e5d 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1173,7 +1173,7 @@ void LLPanelGroupMembersSubTab::confirmEjectMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -1868,7 +1868,7 @@ void LLPanelGroupMembersSubTab::confirmBanMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -2197,7 +2197,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle)) { // If this is the everyone role, then EVERYONE is in it. - S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole(); + S32 members_in_role = (*rit).first.isNull() ? static_cast<S32>(gdatap->mMembers.size()) : (*rit).second->getTotalMembersInRole(); LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role); item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this); if (had_selection && ((*rit).first == last_selected)) @@ -3109,7 +3109,7 @@ void LLPanelGroupBanListSubTab::activate() { mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(group_datap->mBanList.size()); + setBanCount(static_cast<U32>(group_datap->mBanList.size())); } else { @@ -3236,7 +3236,7 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() // update ban-count related elements mCreateBanButton->setEnabled(true); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } @@ -3314,7 +3314,7 @@ void LLPanelGroupBanListSubTab::populateBanList() mRefreshBanListButton->setEnabled(true); mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); } void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index aa90c1960e..ed80c8b732 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -335,7 +335,7 @@ void LLPanelLogin::addFavoritesToStartLocation() { // first login panel has no favorites, just update name length and buttons std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple(); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); return; } @@ -355,7 +355,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLStringUtil::toLower(user_defined_name); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); std::string::size_type index = user_defined_name.find_first_of(" ._"); @@ -597,13 +597,13 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) login_id += lastname; } sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else if(identifier.has("type") && (std::string)identifier["type"] == "account") { std::string login_id = identifier["account_name"].asString(); sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else { @@ -627,7 +627,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) // nice row of asterisks. const std::string filler("123456789!123456"); sInstance->getChild<LLUICtrl>("password_edit")->setValue(filler); - sInstance->mPasswordLength = filler.length(); + sInstance->mPasswordLength = static_cast<unsigned int>(filler.length()); sInstance->updateLoginButtons(); } else @@ -793,7 +793,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) { location_combo->setLabel(new_start_slurl.getLocationString()); - sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->mLocationLength = static_cast<unsigned int>(new_start_slurl.getLocationString().length()); sInstance->updateLoginButtons(); } } @@ -1124,7 +1124,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) } LLLineEditor* password_edit(self->getChild<LLLineEditor>("password_edit")); - self->mPasswordLength = password_edit->getText().length(); + self->mPasswordLength = static_cast<unsigned int>(password_edit->getText().length()); self->updateLoginButtons(); } @@ -1158,8 +1158,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); - sInstance->mUsernameLength = username.length(); - sInstance->mPasswordLength = password.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(username.length()); + sInstance->mPasswordLength = static_cast<unsigned int>(password.length()); } else { diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index b6ec403b87..0925351350 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -179,7 +179,7 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const { - U32 item_count = 0; + size_t item_count = 0; if (mInventoryPanel) { @@ -192,7 +192,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const } } - return item_count; + return static_cast<U32>(item_count); } void LLPanelMarketplaceInbox::onClearSearch() diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index aa60c5cf6c..2dd4866da3 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -1241,7 +1241,7 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) if (!url.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); } } else if ("copy_data" == command_name) @@ -1254,12 +1254,12 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) { pos += encoding_specifier.size(); std::string res = LLBase64::decodeAsString(url.substr(pos)); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, res.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, static_cast<S32>(res.size())); } else { url = LLURI::unescape(url); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); } } } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index e08179dd58..bbaaa764e7 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -871,7 +871,7 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected - U32 groups_count = gAgent.mGroups.size(); + U32 groups_count = static_cast<U32>(gAgent.mGroups.size()); S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 94603471f7..2a27a6e143 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -986,7 +986,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma LLWString wline = utf8str_to_wstring(name); // panel supports two lines long names - S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (segment_length == wline.length()) { // no work needed @@ -994,7 +994,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma } S32 first_line_length = segment_length; - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + first_line_length == wline.length()) { // no work needed @@ -1004,7 +1004,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma // name does not fit, cut it, add ... const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); name = name.substr(0, segment_length + first_line_length) + std::string("..."); } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 579f0941c3..19e2d5de99 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1430,7 +1430,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "agent_permissions") { @@ -1455,7 +1455,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { wstr = utf8str_to_wstring(av_name.getUserName()); } - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "edit_display_name") { diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index d453d2c914..48bbb891b2 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -598,7 +598,7 @@ void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, L { const U32 seconds_in_day = 24 * 60 * 60; - S32 tabs_cnt = mItemContainers.size(); + S32 tabs_cnt = static_cast<S32>(mItemContainers.size()); S32 curr_year = 0, curr_month = 0, curr_day = 0; tab_date = LLDate::now(); @@ -695,7 +695,7 @@ void LLTeleportHistoryPanel::refresh() // tab_boundary_date would be earliest possible date for this tab S32 tab_idx = 0; getNextTab(date, tab_idx, tab_boundary_date); - tab_idx = mItemContainers.size() - 1 - tab_idx; + tab_idx = static_cast<S32>(mItemContainers.size()) - 1 - tab_idx; if (tab_idx >= 0) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); @@ -743,7 +743,7 @@ void LLTeleportHistoryPanel::refresh() break; } - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (size_t n = mItemContainers.size() - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); LLFlatListView* fv = getFlatListViewFromTab(tab); @@ -798,14 +798,14 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance() .getFlatItemForPersistentItem(mGearItemMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed - history_items.size(), // index will be decremented inside loop below + static_cast<S32>(history_items.size()), // index will be decremented inside loop below sFilterSubString); fv->addItem(item, LLUUID::null, ADD_TOP); // Index of each item, from last to removed item should be decremented // to point to the right item in LLTeleportHistoryStorage - for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) + for (auto tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); if (!tab->getVisible()) @@ -821,8 +821,8 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) std::vector<LLPanel*> items; fv->getItems(items); - S32 items_cnt = items.size(); - for (S32 n = 0; n < items_cnt; ++n) + auto items_cnt = items.size(); + for (size_t n = 0; n < items_cnt; ++n) { LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n]; @@ -857,9 +857,9 @@ void LLTeleportHistoryPanel::showTeleportHistory() mTeleportHistory = LLTeleportHistoryStorage::getInstance(); } - mCurrentItem = mTeleportHistory->getItems().size() - 1; + mCurrentItem = static_cast<S32>(mTeleportHistory->getItems().size()) - 1; - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (auto n = mItemContainers.size() - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (tab) @@ -884,9 +884,9 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) if (item) mLastSelectedItemIndex = item->getIndex(); - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); @@ -1001,7 +1001,7 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa void LLTeleportHistoryPanel::gotSLURLCallback(const std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1015,9 +1015,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) if ("expand_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(true); } @@ -1025,9 +1025,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) } else if ("collapse_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(false); } @@ -1082,12 +1082,12 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const if (command_name == "collapse_all" || command_name == "expand_all") { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); bool has_expanded_tabs = false; bool has_collapsed_tabs = false; - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 537bd0d303..c1534c9abd 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -478,11 +478,11 @@ void LLPanelWearing::getAttachmentLimitsCoro(std::string url) void LLPanelWearing::setAttachmentDetails(LLSD content) { mObjectNames.clear(); - S32 number_attachments = content["attachments"].size(); - for(int i = 0; i < number_attachments; i++) + auto number_attachments = content["attachments"].size(); + for(size_t i = 0; i < number_attachments; i++) { - S32 number_objects = content["attachments"][i]["objects"].size(); - for(int j = 0; j < number_objects; j++) + auto number_objects = content["attachments"][i]["objects"].size(); + for(size_t j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); std::string name = content["attachments"][i]["objects"][j]["name"].asString(); @@ -594,6 +594,6 @@ void LLPanelWearing::copyToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } // EOF diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 52a7383da6..c9fbeba2f3 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -140,12 +140,12 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes if ( pContent.has(NAVMESH_DATA_FIELD) ) { const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); - unsigned int binSize = value.size(); + auto binSize = value.size(); std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize); std::istringstream streamdecomp( newStr ); size_t decompBinSize = 0; bool valid = false; - U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh(valid, decompBinSize, streamdecomp, static_cast<S32>(binSize)); if ( !valid ) { LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index a92a8fe138..61791492e7 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -35,9 +35,6 @@ #include "llagent.h" #include "llpathfindingmanager.h" -#include "llpathinglib.h" -#include "llsingleton.h" -#include "lltool.h" #include "llviewercamera.h" #include "llviewerregion.h" #include "llviewerwindow.h" diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 04b39a63f0..e5e99b6701 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -302,7 +302,7 @@ namespace LLPerfStats std::vector<LLVector3d> positions; uuid_vec_t avatar_ids; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); - return positions.size(); + return static_cast<int>(positions.size()); } const U32 NUM_PERIODS = 50; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 56f23a0458..7cbbb89313 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -549,11 +549,9 @@ void LLPreviewGesture::addAnimations() // Copy into something we can sort std::vector<LLInventoryItem*> animations; - - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - animations.push_back( items.at(i) ); + animations.emplace_back(item); } // Do the sort @@ -594,12 +592,9 @@ void LLPreviewGesture::addSounds() // Copy sounds into something we can sort std::vector<LLInventoryItem*> sounds; - - S32 i; - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - sounds.push_back( items.at(i) ); + sounds.emplace_back(item); } // Do the sort @@ -951,8 +946,8 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL); // Make UI steps for each gesture step - S32 i; - S32 count = gesture->mSteps.size(); + size_t i; + size_t count = gesture->mSteps.size(); for (i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 6fa9c59194..620b7c8b2d 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -593,7 +593,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID, tid, copyitem); - S32 size = buffer.length() + 1; + S32 size = static_cast<S32>(buffer.length()) + 1; file.write((U8*)buffer.c_str(), size); gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD, diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index a6ab08601d..c2188ea638 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1203,9 +1203,9 @@ struct LLEntryAndEdCore void LLScriptEdCore::deleteBridges() { - S32 count = mBridges.size(); + auto count = mBridges.size(); LLEntryAndEdCore* eandc; - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { eandc = mBridges.at(i); delete eandc; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 68454bcd60..259332a3ff 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -673,7 +673,7 @@ void LLPreviewTexture::adjustAspectRatio() std::string ratio = std::to_string(num)+":" + std::to_string(denom); mRatiosList.push_back(ratio); combo->add(ratio); - combo->setCurrentByIndex(mRatiosList.size()- 1); + combo->setCurrentByIndex(static_cast<S32>(mRatiosList.size()) - 1); } else { diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 47f01a170c..decf640bcf 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -699,7 +699,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) res /= 2; - S32 mip = i - (mMipChain.size() - mips); + GLint mip = static_cast<GLint>(i - (mMipChain.size() - mips)); if (mip >= 0) { diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8e45a60f86..cdccaf44e9 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -527,7 +527,7 @@ void LLSceneMonitor::dumpToFile(const std::string &file_name) os << std::setprecision(10); LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); - const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); + const auto frame_count = scene_load_recording.getNumRecordedPeriods(); F64Seconds frame_time; diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 26859800fd..6a2470f83a 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -194,13 +194,13 @@ void LLSceneView::draw() F32 size_range = size_domain[1]-size_domain[0]; - U32 count = size[idx].size(); + auto count = size[idx].size(); F32 total = 0.f; gGL.begin(LLRender::LINE_STRIP); - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 rad = size[idx][i]; total += rad; @@ -260,11 +260,11 @@ void LLSceneView::draw() U32 triangle_range = tri_domain[1]-tri_domain[0]; - U32 count = triangles[idx].size(); + auto count = triangles[idx].size(); gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { U32 tri_count = triangles[idx][i]; F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; @@ -325,13 +325,13 @@ void LLSceneView::draw() F32 cost_range = streaming_domain[1]-streaming_domain[0]; - U32 count = streaming_cost[idx].size(); + auto count = streaming_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 sc = streaming_cost[idx][i]; total += sc; @@ -391,13 +391,13 @@ void LLSceneView::draw() F32 cost_range = physics_domain[1]-physics_domain[0]; - U32 count = physics_cost[idx].size(); + auto count = physics_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 pc = physics_cost[idx][i]; total += pc; diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index 104bf79832..2d8a5eaf13 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -75,7 +75,7 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert, { // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const // so we need to cast it. - BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length()); + BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), static_cast<int>(pem_cert.length())); if(pem_bio == NULL) { LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL; @@ -747,7 +747,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, { // split wildcard into the portion before the *, and the portion after - int wildcard_pos = wildcard.find_first_of('*'); + auto wildcard_pos = wildcard.find_first_of('*'); // check the case where there is no wildcard. if(wildcard_pos == wildcard.npos) { @@ -779,7 +779,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos); // iterate through the current subdomain, finding instances of the match string. - int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); + auto sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); while(sub_pos != std::string::npos) { new_subdomain = new_subdomain.substr(sub_pos, std::string::npos); @@ -811,8 +811,8 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin std::string new_cn = common_name; // find the last '.' in the hostname and the match name. - int subdomain_pos = new_hostname.find_last_of('.'); - int subcn_pos = new_cn.find_last_of('.'); + auto subdomain_pos = new_hostname.find_last_of('.'); + auto subcn_pos = new_cn.find_last_of('.'); // if the last char is a '.', strip it if(subdomain_pos == (new_hostname.length()-1)) @@ -1860,7 +1860,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() unsigned char unique_id[MAC_ADDRESS_BYTES]; LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher(unique_id, sizeof(unique_id)); - cipher.decrypt(&buffer[0], buffer.size()); + cipher.decrypt(&buffer[0], static_cast<U32>(buffer.size())); return std::string((const char*)&buffer[0], buffer.size()); } diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index b4108d0c0e..1484c6d0e1 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -138,7 +138,7 @@ public: virtual iterator find(const LLSD& params); // return the number of certs in the store - virtual int size() const { return mCerts.size(); } + virtual int size() const { return static_cast<int>(mCerts.size()); } // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index b7fc2ef123..66f2e65274 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7648,7 +7648,7 @@ void LLObjectSelection::updateEffects() S32 LLObjectSelection::getNumNodes() { - return mList.size(); + return static_cast<S32>(mList.size()); } void LLObjectSelection::addNode(LLSelectNode *nodep) @@ -7715,7 +7715,7 @@ bool LLObjectSelection::isEmpty() const S32 LLObjectSelection::getObjectCount() { cleanupNodes(); - S32 count = mList.size(); + S32 count = static_cast<S32>(mList.size()); return count; } @@ -8454,7 +8454,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (enable_rot) { - int children_count = obj->getChildren().size(); + auto children_count = obj->getChildren().size(); if (obj_count > 1 && children_count > 0) { // for linked sets, rotate around the group center diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index c07d4b7e56..0d81f2c099 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -505,7 +505,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { - int count = 0; + size_t count = 0; std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList(); count += selection_list.size(); @@ -517,7 +517,7 @@ U32 LLSidepanelInventory::getSelectedCount() count += selection_list.size(); } - return count; + return static_cast<U32>(count); } LLInventoryPanel *LLSidepanelInventory::getActivePanel() diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 438b04ff39..bb4917f347 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -194,7 +194,7 @@ void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, con void LLSkinningUtil::scrubSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { - const S32 max_joints = skin->mJointNames.size(); + const S32 max_joints = static_cast<S32>(skin->mJointNames.size()); for (U32 j=0; j<num_vertices; j++) { F32 *w = weights[j].getF32ptr(); @@ -318,7 +318,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a if (vol_face.mJointRiggingInfoTab.needsUpdate()) { S32 num_verts = vol_face.mNumVertices; - S32 num_joints = skin->mJointNames.size(); + S32 num_joints = static_cast<S32>(skin->mJointNames.size()); if (num_verts > 0 && vol_face.mWeights && num_joints > 0) { initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 939673b15e..c57949d834 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2289,12 +2289,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe LLCDMeshData mesh; mesh.mIndexBase = &index[0]; mesh.mVertexBase = pos[0].mV; - mesh.mNumVertices = pos.size(); + mesh.mNumVertices = static_cast<int>(pos.size()); mesh.mVertexStrideBytes = 12; mesh.mIndexStrideBytes = 6; mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mNumTriangles = index.size()/3; + mesh.mNumTriangles = static_cast<int>(index.size())/3; LLCDMeshData res; diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 77eedeaf2f..6c252ed31f 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -216,7 +216,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) //a panel for hidden item buttons LLPanel::Params panel_params = p.items_panel; - mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements()); + mItemsPanel= prepareItemsPanel(panel_params, static_cast<S32>(p.items.numValidElements())); addChild(mItemsPanel); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 384c8caf90..77e615b01c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -378,7 +378,7 @@ bool idle_startup() const std::string delims (" "); std::string system; - int begIdx, endIdx; + size_t begIdx, endIdx; std::string osString = LLOSInfo::instance().getOSStringSimple(); begIdx = osString.find_first_not_of (delims); @@ -3642,7 +3642,7 @@ bool process_login_success_response() if (!look_at_str.empty()) { size_t len = look_at_str.size(); - LLMemoryStream mstr((U8*)look_at_str.c_str(), len); + LLMemoryStream mstr((U8*)look_at_str.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); gAgentStartLookAt = ll_vector3_from_sd(sd); } @@ -3680,7 +3680,7 @@ bool process_login_success_response() if(!home_location.empty()) { size_t len = home_location.size(); - LLMemoryStream mstr((U8*)home_location.c_str(), len); + LLMemoryStream mstr((U8*)home_location.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); S32 region_x = sd["region_handle"][0].asInteger(); S32 region_y = sd["region_handle"][1].asInteger(); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index cb08421606..843da97089 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1375,13 +1375,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries) { - S32 num_entries = entries.size(); + auto num_entries = entries.size(); llassert_always(num_entries == mHeaderEntriesInfo.mEntries); if (!mReadOnly) { LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo)); - for (S32 idx=0; idx<num_entries; idx++) + for (size_t idx=0; idx<num_entries; idx++) { S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry)); if(bytes_written != sizeof(Entry)) diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 70766b0605..faf722dc8f 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -140,8 +140,8 @@ public: void unlockWorkers() { mWorkersMutex.unlock(); } // debug - S32 getNumReads() { return mReaders.size(); } - S32 getNumWrites() { return mWriters.size(); } + S32 getNumReads() { return static_cast<S32>(mReaders.size()); } + S32 getNumWrites() { return static_cast<S32>(mWriters.size()); } S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); } S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); } U32 getEntries() { return mHeaderEntriesInfo.mEntries; } diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 56d0480be4..bb1729a6ce 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1655,7 +1655,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; } - S32 append_size(mHttpBufferArray->size()); + S32 append_size(static_cast<S32>(mHttpBufferArray->size())); S32 total_size(cur_size + append_size); S32 src_offset(0); llassert_always(append_size == mRequestedSize); @@ -2193,7 +2193,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // get length of stream: LLCore::BufferArray * body(response->getBody()); - data_size = body ? body->size() : 0; + data_size = body ? static_cast<S32>(body->size()) : 0; LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL; if (data_size > 0) @@ -3405,7 +3405,7 @@ void LLTextureFetch::cancelHttpWaiters() int LLTextureFetch::getHttpWaitersCount() { mNetworkQueueMutex.lock(); // +Mfnq - int ret(mHttpWaitResource.size()); + int ret(static_cast<int>(mHttpWaitResource.size())); mNetworkQueueMutex.unlock(); // -Mfnq return ret; } diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index e3c3864025..84ef45c97a 100644 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -80,7 +80,7 @@ void LLTextureInfo::addRequest(const LLUUID& id) U32 LLTextureInfo::getTextureInfoMapSize() { - return mTextures.size(); + return static_cast<U32>(mTextures.size()); } bool LLTextureInfo::has(const LLUUID& id) diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index c8502d78ca..05ac9dacf3 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -161,14 +161,14 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal options = supplied_options; } - S32 num_options = options.size(); + auto num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); S32 btn_total_width = 0; S32 default_size_btns = 0; - for( S32 i = 0; i < num_options; i++ ) + for (size_t i = 0; i < num_options; i++) { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; if (mButtonData[i].mWidth > w) @@ -184,7 +184,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if( num_options > 1 ) { - btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD); + btn_total_width = btn_total_width + (button_width * default_size_btns) + ((static_cast<S32>(num_options) - 1) * BTN_HPAD); } else { diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index b50f38354c..0ac2653021 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -216,7 +216,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, S32 dialog_width = max_msg_width + 2 * h_pad; S32 dialog_height = LLToastPanel::getRect().getHeight(); - dialog_height += LINE_HEIGHT * lines.size(); + dialog_height += LINE_HEIGHT * static_cast<S32>(lines.size()); dialog_height += LINE_HEIGHT / 2; LLToastPanel::reshape(dialog_width, dialog_height, false); @@ -227,7 +227,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, LLRect check_rect; // if we are part of the toast, we need to leave space for buttons S32 msg_y = v_pad + (parent_view ? 0 : (BTN_HEIGHT + LINE_HEIGHT / 2)); - mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT*lines.size())); + mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT * static_cast<S32>(lines.size()))); mCheck->setLabel(check_title); mCheck->setCommitCallback(cb); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index c561f43ca0..3b4fb799c2 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -363,16 +363,13 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - folder_ids.push_back(cats.at(i)->getUUID()); + folder_ids.emplace_back(cat->getUUID()); } - count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - item_ids.push_back(items.at(i)->getUUID()); + item_ids.emplace_back(item->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -414,9 +411,9 @@ void LLToolDragAndDrop::beginMultiDrag( { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; - S32 count = llmin(cargo_ids.size(), types.size()); - std::set<LLUUID> cat_ids; - for(S32 i = 0; i < count; ++i) + auto count = llmin(cargo_ids.size(), types.size()); + uuid_set_t cat_ids; + for (size_t i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); if (cat) @@ -434,10 +431,9 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.size(); - for(S32 i = 0; i < cat_count; ++i) + for (auto& cat : cats) { - cat_ids.insert(cat->getUUID()); + cat_ids.emplace(cat->getUUID()); } } } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 364319dc56..ad6402c4ad 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -87,7 +87,7 @@ public: void setCargoCount(U32 count) { mCargoCount = count; } void resetCargoCount() { mCargoCount = 0; } - U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); } + U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : static_cast<S32>(mCargoIDs.size()); } S32 getCargoIndex() const { return mCurItemIndex; } static S32 getOperationId() { return sOperationId; } diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index ae3bcfdf79..b6fbcaa330 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -1148,7 +1148,7 @@ std::string LLTranslate::addNoTranslateTags(std::string mesg) upd_msg.insert(dif + match.getStart(), AZURE_NOTRANSLATE_OPENING_TAG); upd_msg.insert(dif + AZURE_NOTRANSLATE_OPENING_TAG.size() + match.getEnd() + 1, AZURE_NOTRANSLATE_CLOSING_TAG); mesg.erase(match.getStart(), match.getEnd() - match.getStart()); - dif += match.getEnd() - match.getStart() + AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size(); + dif += match.getEnd() - match.getStart() + static_cast<S32>(AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size()); } return upd_msg; } @@ -1170,9 +1170,9 @@ std::string LLTranslate::removeNoTranslateTags(std::string mesg) { std::string upd_msg(mesg); LLUrlMatch match; - S32 opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); - S32 closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); - S32 dif = 0; + auto opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); + auto closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); + size_t dif = 0; //remove 'no-translate' tags we added to the links before while (LLUrlRegistry::instance().findUrl(mesg, match)) { diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index ec54123074..4961d38f8e 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -102,7 +102,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 max_msg_width = 0; std::list<std::string> msg_lines; - S32 size = msg.size() + 1; + auto size = msg.size() + 1; std::vector<char> temp_msg(size); // non-const copy to make strtok happy strcpy( &temp_msg[0], msg.c_str()); char* token = strtok( &temp_msg[0], "\n" ); @@ -117,7 +117,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 line_height = font->getLineHeight(); S32 dialog_width = max_msg_width + 2 * HPAD; - S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; + S32 dialog_height = line_height * static_cast<S32>(msg_lines.size()) + 2 * VPAD; reshape( dialog_width, dialog_height, false ); diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index a4eb231341..6bff31122e 100644 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -71,7 +71,7 @@ void LLURL::init(const char * url) char *parse; char *leftover_url = url_copy; - S32 span = 0; + size_t span = 0; // copy and lop off tag if ((parse = strchr(url_copy,'#'))) diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index c3b6167a7e..de0ed645eb 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard() else // human-readable location text_to_copy = utf8str_to_wstring(unescaped_text); - LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size()); + LLClipboard::instance().copyToClipboard(text_to_copy, 0, static_cast<S32>(text_to_copy.size())); } diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index f5651646a6..e2d2fe00e2 100644 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -128,8 +128,8 @@ bool LLUrlWhiteList::clear () std::string url_cleanup(std::string pattern) { LLStringUtil::trim(pattern); - S32 length = pattern.length(); - S32 position = 0; + size_t length = pattern.length(); + size_t position = 0; std::string::reverse_iterator it = pattern.rbegin(); ++it; // skip last char, might be '/' ++position; @@ -139,7 +139,7 @@ std::string url_cleanup(std::string pattern) if (c == '/') { // found second to last '/' - S32 desired_length = length - position; + auto desired_length = length - position; LLStringUtil::truncate(pattern, desired_length); break; } diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 06410e4d6d..26707f5d9a 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -542,7 +542,7 @@ void LLViewerAssetStorage::assetRequestCoro( const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); - S32 size = raw.size(); + S32 size = static_cast<S32>(raw.size()); if (size > 0) { mTotalBytesFetched += size; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index b12acc8f42..14d24da081 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -598,7 +598,7 @@ LLSD LLNewBufferedResourceUploadInfo::exportTempFile() // copy buffer to the cache for upload LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - file.write((U8*) mBuffer.c_str(), mBuffer.size()); + file.write((U8*) mBuffer.c_str(), static_cast<S32>(mBuffer.size())); return LLSD(); } @@ -700,7 +700,7 @@ LLSD LLBufferedAssetUploadInfo::prepareUpload() LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - S32 size = mContents.length() + 1; + S32 size = static_cast<S32>(mContents.length()) + 1; file.write((U8*)mContents.c_str(), size); mStoredToCache = true; diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 4ddddf03f5..eacf68dda5 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -156,7 +156,7 @@ LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size) // output_str bool LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + S32 in_len = static_cast<S32>(in_str.length()); std::string in_str_lc = in_str; LLStringUtil::toLower(in_str_lc); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 8cc2f1e5d6..ea3088613f 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -1124,7 +1124,7 @@ bool LLViewerInput::handleGlobalBindsKeyDown(KEY key, MASK mask) return false; } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, true, false, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, true, false, false, false); } bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) @@ -1137,7 +1137,7 @@ bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, false, true, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, false, true, false, false); } bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down) @@ -1153,18 +1153,18 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, S32 mode = getMode(); if (down) { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_DOWN, true); } else { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_UP, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_UP, true); } return res; } bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; std::string name; @@ -1211,7 +1211,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalKeyBindings[mode].size(); + auto size = mGlobalKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mGlobalKeyBindings[mode][index].mKey && mask == mGlobalKeyBindings[mode][index].mMask) @@ -1223,7 +1223,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons } else { - S32 size = mKeyBindings[mode].size(); + auto size = mKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mKeyBindings[mode][index].mKey && mask == mKeyBindings[mode][index].mMask) @@ -1254,7 +1254,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; @@ -1293,7 +1293,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalMouseBindings[mode].size(); + auto size = mGlobalMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) @@ -1305,7 +1305,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const } else { - S32 size = mMouseBindings[mode].size(); + auto size = mMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) @@ -1608,7 +1608,7 @@ bool LLViewerInput::scanKey(KEY key, bool key_down, bool key_up, bool key_level) // don't process key down on repeated keys bool repeat = gKeyboard->getKeyRepeated(key); - bool res = scanKey(mKeyBindings[mode], mKeyBindings[mode].size(), key, mask, key_down, key_up, key_level, repeat); + bool res = scanKey(mKeyBindings[mode], static_cast<S32>(mKeyBindings[mode].size()), key, mask, key_down, key_up, key_level, repeat); return res; } @@ -1744,7 +1744,7 @@ bool LLViewerInput::scanMouse(EMouseClickType click, EMouseState state) const bool res = false; S32 mode = getMode(); MASK mask = gKeyboard->currentMask(true); - res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state, false); + res = scanMouse(mMouseBindings[mode], static_cast<S32>(mMouseBindings[mode].size()), click, mask, state, false); // No user defined actions found or those actions can't handle the key/button, // so handle CONTROL_LBUTTON if nessesary. @@ -1805,14 +1805,14 @@ void LLViewerInput::scanMouse() bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const { - S32 size = mMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + auto size = mMouseBindings[mode].size(); + for (size_t index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) return true; } size = mGlobalMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + for (size_t index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) return true; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 88f88d7436..96541b030c 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -746,7 +746,7 @@ S32 LLViewerInventoryCategory::getViewerDescendentCount() const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->size() + items->size(); + descendents_actual = static_cast<S32>(cats->size() + items->size()); } return descendents_actual; } diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 3869213cc5..fe66949f73 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -74,7 +74,7 @@ public: S32 getGroup() const { return mGroup; } S32 getPieSlice() const { return mPieSlice; } - S32 getNumObjects() const { return mAttachedObjects.size(); } + S32 getNumObjects() const { return static_cast<S32>(mAttachedObjects.size()); } S32 getNumAnimatedObjects() const; void clampObjectPosition(); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 177df9af61..4e1372b386 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -569,7 +569,7 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification tinygltf::Model model; if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { @@ -617,7 +617,7 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3 if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f1fdfc548b..76fc629b33 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6286,8 +6286,8 @@ void send_group_notice(const LLUUID& group_id, item_def["owner_id"] = item->getPermissions().getOwner(); std::ostringstream ostr; LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML); - bin_bucket_size = ostr.str().copy( - (char*)bin_bucket, ostr.str().size()); + bin_bucket_size = static_cast<S32>(ostr.str().copy( + (char*)bin_bucket, ostr.str().size())); bin_bucket[bin_bucket_size] = '\0'; } else diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index c791a30d1a..de05054f4b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -7335,7 +7335,7 @@ public: const LLSD& input) const { LLSD object_data = input["body"]["ObjectData"]; - S32 num_entries = object_data.size(); + S32 num_entries = static_cast<S32>(object_data.size()); for ( S32 i = 0; i < num_entries; i++ ) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index cc852b4ce2..d8ab0c8896 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -285,7 +285,7 @@ public: virtual void addChild(LLViewerObject *childp); virtual void removeChild(LLViewerObject *childp); const_child_list_t& getChildren() const { return mChildList; } - S32 numChildren() const { return mChildList.size(); } + S32 numChildren() const { return static_cast<S32>(mChildList.size()); } void addThisAndAllChildren(std::vector<LLViewerObject*>& objects); void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects); bool isChild(LLViewerObject *childp) const; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 2f8e71c5e9..08a1ba0f9b 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1480,7 +1480,7 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - S32 last_index = mActiveObjects.size()-1; + S32 last_index = static_cast<S32>(mActiveObjects.size()) - 1; if (idx != last_index) { @@ -1511,7 +1511,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx <= -1) { mActiveObjects.push_back(objectp); - objectp->setListIndex(mActiveObjects.size()-1); + objectp->setListIndex(static_cast<S32>(mActiveObjects.size()) - 1); objectp->setOnActiveList(true); } else diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index d67e617a35..8c24b2438b 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -615,15 +615,13 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) void LLViewerParcelMgr::notifyObservers() { std::vector<LLParcelObserver*> observers; - S32 count = mObservers.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto observer : mObservers) { - observers.push_back(mObservers.at(i)); + observers.emplace_back(observer); } - for(i = 0; i < count; ++i) + for (auto observer : observers) { - observers.at(i)->changed(); + observer->changed(); } } @@ -2149,7 +2147,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntry::map& entries, LLViewerRegion* region, S32 parcel_local_id) { - S32 count = entries.size(); + S32 count = static_cast<S32>(entries.size()); S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET); S32 sequence_id = 1; bool start_message = true; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 30d17fe532..b556aef768 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -279,7 +279,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLVector3 gravity(0.f, 0.f, GRAVITY); - LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerPartSim::checkParticleCount(static_cast<U32>(mParticles.size())); LLViewerCamera* camera = LLViewerCamera::getInstance(); LLViewerRegion *regionp = getRegion(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 41af61ec97..57d96f4f1b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -136,7 +136,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -150,7 +150,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -922,7 +922,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -1172,7 +1172,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast<U32>(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1259,7 +1259,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast<U32>(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1735,7 +1735,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector<LLDrawable*> delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1774,10 +1774,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2576,10 +2575,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -2837,7 +2835,7 @@ void LLViewerRegion::requestCacheMisses() mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast<S32>(mCacheMissList.size())); mCacheMissList.clear(); } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 82d0caecb5..0ab0265586 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -233,7 +233,7 @@ public: } F32 right_x; - mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x); + mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast<S32>(mLabel.length()), S32_MAX, &right_x); return right_x; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index fbb423358b..879a4bd259 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3516,12 +3516,12 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) return; } - S32 end = te_list.size(); + auto end = te_list.size(); for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); iter != mTextureList.end(); ++iter) { - S32 i = 0; + size_t i = 0; for(i = 0; i < end; i++) { diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 9342eb2865..238e6830ea 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -43,13 +43,13 @@ LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim() mScaleS = mScaleT = 1; mRot = 0; - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); } LLViewerTextureAnim::~LLViewerTextureAnim() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 0016ba6155..f482703dde 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -690,7 +690,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) llassert_always(mInitialized) ; llassert(image); - S32 count = 0; + size_t count = 0; if (image->isInImageList()) { count = mImageList.erase(image) ; @@ -1223,7 +1223,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) } std::shared_ptr<LL::WorkQueue> main_queue = LLImageGLThread::sEnabledTextures ? LL::WorkQueue::getInstance("mainloop") : NULL; // Run threads - S32 fetch_pending = 0; + size_t fetch_pending = 0; while (1) { LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index da1c013335..413209f50d 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -134,7 +134,7 @@ public: void handleIRCallback(void **data, const S32 number); - S32 getNumImages() { return mImageList.size(); } + S32 getNumImages() { return static_cast<S32>(mImageList.size()); } // Local UI images // Local UI images diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 485dd683be..b0a00c29a4 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -246,9 +246,9 @@ LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbp //Clamp the bandwidth users can set. F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH); - S32 count = mPresets.size(); + auto count = mPresets.size(); - S32 i; + size_t i; for (i = 0; i < count; i++) { if (mPresets[i].getTotal() > set_bandwidth) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 17ac0a97b7..3a0fd056d3 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1664,13 +1664,13 @@ bool LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(), recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS), recording.getLastValue(LLStatViewer::SIM_TIME_DILATION)); - S32 len = temp_str.length(); + int len = static_cast<int>(temp_str.length()); TextOutA(hdc, 0, 0, temp_str.c_str(), len); LLVector3d pos_global = gAgent.getPositionGlobal(); temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); - len = temp_str.length(); + len = static_cast<S32>(temp_str.length()); TextOutA(hdc, 0, 25, temp_str.c_str(), len); TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a109de6aa5..1c970895c9 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2327,7 +2327,7 @@ void LLVOAvatar::updateMeshData() S32 f_num = 0 ; const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. - const S32 num_parts = mMeshLOD.size(); + const auto num_parts = mMeshLOD.size(); // this order is determined by number of LODS // if a mesh earlier in this list changed LODs while a later mesh doesn't, @@ -5718,7 +5718,7 @@ void LLVOAvatar::checkTextureLoading() return ; //have not been invisible for enough time. } - mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; + mLoadedCallbackTextures = pause ? static_cast<S32>(mCallbackTextureList.size()) : 0; for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) @@ -6597,8 +6597,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL if ( vobj && vobj->isMesh() && pSkinData ) { - const int bindCnt = pSkinData->mAlternateBindMatrix.size(); - const int jointCnt = pSkinData->mJointNames.size(); + const int bindCnt = static_cast<int>(pSkinData->mAlternateBindMatrix.size()); + const int jointCnt = static_cast<int>(pSkinData->mJointNames.size()); if ((bindCnt > 0) && (bindCnt != jointCnt)) { LL_WARNS_ONCE() << "invalid mesh, bindCnt " << bindCnt << "!= jointCnt " << jointCnt << ", joint overrides will be ignored." << LL_ENDL; @@ -7945,7 +7945,7 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) S32 LLVOAvatar::getAttachmentCount() const { - S32 count = 0; + size_t count = 0; for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -7953,7 +7953,7 @@ S32 LLVOAvatar::getAttachmentCount() const count += pAttachment->mAttachedObjects.size(); } - return count; + return static_cast<S32>(count); } bool LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const @@ -8982,7 +8982,7 @@ void LLVOAvatar::addChat(const LLChat& chat) mChats.push_back(chat); - S32 chat_length = 0; + size_t chat_length = 0; for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter) { chat_length += chat_iter->mText.size(); @@ -9594,7 +9594,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // SUNSHINE CLEANUP - is this case OK now? - S32 num_params = contents->mParamWeights.size(); + auto num_params = contents->mParamWeights.size(); if (num_params <= 1) { // In this case, we have no reliable basis for knowing @@ -9638,7 +9638,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params) { - S32 num_params = contents.mParamWeights.size(); + auto num_params = contents.mParamWeights.size(); ESex old_sex = getSex(); if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE)) @@ -9689,7 +9689,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte bool interp_params = false; S32 params_changed_count = 0; - for( S32 i = 0; i < num_params; i++ ) + for( size_t i = 0; i < num_params; i++ ) { LLVisualParam* param = contents.mParams[i]; F32 newWeight = contents.mParamWeights[i]; @@ -11138,7 +11138,7 @@ void LLVOAvatar::accountRenderComplexityForObject( attached_object->mRiggedAttachedWarned = true; } - hud_object_complexity.texturesCount += textures.size(); + hud_object_complexity.texturesCount += static_cast<U32>(textures.size()); for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); volume_texture != textures.end(); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index dd0501340d..4af52dc3f4 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -1270,7 +1270,7 @@ void LLVOCache::removeEntry(HeaderEntryInfo* entry) removeFromCache(entry); delete entry; - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } } @@ -1447,7 +1447,7 @@ void LLVOCache::writeCacheHeader() success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo)); } - mNumEntries = mHeaderEntryQueue.size() ; + mNumEntries = static_cast<U32>(mHeaderEntryQueue.size()); if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES) { HeaderEntryInfo* entry = new HeaderEntryInfo() ; @@ -1633,7 +1633,7 @@ void LLVOCache::purgeEntries(U32 size) delete entry; // TODO also delete extras } - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, bool dirty_cache, bool removal_enabled) @@ -1703,7 +1703,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(success) { - S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong + S32 num_entries = static_cast<S32>(cache_entry_map.size()); // if removal is enabled num_entries might be wrong success = check_write(&apr_file, &num_entries, sizeof(S32)); if (success) { @@ -1791,7 +1791,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL // TODO - clean up broken cache file } - U32 num_entries = cache_extras_entry_map.size(); + auto num_entries = cache_extras_entry_map.size(); out << num_entries << '\n'; if(!out.good()) { diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 8efdeb50f0..a260967bf9 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -144,7 +144,7 @@ public: void removeChild(LLVOCacheEntry* entry); void removeAllChildren(); LLVOCacheEntry* getChild(); //remove the first child, and return it. - S32 getNumOfChildren() const {return mChildrenList.size();} + S32 getNumOfChildren() const { return static_cast<S32>(mChildrenList.size()); } void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message void updateParentBoundingInfo(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 6af9593df8..e0a818d84e 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -696,7 +696,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); - S32 idx = draw_vec.size()-1; + auto idx = draw_vec.size()-1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index b1ff6eb346..305fd77126 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -248,7 +248,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s { delete[] out_F32s; // get rid of the current array - count_F32s = in_string.length(); + count_F32s = static_cast<U32>(in_string.length()); if (count_F32s == 0) { // we don't like zero length arrays diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index de2c0dfd6a..da4df226ee 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -7389,8 +7389,8 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( } // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser. - int start = 0; - int delim; + size_t start = 0; + size_t delim; while((delim = mInput.find("\n\n\n", start)) != std::string::npos) { @@ -7401,7 +7401,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag); XML_SetCharacterDataHandler(parser, ExpatCharHandler); XML_SetUserData(parser, this); - XML_Parse(parser, mInput.data() + start, delim - start, false); + XML_Parse(parser, mInput.data() + start, static_cast<int>(delim - start), false); LL_DEBUGS("VivoxProtocolParser") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL; start = delim + 3; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index fa4dbd586e..ebb7508a71 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -317,7 +317,7 @@ bool LLVOPartGroup::updateGeometry(LLDrawable *drawable) F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); pixel_meter_ratio *= pixel_meter_ratio; - LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ; + LLViewerPartSim::checkParticleCount(static_cast<U32>(mViewerPartGroupp->mParticles.size())); S32 count=0; mDepth = 0.f; @@ -899,7 +899,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - S32 idx = draw_vec.size()-1; + auto idx = draw_vec.size()-1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 86aaa244ec..a908bb455a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5199,7 +5199,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, //add face to drawmap LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType]; - S32 idx = draw_vec.size()-1; + auto idx = draw_vec.size()-1; bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index a68ad0029f..5ee6aec9f9 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -959,14 +959,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu return; } - const uuid_vec_t& ids = mUUIDs; // selected items IDs - U32 mask = 0; // mask of selected items' types - U32 n_items = ids.size(); // number of selected items - U32 n_worn = 0; // number of worn items among the selected ones - U32 n_already_worn = 0; // number of items worn of same type as selected items - U32 n_links = 0; // number of links among the selected items - U32 n_editable = 0; // number of editable items among the selected ones - U32 n_touchable = 0; // number of touchable items among the selected ones + const uuid_vec_t& ids = mUUIDs; // selected items IDs + U32 mask = 0; // mask of selected items' types + U32 n_items = static_cast<U32>(ids.size()); // number of selected items + U32 n_worn = 0; // number of worn items among the selected ones + U32 n_already_worn = 0; // number of items worn of same type as selected items + U32 n_links = 0; // number of links among the selected items + U32 n_editable = 0; // number of editable items among the selected ones + U32 n_touchable = 0; // number of touchable items among the selected ones bool can_be_worn = true; diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index be00c058a2..680b958b46 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -46,7 +46,7 @@ class LLWearableList : public LLSingleton<LLWearableList> public: void cleanup() ; - S32 getLength() const { return mList.size(); } + S32 getLength() const { return static_cast<S32>(mList.size()); } void getAsset(const LLAssetID& assetID, const std::string& wearable_name, diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 6c5313a3ac..d8852de954 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -131,8 +131,8 @@ std::string LLWeb::escapeURL(const std::string& url) // The CURL curl_escape() function escapes colons, slashes, // and all characters but A-Z and 0-9. Do a cheesy mini-escape. std::string escaped_url; - S32 len = url.length(); - for (S32 i = 0; i < len; i++) + auto len = url.length(); + for (size_t i = 0; i < len; i++) { char c = url[i]; if (c == ' ') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index e0c8186578..2eadea20ef 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1352,8 +1352,8 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.size(); - for (S32 i = 0; i < count; i++) + auto count = regionp->mMapAvatars.size(); + for (size_t i = 0; i < count; i++) { LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global); if(dist_vec_squared(pos_global, relative_to) <= radius_squared) diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 1cd72a1cc5..ec6e22cd7a 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -282,7 +282,7 @@ void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle, body->read(0, bodydata, body->size()); - mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0); + mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, static_cast<int>(body->size()), 0); delete[] bodydata; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 472ccd220d..4c2a321937 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3618,10 +3618,8 @@ void LLPipeline::renderHighlights() // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3637,10 +3635,8 @@ void LLPipeline::renderHighlights() // Paint 'em red! color.setVec(1.f, 0.f, 0.f, 0.5f); - int count = mHighlightFaces.size(); - for (S32 i = 0; i < count; i++) + for (auto facep : mHighlightFaces) { - LLFace* facep = mHighlightFaces[i]; facep->renderSelected(LLViewerTexture::sNullImagep, color); } } @@ -3666,10 +3662,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3696,10 +3690,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -4737,7 +4729,7 @@ void LLPipeline::rebuildPools() assertInitialized(); - S32 max_count = mPools.size(); + auto max_count = mPools.size(); pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool); while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index b61f865d8a..ed5e1f5151 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -346,7 +346,7 @@ public: void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object bool verify(); // Verify that all data in the pipeline is "correct" - S32 getLightCount() const { return mLights.size(); } + S32 getLightCount() const { return static_cast<S32>(mLights.size()); } void calcNearbyLights(LLCamera& camera); void setupHWLights(); diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 4f32299b0d..f6ed745e96 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -634,19 +634,19 @@ namespace tut // Read each of the 4 Pem certs and store in mX509*Cert pointers BIO * validation_bio; - validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), static_cast<S32>(mPemTestCert.length())); PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), static_cast<S32>(mPemRootCert.length())); PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), static_cast<S32>(mPemIntermediateCert.length())); PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), static_cast<S32>(mPemChildCert.length())); PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); BIO_free(validation_bio); } |