loplugin:unnecessaryparen: Warn about parentheses around literals

...that are not composed of multiple tokens, like ("foo" "bar").  Also don't yet
warn about Boolean literals, which are sometimes wrapped in parentheses to
silence unreachable-code warnings.

To avoid multiple warnings about code like

  f((0))

switch to generally using a set of ParenExpr to keep track of which occurrences
have already been handled.

Change-Id: I036a25a92836ec6ab6c56ea848f71bc6d63822bc
Reviewed-on: https://gerrit.libreoffice.org/45317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2017-11-27 09:46:06 +01:00
parent 0093ae5f2c
commit a2656563f1
25 changed files with 134 additions and 89 deletions

View File

@ -470,7 +470,7 @@ Any VCLXAccessibleBox::getCurrentValue( )
{
if(pList->getSelectedAccessibleChildCount()>0)
{
Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild((sal_Int32)(0)), UNO_QUERY);
Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild((sal_Int32)0), UNO_QUERY);
if(xName.is())
{
aAny <<= xName->getAccessibleName();

View File

@ -1136,7 +1136,7 @@ OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
, const OUString& rDragMethodServiceName
, const OUString& rDragParameterString )
{
OUString aChildParticle = getStringForType( eSubObjectType ) + ("=");
OUString aChildParticle = getStringForType( eSubObjectType ) + "=";
return createClassifiedIdentifierForParticles(
rSeriesParticle, aChildParticle

View File

@ -252,7 +252,7 @@ codemaker::UnoType::Sort TypeManager::decompose(
default:
throw CannotDumpException(
"unexpected \"" + n + "\" resolved from \"" + name
+ ("\"in call to TypeManager::decompose"));
+ "\"in call to TypeManager::decompose");
}
}
}

View File

