Kaydet (Commit) f12b902d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fix the -Werror=strict-overflow correctly

...from 2bf2dee0 "Werror=strict-overflow."  The
warning (generated e.g. by --disable-debug --disable-dbgutil builds with
GCC 4.8.2) orginates from the call to

  InvalidateRange( SwCharRange( GetOfst(), COMPLETE_STRING ) );

in SwTxtFrm::Prepare further down in txtfrm.cxx, which inlines the IsIdxInside
code to

  if( GetOfst() > GetOfst() + COMPLETE_STRING )

where COMPLETE_STRING is SAL_MAX_INT32.  The problem is that before
ba27366f "Resolves: #i17171# Writer paragraph
cannot be longer than 65534 characters" that code would inline to

  if( GetOfst() > GetOfst() + STRING_LEN )

where STRING_LEN was 0xFFFF, so the calculation on effectively 16-bit quantities
stayed nicely in the bounds of (32-bit) int.

Change-Id: I958514e52e9102236844eefa4fe92a401be6ab01
üst af84f04c
......@@ -673,7 +673,7 @@ sal_Int32 SwTxtFrm::FindBrk( const OUString &rTxt,
sal_Bool SwTxtFrm::IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const
{
if( nPos + nLen < 0 || GetOfst() > nPos + nLen ) // the range preceded us
if( nLen != COMPLETE_STRING && GetOfst() > nPos + nLen ) // the range preceded us
return sal_False;
if( !GetFollow() ) // the range doesn't precede us,
......
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