loplugin:salbool: Implicit conversions from non-Boolean fundamental types

Change-Id: I67eac95686678e6f5a2d60798535b2c65a9ba5d7
This commit is contained in:
Stephan Bergmann
2016-06-19 21:29:43 +02:00
parent c3a5012c5a
commit 82da3d95c1
18 changed files with 290 additions and 158 deletions
+2 -2
View File
@@ -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;
}
@@ -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;
}
+50
View File
@@ -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
+16
View File
@@ -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>();
+2
View File
@@ -31,6 +31,8 @@ public:
TerminalCheck Char() const;
TerminalCheck AnyBoolean() const;
TypeCheck Pointer() const;
TypeCheck LvalueReference() const;
+1 -1
View File
@@ -290,7 +290,7 @@ sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
}
else
{
return 0;
return false;
}
}
@@ -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{|}~ */
};
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, aCharClass, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
return Uri::encode( rText, uricNoSlash, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
}
OUString string_decode( const OUString & rText )
+2 -2
View File
@@ -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 )
{
+23 -12
View File
@@ -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 )
{
+1 -1
View File
@@ -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
+129 -73
View File
@@ -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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 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{|}~ */
},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* UnoParamValue */
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, 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)
+1 -1
View File
@@ -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;
}
@@ -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{|}~ */
};
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);
}
return rtl::Uri::encode(
fragment,
aCharClass,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8
);
}
}
bool parseSchemeSpecificPart(OUString const & part) {
+1 -1
View File
@@ -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{|}~. ";
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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();
}
+1 -1
View File
@@ -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)
{
+4 -4
View File
@@ -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