From bd2c67e8ecc4b2e04a793d9842143736b946231f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Fri, 11 Oct 2019 15:53:27 -0400 Subject: [PATCH] Fix win32 warnings --- indra/llcommon/llstreamtools.cpp | 2 +- indra/llcommon/llstring.cpp | 8 ++++---- indra/llinventory/llsettingsdaycycle.cpp | 4 ++-- indra/llinventory/llsettingsdaycycle.h | 4 ++-- indra/llmath/llvolume.cpp | 2 ++ indra/llui/lltexteditor.cpp | 2 +- indra/newview/llfavoritesbar.cpp | 6 +++--- indra/newview/llfavoritesbar.h | 4 ++-- indra/newview/llfloatermodelpreview.cpp | 2 +- indra/newview/llparticipantlist.cpp | 6 +++--- indra/newview/llpreviewscript.cpp | 2 +- indra/newview/llvoavatar.cpp | 13 ++++++------- 12 files changed, 28 insertions(+), 27 deletions(-) diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index b7f27c8b6..b3c83dadc 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -139,7 +139,7 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream } else { - int key_index = 1; + size_t key_index = 1; while ( key_index < key_length && keyword[key_index - 1] == c && input_stream.good()) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f01615cc2..baf0c028d 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -577,7 +577,7 @@ std::string utf8str_truncate(const std::string& utf8str, const S32 max_len) } // [RLVa:KB] - Checked: RLVa-2.1.0 -std::string utf8str_substr(const std::string& utf8str, const S32 index, const S32 max_len) +std::string utf8str_substr(const std::string& utf8str, const size_t index, const size_t max_len) { if (0 == max_len) { @@ -589,7 +589,7 @@ std::string utf8str_substr(const std::string& utf8str, const S32 index, const S3 } else { - S32 cur_char = max_len; + size_t cur_char = max_len; // If we're ASCII, we don't need to do anything if ((U8)utf8str[index + cur_char] > 0x7f) @@ -648,7 +648,7 @@ void utf8str_split(std::list& split_list, const std::string& utf8st } // [/RLVa:KB] -std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol_len) +std::string utf8str_symbol_truncate(const std::string& utf8str, const size_t symbol_len) { if (0 == symbol_len) { @@ -660,7 +660,7 @@ std::string utf8str_symbol_truncate(const std::string& utf8str, const S32 symbol } else { - int len = 0, byteIndex = 0; + size_t len = 0, byteIndex = 0; const char* aStr = utf8str.c_str(); size_t origSize = utf8str.size(); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 25516ec6e..b170abfbc 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -608,7 +608,7 @@ LLSettingsDay::validation_list_t LLSettingsDay::validationList() return validation; } -LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(S32 track) +LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(size_t track) { static CycleTrack_t emptyTrack; if (mDayTracks.size() <= track) @@ -617,7 +617,7 @@ LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(S32 track) return mDayTracks[track]; } -const LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrackConst(S32 track) const +const LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrackConst(size_t track) const { static CycleTrack_t emptyTrack; if (mDayTracks.size() <= track) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 8776f6725..bc5f03fa1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -118,8 +118,8 @@ public: virtual LLSettingsWaterPtr_t buildWater(LLSD) const = 0; void setInitialized(bool value = true) { mInitialized = value; } - CycleTrack_t & getCycleTrack(S32 track); - const CycleTrack_t & getCycleTrackConst(S32 track) const; + CycleTrack_t & getCycleTrack(size_t track); + const CycleTrack_t & getCycleTrackConst(size_t track) const; bool clearCycleTrack(S32 track); bool replaceCycleTrack(S32 track, const CycleTrack_t &source); bool isTrackEmpty(S32 track) const; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 744423a67..a97439044 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6331,7 +6331,9 @@ void LLVolumeFace::allocateIndices(S32 num_indices, bool copy) S32 new_size = ((num_indices * sizeof(U16)) + 0xF) & ~0xF; if (copy && num_indices && mIndices && mNumIndices) { +#if !LL_USE_TCMALLOC S32 old_size = ((mNumIndices * sizeof(U16)) + 0xF) & ~0xF; +#endif mIndices = (U16*)ll_aligned_realloc_16(mIndices, new_size, old_size); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index d58249de0..c4cdbbdf8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -4355,7 +4355,7 @@ void LLTextEditor::appendTextImpl(const std::string &new_text, const LLStyleSP s if (mReadOnly && mParseHTML && !is_link) // Singu Note: Do not replace html if the user is going to edit it. (Like in profiles) { LL_RECORD_BLOCK_TIME(FTM_PARSE_HTML); - S32 start=0,end=0; + size_t start=0, end=0; LLUrlMatch match; auto append_substr = [&](const size_t& pos, const size_t& count) { diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 71e1b6a8c..3ed58db98 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -736,7 +736,7 @@ void LLFavoritesBarCtrl::updateButtons() } const child_list_t* childs = getChildList(); child_list_const_iter_t child_it = childs->begin(); - int first_changed_item_index = 0; + size_t first_changed_item_index = 0; int rightest_point = getRect().mRight - mMoreTextBox->getRect().getWidth(); //lets find first changed button while (child_it != childs->end() && first_changed_item_index < mItems.size()) @@ -798,7 +798,7 @@ void LLFavoritesBarCtrl::updateButtons() } //last_right_edge is saving coordinates LLButton* last_new_button = NULL; - int j = first_changed_item_index; + size_t j = first_changed_item_index; for (; j < mItems.size(); j++) { last_new_button = createButton(mItems[j], button_params, last_right_edge); @@ -982,7 +982,7 @@ void LLFavoritesBarCtrl::updateMenuItems(LLMenuGL* menu) U32 widest_item = 0; - for (S32 i = mFirstDropDownItem; i < mItems.size(); i++) + for (size_t i = mFirstDropDownItem; i < mItems.size(); i++) { LLViewerInventoryItem* item = mItems.at(i); const std::string& item_name = item->getName(); diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 48f26624f..7d6008a02 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -101,8 +101,8 @@ protected: LLUUID mFavoriteFolderId; const LLFontGL *mFont; - S32 mFirstDropDownItem; - S32 mDropDownItemsCount; + size_t mFirstDropDownItem; + U32 mDropDownItemsCount; bool mUpdateDropDownItems; bool mRestoreOverflowMenu; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e7821fe63..095d01e40 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2021,7 +2021,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) } //add current model to current LoD's model list (LLModel::mLocalID makes a good vector index) - S32 idx = list_iter->mModel->mLocalID; + size_t idx = list_iter->mModel->mLocalID; if (mModel[lod].size() <= idx) { //stretch model list to fit model at given index diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 1b4c0b8f8..fb7a0bc7d 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -263,14 +263,14 @@ void LLParticipantList::refreshSpeakers() mSpeakerMgr->update(resort_ok); bool re_sort = false; - int start_pos = llmax(0, scroll_pos - 20); - int end_pos = scroll_pos + mAvatarList->getLinesPerPage() + 20; + size_t start_pos = llmax(0, scroll_pos - 20); + size_t end_pos = scroll_pos + mAvatarList->getLinesPerPage() + 20; std::vector items = mAvatarList->getAllData(); if (start_pos >= items.size()) { return; } - int count = 0; + size_t count = 0; for (std::vector::iterator item_it = items.begin(); item_it != items.end(); ++item_it) { diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d0f011998..b8f714298 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -439,7 +439,7 @@ bool LLScriptEdCore::loadScriptText(const std::string& filename) // read in the whole file fseek(file, 0L, SEEK_END); - long file_length = ftell(file); + size_t file_length = ftell(file); fseek(file, 0L, SEEK_SET); if (file_length > 0) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c5d9f09be..812026235 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1808,11 +1808,11 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i) { LLPolyMesh* mesh = i->second; - for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.size(); joint_num++) + for (const auto& joint : mesh->mJointRenderData) { static const LLVector4Logical mask = _mm_load_ps((F32*)&S_V4LOGICAL_MASK_TABLE[3 * 4]); LLVector4a trans; - trans.setSelectWithMask(mask, _mm_setzero_ps(), mesh->mJointRenderData[joint_num]->mWorldMatrix->getRow<3>()); + trans.setSelectWithMask(mask, _mm_setzero_ps(), joint->mWorldMatrix->getRow<3>()); update_min_max(newMin, newMax, trans); } } @@ -8778,7 +8778,7 @@ void LLVOAvatar::updateMeshVisibility() //LL_INFOS() << "head " << bake_flag[BAKED_HEAD] << "eyes " << bake_flag[BAKED_EYES] << "hair " << bake_flag[BAKED_HAIR] << "lower " << bake_flag[BAKED_LOWER] << "upper " << bake_flag[BAKED_UPPER] << "skirt " << bake_flag[BAKED_SKIRT] << LL_ENDL; - for (S32 i = 0; i < mMeshLOD.size(); i++) + for (size_t i = 0; i < mMeshLOD.size(); i++) { LLAvatarJoint* joint = mMeshLOD[i]; if (i == MESH_ID_HAIR) @@ -9471,7 +9471,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, apr_file_printf(file, "\n\n"); LLVisualParam* param = getFirstVisualParam(); - for (S32 i = 0; i < params_for_dump.size(); i++) + for (const auto& param_for_dump : params_for_dump) { while( param && ((param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) && (param->getGroup() != VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE)) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -9479,7 +9479,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, param = getNextVisualParam(); } LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - F32 value = params_for_dump[i]; + F32 value = param_for_dump; dump_visual_param(file, viewer_param, value); param = getNextVisualParam(); } @@ -10187,9 +10187,8 @@ void LLVOAvatar::getSortedJointNames(S32 joint_type, std::vector& r } else if (joint_type==1) { - for (S32 i = 0; i < mCollisionVolumes.size(); i++) + for (const auto& pJoint : mCollisionVolumes) { - LLAvatarJointCollisionVolume* pJoint = mCollisionVolumes[i]; result.push_back(pJoint->getName()); } }