@ -1402,7 +1402,7 @@ void InterfaceType::dumpCppuAttributeRefs(FileStream & out, sal_uInt32 & index)
<< "],\n";
inc(38);
out << indent()
<< ("(typelib_TypeClass)::css::uno::TypeClass_INTERFACE_ATTRIBUTE,\n")
<< "(typelib_TypeClass)::css::uno::TypeClass_INTERFACE_ATTRIBUTE,\n"
<< indent() << "sAttributeName" << n << ".pData );\n";
dec(38);
++n;
@ -1419,7 +1419,7 @@ void InterfaceType::dumpCppuMethodRefs(FileStream & out, sal_uInt32 & index)
<< "],\n";
inc(38);
out << indent()
<< ("(typelib_TypeClass)::css::uno::TypeClass_INTERFACE_METHOD,\n")
<< "(typelib_TypeClass)::css::uno::TypeClass_INTERFACE_METHOD,\n"
<< indent() << "sMethodName" << n << ".pData );\n";
dec(38);
++n;
@ -1965,7 +1965,7 @@ void PlainStructType::dumpLightGetCppuType(FileStream & out)
<< getTypeClass(name_, true) << ", \"" << name_ << "\");\n";
dec();
out << indent() << "}\n" << indent()
<< ("return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n");
<< "return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n";
dumpGetCppuTypePostamble(out);
}
@ -2005,7 +2005,7 @@ void PlainStructType::dumpNormalGetCppuType(FileStream & out)
out << ", " << entity_->getDirectMembers().size() << ", the_members, 0);\n";
dec();
out << indent() << "}\n" << indent()
<< ("return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n");
<< "return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n";
dumpGetCppuTypePostamble(out);
}
@ -2418,7 +2418,7 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out)
<< ", the_buffer.getStr());\n";
dec();
out << indent() << "}\n" << indent()
<< ("return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n");
<< "return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n";
dumpGetCppuTypePostamble(out);
}
@ -3558,7 +3558,7 @@ void ServiceType::dumpHppFile(
o << indent() << "throw;\n";
dec();
o << indent()
<< ("} catch (const ::css::uno::Exception & the_exception) {\n");
<< "} catch (const ::css::uno::Exception & the_exception) {\n";
inc();
o << indent() << "throw ::css::uno::DeploymentException(";
failsToSupply(o, name_, baseName);
@ -3603,7 +3603,7 @@ void ServiceType::dumpHppFile(
o << indent() << "assert(the_context.is());\n";
if (!rest && !cons.parameters.empty()) {
o << indent()
<< ("::css::uno::Sequence< ::css::uno::Any > the_arguments(")
<< "::css::uno::Sequence< ::css::uno::Any > the_arguments("
<< cons.parameters.size() << ");\n";
std::vector<
unoidl::SingleInterfaceBasedServiceEntity::Constructor::
@ -3681,7 +3681,7 @@ void ServiceType::dumpHppFile(
o << "the_arguments";
}
o << ");\n" << indent() << "}\n";
o << ("#else\n")
o << "#else\n"
<< indent() << "the_instance = ::css::uno::Reference< "
<< scopedBaseName
<< (" >(the_context->getServiceManager()->"
@ -3693,7 +3693,7 @@ void ServiceType::dumpHppFile(
u2b(cons.parameters.back().name), "param",
codemaker::cpp::IdentifierTranslationMode::NonGlobal);
} else if (cons.parameters.empty()) {
o << ("::css::uno::Sequence< ::css::uno::Any >()");
o << "::css::uno::Sequence< ::css::uno::Any >()";
} else {
o << "the_arguments";
}
@ -3701,7 +3701,7 @@ void ServiceType::dumpHppFile(
if (!tree.getRoot().present) {
dec();
o << indent()
<< ("} catch (const ::css::uno::RuntimeException &) {\n");
<< "} catch (const ::css::uno::RuntimeException &) {\n";
inc();
o << indent() << "throw;\n";
dec();

View File

@ -201,11 +201,11 @@ void Includes::dump(
}
if (m_includeCppuMacrosHxx) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"cppu/macros.hxx\"\n");
out << "#include \"cppu/macros.hxx\"\n";
}
if (m_includeCppuUnotypeHxx) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"cppu/unotype.hxx\"\n");
out << "#include \"cppu/unotype.hxx\"\n";
}
if (m_includeOslMutexHxx) {
dumpEmptyLineBeforeFirst(out, &first);
@ -213,7 +213,7 @@ void Includes::dump(
}
if (m_includeRtlStrbufHxx) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"rtl/strbuf.hxx\"\n");
out << "#include \"rtl/strbuf.hxx\"\n";
}
if (m_includeRtlStringH) {
dumpEmptyLineBeforeFirst(out, &first);
@ -225,7 +225,7 @@ void Includes::dump(
}
if (m_includeRtlUstrbufHxx) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"rtl/ustrbuf.hxx\"\n");
out << "#include \"rtl/ustrbuf.hxx\"\n";
}
if (m_includeRtlUstringH) {
dumpEmptyLineBeforeFirst(out, &first);
@ -233,7 +233,7 @@ void Includes::dump(
}
if (m_includeRtlUstringHxx) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"rtl/ustring.hxx\"\n");
out << "#include \"rtl/ustring.hxx\"\n";
}
if (m_includeRtlInstanceHxx) {
dumpEmptyLineBeforeFirst(out, &first);
@ -245,11 +245,11 @@ void Includes::dump(
}
if (m_includeTypelibTypeclassH) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"typelib/typeclass.h\"\n");
out << "#include \"typelib/typeclass.h\"\n";
}
if (m_includeTypelibTypedescriptionH) {
dumpEmptyLineBeforeFirst(out, &first);
out << ("#include \"typelib/typedescription.h\"\n");
out << "#include \"typelib/typedescription.h\"\n";
}
}

View File

