diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2013-03-08 14:11:35 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-03-08 13:16:49 +0000 |
commit | 4bf95c4c31dd871065d4042028a4b3ae476dab70 (patch) | |
tree | 2935dfd660fc2ee2b914ca27a72077e51e5862f3 /connectivity/source/drivers | |
parent | 596334776ad45f7ab87937615fa1d4e7d2d0fd42 (diff) |
make use of startsWith()
Change-Id: Ie70097de550ddd1cddc6714f8f86f9723cb36679
Reviewed-on: https://gerrit.libreoffice.org/2599
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r-- | connectivity/source/drivers/ado/ADriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/calc/CDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/EDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/JDriver.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/kab/KDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/macab/MacabDriver.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/odbcbase/ODriver.cxx | 2 |
9 files changed, 9 insertions, 10 deletions
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index fc51c3d2b84a..cbcc5561eb35 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -141,7 +141,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:")),9)); + return url.startsWith("sdbc:ado:"); } // ----------------------------------------------------------------------------- void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl) diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx index d5da23c93797..27ea3e1e5467 100644 --- a/connectivity/source/drivers/calc/CDriver.cxx +++ b/connectivity/source/drivers/calc/CDriver.cxx @@ -78,7 +78,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString("sdbc:calc:"),10) == 0; + return url.startsWith("sdbc:calc:"); } Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx index 36290b84eed9..6da0aa49118f 100644 --- a/connectivity/source/drivers/dbase/DDriver.cxx +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -70,7 +70,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, // -------------------------------------------------------------------------------- sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return !url.compareTo(::rtl::OUString("sdbc:dbase:"),11); + return url.startsWith("sdbc:dbase:"); } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index f4e0e6f2d657..21a0d9dda5ec 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -118,7 +118,7 @@ sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" ); - return (!url.compareTo(::rtl::OUString("sdbc:file:"),10)); + return url.startsWith("sdbc:file:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx index 1398fea8bcc2..86bf8fe5ed27 100644 --- a/connectivity/source/drivers/flat/EDriver.cxx +++ b/connectivity/source/drivers/flat/EDriver.cxx @@ -74,7 +74,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString("sdbc:flat:"),10) == 0; + return url.startsWith("sdbc:flat:"); } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 7aa056edbb4a..2e03671dcdf6 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -118,8 +118,7 @@ sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) thro // I feel responsible for all jdbc url's sal_Bool bEnabled = sal_False; OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" ); - static const ::rtl::OUString s_sJdbcPrefix( "jdbc:" ); - return bEnabled && 0 == url.compareTo(s_sJdbcPrefix, 5); + return bEnabled && url.startsWith("jdbc:"); } // ------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url, diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index b9765c00b14d..d086838af909 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -408,7 +408,7 @@ sal_Bool SAL_CALL KabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString("sdbc:address:kab:"), 16)); + return url.startsWith("sdbc:address:kab:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL KabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index 7365e3d4c995..4a547660b540 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -276,7 +276,7 @@ sal_Bool SAL_CALL MacabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString("sdbc:address:macab:"), 18)); + return url.startsWith("sdbc:address:macab:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/ODriver.cxx b/connectivity/source/drivers/odbcbase/ODriver.cxx index e5c2cf13f590..ba469451fe19 100644 --- a/connectivity/source/drivers/odbcbase/ODriver.cxx +++ b/connectivity/source/drivers/odbcbase/ODriver.cxx @@ -118,7 +118,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString("sdbc:odbc:"),10)); + return url.startsWith("sdbc:odbc:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) |