diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-02 10:49:47 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-16 09:10:14 +0200 |
commit | aa1918efe9afac79b5a715a7a31239d320a75edc (patch) | |
tree | d24339930110928b663f70affe7a7980b23ab1fc /vcl/source | |
parent | 9869ab096f49a507f96d69a4ffbb9a0caa852bd7 (diff) |
Fix some conversion warnings, reduce scope
Change-Id: I9f36b29e329dde3b841f963d9dde3480e80da3f5
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 30 | ||||
-rw-r--r-- | vcl/source/control/longcurr.cxx | 4 |
2 files changed, 17 insertions, 17 deletions
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 59051a153413..328510cdd958 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -121,17 +121,18 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, mnImages++; sal_Int32 insPos = 0; + const sal_Int32 nEntriesSize = static_cast<sal_Int32>(maEntries.size()); if ( !bSort || maEntries.empty()) { - if (0 <= nPos && static_cast<size_t>(nPos) < maEntries.size()) + if (0 <= nPos && nPos < nEntriesSize) { insPos = nPos; maEntries.insert( maEntries.begin() + nPos, pNewEntry ); } else { - insPos = maEntries.size(); + insPos = nEntriesSize; maEntries.push_back(pNewEntry); } } @@ -140,11 +141,8 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, const comphelper::string::NaturalStringSorter &rSorter = theSorter::get(); const OUString& rStr = pNewEntry->maStr; - sal_uLong nLow, nHigh, nMid; - nHigh = maEntries.size(); - - ImplEntryType* pTemp = GetEntry( (sal_Int32)(nHigh-1) ); + ImplEntryType* pTemp = GetEntry( nEntriesSize-1 ); try { @@ -153,13 +151,12 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, // fast insert for sorted data if ( nComp >= 0 ) { - insPos = maEntries.size(); + insPos = nEntriesSize; maEntries.push_back(pNewEntry); } else { - nLow = mnMRUCount; - pTemp = GetEntry( (sal_Int32)nLow ); + pTemp = GetEntry( mnMRUCount ); nComp = rSorter.compare(rStr, pTemp->maStr); if ( nComp <= 0 ) @@ -169,11 +166,14 @@ sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, } else { + sal_uLong nLow = mnMRUCount; + sal_uLong nHigh = maEntries.size()-1; + sal_Int32 nMid; + // binary search - nHigh--; do { - nMid = (nLow + nHigh) / 2; + nMid = static_cast<sal_Int32>((nLow + nHigh) / 2); pTemp = GetEntry( nMid ); nComp = rSorter.compare(rStr, pTemp->maStr); @@ -228,7 +228,7 @@ void ImplEntryList::RemoveEntry( sal_Int32 nPos ) sal_Int32 ImplEntryList::FindEntry( const OUString& rString, bool bSearchMRUArea ) const { - sal_Int32 nEntries = maEntries.size(); + const sal_Int32 nEntries = static_cast<sal_Int32>(maEntries.size()); for ( sal_Int32 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ ) { OUString aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n].maStr ) ); @@ -1910,11 +1910,11 @@ sal_uInt16 ImplListBoxWindow::GetDisplayLineCount() const { // FIXME: ListBoxEntryFlags::MultiLine - sal_Int32 nCount = mpEntryList->GetEntryCount(); + const sal_Int32 nCount = mpEntryList->GetEntryCount()-mnTop; long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder; sal_uInt16 nEntries = static_cast< sal_uInt16 >( ( nHeight + mnMaxHeight - 1 ) / mnMaxHeight ); - if( nEntries > nCount-mnTop ) - nEntries = nCount-mnTop; + if( nEntries > nCount ) + nEntries = static_cast<sal_uInt16>(nCount); return nEntries; } diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 77724b0b02d3..ae9178b98fe5 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -579,8 +579,8 @@ void LongCurrencyBox::ReformatAll() { OUString aStr; SetUpdateMode( false ); - sal_uInt16 nEntryCount = GetEntryCount(); - for ( sal_uInt16 i=0; i < nEntryCount; i++ ) + const sal_Int32 nEntryCount = GetEntryCount(); + for ( sal_Int32 i=0; i < nEntryCount; ++i ) { ImplLongCurrencyReformat( GetEntry( i ), mnMin, mnMax, GetDecimalDigits(), GetLocaleDataWrapper(), |