On 03/11/2013 11:10 AM, Thomas Arnhold wrote:
commit 937b63af3322f7f8b5e869b2c7431a2deaec3113
Author: Thomas Arnhold <thomas@arnhold.org>
Date: Sat Mar 9 22:47:20 2013 +0100
use startsWith() instead of compareToAscii()
brain damage...
Change-Id: I4dc63c7346f724eded9ac7b82cda25c2bb60beff
[...]
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx
b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 3f2a96b..d58c8f5 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -399,7 +399,7 @@ namespace connectivity
{
sal_Bool bEnabled = sal_False;
OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" );
- return bEnabled &&
url.compareToAscii("sdbc:embedded:hsqldb",sizeof("sdbc:embedded:hsqldb")) == 0;
+ return bEnabled && url.startsWith("sdbc:embedded:hsqldb");
Note that sizeof("...") == strlen("...") + 1, so the call to
compareToAscii included the terminating NUL of the string literal in the
comparison, so would never have returned zero (unless url contained
embedded NUL characters, which is unlikely).
Not sure about the details of that sdbc URL scheme, whether what one
wants there is url.startsWith("sdbc:embedded:hsqldb") or
url.startsWith("sdbc:embedded:hsqldb:") or url=="sdbc:embedded:hsqld"
(and, while we are at it, at least for the initial "sdbc" part, URI
syntax would mandated case-insensitive comparison anyway, unless the
given url is known to be normalized to lowercase), but maybe Lionel
knows more.
Stephan
Context
- Re: [Libreoffice-commits] core.git: use startsWith() instead of compareToAscii() · Stephan Bergmann
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.