[Libreoffice-commits] core.git: 27 commits - basegfx/test compilerplugins/clang connectivity/source desktop/source filter/source helpcompiler/source i18nlangtag/source i18npool/source linguistic/source oox/source opencl/source sal/osl sal/qa sax/source scaddins/source sc/qa sc/source sdext/source sd/qa sd/source sfx2/source shell/source starmath/qa svx/source sw/qa sw/source unodevtools/source unoxml/source vcl/source vcl/unx xmloff/source xmlsecurity/qa xmlsecurity/source
Stephan Bergmann
sbergman at redhat.com
Tue Jan 10 07:13:26 UTC 2017
basegfx/test/basegfx2d.cxx | 26 -
basegfx/test/boxclipper.cxx | 36 +-
basegfx/test/clipstate.cxx | 15 -
basegfx/test/genericclipper.cxx | 8
compilerplugins/clang/conststringvar.cxx | 136 ++++++++++
compilerplugins/clang/stringconstant.cxx | 14 +
connectivity/source/drivers/calc/CConnection.cxx | 4
connectivity/source/drivers/evoab2/NConnection.cxx | 4
connectivity/source/drivers/jdbc/Array.cxx | 16 -
connectivity/source/drivers/jdbc/Blob.cxx | 12
connectivity/source/drivers/jdbc/CallableStatement.cxx | 14 -
connectivity/source/drivers/jdbc/Clob.cxx | 12
connectivity/source/drivers/jdbc/DatabaseMetaData.cxx | 24 -
connectivity/source/drivers/jdbc/InputStream.cxx | 4
connectivity/source/drivers/jdbc/JBigDecimal.cxx | 4
connectivity/source/drivers/jdbc/JConnection.cxx | 8
connectivity/source/drivers/jdbc/JStatement.cxx | 14 -
connectivity/source/drivers/jdbc/PreparedStatement.cxx | 30 +-
connectivity/source/drivers/jdbc/Reader.cxx | 8
connectivity/source/drivers/jdbc/ResultSet.cxx | 24 -
connectivity/source/drivers/jdbc/Timestamp.cxx | 6
connectivity/source/drivers/jdbc/tools.cxx | 10
connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx | 4
connectivity/source/drivers/postgresql/pq_preparedstatement.cxx | 2
desktop/source/migration/services/wordbookmigration.cxx | 2
filter/source/msfilter/escherex.cxx | 2
filter/source/msfilter/msdffimp.cxx | 2
helpcompiler/source/HelpLinker.cxx | 2
i18nlangtag/source/isolang/inunx.cxx | 4
i18npool/source/nativenumber/nativenumbersupplier.cxx | 6
linguistic/source/dicimp.cxx | 6
oox/source/export/chartexport.cxx | 4
oox/source/export/drawingml.cxx | 8
opencl/source/openclwrapper.cxx | 2
sal/osl/unx/profile.cxx | 2
sal/qa/rtl/strings/test_oustring_compare.cxx | 6
sax/source/tools/converter.cxx | 10
sc/qa/unit/tiledrendering/tiledrendering.cxx | 2
sc/qa/unit/ucalc_sharedformula.cxx | 6
sc/source/core/opencl/formulagroupcl.cxx | 2
sc/source/filter/dif/difexp.cxx | 32 +-
sc/source/ui/unoobj/dispuno.cxx | 16 -
scaddins/source/analysis/analysishelper.cxx | 2
sd/qa/unit/tiledrendering/tiledrendering.cxx | 2
sd/source/filter/html/htmlex.cxx | 16 -
sd/source/ui/remotecontrol/BluetoothServer.cxx | 2
sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx | 2
sdext/source/pdfimport/test/tests.cxx | 12
sfx2/source/appl/sfxhelp.cxx | 8
sfx2/source/doc/SfxDocumentMetaData.cxx | 37 +-
sfx2/source/sidebar/Deck.cxx | 2
shell/source/unix/sysshell/recently_used_file_handler.cxx | 10
starmath/qa/cppunit/test_nodetotextvisitors.cxx | 4
svx/source/dialog/hexcolorcontrol.cxx | 2
svx/source/form/fmsrccfg.cxx | 2
sw/qa/extras/tiledrendering/tiledrendering.cxx | 2
sw/qa/extras/uiwriter/uiwriter.cxx | 2
sw/source/core/text/xmldump.cxx | 2
sw/source/filter/html/css1atr.cxx | 2
sw/source/filter/html/wrthtml.cxx | 2
sw/source/uibase/uno/unodispatch.cxx | 34 +-
unodevtools/source/skeletonmaker/javacompskeleton.cxx | 2
unodevtools/source/skeletonmaker/skeletonmaker.cxx | 4
unoxml/source/rdf/librdf_repository.cxx | 2
vcl/source/font/font.cxx | 10
vcl/source/fontsubset/sft.cxx | 42 +--
vcl/source/opengl/OpenGLHelper.cxx | 2
vcl/unx/generic/fontmanager/fontmanager.cxx | 2
vcl/unx/gtk/a11y/atktextattributes.cxx | 2
xmloff/source/draw/sdxmlexp.cxx | 12
xmloff/source/meta/xmlmetae.cxx | 8
xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 2
xmlsecurity/qa/unit/signing/signing.cxx | 2
xmlsecurity/source/dialogs/certificateviewer.cxx | 2
74 files changed, 461 insertions(+), 325 deletions(-)
New commits:
commit 0d2ac4afe9f583dee64a5dcebb93caf7d42d0891
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:12:52 2017 +0100
New loplugin:conststringvar
Change-Id: I16648b018ed0f69a085322cfb88481ee2a0c27ca
diff --git a/compilerplugins/clang/conststringvar.cxx b/compilerplugins/clang/conststringvar.cxx
new file mode 100644
index 0000000..58a94e5
--- /dev/null
+++ b/compilerplugins/clang/conststringvar.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <set>
+#include <stack>
+
+#include "check.hxx"
+#include "plugin.hxx"
+
+// Find non-const vars of 'char const *' type initialized with a const expr,
+// that could likely be const (and will then probably trigger further
+// loplugin:stringconstant findings).
+
+namespace {
+
+// It looks like Clang wrongly implements DR 4
+// (<http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#4>) and treats
+// a variable declared in an 'extern "..." {...}'-style linkage-specification as
+// if it contained the 'extern' specifier:
+bool hasExternalLinkage(VarDecl const * decl) {
+ if (decl->getLinkageAndVisibility().getLinkage() != ExternalLinkage) {
+ return false;
+ }
+ for (auto ctx = decl->getLexicalDeclContext();
+ ctx->getDeclKind() != Decl::TranslationUnit;
+ ctx = ctx->getLexicalParent())
+ {
+ if (auto ls = dyn_cast<LinkageSpecDecl>(ctx)) {
+ if (!ls->hasBraces()) {
+ return true;
+ }
+ if (auto prev = decl->getPreviousDecl()) {
+ return hasExternalLinkage(prev);
+ }
+ return !decl->isInAnonymousNamespace();
+ }
+ }
+ return true;
+}
+
+class ConstStringVar:
+ public RecursiveASTVisitor<ConstStringVar>, public loplugin::Plugin
+{
+public:
+ explicit ConstStringVar(InstantiationData const & data): Plugin(data) {}
+
+ void run() override {
+ if (compiler.getLangOpts().CPlusPlus) {
+ // clang::Expr::isCXX11ConstantExpr only works for C++
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ for (auto v: vars_) {
+ report(
+ DiagnosticsEngine::Warning,
+ "variable is only used as rvalue, should be const",
+ v->getLocation())
+ << v->getSourceRange();
+ }
+ }
+ }
+
+ bool TraverseImplicitCastExpr(ImplicitCastExpr * expr) {
+ bool pushed = false;
+ if (expr->getCastKind() == CK_LValueToRValue) {
+ if (auto dr = dyn_cast<DeclRefExpr>(
+ expr->getSubExpr()->IgnoreParenImpCasts()))
+ {
+ if (auto vd = dyn_cast<VarDecl>(dr->getDecl())) {
+ if (vars_.find(vd->getCanonicalDecl()) != vars_.end()) {
+ casted_.push(dr);
+ pushed = true;
+ }
+ }
+ }
+ }
+ bool b = RecursiveASTVisitor::TraverseImplicitCastExpr(expr);
+ if (pushed) {
+ casted_.pop();
+ }
+ return b;
+ }
+
+ bool VisitVarDecl(VarDecl const * decl) {
+ if (ignoreLocation(decl)) {
+ return true;
+ }
+ if (decl != decl->getCanonicalDecl()) {
+ return true;
+ }
+ if (isa<ParmVarDecl>(decl) || hasExternalLinkage(decl)) {
+ return true;
+ }
+ if (!loplugin::TypeCheck(decl->getType()).NonConstVolatile().Pointer()
+ .Const().Char())
+ {
+ return true;
+ }
+ auto init = decl->getAnyInitializer();
+ if (init == nullptr) {
+ return true;
+ }
+ APValue v;
+ if (!init->isCXX11ConstantExpr(compiler.getASTContext(), &v)) {
+ return true;
+ }
+ vars_.insert(decl);
+ return true;
+ }
+
+ bool VisitDeclRefExpr(DeclRefExpr const * expr) {
+ if (!casted_.empty() && expr == casted_.top()) {
+ return true;
+ }
+ auto vd = dyn_cast<VarDecl>(expr->getDecl());
+ if (vd == nullptr) {
+ return true;
+ }
+ vars_.erase(vd->getCanonicalDecl());
+ return true;
+ }
+
+private:
+ std::set<VarDecl const *> vars_;
+ std::stack<DeclRefExpr const *> casted_;
+};
+
+loplugin::Plugin::Registration<ConstStringVar> X("conststringvar");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index 2afd923..d8f04a6 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -289,6 +289,13 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
{
// u.equalsIgnoreAsciiCaseAscii("foo") ->
// u.equalsIngoreAsciiCase("foo"):
+ std::string file(
+ compiler.getSourceManager().getFilename(
+ compiler.getSourceManager().getSpellingLoc(
+ expr->getLocStart())));
+ if (file == SRCDIR "/sal/qa/rtl/strings/test_oustring_compare.cxx") {
+ return true;
+ }
handleChar(
expr, 0, fdecl, "rtl::OUString::equalsIgnoreAsciiCase",
TreatEmpty::CheckEmpty, false);
@@ -300,6 +307,13 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
{
// u.equalsIgnoreAsciiCaseAsciiL("foo", 3) ->
// u.equalsIngoreAsciiCase("foo"):
+ std::string file(
+ compiler.getSourceManager().getFilename(
+ compiler.getSourceManager().getSpellingLoc(
+ expr->getLocStart())));
+ if (file == SRCDIR "/sal/qa/rtl/strings/test_oustring_compare.cxx") {
+ return true;
+ }
handleCharLen(
expr, 0, 1, fdecl, "rtl::OUString::equalsIgnoreAsciiCase",
TreatEmpty::CheckEmpty);
commit d86f83b6d942fa18ffb1e74daff6032dea954dda
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:12:28 2017 +0100
New loplugin:conststringvar: basegfx
Change-Id: Ia298e6a3515de9bde212dfd6159032859a965df1
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index b0b27ef..e41b6dc 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -140,14 +140,14 @@ public:
CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D",
tools::importFromSvgD( aPoly, aPath0, false, nullptr ));
aExport = tools::exportToSvgD( aPoly, true, true, false );
- const char* sExportString = "m10 10h-20v-20h20z";
+ const char sExportString[] = "m10 10h-20v-20h20z";
CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D",
- aExport.equalsAscii(sExportString) );
+ aExport == sExportString );
CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip",
tools::importFromSvgD( aPoly, aExport, false, nullptr ));
aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)",
- aExport.equalsAscii(sExportString));
+ aExport == sExportString);
CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D",
tools::importFromSvgD( aPoly, aPath1, false, nullptr ));
@@ -167,11 +167,11 @@ public:
// so for correct unit test i add the new exported string here as sExportStringSimpleBezier
// and compare to it.
- const char* sExportStringSimpleBezier =
+ const char sExportStringSimpleBezier[] =
"m11430 0c-8890 3810 5715 6985 5715 6985"
"l-17145-1905c0 0 22860-10160 16510 6350"
"s-3810-11430-3810-11430z";
- CPPUNIT_ASSERT_MESSAGE("exporting bezier polygon to SVG-D", aExport.equalsAscii(sExportStringSimpleBezier));
+ CPPUNIT_ASSERT_MESSAGE("exporting bezier polygon to SVG-D", aExport == sExportStringSimpleBezier);
// Adaptions for B2DPolygon bezier change (see #i77162#):
@@ -188,7 +188,7 @@ public:
// same here, the corrected export with the corrected B2DPolygon is simply more efficient,
// so i needed to change the compare string. Also adding the re-import comparison below.
- const char* sExportString1 =
+ const char sExportString1[] =
"m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17"
"0 564c0 145 33 259 98 342 65 84 150 126 257 126q115.5 0 231-57s147-97 210-176 99-143 109-190c38-199 76-398 114"
"-598zm840 1646c-133 73-312 139-537 197-225 57-440 86-644 87-483-1-866-132-1150-392-284-261-426-619-426-1076 0-"
@@ -201,17 +201,17 @@ public:
CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport, false, nullptr));
CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport == aPoly);
- CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", aExport.equalsAscii(sExportString1));
+ CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", aExport == sExportString1);
CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip",
tools::importFromSvgD( aPoly, aExport, false, nullptr ));
aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)",
- aExport.equalsAscii(sExportString1));
+ aExport == sExportString1);
CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D",
tools::importFromSvgD( aPoly, aPath3, false, nullptr ));
aExport = tools::exportToSvgD( aPoly, true, true, false );
- const char* sExportString2 =
+ const char sExportString2[] =
"m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293"
"zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97"
"-12-91-19-85-26-40-16-39-18-38-20-36-22-34-24-33-26-32-27-30-30-29-31-27-33-25-3"
@@ -233,20 +233,20 @@ public:
"11-95-3-100 3-101 11-95 17-90 24-85 30-79 38-75 21-35 23-35 25-32 26-32 28-30 29"
"-28 30-26 31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z";
CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D",
- aExport.equalsAscii(sExportString2));
+ aExport == sExportString2);
CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip",
tools::importFromSvgD( aPoly, aExport, false, nullptr ));
aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)",
- aExport.equalsAscii(sExportString2));
+ aExport == sExportString2);
const B2DPolygon aRect(
tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false, false );
- const char* sExportStringRect = "M0 0H4000V4000H0Z";
+ const char sExportStringRect[] = "M0 0H4000V4000H0Z";
CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string",
- aExport.equalsAscii(sExportStringRect));
+ aExport == sExportStringRect);
}
// Change the following lines only, if you add, remove or rename
diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx
index 9ca522f..e13d156 100644
--- a/basegfx/test/boxclipper.cxx
+++ b/basegfx/test/boxclipper.cxx
@@ -159,11 +159,9 @@ public:
aRandomIntersections.appendElement( aRandomRange, B2VectorOrientation::Negative );
}
#else
- const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-4
28zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z";
+ const char randomSvg[]="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-
428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z";
B2DPolyPolygon randomPoly;
- tools::importFromSvgD(
- randomPoly,
- OUString::createFromAscii(randomSvg), false, nullptr);
+ tools::importFromSvgD(randomPoly, randomSvg, false, nullptr);
for (auto const& aPolygon : randomPoly)
aRandomIntersections.appendElement(aPolygon.getB2DRange(), B2VectorOrientation::Negative);
#endif
@@ -237,28 +235,28 @@ public:
void verifyPoly()
{
- const char* disjunct="m-100-100v200h200v-200zm900 900v200h200v-200z";
- const char* equal="m-100-100v200h200v-200zm200 0h-200v200h200v-200z";
- const char* intersectionN="m-100-100v100h200v-100zm200 0v-100h-200v100 200h200v-200z";
- const char* intersectionE="m0-100v200h100v-200zm0 0h-100v200h100 200v-200z";
- const char* intersectionS="m-100 0v100h200v-100zm0-100v200 100h200v-100-200z";
- const char* intersectionW="m-100-100v200h100v-200zm0 0h-100v200h100 200v-200z";
- const char* intersectionNE="m0-100v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z";
- const char* intersectionSE="m0 0v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z";
- const char* intersectionSW="m-100 0v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z";
- const char* intersectionNW="m-100-100v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z";
- const char* ringIntersection="m50-150v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v300h200v100h-200v300h300v-200h200v-300z";
- const char* ringIntersection2="m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v100z"
+ const char* const disjunct="m-100-100v200h200v-200zm900 900v200h200v-200z";
+ const char* const equal="m-100-100v200h200v-200zm200 0h-200v200h200v-200z";
+ const char* const intersectionN="m-100-100v100h200v-100zm200 0v-100h-200v100 200h200v-200z";
+ const char* const intersectionE="m0-100v200h100v-200zm0 0h-100v200h100 200v-200z";
+ const char* const intersectionS="m-100 0v100h200v-100zm0-100v200 100h200v-100-200z";
+ const char* const intersectionW="m-100-100v200h100v-200zm0 0h-100v200h100 200v-200z";
+ const char* const intersectionNE="m0-100v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z";
+ const char* const intersectionSE="m0 0v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z";
+ const char* const intersectionSW="m-100 0v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z";
+ const char* const intersectionNW="m-100-100v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z";
+ const char* const ringIntersection="m50-150v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v300h200v100h-200v300h300v-200h200v-300z";
+ const char* const ringIntersection2="m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v100z"
"m100-200v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v200h-200v300h200v200h300v-200h200v-300z";
- const char* ringIntersectExtraStrip="m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v25h-50v50h50v25z"
+ const char* const ringIntersectExtraStrip="m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v25h-50v50h50v25z"
"m100-200v100h100v-100zm0 200v100h100v-100zm0-75v50h150v-50z"
"m100-125v-200h-300v200h-200v300h200v200h300v-200h200v-300z";
- const char* complexIntersections="m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm0 0v-100 100h-100 100v100-100h100z"
+ const char* const complexIntersections="m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm0 0v-100 100h-100 100v100-100h100z"
"m100 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100-100v100 100h100 100v-100z"
"m0 0v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100h100z"
"m0-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100-100z"
"m100 0v-100h-200-100-100v100 200 100h100 100 200v-100-200zm600 900v200h200v-200z";
- const char* randomIntersections="m20-4515v393h43v-393zm34-8690v127h18v-127zm24 674v427h56v-427zm126-451v16-16z"
+ const char* const randomIntersections="m20-4515v393h43v-393zm34-8690v127h18v-127zm24 674v427h56v-427zm126-451v16-16z"
"m22 3470v260h50v-260zm55 599v167h26v-167zm-49-1831v455h136v-455z"
"m10 8845v19h158v-19zm54-38v25h228v-25zm156-13245v108h100v-108z"
"m101 14826v200h75v-200zm-205-3000v365h315v-365zm-309-1877v19h628v-19z"
diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx
index d1c44b5..717e274 100644
--- a/basegfx/test/clipstate.cxx
+++ b/basegfx/test/clipstate.cxx
@@ -114,11 +114,11 @@ public:
void verifySimpleRange()
{
- const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
- const char* intersectSvg="m-100 10v-20h10v20zm90 90v-10h20v10zm0-190v-10h20v10zm100 100v-20h10v20z";
- const char* xorSvg="m-100 10h10v-20h-10zm90 90h20v-10h-20zm0-190h20v-10h-20zm100 100h10v-20h-10z"
+ const char* const unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
+ const char* const intersectSvg="m-100 10v-20h10v20zm90 90v-10h20v10zm0-190v-10h20v10zm100 100v-20h10v20z";
+ const char* const xorSvg="m-100 10h10v-20h-10zm90 90h20v-10h-20zm0-190h20v-10h-20zm100 100h10v-20h-10z"
"m10 0v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
- const char* subtractSvg="m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z";
+ const char* const subtractSvg="m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z";
CPPUNIT_ASSERT_MESSAGE("cleared clip stays empty under union operation",
aUnion1.isCleared());
@@ -132,18 +132,17 @@ public:
{
tools::B2DClipState aMixedClip;
- const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
+ const char unionSvg[]="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z";
B2DPolyPolygon aTmp1;
- tools::importFromSvgD(
- aTmp1, OUString::createFromAscii(unionSvg), false, nullptr);
+ tools::importFromSvgD(aTmp1, unionSvg, false, nullptr);
aMixedClip.intersectPolyPolygon(aTmp1);
aMixedClip.subtractRange(B2DRange(-20,-150,20,0));
aMixedClip.subtractRange(B2DRange(-150,-20,0,20));
aMixedClip.xorRange(B2DRange(-150,-150,150,150));
- const char* mixedClipSvg="m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-20-20v-80h-80v80zm-130 170v-300h300v300z";
+ const char* const mixedClipSvg="m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-20-20v-80h-80v80zm-130 170v-300h300v300z";
verifyPoly("mixed clip", mixedClipSvg, aMixedClip);
}
diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx
index dde7afa..b16b19a 100644
--- a/basegfx/test/genericclipper.cxx
+++ b/basegfx/test/genericclipper.cxx
@@ -103,25 +103,25 @@ public:
void validateOr()
{
- const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 100v-50h-50v50z";
+ const char* const pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 100v-50h-50v50z";
validate("validateOr", pValid, &tools::solvePolygonOperationOr);
}
void validateXor()
{
- const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 100h20v-10h-20zm75 0v-50h-50v50z";
+ const char* const pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 100h20v-10h-20zm75 0v-50h-50v50z";
validate("validateXor", pValid, &tools::solvePolygonOperationXor);
}
void validateAnd()
{
- const char* pValid="m0 100v-10h20v10z";
+ const char* const pValid="m0 100v-10h20v10z";
validate("validateAnd", pValid, &tools::solvePolygonOperationAnd);
}
void validateDiff()
{
- const char* pValid="m0 90v-90h100v150h-75v-50h-5v-10zm75 10v-50h-50v50z";
+ const char* const pValid="m0 90v-90h100v150h-75v-50h-5v-10zm75 10v-50h-50v50z";
validate("validateDiff", pValid, &tools::solvePolygonOperationDiff);
}
commit 4e1d0357313a9bf55e78b9228dcf96c829c56855
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:12:16 2017 +0100
New loplugin:conststringvar: connectivity
Change-Id: I2c38bc842ee07d27a5a2ff084e8a608a858f4faa
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 97f8e33..c187256 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -84,13 +84,13 @@ void OCalcConnection::construct(const OUString& url,const Sequence< PropertyValu
m_aFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
m_sPassword.clear();
- const char* pPwd = "password";
+ const char pPwd[] = "password";
const PropertyValue *pIter = info.getConstArray();
const PropertyValue *pEnd = pIter + info.getLength();
for(;pIter != pEnd;++pIter)
{
- if(pIter->Name.equalsAscii(pPwd))
+ if(pIter->Name == pPwd)
{
pIter->Value >>= m_sPassword;
break;
diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx
index 9d21a97..a997517 100644
--- a/connectivity/source/drivers/evoab2/NConnection.cxx
+++ b/connectivity/source/drivers/evoab2/NConnection.cxx
@@ -75,13 +75,13 @@ void OEvoabConnection::construct(const OUString& url, const Sequence< PropertyVa
SAL_INFO("connectivity.evoab2", "OEvoabConnection::construct()::url = " << url );
OUString sPassword;
- const char* pPwd = "password";
+ const char pPwd[] = "password";
const PropertyValue *pIter = info.getConstArray();
const PropertyValue *pEnd = pIter + info.getLength();
for(;pIter != pEnd;++pIter)
{
- if(pIter->Name.equalsAscii(pPwd))
+ if(pIter->Name == pPwd)
{
pIter->Value >>= sPassword;
break;
diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx
index 03a9f48..87928d9 100644
--- a/connectivity/source/drivers/jdbc/Array.cxx
+++ b/connectivity/source/drivers/jdbc/Array.cxx
@@ -57,8 +57,8 @@ css::uno::Sequence< css::uno::Any > SAL_CALL java_sql_Array::getArray( const css
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;";
- static const char * cMethodName = "getArray";
+ static const char * const cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;";
+ static const char * const cMethodName = "getArray";
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
// submit Java-Call
@@ -75,8 +75,8 @@ css::uno::Sequence< css::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sa
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
- static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;";
- static const char * cMethodName = "getArray";
+ static const char * const cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;";
+ static const char * const cMethodName = "getArray";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -95,8 +95,8 @@ css::uno::Reference< css::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultS
// convert Parameter
jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
// initialize temporary variable
- static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getResultSet";
+ static const char * const cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
+ static const char * const cMethodName = "getResultSet";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -115,8 +115,8 @@ css::uno::Reference< css::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultS
// convert parameter
jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap);
// initialize temporary variable
- static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getResultSetAtIndex";
+ static const char * const cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;";
+ static const char * const cMethodName = "getResultSetAtIndex";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx
index 7c972bc..9ec6631 100644
--- a/connectivity/source/drivers/jdbc/Blob.cxx
+++ b/connectivity/source/drivers/jdbc/Blob.cxx
@@ -55,8 +55,8 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(css::sdbc::SQLException, css:
{
// initialize temporary variable
- static const char * cSignature = "()J";
- static const char * cMethodName = "length";
+ static const char * const cSignature = "()J";
+ static const char * const cMethodName = "length";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -72,8 +72,8 @@ css::uno::Sequence< sal_Int8 > SAL_CALL java_sql_Blob::getBytes( sal_Int64 pos,
css::uno::Sequence< sal_Int8 > aSeq;
{
// initialize temporary variable
- static const char * cSignature = "(JI)[B";
- static const char * cMethodName = "getBytes";
+ static const char * const cSignature = "(JI)[B";
+ static const char * const cMethodName = "getBytes";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -107,8 +107,8 @@ sal_Int64 SAL_CALL java_sql_Blob::position( const css::uno::Sequence< sal_Int8 >
{
// initialize temporary variable
- static const char * cSignature = "([BI)J";
- static const char * cMethodName = "position";
+ static const char * const cSignature = "([BI)J";
+ static const char * const cMethodName = "position";
// submit Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx
index 9a1aa1f..c74ae78 100644
--- a/connectivity/source/drivers/jdbc/CallableStatement.cxx
+++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx
@@ -212,8 +212,8 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame
createStatement(t.pEnv);
// initialize temporary variable
- static const char * cSignature = "(IILjava/lang/String;)V";
- static const char * cMethodName = "registerOutParameter";
+ static const char * const cSignature = "(IILjava/lang/String;)V";
+ static const char * const cMethodName = "registerOutParameter";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -232,8 +232,8 @@ void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32
{
createStatement(t.pEnv);
// initialize temporary variable
- static const char * cSignature = "(III)V";
- static const char * cMethodName = "registerOutParameter";
+ static const char * const cSignature = "(III)V";
+ static const char * const cMethodName = "registerOutParameter";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -321,7 +321,7 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
if( t.pEnv && !object ){
// initialize temporary variable
- static const char * cMethodName = "prepareCall";
+ static const char * const cMethodName = "prepareCall";
// execute Java-Call
jobject out = nullptr;
// convert Parameter
@@ -330,7 +330,7 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
+ static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;";
mID = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
}
if( mID ){
@@ -338,7 +338,7 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/)
} //mID
else
{
- static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
+ static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/CallableStatement;";
static jmethodID mID2 = t.pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
if( mID2 ){
out = t.pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, str.get() );
diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx
index 9bbbed1..44424c9 100644
--- a/connectivity/source/drivers/jdbc/Clob.cxx
+++ b/connectivity/source/drivers/jdbc/Clob.cxx
@@ -54,8 +54,8 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(css::sdbc::SQLException, css:
{
// initialize temporary variable
- static const char * cSignature = "()J";
- static const char * cMethodName = "length";
+ static const char * const cSignature = "()J";
+ static const char * const cMethodName = "length";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -71,8 +71,8 @@ OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 subStrin
OUString aStr;
{
// initialize temporary variable
- static const char * cSignature = "(JI)Ljava/lang/String;";
- static const char * cMethodName = "getSubString";
+ static const char * const cSignature = "(JI)Ljava/lang/String;";
+ static const char * const cMethodName = "getSubString";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -104,8 +104,8 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const OUString& searchstr, sal_Int32
// convert Parameter
args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr);
// initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;I)J";
- static const char * cMethodName = "position";
+ static const char * const cSignature = "(Ljava/lang/String;I)J";
+ static const char * const cMethodName = "position";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index 741e4db..acc0974 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -105,7 +105,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns(
Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const Sequence< OUString >& _types ) throw(SQLException, RuntimeException, std::exception)
{
- static const char * cMethodName = "getTables";
+ static const char * const cMethodName = "getTables";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
@@ -113,7 +113,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -334,7 +334,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
const Any& catalog, const OUString& schema, const OUString& table,
sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException, std::exception)
{
- static const char * cMethodName = "getIndexInfo";
+ static const char * const cMethodName = "getIndexInfo";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
@@ -342,7 +342,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo(
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -375,7 +375,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier
const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
sal_Bool nullable ) throw(SQLException, RuntimeException, std::exception)
{
- static const char * cMethodName = "getBestRowIdentifier";
+ static const char * const cMethodName = "getBestRowIdentifier";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
@@ -383,7 +383,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)Ljava/sql/ResultSet;";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)Ljava/sql/ResultSet;";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -492,13 +492,13 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference(
const OUString& primaryTable, const Any& foreignCatalog,
const OUString& foreignSchema, const OUString& foreignTable ) throw(SQLException, RuntimeException, std::exception)
{
- static const char * cMethodName = "getCrossReference";
+ static const char * const cMethodName = "getCrossReference";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName );
jobject out(nullptr);
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -990,7 +990,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames( ) t
sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException, std::exception)
{
- static const char* pMethodName = "supportsConvert";
+ static const char* const pMethodName = "supportsConvert";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, fromType, toType );
jboolean out( false );
@@ -1332,7 +1332,7 @@ sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 se
sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException, std::exception)
{
- static const char* pMethodName = "supportsResultSetConcurrency";
+ static const char* const pMethodName = "supportsResultSetConcurrency";
m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, pMethodName, setType, concurrency );
jboolean out( false );
@@ -1418,8 +1418,8 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs(
{
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;";
- static const char * cMethodName = "getUDTs";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;";
+ static const char * const cMethodName = "getUDTs";
// dismiss Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx
index d64870e..c63a1e4 100644
--- a/connectivity/source/drivers/jdbc/InputStream.cxx
+++ b/connectivity/source/drivers/jdbc/InputStream.cxx
@@ -87,8 +87,8 @@ sal_Int32 SAL_CALL java_io_InputStream::readBytes( css::uno::Sequence< sal_Int8
{
jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead);
- static const char * cSignature = "([BII)I";
- static const char * cMethodName = "read";
+ static const char * const cSignature = "([BII)I";
+ static const char * const cMethodName = "read";
// execute Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwRuntime(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/JBigDecimal.cxx b/connectivity/source/drivers/jdbc/JBigDecimal.cxx
index 24abdb8..8263225 100644
--- a/connectivity/source/drivers/jdbc/JBigDecimal.cxx
+++ b/connectivity/source/drivers/jdbc/JBigDecimal.cxx
@@ -45,7 +45,7 @@ java_math_BigDecimal::java_math_BigDecimal( const OUString& _par0 ): java_lang_O
return;
// Java-Call for the Constructor
// initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)V";
+ static const char * const cSignature = "(Ljava/lang/String;)V";
jobject tempObj;
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, "<init>",cSignature, mID);
@@ -66,7 +66,7 @@ java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Obj
return;
// Java-Call for the Constructor
// initialize temporary Variable
- static const char * cSignature = "(D)V";
+ static const char * const cSignature = "(D)V";
jobject tempObj;
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, "<init>",cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 76450d8..b311573 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -536,8 +536,8 @@ OUString SAL_CALL java_sql_Connection::nativeSQL( const OUString& sql ) throw(SQ
{
// initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)Ljava/lang/String;";
- static const char * cMethodName = "nativeSQL";
+ static const char * const cSignature = "(Ljava/lang/String;)Ljava/lang/String;";
+ static const char * const cMethodName = "nativeSQL";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -810,8 +810,8 @@ bool java_sql_Connection::construct(const OUString& url,
if ( t.pEnv && m_Driver_theClass && m_pDriverobject )
{
// Java-Call
- static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
- static const char * cMethodName = "connect";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;";
+ static const char * const cMethodName = "connect";
jmethodID mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature );
if ( mID )
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index bf405a5..9154c5c 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -226,8 +226,8 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const OUString& sql ) throw(
createStatement(t.pEnv);
m_sSqlStatement = sql;
// initialize temporary Variable
- static const char * cSignature = "(Ljava/lang/String;)Z";
- static const char * cMethodName = "execute";
+ static const char * const cSignature = "(Ljava/lang/String;)Z";
+ static const char * const cMethodName = "execute";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -261,8 +261,8 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const OU
createStatement(t.pEnv);
m_sSqlStatement = sql;
// initialize temporary variable
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/ResultSet;";
- static const char * cMethodName = "executeQuery";
+ static const char * const cSignature = "(Ljava/lang/String;)Ljava/sql/ResultSet;";
+ static const char * const cMethodName = "executeQuery";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -773,13 +773,13 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv)
if( _pEnv && !object ){
// initialize temporary variable
- static const char * cMethodName = "createStatement";
+ static const char * const cMethodName = "createStatement";
// Java-Call
jobject out = nullptr;
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(II)Ljava/sql/Statement;";
+ static const char * const cSignature = "(II)Ljava/sql/Statement;";
mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
}
if( mID ){
@@ -787,7 +787,7 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv)
} //mID
else
{
- static const char * cSignature2 = "()Ljava/sql/Statement;";
+ static const char * const cSignature2 = "()Ljava/sql/Statement;";
static jmethodID mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID2,"Unknown method id!");
if( mID2 ){
out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2);
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 1762c62..526cda6 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -127,8 +127,8 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{ // initialize temporary Variable
createStatement(t.pEnv);
- static const char * cSignature = "(ILjava/lang/String;)V";
- static const char * cMethodName = "setString";
+ static const char * const cSignature = "(ILjava/lang/String;)V";
+ static const char * const cMethodName = "setString";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -328,8 +328,8 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter
createStatement(t.pEnv);
// initialize temporary Variable
- static const char * cSignature = "(ILjava/lang/Object;II)V";
- static const char * cMethodName = "setObject";
+ static const char * const cSignature = "(ILjava/lang/Object;II)V";
+ static const char * const cMethodName = "setObject";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -427,8 +427,8 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co
createStatement(t.pEnv);
// initialize temporary Variable
- static const char * cSignature = "(I[B)V";
- static const char * cMethodName = "setBytes";
+ static const char * const cSignature = "(I[B)V";
+ static const char * const cMethodName = "setBytes";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -461,8 +461,8 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
createStatement(t.pEnv);
// initialize temporary variable
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "setCharacterStream";
+ static const char * const cSignature = "(ILjava/io/InputStream;I)V";
+ static const char * const cMethodName = "setCharacterStream";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -491,7 +491,7 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
if ( !mID2 )
{
// initialize temporary variable
- const char * cSignatureStream = "([BII)V";
+ const char * const cSignatureStream = "([BII)V";
mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
}
jobject tempObj = nullptr;
@@ -518,8 +518,8 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
{
createStatement(t.pEnv);
// initialize temporary variable
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "setBinaryStream";
+ static const char * const cSignature = "(ILjava/io/InputStream;I)V";
+ static const char * const cMethodName = "setBinaryStream";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -550,7 +550,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
if ( !mID2 )
{
// initialize temporary variable
- const char * cSignatureStream = "([BII)V";
+ const char * const cSignatureStream = "([BII)V";
mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream );
}
jobject tempObj = nullptr;
@@ -656,7 +656,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
if( !object && _pEnv ){
// initialize temporary variable
- static const char * cMethodName = "prepareStatement";
+ static const char * const cMethodName = "prepareStatement";
jvalue args[1];
// convert Parameter
@@ -666,7 +666,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;";
+ static const char * const cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;";
mID = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature );
}
if( mID )
@@ -678,7 +678,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
static jmethodID mID2 = nullptr;
if ( !mID2 )
{
- static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
+ static const char * const cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );
}
if ( mID2 )
diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx
index 2f39150..13ab238 100644
--- a/connectivity/source/drivers/jdbc/Reader.cxx
+++ b/connectivity/source/drivers/jdbc/Reader.cxx
@@ -82,8 +82,8 @@ sal_Int32 SAL_CALL java_io_Reader::available( ) throw(css::io::NotConnectedExce
SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!");
{
- static const char * cSignature = "()Z";
- static const char * cMethodName = "ready";
+ static const char * const cSignature = "()Z";
+ static const char * const cMethodName = "ready";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwRuntime(t.pEnv, cMethodName,cSignature, mID);
@@ -133,8 +133,8 @@ sal_Int32 SAL_CALL java_io_Reader::readBytes( css::uno::Sequence< sal_Int8 >& aD
{
jcharArray pCharArray = t.pEnv->NewCharArray(nCharsToRead);
- static const char * cSignature = "([CII)I";
- static const char * cMethodName = "read";
+ static const char * const cSignature = "([CII)I";
+ static const char * const cMethodName = "read";
// Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwRuntime(t.pEnv, cMethodName,cSignature, mID);
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index e8133d3..3550d73 100644
--- a/connectivity/source/drivers/jdbc/ResultSet.cxx
+++ b/connectivity/source/drivers/jdbc/ResultSet.cxx
@@ -301,8 +301,8 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(I)Ljava/lang/Object;";
- static const char * cMethodName = "getObject";
+ static const char * const cSignature = "(I)Ljava/lang/Object;";
+ static const char * const cMethodName = "getObject";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
@@ -627,8 +627,8 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const OUS
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(ILjava/lang/String;)V";
- static const char * cMethodName = "updateString";
+ static const char * const cSignature = "(ILjava/lang/String;)V";
+ static const char * const cMethodName = "updateString";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
@@ -653,8 +653,8 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const css:
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(I[B)V";
- static const char * cMethodName = "updateBytes";
+ static const char * const cSignature = "(I[B)V";
+ static const char * const cMethodName = "updateBytes";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
@@ -715,8 +715,8 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(ILjava/io/InputStream;I)V";
- static const char * cMethodName = "updateBinaryStream";
+ static const char * const cSignature = "(ILjava/io/InputStream;I)V";
+ static const char * const cMethodName = "updateBinaryStream";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
@@ -746,8 +746,8 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex,
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(ILjava/io/Reader;I)V";
- static const char * cMethodName = "updateCharacterStream";
+ static const char * const cSignature = "(ILjava/io/Reader;I)V";
+ static const char * const cMethodName = "updateCharacterStream";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
@@ -793,8 +793,8 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(ILjava/lang/Object;I)V";
- static const char * cMethodName = "updateObject";
+ static const char * const cSignature = "(ILjava/lang/Object;I)V";
+ static const char * const cMethodName = "updateObject";
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
}
diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx
index e6a99e0..1c8039e 100644
--- a/connectivity/source/drivers/jdbc/Timestamp.cxx
+++ b/connectivity/source/drivers/jdbc/Timestamp.cxx
@@ -46,7 +46,7 @@ java_sql_Date::java_sql_Date( const css::util::Date& _rOut ) : java_util_Date( n
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Date;";
+ static const char * const cSignature = "(Ljava/lang/String;)Ljava/sql/Date;";
mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );
}
OSL_ENSURE(mID,"Unknown method id!");
@@ -115,7 +115,7 @@ java_sql_Time::java_sql_Time( const css::util::Time& _rOut ): java_util_Date( nu
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Time;";
+ static const char * const cSignature = "(Ljava/lang/String;)Ljava/sql/Time;";
mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );
}
OSL_ENSURE(mID,"Unknown method id!");
@@ -171,7 +171,7 @@ java_sql_Timestamp::java_sql_Timestamp(const css::util::DateTime& _rOut)
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Timestamp;";
+ static const char * const cSignature = "(Ljava/lang/String;)Ljava/sql/Timestamp;";
mID = t.pEnv->GetStaticMethodID( getMyClass(), "valueOf", cSignature );
}
OSL_ENSURE(mID,"Unknown method id!");
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 78e27dd..f1759cd 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -46,8 +46,8 @@ void java_util_Properties::setProperty(const OUString& key, const OUString& valu
args[0].l = convertwchar_tToJavaString(t.pEnv,key);
args[1].l = convertwchar_tToJavaString(t.pEnv,value);
// Initialize temporary Variables
- static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;";
- static const char * cMethodName = "setProperty";
+ static const char * const cSignature = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;";
+ static const char * const cMethodName = "setProperty";
// Turn off Java-Call
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, cMethodName,cSignature, mID);
@@ -82,7 +82,7 @@ java_util_Properties::java_util_Properties( ): java_lang_Object( nullptr, nullpt
return;
// Turn off Java-Call for the constructor
// Initialize temperary Variables
- static const char * cSignature = "()V";
+ static const char * const cSignature = "()V";
jobject tempObj;
static jmethodID mID(nullptr);
obtainMethodId_throwSQL(t.pEnv, "<init>",cSignature, mID);
@@ -212,7 +212,7 @@ jobject connectivity::createByteInputStream(const css::uno::Reference< css::io::
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "([B)V";
+ static const char * const cSignature = "([B)V";
mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
OSL_ENSURE( mID, cSignature );
if ( !mID )
@@ -239,7 +239,7 @@ jobject connectivity::createCharArrayReader(const css::uno::Reference< css::io::
static jmethodID mID(nullptr);
if ( !mID )
{
- static const char * cSignature = "([C)V";
+ static const char * const cSignature = "([C)V";
mID = t.pEnv->GetMethodID( clazz, "<init>", cSignature );
OSL_ENSURE( mID, cSignature );
if ( !mID )
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
index 65ba48c..a363aa2 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
@@ -110,7 +110,7 @@ namespace
else
{
OUString sProductDirCandidate;
- const char* pProfileRegistry = "profiles.ini";
+ const char pProfileRegistry[] = "profiles.ini";
// check all possible candidates
for ( size_t i=0; i<NB_CANDIDATES; ++i )
@@ -123,7 +123,7 @@ namespace
// check existence
::osl::DirectoryItem aRegistryItem;
- ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + OUString::createFromAscii( pProfileRegistry ), aRegistryItem );
+ ::osl::FileBase::RC result = ::osl::DirectoryItem::get( sProductDirCandidate + pProfileRegistry, aRegistryItem );
if ( result == ::osl::FileBase::E_None )
{
::osl::FileStatus aStatus( osl_FileStatus_Mask_Validate );
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index d809da7..27a931d 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -135,7 +135,7 @@ static ::cppu::IPropertyArrayHelper & getPreparedStatementPropertyArrayHelper()
static bool isOperator( char c )
{
- static const char * operators = "<>=()!/&%.,;";
+ static const char * const operators = "<>=()!/&%.,;";
const char * w = operators;
while (*w && *w != c)
commit 1f145776d815a8669dbf68e4e9b2e2e9176bb034
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:12:10 2017 +0100
New loplugin:conststringvar: desktop
Change-Id: Ib7b946fd033857d7b1b436ac478c1a9ecfccaa0d
diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx
index df8a30f..91950c4 100644
--- a/desktop/source/migration/services/wordbookmigration.cxx
+++ b/desktop/source/migration/services/wordbookmigration.cxx
@@ -112,7 +112,7 @@ bool IsUserWordbook( const OUString& rFile )
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( OUString(rFile), StreamMode::STD_READ );
if ( pStream && !pStream->GetError() )
{
- static const sal_Char* pVerOOo7 = "OOoUserDict1";
+ static const sal_Char* const pVerOOo7 = "OOoUserDict1";
sal_uInt64 const nSniffPos = pStream->Tell();
static std::size_t nVerOOo7Len = sal::static_int_cast< std::size_t >(strlen( pVerOOo7 ));
sal_Char pMagicHeader[MAX_HEADER_LENGTH];
commit 0731f13cb9e272d8a8d4ea172d9eb8a7608d990d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:12:03 2017 +0100
New loplugin:conststringvar: filter
Change-Id: Ic20fc4966ed1a68bff4f9c68debd603145a89321
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c7d31c4..80e09f9 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4283,7 +4283,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
{ // to store a animation, a gif has to be included into the msOG chunk of a png #I5583#
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
SvMemoryStream aGIFStream;
- const char* pString = "MSOFFICE9.0";
+ const char* const pString = "MSOFFICE9.0";
aGIFStream.WriteBytes(pString, strlen(pString));
nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aGIFStream,
rFilter.GetExportFormatNumberForShortName( "GIF" ) );
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 651e94b..dd11def 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2743,7 +2743,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem
bRotateTextWithShape = true; // using the correct xml default
const char* pArry = reinterpret_cast< char* >( aSeq.getArray() );
- const char* pUpright = "upright=";
+ const char* const pUpright = "upright=";
const char* pEnd = pArry + nBytesRead;
const char* pPtr = pArry;
while( ( pPtr + 12 ) < pEnd )
commit 0680fc5195287648793f4d0a4d54b3c9b655d5d3
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:57 2017 +0100
New loplugin:conststringvar: helpcompiler
Change-Id: Iaf9cedae10b9bc04353d175778ff68cb38fdb409
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index cfff46a..3c992be 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -206,7 +206,7 @@ namespace URLEncoder
{
static std::string encode(const std::string &rIn)
{
- const char *good = "!$&'()*+,-.=@_";
+ const char * const good = "!$&'()*+,-.=@_";
static const char hex[17] = "0123456789ABCDEF";
std::string result;
commit 3b4a35762e47d944ce004cf1a5a2d84fbc78979f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:47 2017 +0100
New loplugin:conststringvar: i18nlangtag
Change-Id: I261755055109430e6e8974efc57cc82fce8fd28a
diff --git a/i18nlangtag/source/isolang/inunx.cxx b/i18nlangtag/source/isolang/inunx.cxx
index cf0e5f4..46b5e5b 100644
--- a/i18nlangtag/source/isolang/inunx.cxx
+++ b/i18nlangtag/source/isolang/inunx.cxx
@@ -42,7 +42,7 @@ static LanguageType nImplSystemUILanguage = LANGUAGE_DONTKNOW;
// Get locale of category LC_CTYPE of environment variables
static const sal_Char* getLangFromEnvironment()
{
- static const sal_Char* pFallback = "C";
+ static const sal_Char* const pFallback = "C";
const sal_Char *pLang = nullptr;
pLang = getenv ( "LC_ALL" );
@@ -60,7 +60,7 @@ static const sal_Char* getLangFromEnvironment()
// Get locale of category LC_MESSAGES of environment variables
static const sal_Char* getUILangFromEnvironment()
{
- static const sal_Char* pFallback = "C";
+ static const sal_Char* const pFallback = "C";
const sal_Char *pLang = nullptr;
pLang = getenv ( "LANGUAGE" ); // respect the GNU extension
commit 4eccdab6fca3b256caab59a7cc01d0c4e7f47183
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:39 2017 +0100
New loplugin:conststringvar: i18npool
Change-Id: Ic02549364d0499c453f88bda358c78fce7fc4343
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 1567859..35a3b2e 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -1030,11 +1030,11 @@ OUString SAL_CALL getCyrillicNativeNumberString(const OUString& aNumberString)
return aNumberString;
}
-static const sal_Char* implementationName = "com.sun.star.i18n.NativeNumberSupplier";
+static const sal_Char implementationName[] = "com.sun.star.i18n.NativeNumberSupplier";
OUString SAL_CALL NativeNumberSupplierService::getImplementationName() throw( RuntimeException, std::exception )
{
- return OUString::createFromAscii( implementationName );
+ return OUString(implementationName);
}
sal_Bool SAL_CALL
@@ -1046,7 +1046,7 @@ NativeNumberSupplierService::supportsService(const OUString& rServiceName) throw
Sequence< OUString > SAL_CALL
NativeNumberSupplierService::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
- Sequence< OUString > aRet { OUString::createFromAscii( implementationName ) };
+ Sequence< OUString > aRet {implementationName};
return aRet;
}
commit 03d9c3d67d062f23d58497f80932fa734122f857
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:30 2017 +0100
New loplugin:conststringvar: linguistic
Change-Id: Ia9bf537071df32879c7cc92744c12556025f82ff
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 5efe94f..401398e 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -59,9 +59,9 @@ using namespace linguistic;
#define MAX_HEADER_LENGTH 16
-static const sal_Char* pVerStr2 = "WBSWG2";
-static const sal_Char* pVerStr5 = "WBSWG5";
-static const sal_Char* pVerStr6 = "WBSWG6";
+static const sal_Char* const pVerStr2 = "WBSWG2";
+static const sal_Char* const pVerStr5 = "WBSWG5";
+static const sal_Char* const pVerStr6 = "WBSWG6";
static const sal_Char* pVerOOo7 = "OOoUserDict1";
static const sal_Int16 DIC_VERSION_DONTKNOW = -1;
commit 5f225f7f5d069088a9c2f70768f7506ccf3682af
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:22 2017 +0100
New loplugin:conststringvar: oox
Change-Id: Id27e8c51fe87cbe7fa45a68cbaa8196767473b93
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 1bdd683..621a1d0 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2880,7 +2880,7 @@ void ChartExport::_exportAxis(
|| ( nAxisType == XML_dateAx ) )
{
// FIXME: seems not support? use default value,
- const char* isAuto = "1";
+ const char* const isAuto = "1";
pFS->singleElement( FSNS( XML_c, XML_auto ),
XML_val, isAuto,
FSEND );
@@ -2888,7 +2888,7 @@ void ChartExport::_exportAxis(
if( nAxisType == XML_catAx )
{
// FIXME: seems not support? lblAlgn
- const char* sLblAlgn = "ctr";
+ const char* const sLblAlgn = "ctr";
pFS->singleElement( FSNS( XML_c, XML_lblAlgn ),
XML_val, sLblAlgn,
FSEND );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8befbca..262e8ee 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1408,8 +1408,8 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if( GETA( CharFontName ) )
{
- const char* pitch = nullptr;
- const char* charset = nullptr;
+ const char* const pitch = nullptr;
+ const char* const charset = nullptr;
OUString usTypeface;
mAny >>= usTypeface;
@@ -1424,8 +1424,8 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if( ( bComplex && GETAD( CharFontNameComplex ) ) || ( !bComplex && GETAD( CharFontNameAsian ) ) )
{
- const char* pitch = nullptr;
- const char* charset = nullptr;
+ const char* const pitch = nullptr;
+ const char* const charset = nullptr;
OUString usTypeface;
mAny >>= usTypeface;
commit 4d6353aa9dcebfb86a26428ad68c7b38b5837d38
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:17 2017 +0100
New loplugin:conststringvar: opencl
Change-Id: Ib5762151cff4c903c73ec8d487ec8fbe54a9255a
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 141ce8f..7b9d3ab 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -79,7 +79,7 @@ OString generateMD5(const void* pData, size_t length)
SAL_WARN_IF(aError != rtl_Digest_E_None, "opencl", "md5 generation failed");
OStringBuffer aBuffer;
- const char* pString = "0123456789ABCDEF";
+ const char* const pString = "0123456789ABCDEF";
for(sal_uInt8 val : pBuffer)
{
aBuffer.append(pString[val/16]);
commit 1bd9765a0b80b84ca4cd60a5ff32f05653411fa1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:10 2017 +0100
New loplugin:conststringvar: sal
Change-Id: Ia66415ff9ee67958e84cfff7eda082cdbfc9b9b9
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index b62bfad..17bf399 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -1687,7 +1687,7 @@ static bool storeProfile(osl_TProfileImpl* pProfile, bool bCleanup)
static osl_TFile* osl_openTmpProfileImpl(osl_TProfileImpl* pProfile)
{
osl_TFile* pFile=nullptr;
- sal_Char const * pszExtension = "tmp";
+ sal_Char const * const pszExtension = "tmp";
sal_Char pszTmpName[PATH_MAX];
oslProfileOption PFlags=0;
diff --git a/sal/qa/rtl/strings/test_oustring_compare.cxx b/sal/qa/rtl/strings/test_oustring_compare.cxx
index 5a0b2cb..d500e5c 100644
--- a/sal/qa/rtl/strings/test_oustring_compare.cxx
+++ b/sal/qa/rtl/strings/test_oustring_compare.cxx
@@ -45,9 +45,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION(test::oustring::Compare);
void test::oustring::Compare::equalsIgnoreAsciiCaseAscii()
{
- const char* abc = "abc";
- const char* abcd = "abcd";
- const char* empty = "";
+ const char* const abc = "abc";
+ const char* const abcd = "abcd";
+ const char* const empty = "";
CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAscii(abc));
CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAsciiL(abc,3));
CPPUNIT_ASSERT(!rtl::OUString("abc").
commit cffac9e59b2460e06ad6d781fa8f428a2a3b56bf
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:11:03 2017 +0100
New loplugin:conststringvar: sax
Change-Id: I110325963655391bb6223f132fcaab2b95f3c9e3
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 32e1ceb..7f2069b 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -44,11 +44,11 @@ using namespace ::com::sun::star::i18n;
namespace sax {
-static const sal_Char* gpsMM = "mm";
-static const sal_Char* gpsCM = "cm";
-static const sal_Char* gpsPT = "pt";
-static const sal_Char* gpsINCH = "in";
-static const sal_Char* gpsPC = "pc";
+static const sal_Char* const gpsMM = "mm";
+static const sal_Char* const gpsCM = "cm";
+static const sal_Char* const gpsPT = "pt";
+static const sal_Char* const gpsINCH = "in";
+static const sal_Char* const gpsPC = "pc";
const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 14;
commit 243ab6d5583bdc02de38d62753e1b31ca8c0d162
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:10:58 2017 +0100
New loplugin:conststringvar: sc
Change-Id: I5f353f8aaaa82f0f9dcb5af33320dbd7e4a8abb8
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index b6e8b40..c3e6741 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -42,7 +42,7 @@ using namespace css;
namespace
{
-const char* DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
+const char* const DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
class ScTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
{
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index f5e03c7..89025ef 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -1450,9 +1450,9 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange()
m_pDoc->InsertTab(0, "Test");
- const char* pName = "MyRange";
- const char* pExpr1 = "$Test.$A$1:$A$3";
- const char* pExpr2 = "$Test.$A$1:$A$4";
+ const char* const pName = "MyRange";
+ const char* const pExpr1 = "$Test.$A$1:$A$3";
+ const char* const pExpr2 = "$Test.$A$1:$A$4";
RangeNameDef aName;
aName.mpName = pName;
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 54ae0d1..4f8ac4d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -34,7 +34,7 @@
#define REDUCE_THRESHOLD 201 // set to 4 for correctness testing. priority 1
#define UNROLLING_FACTOR 16 // set to 4 for correctness testing (if no reduce)
-static const char* publicFunc =
+static const char* const publicFunc =
"\n"
"#define IllegalFPOperation 503 // #NUM!\n"
"#define NoValue 519 // #VALUE!\n"
diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx
index cbdd8a8..4d03712 100644
--- a/sc/source/filter/dif/difexp.cxx
+++ b/sc/source/filter/dif/difexp.cxx
@@ -84,12 +84,12 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
bContextOrNotAsciiEncoding = false;
}
- const sal_Char* p2DoubleQuotes_LF = "\"\"\n";
- const sal_Char* pSpecDataType_LF = "-1,0\n";
- const sal_Char* pEmptyData = "1,0\n\"\"\n";
- const sal_Char* pStringData = "1,0\n";
- const sal_Char* pNumData = "0,";
- const sal_Char* pNumDataERROR = "0,0\nERROR\n";
+ const sal_Char p2DoubleQuotes_LF[] = "\"\"\n";
+ const sal_Char pSpecDataType_LF[] = "-1,0\n";
+ const sal_Char pEmptyData[] = "1,0\n\"\"\n";
+ const sal_Char pStringData[] = "1,0\n";
+ const sal_Char pNumData[] = "0,";
+ const sal_Char pNumDataERROR[] = "0,0\nERROR\n";
OUStringBuffer aOS;
OUString aString;
@@ -119,7 +119,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
aOS.append("\n0,");
aOS.append(static_cast<sal_Int32>(nNumCols));
aOS.append('\n');
- aOS.appendAscii(p2DoubleQuotes_LF);
+ aOS.append(p2DoubleQuotes_LF);
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear());
// TUPLES
@@ -127,13 +127,13 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
aOS.append("\n0,");
aOS.append(static_cast<sal_Int32>(nNumRows));
aOS.append('\n');
- aOS.appendAscii(p2DoubleQuotes_LF);
+ aOS.append(p2DoubleQuotes_LF);
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear());
// DATA
aOS.append(pKeyDATA);
aOS.append("\n0,0\n");
- aOS.appendAscii(p2DoubleQuotes_LF);
+ aOS.append(p2DoubleQuotes_LF);
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear());
SCCOL nColCnt;
@@ -142,7 +142,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
for( nRowCnt = rRange.aStart.Row() ; nRowCnt <= nEndRow ; nRowCnt++ )
{
OSL_ASSERT(aOS.getLength() == 0);
- aOS.appendAscii(pSpecDataType_LF);
+ aOS.append(pSpecDataType_LF);
aOS.append(pKeyBOT);
aOS.append('\n');
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear());
@@ -155,10 +155,10 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
switch (aCell.meType)
{
case CELLTYPE_NONE:
- aOS.appendAscii(pEmptyData);
+ aOS.append(pEmptyData);
break;
case CELLTYPE_VALUE:
- aOS.appendAscii(pNumData);
+ aOS.append(pNumData);
pDoc->GetInputString( nColCnt, nRowCnt, nTab, aString );
aOS.append(aString);
aOS.append("\nV\n");
@@ -170,10 +170,10 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
break;
case CELLTYPE_FORMULA:
if (aCell.mpFormula->GetErrCode() != FormulaError::NONE)
- aOS.appendAscii(pNumDataERROR);
+ aOS.append(pNumDataERROR);
else if (aCell.mpFormula->IsValue())
{
- aOS.appendAscii(pNumData);
+ aOS.append(pNumData);
pDoc->GetInputString( nColCnt, nRowCnt, nTab, aString );
aOS.append(aString);
aOS.append("\nV\n");
@@ -198,7 +198,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
// needed just one more time..
OSL_ASSERT(aOS.getLength() == 0);
OUString aTmpStr = aString;
- aOS.appendAscii(pStringData);
+ aOS.append(pStringData);
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear(), eCharSet);
if ( eCharSet == RTL_TEXTENCODING_UNICODE )
{
@@ -258,7 +258,7 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc,
}
OSL_ASSERT(aOS.getLength() == 0);
- aOS.appendAscii(pSpecDataType_LF);
+ aOS.append(pSpecDataType_LF);
aOS.append(pKeyEOD);
aOS.append('\n');
rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear());
diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx
index 49250b5..24957ee 100644
--- a/sc/source/ui/unoobj/dispuno.cxx
+++ b/sc/source/ui/unoobj/dispuno.cxx
@@ -33,8 +33,8 @@
using namespace com::sun::star;
-static const char* cURLInsertColumns = ".uno:DataSourceBrowser/InsertColumns"; //data into text
-static const char* cURLDocDataSource = ".uno:DataSourceBrowser/DocumentDataSource";
+static const char cURLInsertColumns[] = ".uno:DataSourceBrowser/InsertColumns"; //data into text
+static const char cURLDocDataSource[] = ".uno:DataSourceBrowser/DocumentDataSource";
static uno::Reference<view::XSelectionSupplier> lcl_GetSelectionSupplier( SfxViewShell* pViewShell )
{
@@ -98,8 +98,8 @@ uno::Reference<frame::XDispatch> SAL_CALL ScDispatchProviderInterceptor::queryDi
uno::Reference<frame::XDispatch> xResult;
// create some dispatch ...
if ( pViewShell && (
- aURL.Complete.equalsAscii(cURLInsertColumns) ||
- aURL.Complete.equalsAscii(cURLDocDataSource) ) )
+ aURL.Complete == cURLInsertColumns ||
+ aURL.Complete == cURLDocDataSource ) )
{
if (!m_xMyDispatch.is())
m_xMyDispatch = new ScDispatch( pViewShell );
@@ -221,7 +221,7 @@ void SAL_CALL ScDispatch::dispatch( const util::URL& aURL,
SolarMutexGuard aGuard;
bool bDone = false;
- if ( pViewShell && aURL.Complete.equalsAscii(cURLInsertColumns) )
+ if ( pViewShell && aURL.Complete == cURLInsertColumns )
{
ScViewData& rViewData = pViewShell->GetViewData();
ScAddress aPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
@@ -277,7 +277,7 @@ void SAL_CALL ScDispatch::addStatusListener(
aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
aEvent.FeatureURL = aURL;
- if ( aURL.Complete.equalsAscii(cURLDocDataSource) )
+ if ( aURL.Complete == cURLDocDataSource )
{
aDataSourceListeners.push_back( uno::Reference<frame::XStatusListener>( xListener ) );
@@ -306,7 +306,7 @@ void SAL_CALL ScDispatch::removeStatusListener(
{
SolarMutexGuard aGuard;
- if ( aURL.Complete.equalsAscii(cURLDocDataSource) )
+ if ( aURL.Complete == cURLDocDataSource )
{
sal_uInt16 nCount = aDataSourceListeners.size();
for ( sal_uInt16 n=nCount; n--; )
@@ -352,7 +352,7 @@ void SAL_CALL ScDispatch::selectionChanged( const css::lang::EventObject& /* aEv
{
frame::FeatureStateEvent aEvent;
aEvent.Source.set(static_cast<cppu::OWeakObject*>(this));
- aEvent.FeatureURL.Complete = OUString::createFromAscii( cURLDocDataSource );
+ aEvent.FeatureURL.Complete = cURLDocDataSource;
lcl_FillDataSource( aEvent, aNewImport ); // modifies State, IsEnabled
commit 86215f8c6ba6bc3a83375ea362a608f4f1bcfbe5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:10:53 2017 +0100
New loplugin:conststringvar: scaddins
Change-Id: I14b74d90fabaa288f412ebb63a10c07de824f0f3
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 80c2736..c7b4843 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -715,7 +715,7 @@ double ConvertToDec( const OUString& aStr, sal_uInt16 nBase, sal_uInt16 nCharLim
static inline sal_Char GetMaxChar( sal_uInt16 nBase )
{
- const sal_Char* c = "--123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ const sal_Char* const c = "--123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
return c[ nBase ];
}
commit 5637e56cc68b36c9a9484580e9053cca5c04a771
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:10:42 2017 +0100
New loplugin:conststringvar: sd
Change-Id: I7aa74260f1456a22bae368738e3947ead1ecc7be
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 7eb13a8..58dc9e6 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -45,7 +45,7 @@
using namespace css;
-static const char* DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
+static const char* const DATA_DIRECTORY = "/sd/qa/unit/tiledrendering/data/";
class SdTiledRenderingTest : public SdModelTestBase, public XmlTestTools
{
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 56fa197..9c62a04 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -2239,7 +2239,7 @@ OUString const & HtmlExport::getDocumentTitle()
return mDocTitle;
}
-static const char* JS_NavigateAbs =
+static const char JS_NavigateAbs[] =
"function NavigateAbs( nPage )\r\n"
"{\r\n"
" frames[\"show\"].location.href = \"img\" + nPage + \".$EXT\";\r\n"
@@ -2259,7 +2259,7 @@ static const char* JS_NavigateAbs =
" }\r\n"
"}\r\n\r\n";
-static const char* JS_NavigateRel =
+static const char JS_NavigateRel[] =
"function NavigateRel( nDelta )\r\n"
"{\r\n"
" var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n"
@@ -2269,14 +2269,14 @@ static const char* JS_NavigateRel =
" }\r\n"
"}\r\n\r\n";
-static const char* JS_ExpandOutline =
+static const char JS_ExpandOutline[] =
"function ExpandOutline()\r\n"
"{\r\n"
" frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n"
" frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n"
"}\r\n\r\n";
-static const char * JS_CollapseOutline =
+static const char JS_CollapseOutline[] =
"function CollapseOutline()\r\n"
"{\r\n"
" frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n"
@@ -2304,7 +2304,7 @@ bool HtmlExport::CreateFrames()
aStr.append(OUString::number(mnSdPageCount));
aStr.append(";\r\n\r\n");
- OUString aFunction = OUString::createFromAscii(JS_NavigateAbs);
+ OUString aFunction = JS_NavigateAbs;
if(mbNotes)
{
@@ -2316,17 +2316,17 @@ bool HtmlExport::CreateFrames()
aFunction = aFunction.replaceAll(aPlaceHolder, maHTMLExtension);
aStr.append(aFunction);
- aTmp = OUString::createFromAscii(JS_NavigateRel);
+ aTmp = JS_NavigateRel;
aTmp = aTmp.replaceAll(aPlaceHolder, maHTMLExtension);
aStr.append(aTmp);
if(mbImpress)
{
- aTmp = OUString::createFromAscii(JS_ExpandOutline);
+ aTmp = JS_ExpandOutline;
aTmp = aTmp.replaceAll(aPlaceHolder, maHTMLExtension);
aStr.append(aTmp);
- aTmp = OUString::createFromAscii(JS_CollapseOutline);
+ aTmp = JS_CollapseOutline;
aTmp = aTmp.replaceAll(aPlaceHolder, maHTMLExtension);
aStr.append(aTmp);
}
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 3002160..d515911 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -219,7 +219,7 @@ getBluez5Adapter(DBusConnection *pConnection)
if (!pMsg)
return nullptr;
- const gchar* pInterfaceType = "org.bluez.Adapter1";
+ const gchar* const pInterfaceType = "org.bluez.Adapter1";
pMsg = sendUnrefAndWaitForReply( pConnection, pMsg );
diff --git a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
index d85f257..722f4f9 100644
--- a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
+++ b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
@@ -21,7 +21,7 @@
// for numbers see:
// https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
-static const char *bluetooth_service_record =
+static const char * const bluetooth_service_record =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<record>"
"<attribute id=\"0x0001\">" // Service class ID list
commit 0999f6469ee5ce148f2f81b26fc703a3ff65a101
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:10:38 2017 +0100
New loplugin:conststringvar: sdext
Change-Id: I2452ef62e34b1837048ab79bde07660a50b6dec9
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index 1d03e1a..f651ff8 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -229,9 +229,9 @@ namespace
CPPUNIT_ASSERT_MESSAGE( "Line width is 0",
rtl::math::approxEqual(rContext.LineWidth, 28.3) );
- const char* sExportString = "m53570 7650-35430 24100";
+ const char sExportString[] = "m53570 7650-35430 24100";
CPPUNIT_ASSERT_MESSAGE( "Stroke is m535.7 518.5-354.3-241",
- basegfx::tools::exportToSvgD( aPath, true, true, false ).equalsAscii(sExportString) );
+ basegfx::tools::exportToSvgD( aPath, true, true, false ) == sExportString );
m_bGreenStrokeSeen = true;
}
@@ -251,9 +251,9 @@ namespace
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Line width is 0",
0, rContext.LineWidth, 0.0000001 );
- const char* sExportString = "m49890 5670.00000000001-35430 24090";
+ const char sExportString[] = "m49890 5670.00000000001-35430 24090";
CPPUNIT_ASSERT_MESSAGE( "Stroke is m49890 5670.00000000001-35430 24090",
- basegfx::tools::exportToSvgD( aPath, true, true, false ).equalsAscii(sExportString) );
+ basegfx::tools::exportToSvgD( aPath, true, true, false ) == sExportString );
m_bDashedLineSeen = true;
}
@@ -308,10 +308,10 @@ namespace
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Font id is 0",
(sal_Int32) 0, rContext.FontId );
- const char* sExportString = "m12050 49610c-4310 0-7800-3490-7800-7800 0-4300 "
+ const char sExportString[] = "m12050 49610c-4310 0-7800-3490-7800-7800 0-4300 "
"3490-7790 7800-7790 4300 0 7790 3490 7790 7790 0 4310-3490 7800-7790 7800z";
CPPUNIT_ASSERT_MESSAGE( "Stroke is a 4-bezier circle",
- basegfx::tools::exportToSvgD( aPath, true, true, false ).equalsAscii(sExportString) );
+ basegfx::tools::exportToSvgD( aPath, true, true, false ) == sExportString );
m_bRedCircleSeen = true;
}
commit 92b58a275341a1696257804cac85a2c33a71c1d5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Jan 10 08:10:31 2017 +0100
New loplugin:conststringvar: sfx2
Change-Id: I287d338711a15fb53f4653b6475191099b8379e1
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index e992cc9..6586e79 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -113,10 +113,9 @@ static OUString const & HelpLocaleString()
{
OUString aBaseInstallPath;
utl::Bootstrap::locateBaseInstallation(aBaseInstallPath);
- static const char *szHelpPath = "/help/";
+ static const char szHelpPath[] = "/help/";
- OUString sHelpPath = aBaseInstallPath +
- OUString::createFromAscii(szHelpPath) + aLocaleStr;
+ OUString sHelpPath = aBaseInstallPath + szHelpPath + aLocaleStr;
osl::DirectoryItem aDirItem;
if (osl::DirectoryItem::get(sHelpPath, aDirItem) != osl::FileBase::E_None)
@@ -128,8 +127,7 @@ static OUString const & HelpLocaleString()
{
bOk = true;
sLang = sLang.copy( 0, nSepPos );
- sHelpPath = aBaseInstallPath +
- OUString::createFromAscii(szHelpPath) + sLang;
+ sHelpPath = aBaseInstallPath + szHelpPath + sLang;
if (osl::DirectoryItem::get(sHelpPath, aDirItem) != osl::FileBase::E_None)
bOk = false;
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 3bd5fd5..db67f94 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -458,10 +458,10 @@ const char* s_stdMetaList[] = {
nullptr
};
-const char* s_nsXLink = "http://www.w3.org/1999/xlink";
-const char* s_nsDC = "http://purl.org/dc/elements/1.1/";
-const char* s_nsODF = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
-const char* s_nsODFMeta = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0";
+const char s_nsXLink[] = "http://www.w3.org/1999/xlink";
+const char s_nsDC[] = "http://purl.org/dc/elements/1.1/";
+const char s_nsODF[] = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
+const char s_nsODFMeta[] = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0";
// const char* s_nsOOo = "http://openoffice.org/2004/office"; // not used (yet?)
static const char s_meta [] = "meta.xml";
@@ -1123,10 +1123,10 @@ void SAL_CALL SfxDocumentMetaData::init(
m_xDoc = i_xDoc;
// select nodes for standard meta data stuff
- xPath->registerNS("xlink", OUString::createFromAscii(s_nsXLink));
- xPath->registerNS("dc", OUString::createFromAscii(s_nsDC));
- xPath->registerNS("office", OUString::createFromAscii(s_nsODF));
- xPath->registerNS("meta", OUString::createFromAscii(s_nsODFMeta));
+ xPath->registerNS("xlink", s_nsXLink);
+ xPath->registerNS("dc", s_nsDC);
+ xPath->registerNS("office", s_nsODF);
+ xPath->registerNS("meta", s_nsODFMeta);
// NB: we do not handle the single-XML-file ODF variant, which would
// have the root element office:document.
// The root of such documents must be converted in the importer!
@@ -1149,7 +1149,7 @@ void SAL_CALL SfxDocumentMetaData::init(
while (xNode.is()) {
if (css::xml::dom::NodeType_ELEMENT_NODE ==xNode->getNodeType())
{
- if ( xNode->getNamespaceURI().equalsAscii(s_nsODF) && xNode->getLocalName() == "document-meta" )
+ if ( xNode->getNamespaceURI() == s_nsODF && xNode->getLocalName() == "document-meta" )
{
xRElem.set(xNode, css::uno::UNO_QUERY_THROW);
break;
@@ -1168,20 +1168,15 @@ void SAL_CALL SfxDocumentMetaData::init(
}
if (!xRElem.is()) {
xRElem = i_xDoc->createElementNS(
- OUString::createFromAscii(s_nsODF),
- "office:document-meta");
+ s_nsODF, "office:document-meta");
css::uno::Reference<css::xml::dom::XNode> xRNode(xRElem,
css::uno::UNO_QUERY_THROW);
i_xDoc->appendChild(xRNode);
}
- xRElem->setAttributeNS(OUString::createFromAscii(s_nsODF),
- "office:version",
- "1.0");
+ xRElem->setAttributeNS(s_nsODF, "office:version", "1.0");
// does not exist, otherwise m_xParent would not be null
css::uno::Reference<css::xml::dom::XNode> xParent (
- i_xDoc->createElementNS(
- OUString::createFromAscii(s_nsODF),
- "office:meta"),
+ i_xDoc->createElementNS(s_nsODF, "office:meta"),
css::uno::UNO_QUERY_THROW);
xRElem->appendChild(xParent);
m_xParent = xParent;
@@ -1248,12 +1243,8 @@ void SAL_CALL SfxDocumentMetaData::init(
css::uno::Reference<css::xml::dom::XElement> xElem(*it,
css::uno::UNO_QUERY_THROW);
css::uno::Any any;
- OUString name = xElem->getAttributeNS(
- OUString::createFromAscii(s_nsODFMeta),
- "name");
- OUString type = xElem->getAttributeNS(
- OUString::createFromAscii(s_nsODFMeta),
- "value-type");
+ OUString name = xElem->getAttributeNS(s_nsODFMeta, "name");
+ OUString type = xElem->getAttributeNS(s_nsODFMeta, "value-type");
OUString text = getNodeText(*it);
if ( type == "float" ) {
double d;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index acac122..cc39d02 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -280,7 +280,7 @@ const OUString GetWindowClassification(const vcl::Window* pWindow)
void Deck::PrintWindowSubTree(vcl::Window* pRoot, int nIndentation)
{
- static const char* sIndentation = " ";
+ static const char* const sIndentation = " ";
const Point aLocation (pRoot->GetPosPixel());
const Size aSize (pRoot->GetSizePixel());
SAL_INFO(
commit 172257062881dab61b71367c8be31460e9b26cc9
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list