[Libreoffice-commits] core.git: 2 commits - test/source vcl/generic vcl/unx
Stephan Bergmann
sbergman at redhat.com
Thu Dec 18 08:59:01 PST 2014
test/source/bootstrapfixture.cxx | 2 +-
vcl/generic/fontmanager/fontmanager.cxx | 4 ++--
vcl/generic/print/printerjob.cxx | 2 +-
vcl/generic/print/prtsetup.cxx | 10 +++++-----
vcl/unx/generic/app/i18n_ic.cxx | 2 +-
vcl/unx/generic/app/saldisp.cxx | 4 ++--
vcl/unx/generic/app/wmadaptor.cxx | 4 ++--
vcl/unx/generic/dtrans/X11_selection.cxx | 10 +++++-----
vcl/unx/generic/dtrans/config.cxx | 2 +-
vcl/unx/generic/printer/ppdparser.cxx | 20 ++++++++++----------
vcl/unx/generic/printer/printerinfomanager.cxx | 2 +-
vcl/unx/generic/window/salframe.cxx | 6 +++---
vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 2 +-
vcl/unx/gtk/window/gtksalframe.cxx | 6 +++---
14 files changed, 38 insertions(+), 38 deletions(-)
New commits:
commit 9de415945a608b8b90b648e04ad06bac2d53a9cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 18 17:58:17 2014 +0100
vcl: Use appropriate OUString functions on string constants
Change-Id: I169624820cd7d25eab18a6b90482e075ebfebcc6
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 33fb4ed..4fbded7 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -364,8 +364,8 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
// try to parse the font name and decide whether it might be a
// japanese font. Who invented this PITA ?
OUString aPSNameLastToken( aPSName.copy( aPSName.lastIndexOf( '-' )+1 ) );
- if( aPSNameLastToken.equalsAscii( "H" ) ||
- aPSNameLastToken.equalsAscii( "V" ) )
+ if( aPSNameLastToken == "H" ||
+ aPSNameLastToken == "V" )
{
static const char* pEncs[] =
{
diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index 80d52b1..f9da8c9 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -857,7 +857,7 @@ void PrinterJob::writeJobPatch( osl::File* pFile, const JobData& rJobData )
{
const PPDValue* pVal = pKey->getValue( i );
patch_order.push_back( pVal->m_aOption.toInt32() );
- if( patch_order.back() == 0 && ! pVal->m_aOption.equalsAscii( "0" ) )
+ if( patch_order.back() == 0 && pVal->m_aOption != "0" )
{
WritePS( pFile, "% Warning: left out JobPatchFile option \"" );
OString aOption = OUStringToOString( pVal->m_aOption, RTL_TEXTENCODING_ASCII_US );
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index 1af14cc..7118850 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -341,11 +341,11 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
{
const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
- if( pKey->isUIKey() &&
- ! pKey->getKey().equalsAscii( "PageSize" ) &&
- ! pKey->getKey().equalsAscii( "InputSlot" ) &&
- ! pKey->getKey().equalsAscii( "PageRegion" ) &&
- ! pKey->getKey().equalsAscii( "Duplex" )
+ if( pKey->isUIKey() &&
+ pKey->getKey() != "PageSize" &&
+ pKey->getKey() != "InputSlot" &&
+ pKey->getKey() != "PageRegion" &&
+ pKey->getKey() != "Duplex"
)
{
OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index bdc73c0..379243f 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -46,7 +46,7 @@ static void sendEmptyCommit( SalFrame* pFrame )
SalExtTextInputEvent aEmptyEv;
aEmptyEv.mnTime = 0;
aEmptyEv.mpTextAttr = 0;
- aEmptyEv.maText = "";
+ aEmptyEv.maText.clear();
aEmptyEv.mnCursorPos = 0;
aEmptyEv.mnCursorFlags = 0;
aEmptyEv.mbOnlyCursor = False;
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 643415c..908d8ce 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -970,7 +970,7 @@ OUString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
aStrMap += aKeyName;
}
else
- aStrMap = "";
+ aStrMap.clear();
}
else if (!aCustomKeyName.isEmpty())
{
@@ -981,7 +981,7 @@ OUString SalDisplay::GetKeyName( sal_uInt16 nKeyCode ) const
aStrMap += aCustomKeyName;
}
else
- aStrMap = "";
+ aStrMap.clear();
return aStrMap;
}
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index eeaabb9..4fe7433 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -821,7 +821,7 @@ bool WMAdaptor::getNetWmName()
}
// if this is metacity, check for version to enable a legacy workaround
- if( m_aWMName.equalsAscii( "Metacity" ) )
+ if( m_aWMName == "Metacity" )
{
int nVersionMajor = 0, nVersionMinor = 0;
Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
@@ -890,7 +890,7 @@ bool WMAdaptor::getWMshouldSwitchWorkspace() const
OUString( "ShouldSwitchWorkspace" ) ) );
if( aSetting.isEmpty() )
{
- if( m_aWMName.equalsAscii( "awesome" ) )
+ if( m_aWMName == "awesome" )
{
pWMA->m_bWMshouldSwitchWorkspace = false;
}
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index d2f648a..53c0067 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -613,9 +613,9 @@ bool SelectionManager::convertData(
aFlavor.MimeType = convertTypeFromNative( nType, nSelection, rFormat );
sal_Int32 nIndex = 0;
- if( aFlavor.MimeType.getToken( 0, ';', nIndex ).equalsAscii( "text/plain" ) )
+ if( aFlavor.MimeType.getToken( 0, ';', nIndex ) == "text/plain" )
{
- if( aFlavor.MimeType.getToken( 0, ';', nIndex ).equalsAscii( "charset=utf-16" ) )
+ if( aFlavor.MimeType.getToken( 0, ';', nIndex ) == "charset=utf-16" )
aFlavor.DataType = cppu::UnoType<OUString>::get();
else
aFlavor.DataType = getCppuType( (Sequence< sal_Int8 >*)0 );
@@ -1323,18 +1323,18 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
{
OUString aToken(pFlavors->MimeType.getToken( 0, ';', nIndex ));
// omit text/plain;charset=unicode since it is not well defined
- if( aToken.equalsAscii( "charset=unicode" ) )
+ if( aToken == "charset=unicode" )
{
pAtoms++;
continue;
}
bHaveText = true;
- if( aToken.equalsAscii( "charset=utf-16" ) )
+ if( aToken == "charset=utf-16" )
{
bHaveUTF16 = true;
pFlavors->DataType = cppu::UnoType<OUString>::get();
}
- else if( aToken.equalsAscii( "charset=utf-8" ) )
+ else if( aToken == "charset=utf-8" )
{
aUTF8Type = *pAtoms;
}
diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx
index 92f672b..7d52b98 100644
--- a/vcl/unx/generic/dtrans/config.cxx
+++ b/vcl/unx/generic/dtrans/config.cxx
@@ -70,7 +70,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
m_nSelectionTimeout( 3 )
{
Sequence< OUString > aKeys( 1 );
- aKeys.getArray()[0] = OUString( SELECTION_PROPERTY );
+ aKeys.getArray()[0] = SELECTION_PROPERTY;
Sequence< Any > aValues = GetProperties( aKeys );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index c4d97a1..7238a44 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1071,7 +1071,7 @@ void PPDParser::parse( ::std::list< OString >& rLines )
{
// handle main key translations of form:
// *ll_CC.Translation MainKeyword/translated text: ""
- if( aUniKey.equalsAscii( "Translation" ) )
+ if( aUniKey == "Translation" )
{
m_pTranslator->insertKey( aOption, aOptionTranslation, aTransLocale );
}
@@ -1692,7 +1692,7 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
// None / False and the default can always be set, but be careful !
// setting them might influence constrained values
- if( pNewValue->m_aOption.equalsAscii( "None" ) || pNewValue->m_aOption.equalsAscii( "False" ) ||
+ if( pNewValue->m_aOption == "None" || pNewValue->m_aOption == "False" ||
pNewValue == pKey->getDefaultValue() )
return true;
@@ -1727,8 +1727,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
continue; // this should not happen, PPD broken
if( pKeyOption == pNewValue &&
- ! pOtherKeyOption->m_aOption.equalsAscii( "None" ) &&
- ! pOtherKeyOption->m_aOption.equalsAscii( "False" ) )
+ pOtherKeyOption->m_aOption != "None" &&
+ pOtherKeyOption->m_aOption != "False" )
{
// check if the other value can be reset and
// do so if possible
@@ -1741,8 +1741,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
else if( pOtherKeyOption )
{
if( getValue( pOtherKey ) == pOtherKeyOption &&
- ! pNewValue->m_aOption.equalsAscii( "None" ) &&
- ! pNewValue->m_aOption.equalsAscii( "False" ) )
+ pNewValue->m_aOption != "None" &&
+ pNewValue->m_aOption != "False" )
return false;
}
else
@@ -1754,10 +1754,10 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue
else
{
const PPDValue* pOtherValue = getValue( pOtherKey );
- if( ! pOtherValue->m_aOption.equalsAscii( "None" ) &&
- ! pOtherValue->m_aOption.equalsAscii( "False" ) &&
- ! pNewValue->m_aOption.equalsAscii( "None" ) &&
- ! pNewValue->m_aOption.equalsAscii( "False" ) )
+ if( pOtherValue->m_aOption != "None" &&
+ pOtherValue->m_aOption != "False" &&
+ pNewValue->m_aOption != "None" &&
+ pNewValue->m_aOption != "False" )
return false;
}
}
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 8f80433..f4eb32e 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -618,7 +618,7 @@ bool PrinterInfoManager::writePrinterConfig()
while( nIndex != -1 && ! bAutoQueue )
{
OUString aToken( it->second.m_aInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
- if( aToken.equalsAscii( "autoqueue" ) )
+ if( aToken == "autoqueue" )
bAutoQueue = true;
}
if( bAutoQueue )
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 5656748..77370f7 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1035,7 +1035,7 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon )
else
{
const OUString& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() );
- if( rWM.equalsAscii( "KWin" ) ) // assume KDE is running
+ if( rWM == "KWin" ) // assume KDE is running
iconSize = 48;
static bool bGnomeIconSize = false;
static bool bGnomeChecked = false;
@@ -3384,7 +3384,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
{
// ReflectionX in Windows mode changes focus while mouse is grabbed
- if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii( "ReflectionX Windows" ) )
+ if( nVisibleFloats > 0 && GetDisplay()->getWMAdaptor()->getWindowManagerName() == "ReflectionX Windows" )
return 1;
/* ignore focusout resulting from keyboard grabs
@@ -4072,7 +4072,7 @@ long X11SalFrame::Dispatch( XEvent *pEvent )
/* another workaround for sawfish: if a transient window for the same parent is shown
* sawfish does not set the focus to it. Applies only for click to focus mode.
*/
- if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii( "Sawfish" ) )
+ if( ! (nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mbInShow && GetDisplay()->getWMAdaptor()->getWindowManagerName() == "Sawfish" )
{
// don't set the focus into the IME status window
// since this will lead to a parent loss of focus, close status,
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 967aa10..e2af3e5 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -1808,7 +1808,7 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
static const char aStarDot[] = "*.";
OUString aTokens;
- bool bAllGlob = rType.equalsAscii( "*.*" ) || rType.equalsAscii( "*" );
+ bool bAllGlob = rType == "*.*" || rType == "*";
if (bAllGlob)
gtk_file_filter_add_pattern( filter, "*" );
else
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index c840cbf..7341071 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -1158,7 +1158,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XSetWMHints( pDisplay, aWindow, pHints );
XFree( pHints );
- if (GetGtkSalData()->GetGtkDisplay()->getWMAdaptor()->getWindowManagerName().equalsAscii("compiz"))
+ if (GetGtkSalData()->GetGtkDisplay()->getWMAdaptor()->getWindowManagerName() == "compiz")
return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
@@ -4028,7 +4028,7 @@ void GtkSalFrame::IMHandler::sendEmptyCommit()
SalExtTextInputEvent aEmptyEv;
aEmptyEv.mnTime = 0;
aEmptyEv.mpTextAttr = 0;
- aEmptyEv.maText = "";
+ aEmptyEv.maText.clear();
aEmptyEv.mnCursorPos = 0;
aEmptyEv.mnCursorFlags = 0;
aEmptyEv.mbOnlyCursor = False;
@@ -4263,7 +4263,7 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p
if( ! aDel.isDeleted() )
{
// reset input event
- pThis->m_aInputEvent.maText = "";
+ pThis->m_aInputEvent.maText.clear();
pThis->m_aInputEvent.mnCursorPos = 0;
pThis->updateIMSpotLocation();
}
commit 11f20999040e97c052c0015e3265de2a68cee666
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Dec 18 17:57:46 2014 +0100
test: Use appropriate OUString functions on string constants
Change-Id: Idbdc5c9aab8fa65df39d66da2461337db6350e52
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index ac30e5c..f6f100a 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -173,7 +173,7 @@ void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFor
int returnValue = system(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8).getStr());
CPPUNIT_ASSERT_EQUAL_MESSAGE(
- OUStringToOString(OUString("failed to execute: ") + aCommand,
+ OUStringToOString("failed to execute: " + aCommand,
RTL_TEXTENCODING_UTF8).getStr(), 0, returnValue);
OString aContentString = loadFile(aOutput.GetURL());
More information about the Libreoffice-commits
mailing list