Rewrite some (trivial) assignments inside if/while conditions: oox

Change-Id: I75de45677603800baec18d03114418181c4393c2
This commit is contained in:
Stephan Bergmann 2016-11-29 17:19:53 +01:00
parent 542174a24e
commit 40e1595de7

View File

@ -93,19 +93,23 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal
{ {
// pcNameBeg points to begin of attribute name, find equality sign // pcNameBeg points to begin of attribute name, find equality sign
const sal_Char* pcEqualSign = lclFindCharacter( pcNameBeg, pcEnd, '=' ); const sal_Char* pcEqualSign = lclFindCharacter( pcNameBeg, pcEnd, '=' );
if ((bOk = (pcEqualSign < pcEnd))) bOk = (pcEqualSign < pcEnd);
if (bOk)
{ {
// find end of attribute name (ignore whitespace between name and equality sign) // find end of attribute name (ignore whitespace between name and equality sign)
const sal_Char* pcNameEnd = lclTrimWhiteSpaceFromEnd( pcNameBeg, pcEqualSign ); const sal_Char* pcNameEnd = lclTrimWhiteSpaceFromEnd( pcNameBeg, pcEqualSign );
if( (bOk = (pcNameBeg < pcNameEnd)) ) bOk = (pcNameBeg < pcNameEnd);
if( bOk )
{ {
// find begin of attribute value (must be single or double quote) // find begin of attribute value (must be single or double quote)
const sal_Char* pcValueBeg = lclFindNonWhiteSpace( pcEqualSign + 1, pcEnd ); const sal_Char* pcValueBeg = lclFindNonWhiteSpace( pcEqualSign + 1, pcEnd );
if( (bOk = (pcValueBeg < pcEnd) && ((*pcValueBeg == '\'') || (*pcValueBeg == '"'))) ) bOk = (pcValueBeg < pcEnd) && ((*pcValueBeg == '\'') || (*pcValueBeg == '"'));
if( bOk )
{ {
// find end of attribute value (matching quote character) // find end of attribute value (matching quote character)
const sal_Char* pcValueEnd = lclFindCharacter( pcValueBeg + 1, pcEnd, *pcValueBeg ); const sal_Char* pcValueEnd = lclFindCharacter( pcValueBeg + 1, pcEnd, *pcValueBeg );
if( (bOk = (pcValueEnd < pcEnd)) ) bOk = (pcValueEnd < pcEnd);
if( bOk )
{ {
++pcValueEnd; ++pcValueEnd;
OString aAttribName( pcNameBeg, static_cast< sal_Int32 >( pcNameEnd - pcNameBeg ) ); OString aAttribName( pcNameBeg, static_cast< sal_Int32 >( pcNameEnd - pcNameBeg ) );
@ -120,13 +124,17 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal
aAttributes[ pcNameBeg ] = aAttribData; aAttributes[ pcNameBeg ] = aAttribData;
// continue with next attribute (skip whitespace after this attribute) // continue with next attribute (skip whitespace after this attribute)
pcNameBeg = pcValueEnd; pcNameBeg = pcValueEnd;
if( (pcNameBeg < pcEnd) && ((bOk = lclIsWhiteSpace( *pcNameBeg ))) ) if( pcNameBeg < pcEnd )
{
bOk = lclIsWhiteSpace( *pcNameBeg );
if( bOk )
pcNameBeg = lclFindNonWhiteSpace( pcNameBeg + 1, pcEnd ); pcNameBeg = lclFindNonWhiteSpace( pcNameBeg + 1, pcEnd );
} }
} }
} }
} }
} }
}
// if no error has occurred, build the resulting attribute list // if no error has occurred, build the resulting attribute list
if( bOk ) if( bOk )