Kaydet (Commit) 06127e06 authored tarafından Eike Rathke's avatar Eike Rathke

eliminate xub_StrLen left-over

Change-Id: I02e7700536f5a7fcc836a035aa0767b2a34be887
üst 85d1b74f
...@@ -720,12 +720,12 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, ...@@ -720,12 +720,12 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
{ {
OString aTmp(OUStringToOString(aStr, OString aTmp(OUStringToOString(aStr,
osl_getThreadTextEncoding())); osl_getThreadTextEncoding()));
// In case the xub_StrLen will be longer than USHORT // Old Add-Ins are limited to sal_uInt16 string
// one day, and room for pad byte check. // lengths, and room for pad byte check.
if ( aTmp.getLength() > SAL_MAX_UINT16 - 2 ) if ( aTmp.getLength() > SAL_MAX_UINT16 - 2 )
return false; return false;
// Append a 0-pad-byte if string length is odd // 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 nStrLen = (sal_uInt16) aTmp.getLength();
sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; sal_uInt16 nLen = ( nStrLen + 2 ) & ~1;
...@@ -843,12 +843,12 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, ...@@ -843,12 +843,12 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
{ {
OString aTmp(OUStringToOString(aStr, OString aTmp(OUStringToOString(aStr,
osl_getThreadTextEncoding())); osl_getThreadTextEncoding()));
// In case the xub_StrLen will be longer than USHORT // Old Add-Ins are limited to sal_uInt16 string
// one day, and room for pad byte check. // lengths, and room for pad byte check.
if ( aTmp.getLength() > ((sal_uInt16)(~0)) - 2 ) if ( aTmp.getLength() > SAL_MAX_UINT16 - 2 )
return false; return false;
// Append a 0-pad-byte if string length is odd // 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 nStrLen = (sal_uInt16) aTmp.getLength();
sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; sal_uInt16 nLen = ( nStrLen + 2 ) & ~1;
if ( ((sal_uLong)nPos + 2 + nLen) > MAXARRSIZE) if ( ((sal_uLong)nPos + 2 + nLen) > MAXARRSIZE)
......
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