[Libreoffice-commits] core.git: include/vcl vcl/source

Noel Grandin noel at peralex.com
Thu Dec 4 03:28:25 PST 2014


 include/vcl/combobox.h          |    1 -
 vcl/source/control/combobox.cxx |   12 ++++--------
 2 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit e5ed703b833d881b05a71808a5fc2f51903fd1c0
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Dec 4 09:55:07 2014 +0200

    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

diff --git a/include/vcl/combobox.h b/include/vcl/combobox.h
index 047a24c..d51b670 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 d35a64b..fca1716 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;
     }
 


More information about the Libreoffice-commits mailing list