diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-04 09:55:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-12-04 13:27:25 +0200 |
commit | e5ed703b833d881b05a71808a5fc2f51903fd1c0 (patch) | |
tree | 058180e5d2de3e48972f5c01ef9765e59a411c07 | |
parent | 12491e11f05b56130e33ab6ed637cf1fe01ca9fc (diff) |
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
-rw-r--r-- | include/vcl/combobox.h | 1 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 12 |
2 files changed, 4 insertions, 9 deletions
diff --git a/include/vcl/combobox.h b/include/vcl/combobox.h index 047a24cd9d41..d51b670aeba2 100644 --- a/include/vcl/combobox.h +++ b/include/vcl/combobox.h @@ -24,7 +24,6 @@ #define COMBOBOX_APPEND (SAL_MAX_INT32) #define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) -#define COMBOBOX_ERROR (SAL_MAX_INT32) #define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1) #endif // INCLUDED_VCL_COMBOBOX_H 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; } |