@ -25,7 +25,7 @@ int main()
foo((1)); // expected-error {{parentheses immediately inside single-arg call [loplugin:unnecessaryparen]}}
int y = (x); // expected-error {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}} expected-error {{parentheses immediately inside vardecl statement [loplugin:unnecessaryparen]}}
int y = (x); // expected-error {{parentheses immediately inside vardecl statement [loplugin:unnecessaryparen]}}
(void)y;
EFoo foo = EFoo::Bar;
@ -54,8 +54,6 @@ int main()
S s1;
if ((s1)) { // expected-error {{parentheses immediately inside if statement [loplugin:unnecessaryparen]}}
// expected-error@-1 {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}}
// expected-error@-2 {{unnecessary parentheses around member expr [loplugin:unnecessaryparen]}}
return 0;
}
S s2;
@ -65,6 +63,10 @@ int main()
(void) sizeof (int);
(void) sizeof (x); // expect no warning (for whatever reason; for symmetry with above case?)
// Expecting just one error, not reported twice during TraverseInitListExpr:
int a[] = {(x)}; // expected-error {{unnecessary parentheses around identifier [loplugin:unnecessaryparen]}}
(void) a;
};
struct S2 {

View File

@ -12,6 +12,7 @@
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_set>
#include <clang/AST/CXXInheritance.h>
#include "compat.hxx"
@ -81,33 +82,37 @@ public:
bool VisitCallExpr(const CallExpr *);
bool VisitVarDecl(const VarDecl *);
bool VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *);
bool TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *);
bool TraverseCaseStmt(CaseStmt *);
bool VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr const *);
bool VisitConditionalOperator(ConditionalOperator const * expr);
bool VisitMemberExpr(const MemberExpr *f);
private:
void VisitSomeStmt(Stmt const * stmt, const Expr* cond, StringRef stmtName);
Expr const * insideSizeof = nullptr;
Expr const * insideCaseStmt = nullptr;
// Hack for libxml2's BAD_CAST object-like macro (expanding to "(xmlChar *)"), which is
// typically used as if it were a function-like macro, e.g., as "BAD_CAST(pName)" in
// SwNode::dumpAsXml (sw/source/core/docnode/node.cxx):
bool isPrecededBy_BAD_CAST(Expr const * expr);
std::unordered_set<ParenExpr const *> handled_;
};
bool UnnecessaryParen::TraverseUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr * expr)
bool UnnecessaryParen::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr const * expr)
{
auto old = insideSizeof;
if (expr->getKind() == UETT_SizeOf && !expr->isArgumentType()) {
insideSizeof = ignoreAllImplicit(expr->getArgumentExpr());
if (auto const e = dyn_cast<ParenExpr>(ignoreAllImplicit(expr->getArgumentExpr()))) {
handled_.insert(e);
}
}
bool ret = RecursiveASTVisitor::TraverseUnaryExprOrTypeTraitExpr(expr);
insideSizeof = old;
return ret;
return true;
}
bool UnnecessaryParen::TraverseCaseStmt(CaseStmt * caseStmt)
{
auto old = insideCaseStmt;
insideCaseStmt = ignoreAllImplicit(caseStmt->getLHS());
bool ret = RecursiveASTVisitor::TraverseCaseStmt(caseStmt);
insideCaseStmt = old;
return ret;
bool UnnecessaryParen::VisitConditionalOperator(ConditionalOperator const * expr) {
if (auto const e = dyn_cast<ParenExpr>(ignoreAllImplicit(expr->getCond()))) {
if (isa<CXXBoolLiteralExpr>(e->getSubExpr())) {
handled_.insert(e);
}
}
return true;
}
bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr)
@ -116,9 +121,7 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr)
return true;
if (parenExpr->getLocStart().isMacroID())
return true;
if (insideSizeof && parenExpr == insideSizeof)
return true;
if (insideCaseStmt && parenExpr == insideCaseStmt)
if (handled_.find(parenExpr) != handled_.end())
return true;
auto subExpr = ignoreAllImplicit(parenExpr->getSubExpr());
@ -131,32 +134,53 @@ bool UnnecessaryParen::VisitParenExpr(const ParenExpr* parenExpr)
DiagnosticsEngine::Warning, "parentheses around parentheses",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(subParenExpr);
}
if (auto declRefExpr = dyn_cast<DeclRefExpr>(subExpr)) {
// hack for libxml2's BAD_CAST object-like macro (expanding to "(xmlChar *)"), which is
// typically used as if it were a function-like macro, e.g., as "BAD_CAST(pName)" in
// SwNode::dumpAsXml (sw/source/core/docnode/node.cxx)
if (!declRefExpr->getLocStart().isMacroID()) {
SourceManager& SM = compiler.getSourceManager();
const char *p1 = SM.getCharacterData( declRefExpr->getLocStart().getLocWithOffset(-10) );
const char *p2 = SM.getCharacterData( declRefExpr->getLocStart() );
if ( std::string(p1, p2 - p1).find("BAD_CAST") != std::string::npos )
return true;
}
// Somewhat redundantly add parenExpr to handled_, so that issues within InitListExpr don't get
// reported twice (without having to change TraverseInitListExpr to only either traverse the
// syntactic or semantic form, as other plugins do):
if (isa<DeclRefExpr>(subExpr)) {
if (!isPrecededBy_BAD_CAST(parenExpr)) {
report(
DiagnosticsEngine::Warning, "unnecessary parentheses around identifier",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
}
} else if (isa<IntegerLiteral>(subExpr) || isa<CharacterLiteral>(subExpr)
|| isa<FloatingLiteral>(subExpr) || isa<ImaginaryLiteral>(subExpr)
|| isa<CXXNullPtrLiteralExpr>(subExpr))
//TODO: isa<CXXBoolLiteralExpr>(subExpr) || isa<ObjCBoolLiteralExpr>(subExpr)
{
auto const loc = subExpr->getLocStart();
if (loc.isMacroID() && compiler.getSourceManager().isAtStartOfImmediateMacroExpansion(loc))
{
// just in case the macro could also expand to something that /would/ require
// parentheses here
return true;
}
report(
DiagnosticsEngine::Warning, "unnecessary parentheses around identifier",
DiagnosticsEngine::Warning, "unnecessary parentheses around literal",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
}
if (isa<CXXNamedCastExpr>(subExpr)) {
handled_.insert(parenExpr);
} else if (auto const e = dyn_cast<clang::StringLiteral>(subExpr)) {
if (e->getNumConcatenated() == 1 && !isPrecededBy_BAD_CAST(parenExpr)) {
report(
DiagnosticsEngine::Warning,
"unnecessary parentheses around single-token string literal",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
}
} else if (isa<CXXNamedCastExpr>(subExpr)) {
report(
DiagnosticsEngine::Warning, "unnecessary parentheses around cast",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
}
return true;
@ -217,6 +241,7 @@ bool UnnecessaryParen::VisitReturnStmt(const ReturnStmt* returnStmt)
DiagnosticsEngine::Warning, "parentheses immediately inside return statement",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
}
return true;
}
@ -234,6 +259,7 @@ void UnnecessaryParen::VisitSomeStmt(const Stmt * stmt, const Expr* cond, String
if (isa<CXXBoolLiteralExpr>(parenExpr->getSubExpr())
&& stmtName == "if")
{
handled_.insert(parenExpr);
return;
}
// assignments need extra parentheses or they generate a compiler warning
@ -250,6 +276,7 @@ void UnnecessaryParen::VisitSomeStmt(const Stmt * stmt, const Expr* cond, String
parenExpr->getLocStart())
<< stmtName
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
}
}
@ -273,6 +300,7 @@ bool UnnecessaryParen::VisitCallExpr(const CallExpr* callExpr)
DiagnosticsEngine::Warning, "parentheses immediately inside single-arg call",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
return true;
}
@ -311,6 +339,7 @@ bool UnnecessaryParen::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr* callE
DiagnosticsEngine::Warning, "parentheses immediately inside assignment",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
return true;
}
@ -339,6 +368,7 @@ bool UnnecessaryParen::VisitVarDecl(const VarDecl* varDecl)
DiagnosticsEngine::Warning, "parentheses immediately inside vardecl statement",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
return true;
}
@ -350,6 +380,8 @@ bool UnnecessaryParen::VisitMemberExpr(const MemberExpr* memberExpr)
auto parenExpr = dyn_cast<ParenExpr>(ignoreAllImplicit(memberExpr->getBase()));
if (!parenExpr)
return true;
if (handled_.find(parenExpr) != handled_.end())
return true;
if (parenExpr->getLocStart().isMacroID())
return true;
@ -370,9 +402,20 @@ bool UnnecessaryParen::VisitMemberExpr(const MemberExpr* memberExpr)
DiagnosticsEngine::Warning, "unnecessary parentheses around member expr",
parenExpr->getLocStart())
<< parenExpr->getSourceRange();
handled_.insert(parenExpr);
return true;
}
bool UnnecessaryParen::isPrecededBy_BAD_CAST(Expr const * expr) {
if (expr->getLocStart().isMacroID()) {
return false;
}
SourceManager& SM = compiler.getSourceManager();
const char *p1 = SM.getCharacterData( expr->getLocStart().getLocWithOffset(-10) );
const char *p2 = SM.getCharacterData( expr->getLocStart() );
return std::string(p1, p2 - p1).find("BAD_CAST") != std::string::npos;
}
loplugin::Plugin::Registration< UnnecessaryParen > X("unnecessaryparen", true);
}

