loplugin:salbool: Automatic rewrite of sal_False/True

Change-Id: I2f5c4c341c4c38e1603748fb7c1f50e42547d005
This commit is contained in:
Stephan Bergmann
2016-04-20 17:21:52 +02:00
parent 5ef76efb40
commit ef0161b649
4 changed files with 16 additions and 16 deletions

View File

@@ -67,12 +67,12 @@ inline bool getBoolAttr(
{ {
if ( aValue == "true" ) if ( aValue == "true" )
{ {
*pRet = sal_True; *pRet = true;
return true; return true;
} }
else if ( aValue == "false" ) else if ( aValue == "false" )
{ {
*pRet = sal_False; *pRet = false;
return true; return true;
} }
else else

View File

@@ -561,7 +561,7 @@ void FormattedFieldElement::endElement()
{ {
Reference< util::XNumberFormats > xFormats( Reference< util::XNumberFormats > xFormats(
_pImport->getNumberFormatsSupplier()->getNumberFormats() ); _pImport->getNumberFormatsSupplier()->getNumberFormats() );
sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True ); sal_Int32 nKey = xFormats->queryKey( sFormat, locale, true );
if (-1 == nKey) if (-1 == nKey)
{ {
nKey = xFormats->addNew( sFormat, locale ); nKey = xFormats->addNew( sFormat, locale );
@@ -1225,7 +1225,7 @@ void TitledBoxElement::endElement()
ctx.importStringProperty( "GroupName", "group-name", xAttributes ); ctx.importStringProperty( "GroupName", "group-name", xAttributes );
sal_Int16 nVal = 0; sal_Int16 nVal = 0;
sal_Bool bChecked = sal_False; sal_Bool bChecked = false;
if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked) if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
{ {
nVal = 1; nVal = 1;
@@ -1321,7 +1321,7 @@ void RadioGroupElement::endElement()
ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes ); ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes );
ctx.importStringProperty( "GroupName", "group-name", xAttributes ); ctx.importStringProperty( "GroupName", "group-name", xAttributes );
sal_Int16 nVal = 0; sal_Int16 nVal = 0;
sal_Bool bChecked = sal_False; sal_Bool bChecked = false;
if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked) if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
{ {
nVal = 1; nVal = 1;
@@ -1578,12 +1578,12 @@ void CheckBoxElement::endElement()
ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes ); ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes );
ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes ); ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
sal_Bool bTriState = sal_False; sal_Bool bTriState = false;
if (getBoolAttr( &bTriState, "tristate", _xAttributes, _pImport->XMLNS_DIALOGS_UID )) if (getBoolAttr( &bTriState, "tristate", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
{ {
xControlModel->setPropertyValue( "TriState", makeAny( bTriState ) ); xControlModel->setPropertyValue( "TriState", makeAny( bTriState ) );
} }
sal_Bool bChecked = sal_False; sal_Bool bChecked = false;
if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID )) if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
{ {
// has "checked" attribute // has "checked" attribute
@@ -1655,7 +1655,7 @@ void ButtonElement::endElement()
ctx.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes ); ctx.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes );
ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes ); ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
// State // State
sal_Bool bChecked = sal_False; sal_Bool bChecked = false;
if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked) if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
{ {
sal_Int16 nVal = 1; sal_Int16 nVal = 1;

View File

@@ -1575,18 +1575,18 @@ void ImportContext::importDefaults(
importShortProperty( "TabIndex", "tab-index", xAttributes ); importShortProperty( "TabIndex", "tab-index", xAttributes );
sal_Bool bDisable = sal_False; sal_Bool bDisable = false;
if (getBoolAttr( &bDisable,"disabled", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bDisable) if (getBoolAttr( &bDisable,"disabled", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bDisable)
{ {
_xControlModel->setPropertyValue( "Enabled", makeAny( sal_False ) ); _xControlModel->setPropertyValue( "Enabled", makeAny( false ) );
} }
sal_Bool bVisible = sal_True; sal_Bool bVisible = true;
if (getBoolAttr( &bVisible, "visible", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible) if (getBoolAttr( &bVisible, "visible", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible)
{ {
try try
{ {
_xControlModel->setPropertyValue( "EnableVisible", makeAny( sal_False ) ); _xControlModel->setPropertyValue( "EnableVisible", makeAny( false ) );
} }
catch( Exception& ) catch( Exception& )
{ {

View File

@@ -73,12 +73,12 @@ namespace xmlscript
{ {
if ( aValue == "true" ) if ( aValue == "true" )
{ {
*pRet = sal_True; *pRet = true;
return true; return true;
} }
else if ( aValue == "false" ) else if ( aValue == "false" )
{ {
*pRet = sal_False; *pRet = false;
return true; return true;
} }
else else
@@ -180,7 +180,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
OUString aStorageURL = xAttributes->getValueByUidName(m_pImport->XMLNS_XLINK_UID, "href" ); OUString aStorageURL = xAttributes->getValueByUidName(m_pImport->XMLNS_XLINK_UID, "href" );
sal_Bool bReadOnly = sal_False; sal_Bool bReadOnly = false;
getBoolAttr( &bReadOnly,"readonly", xAttributes, m_pImport->XMLNS_UID ); getBoolAttr( &bReadOnly,"readonly", xAttributes, m_pImport->XMLNS_UID );
if ( m_xLibContainer.is() ) if ( m_xLibContainer.is() )
@@ -211,7 +211,7 @@ void BasicElementBase::processingInstruction( const OUString& /*rTarget*/, const
{ {
OUString aName = xAttributes->getValueByUidName( m_pImport->XMLNS_UID, "name" ); OUString aName = xAttributes->getValueByUidName( m_pImport->XMLNS_UID, "name" );
sal_Bool bReadOnly = sal_False; sal_Bool bReadOnly = false;
getBoolAttr( &bReadOnly, "readonly", xAttributes, m_pImport->XMLNS_UID ); getBoolAttr( &bReadOnly, "readonly", xAttributes, m_pImport->XMLNS_UID );
if ( m_xLibContainer.is() ) if ( m_xLibContainer.is() )