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

Do not pass bad pointers to strlen

...neither a pointer to a lone char nor null

Change-Id: I08a4f6b80310e23edd614490633b677bd50323a4
üst 948c4654
......@@ -1659,7 +1659,7 @@ SwTxtSlot::SwTxtSlot(
const SwLinePortion *pPor,
bool bTxtLen,
bool bExgLists,
const sal_Char *pCh )
OUString const & pCh )
: pOldTxt(0)
, pOldSmartTagList(0)
, pOldGrammarCheckList(0)
......@@ -1668,13 +1668,15 @@ SwTxtSlot::SwTxtSlot(
, nLen(0)
, pInf(NULL)
{
if( pCh )
if( pCh.isEmpty() )
{
aTxt = OUString( pCh, strlen(pCh), RTL_TEXTENCODING_MS_1252 );
bOn = true;
bOn = pPor->GetExpTxt( *pNew, aTxt );
}
else
bOn = pPor->GetExpTxt( *pNew, aTxt );
{
aTxt = pCh;
bOn = true;
}
// The text is replaced ...
if( bOn )
......
......@@ -777,7 +777,7 @@ public:
// The replacement string originates either from the portion via GetExpText()
// or from the char * pCh, if it is not NULL
SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, bool bTxtLen,
bool bExgLists, const sal_Char *pCh = NULL );
bool bExgLists, OUString const & pCh = OUString() );
~SwTxtSlot();
bool IsOn() const { return bOn; }
};
......
......@@ -713,7 +713,6 @@ void SwNumberPortion::Paint( const SwTxtPaintInfo &rInf ) const
if( bPaintSpace && nOldWidth > nSpaceOffs )
{
SwTxtPaintInfo aInf( rInf );
static sal_Char const sDoubleSpace[] = " ";
aInf.X( aInf.X() + nSpaceOffs );
// #i53199# Adjust position of underline:
......@@ -725,7 +724,7 @@ static sal_Char const sDoubleSpace[] = " ";
pThis->Width( nOldWidth - nSpaceOffs + 12 );
{
SwTxtSlot aDiffTxt( &aInf, this, true, false, sDoubleSpace );
SwTxtSlot aDiffTxt( &aInf, this, true, false, " " );
aInf.DrawText( *this, aInf.GetLen(), true );
}
}
......
......@@ -719,7 +719,7 @@ bool SwTxtInputFldPortion::Format( SwTxtFormatInfo &rInf )
}
else
{
SwTxtSlot aFormatTxt( &rInf, this, true, true, 0 );
SwTxtSlot aFormatTxt( &rInf, this, true, true );
if ( rInf.GetLen() == 0 )
{
Width( 0 );
......@@ -763,9 +763,8 @@ void SwTxtInputFldPortion::Paint( const SwTxtPaintInfo &rInf ) const
if ( Width() )
{
rInf.DrawViewOpt( *this, POR_INPUTFLD );
static sal_Char sSpace = ' ';
SwTxtSlot aPaintTxt( &rInf, this, true, true,
ContainsOnlyDummyChars() ? &sSpace : 0 );
ContainsOnlyDummyChars() ? OUString(" ") : OUString() );
SwTxtPortion::Paint( rInf );
}
}
......@@ -790,7 +789,7 @@ bool SwTxtInputFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt
SwPosSize SwTxtInputFldPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
{
SwTxtSlot aFormatTxt( &rInf, this, true, false, 0 );
SwTxtSlot aFormatTxt( &rInf, this, true, false );
if ( rInf.GetLen() == 0 )
{
return SwPosSize( 0, 0 );
......
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