include/unotools/digitgroupingiterator.hxx | 11 ++++------- sc/source/core/tool/interpr4.cxx | 14 +++++++------- 2 files changed, 11 insertions(+), 14 deletions(-)
New commits: commit 06127e06e1d9d99e58b32e618c93667f70929249 Author: Eike Rathke <er...@redhat.com> Date: Tue Jun 3 15:55:28 2014 +0200 eliminate xub_StrLen left-over Change-Id: I02e7700536f5a7fcc836a035aa0767b2a34be887 diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index f0f7c3a..c59431c 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -720,12 +720,12 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { OString aTmp(OUStringToOString(aStr, osl_getThreadTextEncoding())); - // In case the xub_StrLen will be longer than USHORT - // one day, and room for pad byte check. + // Old Add-Ins are limited to sal_uInt16 string + // lengths, and room for pad byte check. if ( aTmp.getLength() > SAL_MAX_UINT16 - 2 ) return false; // Append a 0-pad-byte if string length is odd - //! MUST be sal_uInt16 and not xub_StrLen + //! MUST be sal_uInt16 sal_uInt16 nStrLen = (sal_uInt16) aTmp.getLength(); sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; @@ -843,12 +843,12 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { OString aTmp(OUStringToOString(aStr, osl_getThreadTextEncoding())); - // In case the xub_StrLen will be longer than USHORT - // one day, and room for pad byte check. - if ( aTmp.getLength() > ((sal_uInt16)(~0)) - 2 ) + // Old Add-Ins are limited to sal_uInt16 string + // lengths, and room for pad byte check. + if ( aTmp.getLength() > SAL_MAX_UINT16 - 2 ) return false; // Append a 0-pad-byte if string length is odd - //! MUST be sal_uInt16 and not xub_StrLen + //! MUST be sal_uInt16 sal_uInt16 nStrLen = (sal_uInt16) aTmp.getLength(); sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; if ( ((sal_uLong)nPos + 2 + nLen) > MAXARRSIZE) commit 85d1b74fd0866dc54a3745743acd1aa76ef30aaf Author: Eike Rathke <er...@redhat.com> Date: Tue Jun 3 15:39:05 2014 +0200 eliminate xub_StrLen left-over Change-Id: I4862481d69ac86bf082e35b28d6326444deafee8 diff --git a/include/unotools/digitgroupingiterator.hxx b/include/unotools/digitgroupingiterator.hxx index d7bca11..ce1cf84 100644 --- a/include/unotools/digitgroupingiterator.hxx +++ b/include/unotools/digitgroupingiterator.hxx @@ -31,9 +31,8 @@ namespace utl { digits per group. If the last group was encountered the iterator will always return the last grouping. - Grouping values are sanitized to be 0 <= value <= SAL_MAX_UINT16, even if - originally Int32, to be able to easily cast it down to String's xub_StrLen. - This shouldn't make any difference in practice. + Grouping values are sanitized to be >= 0, even if originally signed + sal_Int32. Usage example with a string buffer containing a decimal representation of an integer number. Note that of course this loop could be optimized to not @@ -81,11 +80,9 @@ class DigitGroupingIterator if (mnGroup < maGroupings.getLength()) { sal_Int32 n = maGroupings[mnGroup]; - OSL_ENSURE( 0 <= n && n <= SAL_MAX_UINT16, "DigitGroupingIterator::getGrouping: far out"); + SAL_WARN_IF( n < 0, "unotools", "DigitGroupingIterator::getGrouping: negative grouping"); if (n < 0) - n = 0; // sanitize ... - else if (n > SAL_MAX_UINT16) - n = SAL_MAX_UINT16; // limit for use with xub_StrLen + n = 0; // sanitize ... return n; } return 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits