From 624a116d1482cdf0f9249e10a631dd6bd89f43eb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 28 May 2014 12:54:54 +0200 Subject: use OUString::startsWith() Change-Id: I0fc77b50792e48be175ab7cc151509e097676849 --- connectivity/source/drivers/mysql/YDriver.cxx | 4 ++-- mysqlc/source/mysqlc_connection.cxx | 2 +- mysqlc/source/mysqlc_driver.cxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 588845ecd201..5e854c6c5fec 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -115,12 +115,12 @@ namespace connectivity bool isOdbcUrl(const OUString& _sUrl) { - return _sUrl.copy(0,16) == "sdbc:mysql:odbc:"; + return _sUrl.startsWith("sdbc:mysql:odbc:"); } bool isNativeUrl(const OUString& _sUrl) { - return (!_sUrl.compareTo(OUString("sdbc:mysql:mysqlc:"), sizeof("sdbc:mysql:mysqlc:")-1)); + return _sUrl.startsWith("sdbc:mysql:mysqlc:"); } T_DRIVERTYPE lcl_getDriverType(const OUString& _sUrl) diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx index c3643faa045f..9c0b1831c28f 100644 --- a/mysqlc/source/mysqlc_connection.cxx +++ b/mysqlc/source/mysqlc_connection.cxx @@ -118,7 +118,7 @@ void OConnection::construct(const OUString& url, const Sequence< PropertyValue > // parse url. Url has the following format: // external server: sdbc:mysqlc:[hostname]:[port]/[dbname] - if (!url.compareTo(OUString(MYSQLC_URI_PREFIX), sizeof(MYSQLC_URI_PREFIX)-1)) { + if (url.startsWith(MYSQLC_URI_PREFIX)) { nIndex = 12; } else { bEmbedded = sal_True; diff --git a/mysqlc/source/mysqlc_driver.cxx b/mysqlc/source/mysqlc_driver.cxx index 343949dfe920..be6d927c99fc 100644 --- a/mysqlc/source/mysqlc_driver.cxx +++ b/mysqlc/source/mysqlc_driver.cxx @@ -243,7 +243,7 @@ sal_Bool SAL_CALL MysqlCDriver::acceptsURL(const OUString& url) throw(SQLException, RuntimeException, std::exception) { OSL_TRACE("MysqlCDriver::acceptsURL"); - return (!url.compareTo(OUString("sdbc:mysqlc:"), sizeof("sdbc:mysqlc:")-1)); + return url.startsWith("sdbc:mysqlc:"); } /* }}} */ -- cgit