[PATCH 2/2] Remove dead less-than-zero conditional checks.

Phil Bordelon phil at thenexusproject.org
Thu Sep 30 08:43:59 PDT 2010


A large number of conditionals in accessibility.cxx checked that
their values were above zero at some point, but that code was
commented out; this removes those (unused) checks completely.

Signed-off-by: Phil Bordelon <phil at thenexusproject.org>
---
 starmath/source/accessibility.cxx |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 74c5f0f..55e9a02 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -464,7 +464,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex )
 {
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     String aTxt( GetAccessibleText_Impl() );
-    if (!(/*0 <= nIdx  &&*/  nIdx < aTxt.Len()))
+    if (!(nIdx < aTxt.Len()))
         throw IndexOutOfBoundsException();
     return sal_False;
 }
@@ -476,7 +476,7 @@ sal_Unicode SAL_CALL SmGraphicAccessible::getCharacter( sal_Int32 nIndex )
 
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     String aTxt( GetAccessibleText_Impl() );
-    if (!(/*0 <= nIdx  &&*/  nIdx < aTxt.Len()))
+    if (!(nIdx < aTxt.Len()))
         throw IndexOutOfBoundsException();
     return aTxt.GetChar( nIdx );
 }
@@ -694,8 +694,8 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nStart = (xub_StrLen) Min(nStartIndex, nEndIndex);
     xub_StrLen nEnd   = (xub_StrLen) Max(nStartIndex, nEndIndex);
-    if (!(/*0 <= nStart  &&*/  nStart <= aTxt.Len()) ||
-        !(/*0 <= nEnd    &&*/  nEnd   <= aTxt.Len()))
+    if (!(nStart <= aTxt.Len()) ||
+        !(nEnd   <= aTxt.Len()))
         throw IndexOutOfBoundsException();
     return aTxt.Copy( nStart, nEnd - nStart );
 }
@@ -706,7 +706,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
@@ -727,7 +727,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
@@ -749,7 +749,7 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     String aTxt( GetAccessibleText_Impl() );
     xub_StrLen nIdx = (xub_StrLen) nIndex;
     //!! nIndex is allowed to be the string length
-    if (!(/*0 <= nIdx  &&*/  nIdx <= aTxt.Len()))
+    if (!(nIdx <= aTxt.Len()))
         throw IndexOutOfBoundsException();
 
     ::com::sun::star::accessibility::TextSegment aResult;
-- 
1.7.0.4


--------------050905050206040109040706--


More information about the LibreOffice mailing list