Kaydet (Commit) d4e96a36 authored tarafından Noel Grandin's avatar Noel Grandin

drop LISTBOX_ERROR

almost nobody checks it, so rather just assert

Change-Id: Ic3ad4c04c4f6013db3e8757559d3a773df020a1d
Reviewed-on: https://gerrit.libreoffice.org/62684
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2f1a4e0a
......@@ -51,19 +51,16 @@ void SvxDefaultColorOptPage::InsertColorEntry(const XColorEntry& rEntry, sal_Int
nPos = m_pLbChartColors->InsertEntry(rStr, Image(aBitmap), nPos);
if (nPos != LISTBOX_ERROR)
if ( static_cast<size_t>(nPos) < aColorList.size() )
{
if ( static_cast<size_t>(nPos) < aColorList.size() )
{
ImpColorList::iterator it = aColorList.begin();
std::advance( it, nPos );
aColorList.insert( it, rColor );
}
else
{
aColorList.push_back( rColor );
nPos = aColorList.size() - 1;
}
ImpColorList::iterator it = aColorList.begin();
std::advance( it, nPos );
aColorList.insert( it, rColor );
}
else
{
aColorList.push_back( rColor );
nPos = aColorList.size() - 1;
}
}
......
......@@ -27,7 +27,6 @@
#define LISTBOX_APPEND (SAL_MAX_INT32)
#define LISTBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
#define LISTBOX_ERROR (SAL_MAX_INT32)
#define LISTBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1)
// the following defines can be used for the SetEntryFlags()
......
......@@ -748,15 +748,12 @@ void FontNameBox::Fill( const FontList* pList )
{
const FontMetric& rFontMetric = pList->GetFontName( i );
sal_Int32 nIndex = InsertEntry( rFontMetric.GetFamilyName() );
if ( nIndex != LISTBOX_ERROR )
{
if ( nIndex < static_cast<sal_Int32>(mpFontList->size()) ) {
ImplFontList::iterator it = mpFontList->begin();
::std::advance( it, nIndex );
mpFontList->insert( it, rFontMetric );
} else {
mpFontList->push_back( rFontMetric );
}
if ( nIndex < static_cast<sal_Int32>(mpFontList->size()) ) {
ImplFontList::iterator it = mpFontList->begin();
::std::advance( it, nIndex );
mpFontList->insert( it, rFontMetric );
} else {
mpFontList->push_back( rFontMetric );
}
}
......
......@@ -121,8 +121,8 @@ sal_Int32 ListBox::NaturalSortCompare(const OUString &rA, const OUString &rB)
sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort )
{
if (nPos < 0 || LISTBOX_MAX_ENTRIES <= maEntries.size())
return LISTBOX_ERROR;
assert(nPos >= 0);
assert(maEntries.size() < LISTBOX_MAX_ENTRIES);
if ( !!pNewEntry->maImage )
mnImages++;
......@@ -764,8 +764,8 @@ void ImplListBoxWindow::ImplCallSelect()
sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry )
{
if (nPos < 0 || LISTBOX_MAX_ENTRIES <= mpEntryList->GetEntryCount())
return LISTBOX_ERROR;
assert(nPos >= 0);
assert(mpEntryList->GetEntryCount() < LISTBOX_MAX_ENTRIES);
ImplClearLayoutData();
sal_Int32 nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort );
......@@ -2220,11 +2220,6 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr );
sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
return nNewPos;
}
CompatStateChanged( StateChangedType::Data );
return nNewPos;
}
......@@ -2233,11 +2228,6 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
return nNewPos;
}
CompatStateChanged( StateChangedType::Data );
return nNewPos;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment