summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-06 09:23:33 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-09 08:34:40 +0000
commit6c80a8fe89fadf9a2c7260a09c037a09462f53d1 (patch)
treed36da9ee2a5fdc579d2a57ff6ba02deaddfa785a /connectivity
parente1fc599eb764186e5d511ace9785463eebbc7028 (diff)
new loplugin: oncevar
Change-Id: If57390510dde4d166be3141b9f658a7453755d3f Reviewed-on: https://gerrit.libreoffice.org/19815 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/DateConversion.cxx3
-rw-r--r--connectivity/source/commontools/dbtools.cxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx7
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.cxx10
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx14
6 files changed, 13 insertions, 30 deletions
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index b50fd8c3e653..4fa406653e4a 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -83,13 +83,12 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b
_rxTypeConverter->convertToSimpleType(_rVal, TypeClass_STRING) >>= aTemp;
sal_Int32 nIndex = (sal_Int32)-1;
const OUString sQuot("\'");
- const OUString sQuotToReplace("\'\'");
do
{
nIndex += 2;
nIndex = aTemp.indexOf(sQuot,nIndex);
if(nIndex != -1)
- aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(),sQuotToReplace);
+ aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), "\'\'");
} while (nIndex != -1);
aRet.append(aTemp);
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index feed005fd073..247b8d71dd72 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -943,8 +943,6 @@ try
Property* pOldProps = aOldProperties.getArray();
Property* pNewProps = aNewProperties.getArray();
- OUString sPropDefaultControl("DefaultControl");
- OUString sPropLabelControl("LabelControl");
OUString sPropFormatsSupplier("FormatsSupplier");
OUString sPropCurrencySymbol("CurrencySymbol");
OUString sPropDecimals("Decimals");
@@ -962,9 +960,7 @@ try
for (sal_Int32 i=0; i<aOldProperties.getLength(); ++i)
{
- if ( (!pOldProps[i].Name.equals(sPropDefaultControl))
- && (!pOldProps[i].Name.equals(sPropLabelControl))
- )
+ if ( pOldProps[i].Name != "DefaultControl" && pOldProps[i].Name != "LabelControl" )
{
// binary search
Property* pResult = ::std::lower_bound(
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index ade5ae0d74cf..1ddded1006f3 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -834,9 +834,10 @@ namespace connectivity
// arguments for creating the config access
Sequence< Any > aArguments(2);
// the path to the node to open
- OUString sNodePath("/org.openoffice.Setup/L10N" );
- aArguments[0] <<= PropertyValue( OUString("nodepath"), 0,
- makeAny( sNodePath ), PropertyState_DIRECT_VALUE
+ aArguments[0] <<= PropertyValue(
+ OUString("nodepath"), 0,
+ makeAny( OUString("/org.openoffice.Setup/L10N" ) ),
+ PropertyState_DIRECT_VALUE
);
// the depth: -1 means unlimited
aArguments[1] <<= PropertyValue(
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index d93d7baa0f68..9df93ea8c05f 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -137,8 +137,7 @@ OUString ConnectionGetImplementationName()
}
com::sun::star::uno::Sequence<OUString> ConnectionGetSupportedServiceNames()
{
- OUString serv( "com.sun.star.sdbc.Connection" );
- return Sequence< OUString> (&serv,1);
+ return Sequence< OUString > { "com.sun.star.sdbc.Connection" };
}
static sal_Int32 readLogLevelFromConfiguration()
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index 8ff522348834..d67d14a1777b 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.cxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.cxx
@@ -76,15 +76,7 @@ OUString DriverGetImplementationName()
Sequence< OUString > DriverGetSupportedServiceNames()
{
- static Sequence< OUString > *p;
- if( ! p )
- {
- MutexGuard guard( osl::Mutex::getGlobalMutex() );
- OUString tmp( "com.sun.star.sdbc.Driver" );
- static Sequence< OUString > instance( &tmp,1 );
- p = &instance;
- }
- return *p;
+ return Sequence< OUString > { "com.sun.star.sdbc.Driver" };
}
Reference< XConnection > Driver::connect(
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index cddcf29630d8..686fdf6ee1a4 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -180,28 +180,24 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
_rPrecedence.realloc( 0 );
try
{
- // some strings we need
- const OUString sDriverManagerConfigLocation( "org.openoffice.Office.DataAccess/DriverManager" );
- const OUString sDriverPreferenceLocation( "DriverPrecedence" );
- const OUString sNodePathArgumentName( "nodepath" );
- const OUString sNodeAccessServiceName( "com.sun.star.configuration.ConfigurationAccess" );
-
// create a configuration provider
Reference< XMultiServiceFactory > xConfigurationProvider(
com::sun::star::configuration::theDefaultProvider::get( _rContext ) );
// one argument for creating the node access: the path to the configuration node
Sequence< Any > aCreationArgs(1);
- aCreationArgs[0] <<= NamedValue( sNodePathArgumentName, makeAny( sDriverManagerConfigLocation ) );
+ aCreationArgs[0] <<= NamedValue( "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) );
// create the node access
- Reference< XNameAccess > xDriverManagerNode(xConfigurationProvider->createInstanceWithArguments(sNodeAccessServiceName, aCreationArgs), UNO_QUERY);
+ Reference< XNameAccess > xDriverManagerNode(
+ xConfigurationProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aCreationArgs),
+ UNO_QUERY);
OSL_ENSURE(xDriverManagerNode.is(), "lcl_getDriverPrecedence: could not open my configuration node!");
if (xDriverManagerNode.is())
{
// obtain the preference list
- Any aPreferences = xDriverManagerNode->getByName(sDriverPreferenceLocation);
+ Any aPreferences = xDriverManagerNode->getByName("DriverPrecedence");
bool bSuccess = aPreferences >>= _rPrecedence;
OSL_ENSURE(bSuccess || !aPreferences.hasValue(), "lcl_getDriverPrecedence: invalid value for the preferences node (no string sequence but not NULL)!");
}