View File

@ -156,7 +156,7 @@ void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,css::util::DateTi
sal_Int32 ka = _nJulianDate;
if ( _nJulianDate >= 2299161 )
{
ialp = (sal_Int32)( ((double) _nJulianDate - 1867216.25 ) / ( 36524.25 ));
ialp = (sal_Int32)( ((double) _nJulianDate - 1867216.25 ) / 36524.25 );
ka = _nJulianDate + 1 + ialp - ( ialp >> 2 );
}
sal_Int32 kb = ka + 1524;

View File

@ -545,7 +545,7 @@ bool parsePaintUri( std::pair<const char*,const char*>& o_rPaintUri,
const bool bRes = parse(sPaintUri,
// Begin grammar
(
str_p("url(") >> !( str_p("'") ) >> ("#") >>
str_p("url(") >> !( str_p("'") ) >> "#" >>
(+(anychar_p - (str_p("'") | str_p(")"))))[assign_a(o_rPaintUri)] >>
!( str_p("'") ) >> str_p(")") >>
*( str_p("none")[assign_a(io_rColor.second,false)] |

View File

@ -355,16 +355,16 @@ void ImageProducer::ImplInitConsumer( const Graphic& rGraphic )
{
const BitmapColor& rCol = pBmpAcc->GetPaletteColor( (sal_uInt16) i );
*pTmp = ( (sal_Int32) rCol.GetRed() ) << (sal_Int32)(24);
*pTmp |= ( (sal_Int32) rCol.GetGreen() ) << (sal_Int32)(16);
*pTmp |= ( (sal_Int32) rCol.GetBlue() ) << (sal_Int32)(8);
*pTmp |= (sal_Int32)(0x000000ffL);
*pTmp = ( (sal_Int32) rCol.GetRed() ) << (sal_Int32)24;
*pTmp |= ( (sal_Int32) rCol.GetGreen() ) << (sal_Int32)16;
*pTmp |= ( (sal_Int32) rCol.GetBlue() ) << (sal_Int32)8;
*pTmp |= (sal_Int32)0x000000ffL;
}
if( rGraphic.IsTransparent() )
{
// append transparent entry
*pTmp = (sal_Int32)(0xffffff00L);
*pTmp = (sal_Int32)0xffffff00L;
mnTransIndex = nPalCount;
nPalCount++;
}

View File

@ -1083,7 +1083,7 @@ const sal_Char* SAL_CALL exprTypeToString(ExprType t)
return "none";
}
return ("unknown");
return "unknown";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -289,7 +289,7 @@ oslFileError FileHandle_Impl::setPos(sal_uInt64 uPos)
sal_uInt64 FileHandle_Impl::getSize() const
{
off_t const bufend = std::max((off_t)(0), m_bufptr) + m_buflen;
off_t const bufend = std::max((off_t)0, m_bufptr) + m_buflen;
return std::max(m_size, sal::static_int_cast< sal_uInt64 >(bufend));
}

View File

@ -216,7 +216,7 @@ static oslFileError osl_psz_getVolumeInformation (
{
OSL_detail_STATFS_STRUCT sfs;
OSL_detail_STATFS_INIT(sfs);
if ((OSL_detail_STATFS(pszDirectory, &sfs)) < (0))
if ((OSL_detail_STATFS(pszDirectory, &sfs)) < 0)
{
oslFileError result = oslTranslateFileError(errno);
return result;

View File

@ -2194,11 +2194,11 @@ void Test::testFuncGETPIVOTDATA()
aPivotPosStr = aOutRange.aStart.Format(ScRefFlags::ADDR_ABS);
// First, get the grand totals.
aFormula = ("=GETPIVOTDATA(\"Sum - Value\";") + aPivotPosStr + ")";
aFormula = "=GETPIVOTDATA(\"Sum - Value\";" + aPivotPosStr + ")";
m_pDoc->SetString(aPos, aFormula);
fVal = m_pDoc->GetValue(aPos);
CPPUNIT_ASSERT_EQUAL(21.0, fVal);
aFormula = ("=GETPIVOTDATA(\"Count - Value\";") + aPivotPosStr + ")";
aFormula = "=GETPIVOTDATA(\"Count - Value\";" + aPivotPosStr + ")";
m_pDoc->SetString(aPos, aFormula);
fVal = m_pDoc->GetValue(aPos);
CPPUNIT_ASSERT_EQUAL(6.0, fVal);

View File

@ -567,7 +567,7 @@ void ScCsvRuler::ImplDrawBackgrDev()
maBackgrDev->SetFillColor();
sal_Int32 nPos;
sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - 1, (sal_Int32)(0) );
sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - 1, (sal_Int32)0 );
sal_Int32 nLastPos = GetPosFromX( GetWidth() );
sal_Int32 nY = (maActiveRect.Top() + maActiveRect.Bottom()) / 2;
for( nPos = nFirstPos; nPos <= nLastPos; ++nPos )

View File

@ -1323,9 +1323,9 @@ void SdImportTest::testTdf93124()
uno::Sequence< beans::PropertyValue > aFilterData(2);
aFilterData[0].Name = "PixelWidth";
aFilterData[0].Value <<= (sal_Int32)(320);
aFilterData[0].Value <<= (sal_Int32)320;
aFilterData[1].Name = "PixelHeight";
aFilterData[1].Value <<= (sal_Int32)(180);
aFilterData[1].Value <<= (sal_Int32)180;
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
@ -1399,9 +1399,9 @@ void SdImportTest::testTdf99729()
uno::Sequence< beans::PropertyValue > aFilterData(2);
aFilterData[0].Name = "PixelWidth";
aFilterData[0].Value <<= (sal_Int32)(320);
aFilterData[0].Value <<= (sal_Int32)320;
aFilterData[1].Name = "PixelHeight";
aFilterData[1].Value <<= (sal_Int32)(240);
aFilterData[1].Value <<= (sal_Int32)240;
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();

View File

@ -1116,7 +1116,7 @@ uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames(
const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) );
uno::Sequence< OUString > aSNS( mbImpressDoc ? 36 : 19 );
sal_uInt16 i(0);

View File

@ -838,9 +838,9 @@ void OptimizerDialog::InitPage4()
Any( OUString("STR_SAVE_AS") ),
Any( (sal_Int32)( PAGE_POS_X + 6 ) ),
Any( (sal_Int32)( DIALOG_HEIGHT - 75 ) ),
Any( (sal_Int32)( 0 ) ),
Any( (sal_Int32)( 100 ) ),
Any( (sal_Int32)( 0 ) ),
Any( (sal_Int32)0 ),
Any( (sal_Int32)100 ),
Any( (sal_Int32)0 ),
Any( (sal_Int32)( PAGE_WIDTH - 12 ) ) };
sal_Int32 nCount = SAL_N_ELEMENTS( pNames );

View File

@ -1411,7 +1411,7 @@ const HTMLOptions& HTMLParser::GetOptions( HtmlOptionId const *pNoConvertToken )
{
sal_Int32 nLen = 0;
nStt = nPos;
if( ('"'==cChar) || ('\'')==cChar )
if( ('"'==cChar) || '\''==cChar )
{
sal_Unicode cEnd = cChar;
nPos++; nStt++;

View File

@ -1461,7 +1461,7 @@ void WW8AttributeOutput::CharBidiRTL( const SfxPoolItem& rHt )
if( rAttr.GetValue() == 1 )
{
m_rWW8Export.InsUInt16(0x85a);
m_rWW8Export.pO->push_back((sal_uInt8)(1));
m_rWW8Export.pO->push_back((sal_uInt8)1);
}
}

View File

@ -436,9 +436,9 @@ void SwEnvFormatPage::SetMinMax()
m_pAddrLeftField->SetMax((long) 100 * (lWidth - 2 * 566), FUNIT_TWIP);
m_pAddrTopField->SetMin((long) 100 * (GetFieldVal(*m_pSendTopField ) + 2 * 566), FUNIT_TWIP);
m_pAddrTopField->SetMax((long) 100 * (lHeight - 2 * 566), FUNIT_TWIP);
m_pSendLeftField->SetMin((long) 100 * (566), FUNIT_TWIP);
m_pSendLeftField->SetMin((long) 100 * 566, FUNIT_TWIP);
m_pSendLeftField->SetMax((long) 100 * (GetFieldVal(*m_pAddrLeftField) - 566), FUNIT_TWIP);
m_pSendTopField->SetMin((long) 100 * (566), FUNIT_TWIP);
m_pSendTopField->SetMin((long) 100 * 566, FUNIT_TWIP);
m_pSendTopField->SetMax((long) 100 * (GetFieldVal(*m_pAddrTopField ) - 2 * 566), FUNIT_TWIP);
// First and last

View File

@ -25,7 +25,7 @@ InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleI
bUseCaption(false),
eObjType(eType),
nNumType(SVX_NUM_ARABIC),
sNumberSeparator((". ")),
sNumberSeparator(". "),
nPos(1),
nLevel(0),
sSeparator( OUString(": ") ),

View File

@ -254,7 +254,7 @@ SAL_IMPLEMENT_MAIN()
if ( types.empty() && options.componenttype != 3) {
std::cerr
<< ("\nError: no type is specified, use the -T option at least once\n");
<< "\nError: no type is specified, use the -T option at least once\n";
printUsageAndExit(programname, version);
exit(EXIT_FAILURE);
}

View File

@ -529,7 +529,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
bool bAlternate = xHyphWord->isAlternativeSpelling();
sal_Int32 _nWordLen = 1 + xHyphWord->getHyphenPos();
if ( ( _nWordLen >= 2 ) && ( (nWordStart+_nWordLen) >= ( 2 ) ) )
if ( ( _nWordLen >= 2 ) && ( (nWordStart+_nWordLen) >= 2 ) )
{
if ( !bAlternate )
{

View File

@ -445,7 +445,7 @@ void SAXEventKeeperImpl::smashBufferNode(
*/
m_xXMLDocument->clearUselessData(m_pRootBufferNode->getXMLElement(),
aChildElements,
bIsNotBlocking?(nullptr):
bIsNotBlocking?nullptr:
(m_pCurrentBlockingBufferNode->getXMLElement()));
/*
@ -497,7 +497,7 @@ void SAXEventKeeperImpl::smashBufferNode(
m_xXMLDocument->clearUselessData(pBufferNode->getXMLElement(),
aChildElements,
bIsBlockInside?(m_pCurrentBlockingBufferNode->getXMLElement()):
(nullptr));
nullptr);
/*
* remove the node if it is empty, then if its parent is also