From e5ed703b833d881b05a71808a5fc2f51903fd1c0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 4 Dec 2014 09:55:07 +0200 Subject: the return code COMBOBOX_ERROR is completely ignored so let's turn it into an assert, since these failures are pretty fatal anyhow Change-Id: Idfb499e3b09f1c5413fae8a0961d968a0694beed --- vcl/source/control/combobox.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'vcl') diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index d35a64bf3006..fca17160338a 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -845,8 +845,7 @@ void ComboBox::ImplUpdateFloatSelection() sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) { - if (nPos < 0 || COMBOBOX_MAX_ENTRIES <= mpImplLB->GetEntryList()->GetEntryCount()) - return COMBOBOX_ERROR; + assert(nPos >= 0 && COMBOBOX_MAX_ENTRIES > mpImplLB->GetEntryList()->GetEntryCount()); sal_Int32 nRealPos; if (nPos == COMBOBOX_APPEND) @@ -854,8 +853,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) else { const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount(); - if (nPos > COMBOBOX_MAX_ENTRIES - nMRUCount) - return COMBOBOX_ERROR; + assert(nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount); nRealPos = nPos + nMRUCount; } @@ -868,8 +866,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) sal_Int32 ComboBox::InsertEntryWithImage( const OUString& rStr, const Image& rImage, sal_Int32 const nPos) { - if (nPos < 0 || COMBOBOX_MAX_ENTRIES <= mpImplLB->GetEntryList()->GetEntryCount()) - return COMBOBOX_ERROR; + assert(nPos >= 0 & COMBOBOX_MAX_ENTRIES > mpImplLB->GetEntryList()->GetEntryCount()); sal_Int32 nRealPos; if (nPos == COMBOBOX_APPEND) @@ -877,8 +874,7 @@ sal_Int32 ComboBox::InsertEntryWithImage( else { const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount(); - if (nPos > COMBOBOX_MAX_ENTRIES - nMRUCount) - return COMBOBOX_ERROR; + assert(nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount); nRealPos = nPos + nMRUCount; } -- cgit