diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 11:45:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 14:13:18 +0200 |
commit | d36f7c5bd2115fcdd26ba8ff7b6a0446dea70bd4 (patch) | |
tree | 5ae4b15f3302a538ac55d714ba0529ca4c1de87a /vcl/source/control | |
parent | 61d57bcebd1a246603cbcd9ad5e0a7df1a8d66cd (diff) |
Revert "long->sal_Int32 in tools/gen.hxx"
This reverts commit 8bc951daf79decbd8a599a409c6d33c5456710e0.
As discussed at
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html>
"long->sal_Int32 in tools/gen.hxx", that commit caused lots of problems with
signed integer overflow, and the original plan was to redo it to consistently
use sal_Int64 instead of sal_Int32. <https://gerrit.libreoffice.org/#/c/52471/>
"sal_Int32->sal_Int64 in tools/gen.hxx" tried that. However, it failed
miserably on Windows, causing odd failures like not writing out Pictures/*.svm
streams out into .odp during CppunitTest_sd_export_ooxml2. So the next best
approach is to just revert the original commit, at least for now.
Includes revert of follow-up 8c50aff2175e85c54957d98ce32af40a3a87e168 "Fix
Library_vclplug_qt5".
Change-Id: Ia8bf34272d1ed38aac00e5d07a9d13fb03f439ae
Reviewed-on: https://gerrit.libreoffice.org/52532
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/button.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 12 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/field2.cxx | 18 | ||||
-rw-r--r-- | vcl/source/control/fixed.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/notebookbar.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 8 |
10 files changed, 30 insertions, 30 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 7c3238979e7d..35400b70ed8a 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1639,7 +1639,7 @@ Size PushButton::CalcMinimumSize() const Size textSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ), PushButton::GetText(), ImplGetTextStyle( DrawFlags::NONE ) ).GetSize(); aSize.AdjustWidth(textSize.Width() ); - aSize.setHeight( std::max<sal_Int32>( aSize.Height(), sal_Int32( textSize.Height() * 1.15 ) ) ); + aSize.setHeight( std::max( aSize.Height(), long( textSize.Height() * 1.15 ) ) ); } // cf. ImplDrawPushButton ... diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index abb0a5e0c677..7b14c8da64c2 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -311,7 +311,7 @@ IMPL_LINK(ComboBox::Impl, ImplAutocompleteHdl, Edit&, rEdit, void) { OUString aFullText = rEdit.GetText(); - OUString aStartText = aFullText.copy( 0, aSel.Max() ); + OUString aStartText = aFullText.copy( 0, static_cast<sal_Int32>(aSel.Max()) ); sal_Int32 nStart = m_pImplLB->GetCurrentPos(); if ( nStart == LISTBOX_ENTRY_NOTFOUND ) @@ -1039,7 +1039,7 @@ Size ComboBox::CalcMinimumSize() const if (m_pImpl->m_nMaxWidthChars != -1) { long nMaxWidth = m_pImpl->m_nMaxWidthChars * approximate_char_width(); - aSz.setWidth( std::min<sal_Int32>(aSz.Width(), nMaxWidth) ); + aSz.setWidth( std::min(aSz.Width(), nMaxWidth) ); } if (IsDropDownBox()) diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index e6c8e07bb824..42dd22296585 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -743,7 +743,7 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI } } - maText.remove( aSelection.Min(), aSelection.Len() ); + maText.remove( static_cast<sal_Int32>(aSelection.Min()), static_cast<sal_Int32>(aSelection.Len()) ); maSelection.Min() = aSelection.Min(); maSelection.Max() = aSelection.Min(); ImplAlignAndPaint(); @@ -807,9 +807,9 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool ImplClearLayoutData(); if ( aSelection.Len() ) - maText.remove( aSelection.Min(), aSelection.Len() ); + maText.remove( static_cast<sal_Int32>(aSelection.Min()), static_cast<sal_Int32>(aSelection.Len()) ); else if ( !mbInsertMode && (aSelection.Max() < maText.getLength()) ) - maText.remove( aSelection.Max(), 1 ); + maText.remove( static_cast<sal_Int32>(aSelection.Max()), 1 ); // take care of input-sequence-checking now if (bIsUserInput && !rStr.isEmpty()) @@ -829,7 +829,7 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool if (bIsInputSequenceChecking && (xISC = ImplGetInputSequenceChecker()).is()) { sal_Unicode cChar = rStr[0]; - sal_Int32 nTmpPos = aSelection.Min(); + sal_Int32 nTmpPos = static_cast< sal_Int32 >( aSelection.Min() ); sal_Int16 nCheckMode = officecfg::Office::Common::I18N::CTL::CTLSequenceCheckingRestricted::get()? i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; @@ -876,7 +876,7 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool } if ( !aNewText.isEmpty() ) - maText.insert( aSelection.Min(), aNewText ); + maText.insert( static_cast<sal_Int32>(aSelection.Min()), aNewText ); if ( !pNewSel ) { @@ -2036,7 +2036,7 @@ void Edit::Command( const CommandEvent& rCEvt ) { DeleteSelected(); delete mpIMEInfos; - sal_Int32 nPos = maSelection.Max(); + sal_Int32 nPos = static_cast<sal_Int32>(maSelection.Max()); mpIMEInfos = new Impl_IMEInfos( nPos, OUString(maText.getStr() + nPos ) ); mpIMEInfos->bWasCursorOverwrite = !IsInsertMode(); } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 13fe3a348a96..a59557dcbb9b 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -713,7 +713,7 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue ) aSelection.Justify(); OUString aText = GetField()->GetText(); // leave it as is if selected until end - if ( aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index c57449aec148..dff8cee200b5 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -466,7 +466,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, sal_Unicode cChar = rKEvt.GetCharCode(); sal_uInt16 nKeyCode = aCode.GetCode(); bool bShift = aCode.IsShift(); - sal_Int32 nCursorPos = aOldSel.Max(); + sal_Int32 nCursorPos = static_cast<sal_Int32>(aOldSel.Max()); sal_Int32 nNewPos; sal_Int32 nTempPos; @@ -523,7 +523,7 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, // all was selected by the focus Selection aSel( aOldSel ); aSel.Justify(); - nCursorPos = aSel.Min(); + nCursorPos = static_cast<sal_Int32>(aSel.Min()); ImplPatternMaxPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos ); aSel.Max() = nNewPos; if ( bShift ) @@ -540,16 +540,16 @@ static bool ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt, Selection aSel = aOldSel; aSel.Justify(); - nNewPos = aSel.Min(); + nNewPos = static_cast<sal_Int32>(aSel.Min()); // if selection then delete it if ( aSel.Len() ) { if ( bSameMask ) - aStr.remove( aSel.Min(), aSel.Len() ); + aStr.remove( static_cast<sal_Int32>(aSel.Min()), static_cast<sal_Int32>(aSel.Len()) ); else { - OUString aRep = rLiteralMask.copy( aSel.Min(), aSel.Len() ); + OUString aRep = rLiteralMask.copy( static_cast<sal_Int32>(aSel.Min()), static_cast<sal_Int32>(aSel.Len()) ); aStr.remove( aSel.Min(), aRep.getLength() ); aStr.insert( aSel.Min(), aRep ); } @@ -1323,7 +1323,7 @@ void DateField::ImplDateSpinArea( bool bUp ) Selection aSelection = GetField()->GetSelection(); aSelection.Justify(); OUString aText( GetText() ); - if ( aSelection.Len() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Len()) == aText.getLength() ) ImplDateIncrementDay( aDate, bUp ); else { @@ -1343,7 +1343,7 @@ void DateField::ImplDateSpinArea( bool bUp ) for ( sal_Int8 i = 1; i <= 3; i++ ) { nPos = aText.indexOf( aDateSep, nPos ); - if (nPos < 0 || nPos >= aSelection.Max()) + if (nPos < 0 || nPos >= static_cast<sal_Int32>(aSelection.Max())) { nDateArea = i; break; @@ -1584,7 +1584,7 @@ void DateFormatter::ImplNewFieldValue( const Date& rDate ) OUString aText = GetField()->GetText(); // If selected until the end then keep it that way - if ( aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; @@ -2363,7 +2363,7 @@ void TimeFormatter::ImplNewFieldValue( const tools::Time& rTime ) OUString aText = GetField()->GetText(); // If selected until the end then keep it that way - if ( aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index f82d1dc992f5..f998285abc1a 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -316,7 +316,7 @@ Size FixedText::getTextDimensions(Control const *pControl, const OUString &rTxt, if ( !( pControl->GetStyle() & WB_NOLABEL ) ) nStyle |= DrawTextFlags::Mnemonic; - return pControl->GetTextRect(tools::Rectangle( Point(), Size(nMaxWidth, RECT_MAX)), + return pControl->GetTextRect(tools::Rectangle( Point(), Size(nMaxWidth, 0x7fffffff)), rTxt, nStyle).GetSize(); } diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 6f510684b866..171b75afd151 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -661,10 +661,10 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) } if ( IsUserDrawEnabled() || aMetrics.bImage ) { - aMetrics.nEntryWidth = std::max<sal_Int32>( aMetrics.nImgWidth, maUserItemSize.Width() ); + aMetrics.nEntryWidth = std::max( aMetrics.nImgWidth, maUserItemSize.Width() ); if ( aMetrics.bText ) aMetrics.nEntryWidth += aMetrics.nTextWidth + IMG_TXT_DISTANCE; - aMetrics.nEntryHeight = std::max<sal_Int32>( std::max<sal_Int32>( mnMaxImgHeight, maUserItemSize.Height() ) + 2, + aMetrics.nEntryHeight = std::max( std::max( mnMaxImgHeight, maUserItemSize.Height() ) + 2, aMetrics.nEntryHeight ); } @@ -1802,7 +1802,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 if (!bDrawTextAtImagePos && (mpEntryList->HasEntryImage(nPos) || IsUserDrawEnabled())) { - sal_Int32 nImageWidth = std::max<sal_Int32>(mnMaxImgWidth, maUserItemSize.Width()); + long nImageWidth = std::max(mnMaxImgWidth, maUserItemSize.Width()); aTextRect.AdjustLeft(nImageWidth + IMG_TXT_DISTANCE ); } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 17d1c9c8cefc..ef945a087659 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -1230,7 +1230,7 @@ Size ListBox::CalcSubEditSize() const if (m_nMaxWidthChars != -1) { long nMaxWidth = m_nMaxWidthChars * approximate_char_width(); - aSz.setWidth( std::min<sal_Int32>(aSz.Width(), nMaxWidth) ); + aSz.setWidth( std::min(aSz.Width(), nMaxWidth) ); } // Do not create ultrathin ListBoxes, it doesn't look good diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index 370891802b9f..54931df82557 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -112,9 +112,9 @@ void NotebookBar::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P Size aSize(GetOptimalSize()); if (!bCanHandleSmallerWidth) - nWidth = std::max<sal_Int32>(nWidth, aSize.Width()); + nWidth = std::max(nWidth, aSize.Width()); if (!bCanHandleSmallerHeight) - nHeight = std::max<sal_Int32>(nHeight, aSize.Height()); + nHeight = std::max(nHeight, aSize.Height()); Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index a1bcc29273c6..a4f06757c2ea 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2142,7 +2142,7 @@ Size TabControl::calculateRequisition() const { TabControl* pThis = const_cast<TabControl*>(this); - tools::Rectangle aTabRect = pThis->ImplGetTabRect(nPos, aOptimalPageSize.Width(), RECT_MAX); + tools::Rectangle aTabRect = pThis->ImplGetTabRect(nPos, aOptimalPageSize.Width(), LONG_MAX); if (aTabRect.Bottom() > nTabLabelsBottom) nTabLabelsBottom = aTabRect.Bottom(); if (aTabRect.Right() > nTabLabelsRight) @@ -2151,7 +2151,7 @@ Size TabControl::calculateRequisition() const Size aOptimalSize(aOptimalPageSize); aOptimalSize.AdjustHeight(nTabLabelsBottom ); - aOptimalSize.setWidth( std::max<sal_Int32>(nTabLabelsRight, aOptimalSize.Width()) ); + aOptimalSize.setWidth( std::max(nTabLabelsRight, aOptimalSize.Width()) ); aOptimalSize.AdjustWidth(TAB_OFFSET * 2 ); aOptimalSize.AdjustHeight(TAB_OFFSET * 2 ); @@ -2671,7 +2671,7 @@ Size NotebookbarTabControlBase::calculateRequisition() const { NotebookbarTabControlBase* pThis = const_cast<NotebookbarTabControlBase*>(this); - tools::Rectangle aTabRect = pThis->ImplGetTabRect(nPos, aOptimalPageSize.Width(), RECT_MAX); + tools::Rectangle aTabRect = pThis->ImplGetTabRect(nPos, aOptimalPageSize.Width(), LONG_MAX); if (aTabRect.Bottom() > nTabLabelsBottom) { nTabLabelsBottom = aTabRect.Bottom(); @@ -2683,7 +2683,7 @@ Size NotebookbarTabControlBase::calculateRequisition() const Size aOptimalSize(aOptimalPageSize); aOptimalSize.AdjustHeight(nTabLabelsBottom ); - aOptimalSize.setWidth( std::max<sal_Int32>(nTabLabelsRight, aOptimalSize.Width()) ); + aOptimalSize.setWidth( std::max(nTabLabelsRight, aOptimalSize.Width()) ); aOptimalSize.AdjustWidth(TAB_OFFSET * 2 ); aOptimalSize.AdjustHeight(TAB_OFFSET * 2 ); |