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

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
üst 12491e11
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define COMBOBOX_APPEND (SAL_MAX_INT32) #define COMBOBOX_APPEND (SAL_MAX_INT32)
#define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) #define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
#define COMBOBOX_ERROR (SAL_MAX_INT32)
#define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1) #define COMBOBOX_MAX_ENTRIES (SAL_MAX_INT32 - 1)
#endif // INCLUDED_VCL_COMBOBOX_H #endif // INCLUDED_VCL_COMBOBOX_H
......
...@@ -845,8 +845,7 @@ void ComboBox::ImplUpdateFloatSelection() ...@@ -845,8 +845,7 @@ void ComboBox::ImplUpdateFloatSelection()
sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos)
{ {
if (nPos < 0 || COMBOBOX_MAX_ENTRIES <= mpImplLB->GetEntryList()->GetEntryCount()) assert(nPos >= 0 && COMBOBOX_MAX_ENTRIES > mpImplLB->GetEntryList()->GetEntryCount());
return COMBOBOX_ERROR;
sal_Int32 nRealPos; sal_Int32 nRealPos;
if (nPos == COMBOBOX_APPEND) if (nPos == COMBOBOX_APPEND)
...@@ -854,8 +853,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) ...@@ -854,8 +853,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos)
else else
{ {
const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount(); const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount();
if (nPos > COMBOBOX_MAX_ENTRIES - nMRUCount) assert(nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount);
return COMBOBOX_ERROR;
nRealPos = nPos + nMRUCount; nRealPos = nPos + nMRUCount;
} }
...@@ -868,8 +866,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos) ...@@ -868,8 +866,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, sal_Int32 const nPos)
sal_Int32 ComboBox::InsertEntryWithImage( sal_Int32 ComboBox::InsertEntryWithImage(
const OUString& rStr, const Image& rImage, sal_Int32 const nPos) const OUString& rStr, const Image& rImage, sal_Int32 const nPos)
{ {
if (nPos < 0 || COMBOBOX_MAX_ENTRIES <= mpImplLB->GetEntryList()->GetEntryCount()) assert(nPos >= 0 & COMBOBOX_MAX_ENTRIES > mpImplLB->GetEntryList()->GetEntryCount());
return COMBOBOX_ERROR;
sal_Int32 nRealPos; sal_Int32 nRealPos;
if (nPos == COMBOBOX_APPEND) if (nPos == COMBOBOX_APPEND)
...@@ -877,8 +874,7 @@ sal_Int32 ComboBox::InsertEntryWithImage( ...@@ -877,8 +874,7 @@ sal_Int32 ComboBox::InsertEntryWithImage(
else else
{ {
const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount(); const sal_Int32 nMRUCount = mpImplLB->GetEntryList()->GetMRUCount();
if (nPos > COMBOBOX_MAX_ENTRIES - nMRUCount) assert(nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount);
return COMBOBOX_ERROR;
nRealPos = nPos + nMRUCount; nRealPos = nPos + nMRUCount;
} }
......
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