comphelper/source/streaming/basicio.cxx | 4 compilerplugins/clang/implicitboolconversion.cxx | 37 - compilerplugins/clang/salbool.cxx | 50 ++ compilerplugins/clang/typecheck.cxx | 16 compilerplugins/clang/typecheck.hxx | 2 editeng/source/uno/unotext2.cxx | 2 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 35 - forms/source/component/Grid.cxx | 4 sal/osl/unx/file_url.cxx | 35 + sal/qa/osl/profile/osl_old_testprofile.cxx | 2 sal/rtl/uri.cxx | 202 ++++++---- sc/source/ui/unoobj/cellsuno.cxx | 2 stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 47 +- svtools/source/misc/transfer.cxx | 2 svx/source/accessibility/AccessibleShape.cxx | 2 svx/source/accessibility/charmapacc.cxx | 2 sw/source/core/access/accnotextframe.cxx | 2 toolkit/source/controls/unocontrolmodel.cxx | 8 18 files changed, 293 insertions(+), 161 deletions(-)
New commits: commit 82da3d95c1bb2ba410a89fc1721b1ccb4f25b7cb Author: Stephan Bergmann <sberg...@redhat.com> Date: Sun Jun 19 21:29:43 2016 +0200 loplugin:salbool: Implicit conversions from non-Boolean fundamental types Change-Id: I67eac95686678e6f5a2d60798535b2c65a9ba5d7 diff --git a/comphelper/source/streaming/basicio.cxx b/comphelper/source/streaming/basicio.cxx index a786cfe..0caf2ab 100644 --- a/comphelper/source/streaming/basicio.cxx +++ b/comphelper/source/streaming/basicio.cxx @@ -67,8 +67,8 @@ const css::uno::Reference<css::io::XObjectInputStream>& operator >> ( _rFont.Underline = _rxInStream->readShort(); _rFont.Strikeout = _rxInStream->readShort(); _rFont.Orientation = static_cast< float >(_rxInStream->readDouble()); - _rFont.Kerning = _rxInStream->readBoolean(); - _rFont.WordLineMode = _rxInStream->readBoolean(); + _rFont.Kerning = _rxInStream->readBoolean() != 0; + _rFont.WordLineMode = _rxInStream->readBoolean() != 0; _rFont.Type = _rxInStream->readShort(); return _rxInStream; } diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index 8c47212..1e4c5e2 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -17,6 +17,7 @@ #include "compat.hxx" #include "plugin.hxx" +#include "typecheck.hxx" #if CLANG_VERSION < 30700 @@ -83,26 +84,10 @@ bool areSameTypedef(QualType type1, QualType type2) { return t1 != nullptr && t2 != nullptr && t1->getDecl() == t2->getDecl(); } -bool isBool(QualType type, bool allowTypedefs = true) { - if (type->isBooleanType()) { - return true; - } - if (!allowTypedefs) { - return false; - } - TypedefType const * t2 = type->getAs<TypedefType>(); - if (t2 == nullptr) { - return false; - } - std::string name(t2->getDecl()->getNameAsString()); - return name == "sal_Bool" || name == "BOOL" || name == "Boolean" - || name == "FT_Bool" || name == "FcBool" || name == "GLboolean" - || name == "NPBool" || name == "UBool" || name == "dbus_bool_t" - || name == "gboolean" || name == "hb_bool_t" || name == "jboolean"; -} - bool isBool(Expr const * expr, bool allowTypedefs = true) { - return isBool(expr->getType(), allowTypedefs); + auto t = expr->getType(); + return allowTypedefs + ? bool(loplugin::TypeCheck(t).AnyBoolean()) : t->isBooleanType(); } bool isMatchingBool(Expr const * expr, Expr const * comparisonExpr) { @@ -209,7 +194,7 @@ bool isBoolExpr(Expr const * expr) { } stack.pop(); if (stack.empty()) { - if (isBool(ty)) { + if (loplugin::TypeCheck(ty).AnyBoolean()) { return true; } break; @@ -379,8 +364,10 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { auto const ta = dr->getTemplateArgs(); if ((ta[0].getArgument().getKind() == TemplateArgument::Type) - && isBool( - ta[0].getTypeSourceInfo()->getType())) + && (loplugin::TypeCheck( + ta[0].getTypeSourceInfo() + ->getType()) + .AnyBoolean())) { continue; } @@ -442,7 +429,8 @@ bool ImplicitBoolConversion::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) //TODO: fix this superficial nonsense check: if (ct->getNumArgs() >= 1 && ct->getArg(0).getKind() == TemplateArgument::Type - && isBool(ct->getArg(0).getAsType())) + && (loplugin::TypeCheck(ct->getArg(0).getAsType()) + .AnyBoolean())) { continue; } @@ -994,7 +982,8 @@ void ImplicitBoolConversion::checkCXXConstructExpr( TemplateArgument const & arg = t1->getArg( i - ps->begin()); if (arg.getKind() == TemplateArgument::Type - && isBool(arg.getAsType())) + && (loplugin::TypeCheck(arg.getAsType()) + .AnyBoolean())) { continue; } diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx index f701358..f08b1c0 100644 --- a/compilerplugins/clang/salbool.cxx +++ b/compilerplugins/clang/salbool.cxx @@ -16,6 +16,7 @@ #include "compat.hxx" #include "plugin.hxx" +#include "typecheck.hxx" namespace { @@ -143,6 +144,8 @@ public: bool VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr); + bool VisitImplicitCastExpr(ImplicitCastExpr * expr); + bool VisitReturnStmt(ReturnStmt const * stmt); bool WalkUpFromParmVarDecl(ParmVarDecl const * decl); @@ -382,6 +385,53 @@ bool SalBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) { return true; } +bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) { + if (ignoreLocation(expr)) { + return true; + } + if (!isSalBool(expr->getType())) { + return true; + } + auto l = expr->getLocStart(); + while (compiler.getSourceManager().isMacroArgExpansion(l)) { + l = compiler.getSourceManager().getImmediateMacroCallerLoc(l); + } + if (compat::isMacroBodyExpansion(compiler, l)) { + auto n = Lexer::getImmediateMacroName( + l, compiler.getSourceManager(), compiler.getLangOpts()); + if (n == "sal_False" || n == "sal_True") { + return true; + } + } + auto e1 = expr->getSubExprAsWritten(); + auto t = e1->getType(); + if (!t->isFundamentalType() || loplugin::TypeCheck(t).AnyBoolean()) { + return true; + } + auto e2 = dyn_cast<ConditionalOperator>(e1); + if (e2 != nullptr) { + auto ic1 = dyn_cast<ImplicitCastExpr>( + e2->getTrueExpr()->IgnoreParens()); + auto ic2 = dyn_cast<ImplicitCastExpr>( + e2->getFalseExpr()->IgnoreParens()); + if (ic1 != nullptr && ic2 != nullptr + && ic1->getType()->isSpecificBuiltinType(BuiltinType::Int) + && (loplugin::TypeCheck(ic1->getSubExprAsWritten()->getType()) + .AnyBoolean()) + && ic2->getType()->isSpecificBuiltinType(BuiltinType::Int) + && (loplugin::TypeCheck(ic2->getSubExprAsWritten()->getType()) + .AnyBoolean())) + { + return true; + } + } + report( + DiagnosticsEngine::Warning, "conversion from %0 to sal_Bool", + expr->getLocStart()) + << t << expr->getSourceRange(); + return true; +} + bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) { // Just enough to avoid warnings in rtl_getUriCharClass (sal/rtl/uri.cxx), // which has diff --git a/compilerplugins/clang/typecheck.cxx b/compilerplugins/clang/typecheck.cxx index 800a2d2..71f9994 100644 --- a/compilerplugins/clang/typecheck.cxx +++ b/compilerplugins/clang/typecheck.cxx @@ -29,6 +29,22 @@ TerminalCheck TypeCheck::Char() const { || type_->isSpecificBuiltinType(clang::BuiltinType::Char_U))); } +TerminalCheck TypeCheck::AnyBoolean() const { + if (type_->isBooleanType()) { + return TerminalCheck(true); + } + auto t = type_->getAs<clang::TypedefType>(); + if (t == nullptr) { + return TerminalCheck(false); + } + auto n =t->getDecl()->getName(); + return TerminalCheck( + n == "sal_Bool" || n == "BOOL" || n == "Boolean" || n == "FT_Bool" + || n == "FcBool" || n == "GLboolean" || n == "NPBool" || n == "UBool" + || n == "dbus_bool_t" || n == "gboolean" || n == "hb_bool_t" + || n == "jboolean"); +} + TypeCheck TypeCheck::LvalueReference() const { if (!type_.isNull()) { auto const t = type_->getAs<clang::LValueReferenceType>(); diff --git a/compilerplugins/clang/typecheck.hxx b/compilerplugins/clang/typecheck.hxx index c49adcc..9862890 100644 --- a/compilerplugins/clang/typecheck.hxx +++ b/compilerplugins/clang/typecheck.hxx @@ -31,6 +31,8 @@ public: TerminalCheck Char() const; + TerminalCheck AnyBoolean() const; + TypeCheck Pointer() const; TypeCheck LvalueReference() const; diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 80a38bc..a5d593e 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -290,7 +290,7 @@ sal_Bool SAL_CALL SvxUnoTextContent::hasElements() } else { - return 0; + return false; } } diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index e22acfe5..f0cab38 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1593,21 +1593,26 @@ Sequence< OUString > filter_info_impl::getFilterUserData() const OUString string_encode( const OUString & rText ) { - - static sal_Bool const aCharClass[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* UricNoSlash */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, /* !"#$%&'()*+,-./*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, /*0123456789:;<=>?*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*@ABCDEFGHIJKLMNO*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /*PQRSTUVWXYZ[\]^_*/ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*`abcdefghijklmno*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /*pqrstuvwxyz{|}~ */ - }; - - - return Uri::encode( rText, aCharClass, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 ); + static sal_Bool const uricNoSlash[] = { + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, false, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, false, false, true, false, true, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}; // xyz{|}~ + + + return Uri::encode( rText, uricNoSlash, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 ); } OUString string_decode( const OUString & rText ) diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 9433424..b2a793b 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -940,8 +940,8 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) t aFont.Underline = _rxInStream->readShort(); aFont.Strikeout = _rxInStream->readShort(); aFont.Orientation = ( (float)_rxInStream->readShort() ) / 10; - aFont.Kerning = _rxInStream->readBoolean(); - aFont.WordLineMode = _rxInStream->readBoolean(); + aFont.Kerning = _rxInStream->readBoolean() != 0; + aFont.WordLineMode = _rxInStream->readBoolean() != 0; } if ( nAnyMask & FONTSIZE ) { diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index 6c279f5..6eb3f25 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -64,18 +64,29 @@ using namespace osl; -/* a slightly modified version of Pchar in rtl/source/uri.c */ -const sal_Bool uriCharClass[128] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Pchar but without encoding slashes */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* !"#$%&'()*+,-./ */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, /* 0123456789:;<=>? */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* @ABCDEFGHIJKLMNO */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* PQRSTUVWXYZ[\]^_ */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* `abcdefghijklmno */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /* pqrstuvwxyz{|}~ */ -}; +namespace { + +// A slightly modified version of Pchar in rtl/source/uri.c, but without +// encoding slashes: +const sal_Bool uriCharClass[128] = { + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, true, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, false, false, true, false, false, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}; // xyz{|}~ + +} oslFileError SAL_CALL osl_getCanonicalName( rtl_uString* ustrFileURL, rtl_uString** pustrValidURL ) { diff --git a/sal/qa/osl/profile/osl_old_testprofile.cxx b/sal/qa/osl/profile/osl_old_testprofile.cxx index 5389c0c..903851b 100644 --- a/sal/qa/osl/profile/osl_old_testprofile.cxx +++ b/sal/qa/osl/profile/osl_old_testprofile.cxx @@ -48,7 +48,7 @@ void oldtests::test_profile() CPPUNIT_ASSERT(hProfile != nullptr); CPPUNIT_ASSERT_MESSAGE( "cannot write into init file", - osl_writeProfileBool( hProfile, "testsection", "testbool", 1 )); + osl_writeProfileBool( hProfile, "testsection", "testbool", true )); CPPUNIT_ASSERT(osl_closeProfile( hProfile )); // unsuccessful open diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx index aff2c77..7edeb30 100644 --- a/sal/rtl/uri.cxx +++ b/sal/rtl/uri.cxx @@ -453,79 +453,135 @@ void appendPath( sal_Bool const * SAL_CALL rtl_getUriCharClass(rtl_UriCharClass eCharClass) SAL_THROW_EXTERN_C() { - static sal_Bool const aCharClass[][nCharClassSize] - = {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* None */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* !"#$%&'()*+,-./*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*0123456789:;<=>?*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*@ABCDEFGHIJKLMNO*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*PQRSTUVWXYZ[\]^_*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*`abcdefghijklmno*/ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /*pqrstuvwxyz{|}~ */ - }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Uric */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1,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 0, 0, 0, 0, - 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, /* !"#$%&'()*+,-./*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /*0123456789:;<=>?*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*@ABCDEFGHIJKLMNO*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /*PQRSTUVWXYZ[\]^_*/ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*`abcdefghijklmno*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /*pqrstuvwxyz{|}~ */ - }}; + static sal_Bool const aCharClass[][nCharClassSize] = { + {false, false, false, false, false, false, false, false,// None + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, // !"#$%&' + false, false, false, false, false, false, false, false, // ()*+,-./ + false, false, false, false, false, false, false, false, // 01234567 + false, false, false, false, false, false, false, false, // 89:;<=>? + false, false, false, false, false, false, false, false, // @ABCDEFG + false, false, false, false, false, false, false, false, // HIJKLMNO + false, false, false, false, false, false, false, false, // PQRSTUVW + false, false, false, false, false, false, false, false, // XYZ[\]^_ + false, false, false, false, false, false, false, false, // `abcdefg + false, false, false, false, false, false, false, false, // hijklmno + false, false, false, false, false, false, false, false, // pqrstuvw + false, false, false, false, false, false, false, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// Uric + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, true, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, true, false, true, false, true, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, true, false, true, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// UricNoSlash + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, true, false, true, false, true, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// RelSegment + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, false, true, false, true, false, false, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// RegName + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, true, false, true, false, false, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// Userinfo + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, true, false, true, false, false, // 89:;<=>? + false, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// Pchar + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, false, false, true, false, false, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}, // xyz{|}~ + {false, false, false, false, false, false, false, false,// UnoParamValue + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, true, true, // !"#$%&' + true, true, true, true, false, true, true, true, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, false, false, false, false, true, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, false, false, false, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}}; // xyz{|}~ assert( (eCharClass >= 0 && (sal::static_int_cast< std::size_t >(eCharClass) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 16f81fa..46c69d2 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -7066,7 +7066,7 @@ uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPage if (nBreak) { aData.Position = nCol; - aData.ManualBreak = (nBreak & BREAK_MANUAL); + aData.ManualBreak = (nBreak & BREAK_MANUAL) != 0; pAry[nPos] = aData; ++nPos; } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 2f12979..8405ad7 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -135,28 +135,31 @@ OUString parsePart( return buf.makeStringAndClear(); } -namespace -{ - OUString encodeNameOrParamFragment( OUString const & fragment ) - { - static sal_Bool const aCharClass[] = - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* NameOrParamFragment */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, /* !"#$%&'()*+,-./*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /*0123456789:;<=>?*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*@ABCDEFGHIJKLMNO*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, /*PQRSTUVWXYZ[\]^_*/ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*`abcdefghijklmno*/ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /*pqrstuvwxyz{|}~ */ - }; - - return rtl::Uri::encode( - fragment, - aCharClass, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 - ); - } +namespace { + +OUString encodeNameOrParamFragment(OUString const & fragment) { + static sal_Bool const nameOrParamFragment[] = { + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, + false, true, false, false, true, false, false, true, // !"#$%&' + true, true, true, true, true, true, true, false, // ()*+,-./ + true, true, true, true, true, true, true, true, // 01234567 + true, true, true, true, false, false, false, false, // 89:;<=>? + true, true, true, true, true, true, true, true, // @ABCDEFG + true, true, true, true, true, true, true, true, // HIJKLMNO + true, true, true, true, true, true, true, true, // PQRSTUVW + true, true, true, true, false, true, false, true, // XYZ[\]^_ + false, true, true, true, true, true, true, true, // `abcdefg + true, true, true, true, true, true, true, true, // hijklmno + true, true, true, true, true, true, true, true, // pqrstuvw + true, true, true, false, false, false, true, false}; // xyz{|}~ + return rtl::Uri::encode( + fragment, nameOrParamFragment, rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8); +} + } bool parseSchemeSpecificPart(OUString const & part) { diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 64e15ac..0dc040e 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -127,7 +127,7 @@ static OUString ImplGetParameterString( const TransferableObjectDescriptor& rObj // this seems to be the only parameter currently that might contain such characters sal_Bool pToAccept[128]; for (sal_Bool & rb : pToAccept) - rb = 0; + rb = false; const char aQuotedParamChars[] = "()<>@,;:/[]?=!#$&'*+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~. "; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 45bcf70..21708ad 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -1520,7 +1520,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex } // XAccesibleText sal_Int32 SAL_CALL AccessibleShape::getCaretPosition( ) throw (css::uno::RuntimeException, std::exception){return 0;} -sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return 0;} +sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return false;} sal_Unicode SAL_CALL AccessibleShape::getCharacter( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return 0;} css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleShape::getCharacterAttributes( sal_Int32, const css::uno::Sequence< OUString >& ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) { diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 80d0e51..b1bc3b5 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -741,7 +741,7 @@ sal_Bool SvxShowCharSetItemAcc::doAccessibleAction ( sal_Int32 nIndex ) throw (I if( nIndex == 0 ) { mpParent->mrParent.OutputIndex( mpParent->mnId ); - return 1; + return true; } throw IndexOutOfBoundsException(); } diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index 3af6558..154526f 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -260,7 +260,7 @@ sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getAccessibleImageWidth( ) // XAccesibleText sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition( ) throw (css::uno::RuntimeException, std::exception){return 0;} -sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return 0;} +sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return false;} sal_Unicode SAL_CALL SwAccessibleNoTextFrame::getCharacter( sal_Int32 ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception){return 0;} css::uno::Sequence< css::beans::PropertyValue > SAL_CALL SwAccessibleNoTextFrame::getCharacterAttributes( sal_Int32 , const css::uno::Sequence< OUString >& ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) { diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 4d390c3..546b651 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -840,8 +840,8 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre aFD.Underline = InStream->readShort(); aFD.Strikeout = InStream->readShort(); aFD.Orientation = (float)InStream->readDouble(); - aFD.Kerning = InStream->readBoolean(); - aFD.WordLineMode = InStream->readBoolean(); + aFD.Kerning = InStream->readBoolean() != 0; + aFD.WordLineMode = InStream->readBoolean() != 0; aFD.Type = InStream->readShort(); aValue <<= aFD; } @@ -955,8 +955,8 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre pFD->Underline = InStream->readShort(); pFD->Strikeout = InStream->readShort(); pFD->Orientation = ( (float)(double)InStream->readShort() ) / 10; - pFD->Kerning = InStream->readBoolean(); - pFD->WordLineMode = InStream->readBoolean(); + pFD->Kerning = InStream->readBoolean() != 0; + pFD->WordLineMode = InStream->readBoolean() != 0; } } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits