diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-06-01 15:49:26 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-06-01 15:49:26 +0200 |
commit | b42f9d836b4c0f7fbd4bdae1734021e2a09fdbe8 (patch) | |
tree | d73404c2fbacce379a57e2d03a6cd54558590859 /indra/llui | |
parent | cb3bd8865aa0f9fb8a247ea595cf1973057ba91f (diff) |
Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings
Diffstat (limited to 'indra/llui')
37 files changed, 150 insertions, 150 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 26f5e4fbe2..4682044d6e 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -484,7 +484,7 @@ void LLAccordionCtrl::arrangeMultiple() if (mFitParent) { // All expanded tabs will have equal height - panel_height = calcExpandedTabHeight(i, panel_top); + panel_height = calcExpandedTabHeight(static_cast<S32>(i), panel_top); ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height); // Try to make accordion tab fit accordion view height. diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 5132d33bbf..64896ccfcb 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -73,7 +73,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ if (LLAssetType::lookupIsAssetIDKnowable(type)) { LLWString source = utf8str_to_wstring(src.asString()); - res = addToClipboard(source, 0, source.size()); + res = addToClipboard(source, 0, static_cast<S32>(source.size())); } if (res) { @@ -87,13 +87,13 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const { bool res = false; - S32 count = mObjects.size(); + auto count = mObjects.size(); inv_objects.reserve(inv_objects.size() + count); if (count > 0) { res = true; inv_objects.clear(); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { inv_objects.push_back(mObjects[i]); } diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 0d82f29dfb..79dce1c714 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -995,7 +995,7 @@ void LLComboBox::updateSelection() LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); - mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); + mTextEntry->setSelection(static_cast<S32>(left_wstring.size()), static_cast<S32>(mTextEntry->getWText().size())); mTextEntry->endSelection(); mTextEntry->setTentative(false); mHasAutocompletedText = true; diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 270ec86e01..03717da80b 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -107,7 +107,7 @@ LLCommandManager::~LLCommandManager() U32 LLCommandManager::commandCount() const { - return mCommands.size(); + return static_cast<U32>(mCommands.size()); } LLCommand * LLCommandManager::getCommand(U32 commandIndex) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 3b2586a5a1..e6df0d3a4b 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -198,7 +198,7 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map<LLUUID, U32> CommandIndexMap; + typedef std::map<LLUUID, size_t> CommandIndexMap; typedef std::vector<LLCommand *> CommandVector; CommandVector mCommands; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index be100a6fd2..54bb8cbb94 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -147,11 +147,11 @@ void LLConsole::draw() return; } - U32 num_lines=0; + size_t num_lines{ 0 }; paragraph_t::reverse_iterator paragraph_it; paragraph_it = mParagraphs.rbegin(); - U32 paragraph_num=mParagraphs.size(); + auto paragraph_num=mParagraphs.size(); while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) { @@ -159,7 +159,7 @@ void LLConsole::draw() if(num_lines > mMaxLines || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) { //All lines above here are done. Lose them. - for (U32 i=0;i<paragraph_num;i++) + for (size_t i = 0; i < paragraph_num; i++) { if (!mParagraphs.empty()) mParagraphs.pop_front(); @@ -258,7 +258,7 @@ void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) ParagraphColorSegment color_segment; color_segment.mColor.setValue(color_llsd); - color_segment.mNumChars = color_str.length(); + color_segment.mNumChars = static_cast<S32>(color_str.length()); mParagraphColorSegments.push_back(color_segment); } @@ -310,7 +310,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b skip_chars = 0; } - U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, static_cast<S32>(line_end) - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (drawable != 0) { diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index f16c38a11a..925608e47e 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -210,7 +210,7 @@ void LLEmojiDictionary::findByShortCode( std::size_t begin, end; if (searchInShortCode(begin, end, shortCode, needle)) { - results[begin].emplace_back(d.Character, shortCode, begin, end); + results[static_cast<llwchar>(begin)].emplace_back(d.Character, shortCode, begin, end); } } } diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index b1a95715f1..1799968afb 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -390,7 +390,7 @@ U32 LLFlatListView::size(const bool only_visible_items) const } else { - return mItemPairs.size(); + return static_cast<U32>(mItemPairs.size()); } } @@ -563,7 +563,7 @@ void LLFlatListView::rearrangeItems() } // add paddings between items, excluding invisible ones - height += mItemPad * (mItemPairs.size() - invisible_children_count - 1); + height += mItemPad * (static_cast<S32>(mItemPairs.size()) - invisible_children_count - 1); LLRect rc = mItemsPanel->getRect(); S32 width = mItemsNoScrollWidth; diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index b64a9862a2..6d75e9f282 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -264,7 +264,7 @@ public: void setCommitOnSelectionChange(bool b) { mCommitOnSelectionChange = b; } /** Get number of selected items in the list */ - U32 numSelected() const {return mSelectedItemPairs.size(); } + U32 numSelected() const {return static_cast<U32>(mSelectedItemPairs.size()); } /** Get number of (visible) items in the list */ U32 size(const bool only_visible_items = true) const; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 47821e38ca..1d4ecbe9c9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -758,7 +758,7 @@ void LLFolderView::removeSelectedItems() // items, since the removal will futz with internal data // structures. std::vector<LLFolderViewItem*> items; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(count <= 0) return; LLFolderViewItem* item = NULL; selected_items_t::iterator item_it; @@ -803,7 +803,7 @@ void LLFolderView::removeSelectedItems() setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); listeners.reserve(count); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { listener = items[i]->getViewModelItem(); if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end())) @@ -922,7 +922,7 @@ void LLFolderView::copy() { // *NOTE: total hack to clear the inventory clipboard LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { LLFolderViewModelItem* listener = NULL; @@ -1059,7 +1059,7 @@ void LLFolderView::startRenamingSelectedItem( void ) // make sure selection is visible scrollToShowSelection(); - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLFolderViewItem* item = NULL; if(count > 0) { @@ -1414,7 +1414,7 @@ bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); LLStringUtil::toUpper(current_item_label); - S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); + auto search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { found = true; @@ -1454,7 +1454,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) mParentPanel.get()->setFocus(true); bool handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - S32 count = mSelectedItems.size(); + auto count = mSelectedItems.size(); LLMenuGL* menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); if (!menu) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index a0c7407b06..82cd2483e8 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -940,22 +940,22 @@ void LLFolderViewItem::draw() return; } - std::string::size_type filter_string_length = mViewModelItem->hasFilterStringMatch() ? mViewModelItem->getFilterStringSize() : 0; + auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast<S32>(mViewModelItem->getFilterStringSize()) : 0; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); std::string combined_string = mLabel + mLabelSuffix; const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL); - S32 filter_offset = mViewModelItem->getFilterStringOffset(); + S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset()); if (filter_string_length > 0) { S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); S32 top = getRect().getHeight() - TOP_PAD; if(mLabelSuffix.empty() || (font == suffix_font)) { - S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2; - S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2; + S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2; + S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -976,7 +976,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; + S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2; S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2; LLUIImage* box_image = default_params.selection_image; LLRect box_rect(left, top, right, bottom); @@ -1033,7 +1033,7 @@ void LLFolderViewItem::draw() if(suffix_filter_length > 0) { S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size()); - F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); + F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length); F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index ce644b094c..df446a5d70 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -39,7 +39,7 @@ inline bool LLKeywordToken::isHead(const llwchar* s) const // strncmp is much faster than string compare bool res = true; const llwchar* t = mToken.c_str(); - S32 len = mToken.size(); + auto len = mToken.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -55,7 +55,7 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const { bool res = true; const llwchar* t = mDelimiter.c_str(); - S32 len = mDelimiter.size(); + auto len = mDelimiter.size(); for (S32 i=0; i<len; i++) { if (s[i] != t[i]) @@ -134,7 +134,7 @@ std::string LLKeywords::getArguments(LLSD& arguments) if (arguments.isArray()) { - U32 argsCount = arguments.size(); + auto argsCount = arguments.size(); LLSD::array_iterator arrayIt = arguments.beginArray(); for ( ; arrayIt != arguments.endArray(); ++arrayIt) { @@ -489,7 +489,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW return; } - S32 text_len = wtext.size() + 1; + S32 text_len = static_cast<S32>(wtext.size()) + 1; seg_list->push_back( new LLNormalTextSegment( style, 0, text_len, editor ) ); @@ -707,16 +707,16 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen { if (pos!=seg_start) { - LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, pos, editor); + LLTextSegmentPtr text_segment = new LLNormalTextSegment(cur_token_style, seg_start, static_cast<S32>(pos), editor); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); } - LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, pos); + LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, static_cast<S32>(pos)); text_segment->setToken( cur_token ); insertSegment( seg_list, text_segment, text_len, style, editor); - seg_start = pos+1; + seg_start = static_cast<S32>(pos) + 1; pos = wtext.find('\n',seg_start); } diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 9dcdea121b..f498b3ddee 100644 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -82,8 +82,8 @@ public: { } - S32 getLengthHead() const { return mToken.size(); } - S32 getLengthTail() const { return mDelimiter.size(); } + S32 getLengthHead() const { return static_cast<S32>(mToken.size()); } + S32 getLengthTail() const { return static_cast<S32>(mDelimiter.size()); } bool isHead(const llwchar* s) const; bool isTail(const llwchar* s) const; const LLWString& getToken() const { return mToken; } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index d362d4362c..9e5f8048ba 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -86,7 +86,7 @@ public: void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); void collapsePanel(LLPanel* panel, bool collapsed = true); - S32 getNumPanels() { return mPanels.size(); } + S32 getNumPanels() { return static_cast<S32>(mPanels.size()); } void updateLayout(); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 5ec4c34f57..50bf3f5877 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -590,7 +590,7 @@ const std::string& LLLineEditor::getSuggestion(U32 index) const U32 LLLineEditor::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLLineEditor::replaceWithSuggestion(U32 index) @@ -994,7 +994,7 @@ void LLLineEditor::addChar(const llwchar uni_char) mText.erase(getCursor(), 1); } - S32 cur_bytes = mText.getString().size(); + S32 cur_bytes = static_cast<S32>(mText.getString().size()); S32 new_bytes = wchar_utf8_length(new_c); @@ -1007,7 +1007,7 @@ void LLLineEditor::addChar(const llwchar uni_char) } else if (mMaxLengthChars) { - S32 wide_chars = mText.getWString().size(); + auto wide_chars = mText.getWString().size(); if ((wide_chars + 1) > mMaxLengthChars) { allow_char = false; @@ -1332,7 +1332,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if (mMaxLengthChars) { - U32 available_chars = mMaxLengthChars - mText.getWString().size(); + auto available_chars = mMaxLengthChars - mText.getWString().size(); if (available_chars < clean_string.size()) { @@ -2300,10 +2300,10 @@ bool LLLineEditor::postvalidateFloat(const std::string &str) LLWString trimmed = utf8str_to_wstring(str); LLWStringUtil::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if( 0 < len ) { - S32 i = 0; + size_t i = 0; // First character can be a negative sign if( '-' == trimmed[0] ) @@ -2360,7 +2360,7 @@ bool LLLineEditor::evaluateFloat() if (!success) { // Move the cursor to near the error on failure - setCursor(LLCalc::getInstance()->getLastErrorPos()); + setCursor(static_cast<S32>(LLCalc::getInstance()->getLastErrorPos())); // *TODO: Translated error message indicating the type of error? Select error text? } else @@ -2501,7 +2501,7 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString.assign( LLWString( mText, insert_preedit_at, mPreeditWString.length() ) ); - mText.erase(insert_preedit_at, mPreeditWString.length()); + mText.erase(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 279f5628e1..dffaf69a9f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -187,7 +187,7 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) { mAcceleratorMask |= MASK_SHIFT; } - S32 pipe_pos = shortcut.rfind("|"); + auto pipe_pos = shortcut.rfind("|"); std::string key_str = shortcut.substr(pipe_pos+1); LLKeyboard::keyFromString(key_str, &mAcceleratorKey); @@ -545,8 +545,8 @@ void LLMenuItemGL::draw( void ) std::string::size_type offset = upper_case_label.find(mJumpKey); if (offset != std::string::npos) { - S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset); - S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, offset + 1); + S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1); } } @@ -1649,8 +1649,8 @@ void LLMenuItemBranchDownGL::draw( void ) if (offset != std::string::npos) { S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f); - S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, offset); - S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, offset + 1); + S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset)); + S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); } } @@ -2068,7 +2068,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) // Otherwise viewer will hang for a time needed to scroll U32_MAX // times in std::advance(). STORM-659. size_t nitems = mItems.size(); - U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + U32 scrollable_items = nitems < mMaxScrollableItems ? static_cast<U32>(nitems) : mMaxScrollableItems; // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. @@ -2594,7 +2594,7 @@ void LLMenuGL::empty( void ) // erase group of items from menu void LLMenuGL::erase( S32 begin, S32 end, bool arrange/* = true*/) { - S32 items = mItems.size(); + auto items = mItems.size(); if ( items == 0 || begin >= end || begin < 0 || end > items ) { @@ -2813,7 +2813,7 @@ void LLMenuGL::setTornOff(bool torn_off) U32 LLMenuGL::getItemCount() { - return mItems.size(); + return static_cast<U32>(mItems.size()); } LLMenuItemGL* LLMenuGL::getItem(S32 number) diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index 58c253c3f4..177664dde4 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -66,7 +66,7 @@ public: static void onAppFocusLost(); static void onAppFocusGained(); - static S32 activeCount() { return sModalStack.size(); } + static S32 activeCount() { return static_cast<S32>(sModalStack.size()); } static void shutdownModals(); protected: diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 630e45dddb..b2bfc8bc84 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -118,7 +118,7 @@ public: /*virtual*/ void draw() override; S32 getMaxNumSliders() { return mMaxNumSliders; } - S32 getCurNumSliders() { return mValue.size(); } + S32 getCurNumSliders() { return static_cast<S32>(mValue.size()); } F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 74e573bb4e..bee7d5bb3f 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1187,7 +1187,7 @@ bool LLNotificationChannel::isEmpty() const S32 LLNotificationChannel::size() const { - return mItems.size(); + return static_cast<S32>(mItems.size()); } size_t LLNotificationChannel::size() diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index e7159de94c..d3615b6601 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -249,7 +249,7 @@ public: void fromLLSD(const LLSD& sd); LLSD asLLSD() const; - S32 getNumElements() { return mFormData.size(); } + S32 getNumElements() { return static_cast<S32>(mFormData.size()); } LLSD getElement(S32 index) { return mFormData.get(index); } LLSD getElement(const std::string& element_name); void getElements(LLSD& elements, S32 offset = 0); diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index 810830ffa4..a24a7c86b2 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -87,7 +87,7 @@ public: LLCtrlSelectionInterface* getSelectionInterface() { return (LLCtrlSelectionInterface*)this; }; // LLCtrlSelectionInterface functions - /*virtual*/ S32 getItemCount() const { return mRadioButtons.size(); } + /*virtual*/ S32 getItemCount() const { return static_cast<S32>(mRadioButtons.size()); } /*virtual*/ bool getCanSelect() const { return true; } /*virtual*/ bool selectFirstItem() { return setSelectedIndex(0); } /*virtual*/ bool selectNthItem( S32 index ) { return setSelectedIndex(index); } diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index d07aa800d1..21bdf3f8a6 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -140,7 +140,7 @@ std::string LLResMgr::getMonetaryString( S32 input ) const S32 output_pos = 0; cur_group = 0; - S32 pos = digits.size()-1; + auto pos = digits.size()-1; S32 count_within_group = 0; while( (pos >= 0) && (groupings[cur_group] >= 0) ) { diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 39e575173d..74a9641836 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -373,7 +373,7 @@ S32 LLScrollListCtrl::isEmpty() const S32 LLScrollListCtrl::getItemCount() const { - return mItemList.size(); + return static_cast<S32>(mItemList.size()); } bool LLScrollListCtrl::hasSelectedItem() const @@ -1325,7 +1325,7 @@ bool LLScrollListCtrl::selectItemByPrefix(const LLWString& target, bool case_sen bool found = false; LLWString target_trimmed( target ); - S32 target_len = target_trimmed.size(); + auto target_len = target_trimmed.size(); if( 0 == target_len ) { @@ -1377,8 +1377,8 @@ bool LLScrollListCtrl::selectItemByPrefix(const LLWString& target, bool case_sen if (select) { // find offset of matching text (might have leading whitespace) - S32 offset = item_label.find(target_trimmed); - cellp->highlightText(offset, target_trimmed.size()); + auto offset = item_label.find(target_trimmed); + cellp->highlightText(static_cast<S32>(offset), static_cast<S32>(target_trimmed.size())); selectItem(item, -1); found = true; break; @@ -1404,7 +1404,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv U32 found = 0; LLWString substring_trimmed(substring); - S32 len = substring_trimmed.size(); + auto len = substring_trimmed.size(); if (0 == len) { @@ -1446,7 +1446,7 @@ U32 LLScrollListCtrl::searchItems(const LLWString& substring, bool case_sensitiv if (found_iter != std::string::npos) { // find offset of matching text - cellp->highlightText(found_iter, substring_trimmed.size()); + cellp->highlightText(static_cast<S32>(found_iter), static_cast<S32>(substring_trimmed.size())); selectItem(item, -1, false); found++; @@ -2897,7 +2897,7 @@ void LLScrollListCtrl::copy() { buffer += (*itor)->getContentsCSV() + "\n"; } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, static_cast<S32>(buffer.length())); } // virtual @@ -2981,7 +2981,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params // Add column mColumns[name] = new LLScrollListColumn(column_params, this); LLScrollListColumn* new_column = mColumns[name]; - new_column->mIndex = mColumns.size()-1; + new_column->mIndex = static_cast<S32>(mColumns.size()) - 1; // Add button if (new_column->getWidth() > 0 || new_column->mRelWidth > 0 || new_column->mDynamicWidth) @@ -3177,7 +3177,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; if (!item_p.validateBlock() || !new_item) return NULL; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); // Add any columns we don't already have S32 col_index = 0; @@ -3212,7 +3212,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } addColumn(new_column); columnp = mColumns[column]; - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } S32 index = columnp->mIndex; @@ -3245,7 +3245,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS new_column.name = "0"; addColumn(new_column); - new_item->setNumColumns(mColumns.size()); + new_item->setNumColumns(static_cast<S32>(mColumns.size())); } LLScrollListCell* cell = LLScrollListCell::create(LLScrollListCell::Params().value(item_p.value)); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 356d40ce3c..f25ba61fd4 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -178,7 +178,7 @@ public: virtual bool preProcessChildNode(LLXMLNodePtr child); virtual LLScrollListColumn* getColumn(S32 index); virtual LLScrollListColumn* getColumn(const std::string& name); - virtual S32 getNumColumns() const { return mColumnsIndexed.size(); } + virtual S32 getNumColumns() const { return static_cast<S32>(mColumnsIndexed.size()); } // Adds a single element, from an array of: // "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index 85da55e3e6..0d79d19a37 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -85,7 +85,7 @@ void LLScrollListItem::addColumn(const LLScrollListCell::Params& p) void LLScrollListItem::setNumColumns(S32 columns) { - S32 prev_columns = mColumns.size(); + auto prev_columns = mColumns.size(); if (columns < prev_columns) { std::for_each(mColumns.begin()+columns, mColumns.end(), DeletePointer()); @@ -93,7 +93,7 @@ void LLScrollListItem::setNumColumns(S32 columns) mColumns.resize(columns); - for (S32 col = prev_columns; col < columns; ++col) + for (auto col = prev_columns; col < columns; ++col) { mColumns[col] = NULL; } @@ -115,7 +115,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) S32 LLScrollListItem::getNumColumns() const { - return mColumns.size(); + return static_cast<S32>(mColumns.size()); } LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index b8aeb3b91f..1615db5b52 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -94,7 +94,7 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str } mHunspell->free_list(&suggestion_list, suggestion_cnt); } - return suggestions.size(); + return static_cast<S32>(suggestions.size()); } const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language) diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index f125dda916..adb1d51813 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -455,7 +455,7 @@ void LLStatBar::draw() if (mDisplayHistory && mStat.valid) { - const S32 num_values = frame_recording.getNumRecordedPeriods() - 1; + const S32 num_values = static_cast<S32>(frame_recording.getNumRecordedPeriods()) - 1; F32 min_value = 0.f, max_value = 0.f; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 752ef47d14..06f584d372 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1298,7 +1298,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) if (mCurrentTabIdx >= (S32)mTabList.size()) { - mCurrentTabIdx = mTabList.size()-1; + mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1; } selectTab(mCurrentTabIdx); if (has_focus) @@ -1377,7 +1377,7 @@ S32 LLTabContainer::getCurrentPanelIndex() S32 LLTabContainer::getTabCount() { - return mTabList.size(); + return static_cast<S32>(mTabList.size()); } LLPanel* LLTabContainer::getPanelByIndex(S32 index) @@ -1444,7 +1444,7 @@ void LLTabContainer::selectFirstTab() void LLTabContainer::selectLastTab() { - selectTab( mTabList.size()-1 ); + selectTab(static_cast<S32>(mTabList.size()) - 1); } void LLTabContainer::selectNextTab() @@ -1482,12 +1482,12 @@ void LLTabContainer::selectPrevTab() } S32 idx = mCurrentTabIdx-1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; while (!selectTab(idx) && idx != mCurrentTabIdx) { idx = idx - 1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; } if (tab_has_focus) { diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 1249461be9..387f2b9810 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -320,12 +320,12 @@ bool LLTextBase::truncate() if (value.type() == LLSD::TypeString) { // save a copy for strings. - utf8_byte_size = value.size(); + utf8_byte_size = static_cast<S32>(value.size()); } else { // non string LLSDs need explicit conversion to string - utf8_byte_size = value.asString().size(); + utf8_byte_size = static_cast<S32>(value.asString().size()); } if ( utf8_byte_size > mMaxTextByteLength ) @@ -335,7 +335,7 @@ bool LLTextBase::truncate() temp_utf8_text = utf8str_truncate( temp_utf8_text, mMaxTextByteLength ); LLWString text = utf8str_to_wstring( temp_utf8_text ); // remove extra bit of current string, to preserve formatting, etc. - removeStringNoUndo(text.size(), getWText().size() - text.size()); + removeStringNoUndo(static_cast<S32>(text.size()), static_cast<S32>(getWText().size() - text.size())); did_truncate = true; } } @@ -617,7 +617,7 @@ void LLTextBase::drawText() } else if (useLabel()) { - text_len = mLabel.getWString().length(); + text_len = static_cast<S32>(mLabel.getWString().length()); } S32 selection_left = -1; @@ -686,7 +686,7 @@ void LLTextBase::drawText() // Find the start of the first word U32 word_start = seg_start, word_end = -1; - U32 text_length = wstrText.length(); + U32 text_length = static_cast<U32>(wstrText.length()); while ( (word_start < text_length) && (!LLStringOps::isAlpha(wstrText[word_start])) ) { word_start++; @@ -845,7 +845,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s beforeValueChange(); S32 old_len = getLength(); // length() returns character length - S32 insert_len = wstr.length(); + S32 insert_len = static_cast<S32>(wstr.length()); pos = getEditableIndex(pos, true); if (pos > old_len) @@ -916,7 +916,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s { LLStyleSP emoji_style; LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL; - for (S32 text_kitty = 0, text_len = wstr.size(); text_kitty < text_len; text_kitty++) + for (S32 text_kitty = 0, text_len = static_cast<S32>(wstr.size()); text_kitty < text_len; text_kitty++) { llwchar code = wstr[text_kitty]; bool isEmoji = ed ? ed->isEmoji(code) : LLStringOps::isEmoji(code); @@ -1469,7 +1469,7 @@ const std::string& LLTextBase::getSuggestion(U32 index) const U32 LLTextBase::getSuggestionCount() const { - return mSuggestionList.size(); + return static_cast<U32>(mSuggestionList.size()); } void LLTextBase::replaceWithSuggestion(U32 index) @@ -2335,7 +2335,7 @@ void LLTextBase::resetLabel() style->setColor(mTentativeFgColor); LLStyleConstSP sp(style); - LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, mLabel.getWString().length() + 1, *this); + LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, static_cast<S32>(mLabel.getWString().length()) + 1, *this); insertSegment(label); } } @@ -2395,7 +2395,7 @@ void LLTextBase::appendWidget(const LLInlineViewSegment::Params& params, const s { segment_vec_t segments; LLWString widget_wide_text = utf8str_to_wstring(text); - segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + widget_wide_text.size())); + segments.push_back(new LLInlineViewSegment(params, getLength(), getLength() + static_cast<S32>(widget_wide_text.size()))); insertStringNoUndo(getLength(), widget_wide_text, &segments); } @@ -2436,11 +2436,11 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig { highlight_params.font.style("NORMAL"); LLStyleConstSP normal_sp(new LLStyle(highlight_params)); - segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLOnHoverChangeableTextSegment(sp, normal_sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } else { - segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + wide_text.size(), *this); + segmentp = new LLNormalTextSegment(sp, cur_length, cur_length + static_cast<S32>(wide_text.size()), *this); } segment_vec_t segments; segments.push_back(segmentp); @@ -2454,7 +2454,7 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig segment_vec_t segments; S32 segment_start = old_length; - S32 segment_end = old_length + wide_text.size(); + S32 segment_end = old_length + static_cast<S32>(wide_text.size()); LLStyleConstSP sp(new LLStyle(style_params)); if (underline_on_hover_only || mSkipLinkUnderline) { @@ -2545,7 +2545,7 @@ void LLTextBase::replaceUrl(const std::string &url, S32 start = seg->getStart(); S32 end = seg->getEnd(); text = text.substr(0, start) + wlabel + text.substr(end, text.size() - end + 1); - seg->setEnd(start + wlabel.size()); + seg->setEnd(start + static_cast<S32>(wlabel.size())); modified = true; } @@ -2898,7 +2898,7 @@ bool LLTextBase::setCursor(S32 row, S32 column) { if (row < 0 || column < 0) return false; - S32 n_lines = mLineInfoList.size(); + S32 n_lines = static_cast<S32>(mLineInfoList.size()); for (S32 line = row; line < n_lines; ++line) { const line_info& li = mLineInfoList[line]; @@ -3537,7 +3537,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin : LLFontGL::ONLY_WORD_BOUNDARIES; - S32 offsetLength = text.length() - (segment_offset + mStart); + S32 offsetLength = static_cast<S32>(text.length()) - (segment_offset + mStart); if(getLength() < segment_offset + mStart) { @@ -3617,7 +3617,7 @@ const LLWString& LLLabelTextSegment::getWText() const /*virtual*/ const S32 LLLabelTextSegment::getLength() const { - return mEditor.getWlabel().length(); + return static_cast<S32>(mEditor.getWlabel().length()); } // diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index f6c7ce6e81..4120d9ea32 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -454,8 +454,8 @@ public: // force reflow of text void needsReflow(S32 index = 0); - S32 getLength() const { return getWText().length(); } - S32 getLineCount() const { return mLineInfoList.size(); } + S32 getLength() const { return static_cast<S32>(getWText().length()); } + S32 getLineCount() const { return static_cast<S32>(mLineInfoList.size()); } S32 removeFirstLine(); // returns removed length void addDocumentChild(LLView* view); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index b4254524ad..dc3026e14d 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -98,13 +98,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: @@ -151,13 +151,13 @@ public: } virtual S32 undo( LLTextBase* editor ) { - remove(editor, getPosition(), mWString.length() ); + remove(editor, getPosition(), static_cast<S32>(mWString.length())); return getPosition(); } virtual S32 redo( LLTextBase* editor ) { - insert(editor, getPosition(), mWString ); - return getPosition() + mWString.length(); + insert(editor, getPosition(), mWString); + return getPosition() + static_cast<S32>(mWString.length()); } private: @@ -216,7 +216,7 @@ public: virtual S32 undo( LLTextBase* editor ) { insert(editor, getPosition(), mWString); - return getPosition() + mWString.length(); + return getPosition() + static_cast<S32>(mWString.length()); } virtual S32 redo( LLTextBase* editor ) { @@ -365,16 +365,16 @@ void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insen if (selected_text == search_text) { // We already have this word selected, we are searching for the next. - setCursorPos(mCursorPos + search_text.size()); + setCursorPos(mCursorPos + static_cast<S32>(search_text.size())); } } - S32 loc = text.find(search_text,mCursorPos); + S32 loc = static_cast<S32>(text.find(search_text,mCursorPos)); // If Maybe we wrapped, search again if (wrap && (-1 == loc)) { - loc = text.find(search_text); + loc = static_cast<S32>(text.find(search_text)); } // If still -1, then search_text just isn't found. @@ -1578,8 +1578,8 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string) if( mAllowEmbeddedItems ) { const llwchar LF = 10; - S32 len = clean_string.length(); - for( S32 i = 0; i < len; i++ ) + auto len = clean_string.length(); + for( size_t i = 0; i < len; i++ ) { llwchar wc = clean_string[i]; if( (wc < LLFontFreetype::FIRST_CHAR) && (wc != LF) ) @@ -2489,7 +2489,7 @@ void LLTextEditor::appendWidget(const LLInlineViewSegment::Params& params, const LLWString widget_wide_text = utf8str_to_wstring(text); - LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + widget_wide_text.size()); + LLTextSegmentPtr segment = new LLInlineViewSegment(params, old_length, old_length + static_cast<S32>(widget_wide_text.size())); insert(getLength(), widget_wide_text, false, segment); // Set the cursor and scroll position @@ -2843,7 +2843,7 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string, if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { mPreeditOverwrittenWString = getWText().substr(insert_preedit_at, mPreeditWString.length()); - removeStringNoUndo(insert_preedit_at, mPreeditWString.length()); + removeStringNoUndo(insert_preedit_at, static_cast<S32>(mPreeditWString.length())); } else { diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 8e2bfe6ac2..6a867fc759 100644 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -73,11 +73,11 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight) found = (! ltext.find(pattern) ? 0 : std::string::npos); break; case ENDS_WITH: - S32 pos = ltext.rfind(pattern); + auto pos = ltext.rfind(pattern); if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos; break; } - return found; + return static_cast<S32>(found); } LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index) @@ -99,8 +99,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC S32 start = findPattern(text,mHighlights[i]); if (start >= 0 ) { - S32 end = std::string(mHighlights[i]["pattern"]).length(); - S32 len = text.length(); + auto end = std::string(mHighlights[i]["pattern"]).length(); + auto len = text.length(); EHighlightPosition newpart; if (start==0) { diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9e27ed6232..f9de6f7386 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -73,7 +73,7 @@ class ValidatorFloat : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { // May be a comma or period, depending on the locale @@ -118,7 +118,7 @@ class ValidatorInt : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { S32 i = 0; @@ -157,7 +157,7 @@ class ValidatorPositiveS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -167,7 +167,7 @@ class ValidatorPositiveS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinusOrZero", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -177,7 +177,7 @@ class ValidatorPositiveS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val <= 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -201,7 +201,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl std::basic_string<CHAR> trimmed = str; LLStringUtilBase<CHAR>::trim(trimmed); - S32 len = trimmed.length(); + auto len = trimmed.length(); if (0 < len) { CHAR ch = trimmed.front(); @@ -211,7 +211,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = trimmed[i]; if (!LLStringOps::isDigit(ch)) @@ -221,7 +221,7 @@ class ValidatorNonNegativeS32 : public ValidatorImpl } } - S32 val = strtol(trimmed); + auto val = strtol(trimmed); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(trimmed))); @@ -244,7 +244,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl LLLocale locale(LLLocale::USER_LOCALE); std::basic_string<CHAR> test_str = str; - S32 len = test_str.length(); + auto len = test_str.length(); if (0 < len) { CHAR ch = test_str.front(); @@ -254,7 +254,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl return setError("Validator_ShouldNotBeMinus", LLSD().with("CH", llsd(ch))); } - for (S32 i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { ch = test_str[i]; if (!LLStringOps::isDigit(ch) || LLStringOps::isSpace(ch)) @@ -264,7 +264,7 @@ class ValidatorNonNegativeS32NoSpace : public ValidatorImpl } } - S32 val = strtol(test_str); + auto val = strtol(test_str); if (val < 0) { return setError("Validator_InvalidNumericString", LLSD().with("STR", llsd(test_str))); @@ -286,7 +286,7 @@ class ValidatorAlphaNum : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -313,7 +313,7 @@ class ValidatorAlphaNumSpace : public ValidatorImpl { LLLocale locale(LLLocale::USER_LOCALE); - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -341,7 +341,7 @@ class ValidatorASCIIPrintableNoPipe : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -368,7 +368,7 @@ class ValidatorASCIIPrintableNoSpace : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -395,7 +395,7 @@ protected: template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; @@ -441,7 +441,7 @@ class ValidatorASCIIWithNewLine : public ValidatorImpl template <class CHAR> bool validate(const std::basic_string<CHAR>& str) { - S32 len = str.length(); + auto len = str.length(); while (len--) { CHAR ch = str[len]; diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index f1bf60d262..e2e735b131 100644 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp @@ -343,7 +343,7 @@ LLTimeCtrl::EEditingPart LLTimeCtrl::getEditingPart() S32 cur_pos = mEditor->getCursor(); std::string time_str = mEditor->getText(); - S32 colon_index = time_str.find_first_of(':'); + auto colon_index = time_str.find_first_of(':'); if (cur_pos <= colon_index) { @@ -376,7 +376,7 @@ std::string LLTimeCtrl::getMinutesString(const std::string& str) size_t colon_index = str.find_first_of(':'); ++colon_index; - int minutes_len = str.length() - colon_index - AMPM_LEN; + auto minutes_len = str.length() - colon_index - AMPM_LEN; std::string minutes_str = str.substr(colon_index, minutes_len); return minutes_str; @@ -411,7 +411,7 @@ bool LLTimeCtrl::isMinutesStringValid(const std::string& str) // static bool LLTimeCtrl::isPMAMStringValid(const std::string& str) { - S32 len = str.length(); + auto len = str.length(); bool valid = (str[--len] == 'M') && (str[--len] == 'P' || str[len] == 'A'); diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 0cc699f59c..b9d4ff0ebb 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -79,7 +79,7 @@ public: operator LLWString() const { return getUpdatedWResult(); } bool empty() const { return getUpdatedResult().empty(); } - S32 length() const { return getUpdatedWResult().size(); } + S32 length() const { return static_cast<S32>(getUpdatedWResult().size()); } void clear(); void clearArgs() { if (mArgs) mArgs->clear(); } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 234ce9f4c3..198441804b 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -389,7 +389,7 @@ bool LLUrlEntryInvalidSLURL::isSLURLvalid(const std::string &url) const LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); S32 x,y,z; if (path_parts == actual_parts) @@ -454,7 +454,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 5) { // handle slurl with (X,Y,Z) coordinates @@ -1074,7 +1074,7 @@ LLUrlEntryParcel::~LLUrlEntryParcel() std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no parcel id { @@ -1165,7 +1165,7 @@ std::string LLUrlEntryPlace::getLabel(const std::string &url, const LLUrlLabelCa LLURI uri(url); std::string location = unescapeUrl(uri.hostName()); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts == 3) { // handle slurl with (X,Y,Z) coordinates @@ -1214,7 +1214,7 @@ std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelC // LLSD path_array = LLURI(url).pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) // no region name { @@ -1278,7 +1278,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); std::string host = uri.hostName(); std::string label = LLTrans::getString("SLurlLabelTeleport"); if (!host.empty()) @@ -1413,7 +1413,7 @@ std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabe // LLURI uri(url); LLSD path_array = uri.pathArray(); - S32 path_parts = path_array.size(); + auto path_parts = path_array.size(); if (path_parts < 3) { return url; @@ -1505,7 +1505,7 @@ LLUrlEntryEmail::LLUrlEntryEmail() std::string LLUrlEntryEmail::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - int pos = url.find("mailto:"); + auto pos = url.find("mailto:"); if (pos == std::string::npos) { diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 9c3994480c..3a4ce6a72f 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -263,9 +263,9 @@ bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUr { return false; } - S32 end = start + wurl.size() - 1; + auto end = start + wurl.size() - 1; - match.setValues(start, end, match.getUrl(), + match.setValues(static_cast<U32>(start), static_cast<U32>(end), match.getUrl(), match.getLabel(), match.getQuery(), match.getTooltip(), |