diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-20 15:53:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-21 08:22:29 +0100 |
commit | 783120996aba341519393dd0100520707249d208 (patch) | |
tree | aa6ff11749e3880ca7df05010277fde6a6269b45 | |
parent | TypedWhichId in svx part 1 (diff) | |
download | core-783120996aba341519393dd0100520707249d208.tar.gz core-783120996aba341519393dd0100520707249d208.zip |
new loplugin: convertlong
merge the droplong and convertuintptr into one new plugin.
Limit the analysis to looking at var decl's, since that seems to be
safest proposition, even if that too needs some careful analysis.
Change-Id: Id005baaf05cfb157ce44a06a1c81f08559a07d1f
Reviewed-on: https://gerrit.libreoffice.org/46851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/convertlong.cxx | 142 | ||||
-rw-r--r-- | compilerplugins/clang/convertuintptr.cxx | 106 | ||||
-rw-r--r-- | compilerplugins/clang/droplong.cxx | 190 | ||||
-rw-r--r-- | compilerplugins/clang/test/convertlong.cxx | 41 | ||||
-rw-r--r-- | compilerplugins/clang/test/convertuintptr.cxx | 20 | ||||
-rw-r--r-- | compilerplugins/clang/test/droplong.cxx | 27 | ||||
-rw-r--r-- | sax/source/tools/converter.cxx | 2 | ||||
-rw-r--r-- | solenv/CompilerTest_compilerplugins_clang.mk | 3 | ||||
-rw-r--r-- | solenv/clang-format/blacklist | 2 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 8 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 10 | ||||
-rw-r--r-- | svl/source/items/itemset.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 2 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 2 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 2 |
16 files changed, 199 insertions, 362 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index 038f101a7edf..762d1392b34e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -56,7 +56,7 @@ static OUString toUNOname( char const * p ) while (*p != 'E') { // read chars count - long n = (*p++ - '0'); + int n = (*p++ - '0'); while ('0' <= *p && '9' >= *p) { n *= 10; diff --git a/compilerplugins/clang/convertlong.cxx b/compilerplugins/clang/convertlong.cxx new file mode 100644 index 000000000000..4d713aeecf2b --- /dev/null +++ b/compilerplugins/clang/convertlong.cxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 <memory> +#include <cassert> +#include <string> +#include <iostream> +#include <fstream> +#include <set> +#include "plugin.hxx" +#include "check.hxx" + +/** + plugin to help to when converting code from + + sal_uIntPtr/sal_uLong/sal_Long/long/unsigned long + + to something more precise. + */ +namespace +{ +class ConvertLong : public RecursiveASTVisitor<ConvertLong>, public loplugin::Plugin +{ +public: + explicit ConvertLong(loplugin::InstantiationData const& data) + : Plugin(data) + { + } + + virtual void run() override + { + std::string fn(compiler.getSourceManager() + .getFileEntryForID(compiler.getSourceManager().getMainFileID()) + ->getName()); + loplugin::normalizeDotDotInFilePath(fn); + // using sal_uIntPtr as in-between type when converting void* to rtl_TextEncoding + if (fn == SRCDIR "/sal/osl/unx/thread.cxx") + return; + // too much magic + if (fn == SRCDIR "/sal/rtl/alloc_arena.cxx") + return; + if (fn == SRCDIR "/sal/rtl/alloc_cache.cxx") + return; + // TODO not sure what is going on here + if (fn == SRCDIR "/tools/source/generic/bigint.cxx") + return; + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool VisitVarDecl(VarDecl const*); + bool TraverseFunctionDecl(FunctionDecl*); + +private: + bool isInterestingType(QualType qt); +}; + +bool ConvertLong::TraverseFunctionDecl(FunctionDecl* functionDecl) +{ + // ignore template stuff + if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate) + { + return true; + } + return RecursiveASTVisitor::TraverseFunctionDecl(functionDecl); +} + +bool ConvertLong::VisitVarDecl(VarDecl const* varDecl) +{ + if (ignoreLocation(varDecl)) + return true; + StringRef fileName{ compiler.getSourceManager().getFilename(varDecl->getLocation()) }; + if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/bigint.hxx")) + return true; + if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/solar.h")) + return true; + if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/o3tl/string_view.hxx")) + return true; + if (!varDecl->hasInit()) + return true; + if (isa<IntegerLiteral>(varDecl->getInit()->IgnoreParenImpCasts())) + return true; + // ignore int x = -1; + if (isa<UnaryOperator>(varDecl->getInit()->IgnoreParenImpCasts())) + return true; + auto lhsType = varDecl->getType(); + auto rhsType = varDecl->getInit()->IgnoreParenImpCasts()->getType(); + if (lhsType.getLocalUnqualifiedType() == rhsType) + return true; + if (!rhsType.getTypePtrOrNull()) + return true; + if (isInterestingType(rhsType)) + return true; + if (!isInterestingType(lhsType)) + return true; + if (rhsType->isFloatingType()) // TODO + return true; + report(DiagnosticsEngine::Warning, "rather replace type of decl %0 with %1", + varDecl->getLocation()) + << lhsType << rhsType << varDecl->getSourceRange(); + //lhsType->dump(); + //varDecl->dump(); + return true; +} + +bool ConvertLong::isInterestingType(QualType qt) +{ + auto tc = loplugin::TypeCheck(qt); + if (tc.Typedef()) + { + TypedefType const* typedefType = qt->getAs<TypedefType>(); + auto name = typedefType->getDecl()->getName(); + if (name == "sal_uLong") + return true; + // because this is a typedef to long on 64-bit Linux + if (name == "sal_Int64" || name == "sal_uInt64" || name.find("size_t") != StringRef::npos) + return false; + } + if (isa<AutoType>(qt.getTypePtr())) + return false; + auto unqual = qt.getUnqualifiedType(); + if (unqual->isSpecificBuiltinType(BuiltinType::Kind::Long) + || unqual->isSpecificBuiltinType(BuiltinType::Kind::ULong)) + { + return true; + } + if (!tc.Typedef()) + return false; + TypedefType const* typedefType = qt->getAs<TypedefType>(); + auto name = typedefType->getDecl()->getName(); + return name == "sal_uIntPtr" || name == "sal_IntPtr"; +} + +loplugin::Plugin::Registration<ConvertLong> X("convertlong", false); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/convertuintptr.cxx b/compilerplugins/clang/convertuintptr.cxx deleted file mode 100644 index d2cc93b458f6..000000000000 --- a/compilerplugins/clang/convertuintptr.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 <memory> -#include <cassert> -#include <string> -#include <iostream> -#include <fstream> -#include <set> -#include "plugin.hxx" -#include "check.hxx" - -/** - plugin to help to when converting code from sal_uIntPtr to something more precise. - */ -namespace { - -class ConvertUIntPtr: - public RecursiveASTVisitor<ConvertUIntPtr>, public loplugin::Plugin -{ -public: - explicit ConvertUIntPtr(loplugin::InstantiationData const & data): - Plugin(data) {} - - virtual void run() override - { - std::string fn( compiler.getSourceManager().getFileEntryForID( - compiler.getSourceManager().getMainFileID())->getName() ); - loplugin::normalizeDotDotInFilePath(fn); - // using sal_uIntPtr as in-between type when converting void* to rtl_TextEncoding - if (fn == SRCDIR "/sal/osl/unx/thread.cxx") - return; - // too much magic - if (fn == SRCDIR "/sal/rtl/alloc_arena.cxx") - return; - if (fn == SRCDIR "/sal/rtl/alloc_cache.cxx") - return; - // TODO not sure what is going on here - if (fn == SRCDIR "/tools/source/generic/bigint.cxx") - return; - TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); - } - - bool VisitImplicitCastExpr(ImplicitCastExpr const *); -private: - bool isIntPtr(QualType qt); -}; - -bool ConvertUIntPtr::VisitImplicitCastExpr(ImplicitCastExpr const * castExpr) -{ - if (ignoreLocation(castExpr)) - return true; - - if (castExpr->getCastKind() == CK_LValueToRValue) - return true; - if (isa<IntegerLiteral>(castExpr->IgnoreCasts())) - return true; - // ignore literals like "-123" - if (isa<UnaryOperator>(castExpr->IgnoreCasts())) - return true; - - bool isSrcIntPtr = isIntPtr(castExpr->getSubExpr()->getType()); - bool isDestIntPtr = isIntPtr(castExpr->getType()); - - if (!isSrcIntPtr && !isDestIntPtr) - return true; - - // exclude casting between sal_uIntPtr <-> sal_IntPtr - if (isSrcIntPtr && isDestIntPtr) - return true; - - if (isSrcIntPtr && loplugin::TypeCheck(castExpr->getType()).AnyBoolean()) - return true; - - report( - DiagnosticsEngine::Warning, - "cast from %0 to %1", - castExpr->getExprLoc()) - << castExpr->getSubExpr()->getType() - << castExpr->getType() - << castExpr->getSourceRange(); - - return true; -} - -bool ConvertUIntPtr::isIntPtr(QualType qt) -{ - auto tc = loplugin::TypeCheck(qt); - if (!tc.Typedef()) - return false; - TypedefType const * typedefType = qt->getAs<TypedefType>(); - auto name = typedefType->getDecl()->getName(); - return name == "sal_uIntPtr" || name == "sal_IntPtr"; -} - -loplugin::Plugin::Registration< ConvertUIntPtr > X("convertuintptr", false); - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/droplong.cxx b/compilerplugins/clang/droplong.cxx deleted file mode 100644 index 1efcf9bf9efb..000000000000 --- a/compilerplugins/clang/droplong.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 <memory> -#include <cassert> -#include <string> -#include <iostream> -#include <fstream> -#include <set> -#include "plugin.hxx" -#include "check.hxx" - -/** -The types 'long' and 'unsigned long' are different sizes on different platforms, making them wholly unsuitable -for portable code. -And when I mean different sizes, I mean 64bit Linux and 64bit Windows have different sizes. - */ -namespace { - -static bool startswith(const std::string& rStr, const char* pSubStr) { - return rStr.compare(0, strlen(pSubStr), pSubStr) == 0; -} - -class DropLong: - public RecursiveASTVisitor<DropLong>, public loplugin::Plugin -{ -public: - explicit DropLong(loplugin::InstantiationData const & data): Plugin(data) {} - - virtual void run() override - { - std::string fn( compiler.getSourceManager().getFileEntryForID( - compiler.getSourceManager().getMainFileID())->getName() ); - loplugin::normalizeDotDotInFilePath(fn); - if (startswith(fn, SRCDIR "/sal/")) - return; - if (startswith(fn, SRCDIR "/desktop/unx/")) - return; - if (startswith(fn, SRCDIR "/bridges/")) - return; - if (startswith(fn, SRCDIR "/registry/")) - return; - if (startswith(fn, SRCDIR "/tools/source/generic/fract.cxx")) - return; - if (startswith(fn, SRCDIR "/tools/source/generic/bigint.cxx")) - return; - // TODO figure out how to cope with iterators - if (startswith(fn, SRCDIR "/cppu/source/threadpool/jobqueue.cxx")) - return; - - TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); - } - - bool VisitBinAssign(BinaryOperator const *); - bool VisitVarDecl(VarDecl const *); - bool VisitCastExpr(CastExpr const *); -private: - bool isOK(QualType lhs, QualType rhs); -}; - -bool DropLong::VisitBinAssign(BinaryOperator const * expr) -{ - if (ignoreLocation(expr)) - return true; - StringRef fileName { compiler.getSourceManager().getFilename(expr->getExprLoc()) }; - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/bigint.hxx")) - return true; - - auto lhsType = expr->getLHS()->getType(); - auto rhsType = expr->getRHS()->IgnoreCasts()->getType(); - if (!isOK(lhsType, rhsType)) - { - report( - DiagnosticsEngine::Warning, - "rather replace %0 with %1", - expr->getExprLoc()) - << lhsType - << rhsType - << expr->getSourceRange(); -// lhsType->dump(); - } - return true; -} - -bool DropLong::VisitVarDecl(VarDecl const * varDecl) -{ - if (ignoreLocation(varDecl)) - return true; - StringRef fileName { compiler.getSourceManager().getFilename(varDecl->getLocation()) }; - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/bigint.hxx")) - return true; - if (!varDecl->hasInit()) - return true; - auto lhsType = varDecl->getType(); - auto rhsType = varDecl->getInit()->IgnoreCasts()->getType(); - if (!isOK(lhsType, rhsType)) - { - report( - DiagnosticsEngine::Warning, - "rather replace %0 with %1", - varDecl->getLocation()) - << lhsType - << rhsType - << varDecl->getSourceRange(); -// lhsType->dump(); - } - return true; -} - -bool DropLong::VisitCastExpr(CastExpr const * castExpr) -{ - if (ignoreLocation(castExpr)) - return true; - StringRef fileName { compiler.getSourceManager().getFilename(castExpr->getExprLoc()) }; - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/bigint.hxx")) - return true; - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/sal/types.h")) - return true; - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/rtl/math.hxx")) - return true; - // TODO - if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/helpers.hxx")) - return true; - if (isa<ImplicitCastExpr>(castExpr)) - return true; - - auto type = castExpr->getType(); - if (loplugin::TypeCheck(type).Typedef()) - { - TypedefType const * typedefType = type->getAs<TypedefType>(); - if (typedefType->getDecl()->getName() == "sal_uLong") - report( - DiagnosticsEngine::Warning, - "sal_uLong cast from %0", - castExpr->getExprLoc()) - << castExpr->getSubExpr()->getType() - << castExpr->getSourceRange(); - } - else if (type->isSpecificBuiltinType(BuiltinType::Kind::Long) - || type->isSpecificBuiltinType(BuiltinType::Kind::ULong)) - { - report( - DiagnosticsEngine::Warning, - "long cast from %0", - castExpr->getExprLoc()) - << castExpr->getSubExpr()->getType() - << castExpr->getSourceRange(); - } - return true; -} - -bool DropLong::isOK(QualType lhs, QualType rhs) -{ - if (loplugin::TypeCheck(lhs).Typedef()) - { - TypedefType const * typedefType = lhs->getAs<TypedefType>(); - // Lots of stuff in the standard library and in sal/types.h is - // 'long' on Linux, so just ignore all typedefs. - if (typedefType->getDecl()->getName() != "sal_uLong") - return true; - } - else if (lhs->isSpecificBuiltinType(BuiltinType::Kind::Long) - || lhs->isSpecificBuiltinType(BuiltinType::Kind::ULong)) - { - if (rhs->isSpecificBuiltinType(BuiltinType::Kind::Long) - || rhs->isSpecificBuiltinType(BuiltinType::Kind::ULong)) - return true; - } - else - return true; - - if (isa<SubstTemplateTypeParmType>(lhs)) - return true; - if (isa<AutoType>(lhs)) - return true; - - return false; -} - -loplugin::Plugin::Registration< DropLong > X("droplong", false); - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/convertlong.cxx b/compilerplugins/clang/test/convertlong.cxx new file mode 100644 index 000000000000..850da3edebf1 --- /dev/null +++ b/compilerplugins/clang/test/convertlong.cxx @@ -0,0 +1,41 @@ +/* -*- 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 <tools/solar.h> + +int main() +{ + sal_uIntPtr x = 1; + sal_uInt32 y = x; + y = x; + (void)y; +} + +void main2() +{ + int x = 1; + int y = 1; + long tmp = x + y; + // expected-error@-1 {{rather replace type of decl 'long' with 'int' [loplugin:convertlong]}} + (void)tmp; + tmp = x + y; + + sal_uLong tmp1 = x + y; + // expected-error-re@-1 {{rather replace type of decl 'sal_uLong' (aka 'unsigned {{.+}}') with 'int' [loplugin:convertlong]}} + (void)tmp1; + + int tmp2 = (sal_uLong)1; + tmp2 = (long)1; + + sal_uIntPtr tmp3 = x + y; + // expected-error-re@-1 {{rather replace type of decl 'sal_uIntPtr' (aka 'unsigned {{.+}}') with 'int' [loplugin:convertlong]}} + (void)tmp3; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/test/convertuintptr.cxx b/compilerplugins/clang/test/convertuintptr.cxx deleted file mode 100644 index f1c484d8f730..000000000000 --- a/compilerplugins/clang/test/convertuintptr.cxx +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- 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 <tools/solar.h> - -int main() -{ - sal_uIntPtr x = 1; - sal_uInt32 y = x; // expected-error-re {{cast from 'sal_uIntPtr' (aka 'unsigned {{.+}}') to 'sal_uInt32' (aka 'unsigned {{.+}}') [loplugin:convertuintptr]}} - y = x; // expected-error-re {{cast from 'sal_uIntPtr' (aka 'unsigned {{.+}}') to 'sal_uInt32' (aka 'unsigned {{.+}}') [loplugin:convertuintptr]}} - (void)y; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/test/droplong.cxx b/compilerplugins/clang/test/droplong.cxx deleted file mode 100644 index 6b9271a20103..000000000000 --- a/compilerplugins/clang/test/droplong.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- 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 <tools/solar.h> - -int main() -{ - int x = 1; - int y = 1; - long tmp = x + y; // expected-error {{rather replace 'long' with 'int' [loplugin:droplong]}} - (void)tmp; - tmp = x + y; // expected-error {{rather replace 'long' with 'int' [loplugin:droplong]}} - - sal_uLong tmp1 = x + y; // expected-error-re {{rather replace 'sal_uLong' (aka 'unsigned {{.+}}') with 'int' [loplugin:droplong]}} - (void)tmp1; - - int tmp2 = (sal_uLong)1; // expected-error-re {{sal_uLong cast from 'sal_uLong' (aka 'unsigned {{.+}}') [loplugin:droplong]}} - tmp2 = (long)1; // expected-error {{long cast from 'long' [loplugin:droplong]}} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 431cfde4308a..b824015d1126 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -351,7 +351,7 @@ void Converter::convertMeasure( OUStringBuffer& rBuffer, case MeasureUnit::MM_10TH: case MeasureUnit::MM_100TH: { - long nFac2 = (MeasureUnit::MM_100TH == nSourceUnit) ? 100 : 10; + int nFac2 = (MeasureUnit::MM_100TH == nSourceUnit) ? 100 : 10; switch( nTargetUnit ) { case MeasureUnit::MM_100TH: diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 41990fab90f4..ff3f02c3a233 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -15,11 +15,10 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/casttovoid \ compilerplugins/clang/test/commaoperator \ compilerplugins/clang/test/constparams \ - $(if $(filter-out INTEL,$(CPU)),compilerplugins/clang/test/convertuintptr) \ + compilerplugins/clang/test/convertlong \ compilerplugins/clang/test/cppunitassertequals \ compilerplugins/clang/test/datamembershadow \ compilerplugins/clang/test/dodgyswitch \ - compilerplugins/clang/test/droplong \ compilerplugins/clang/test/externvar \ compilerplugins/clang/test/expressionalwayszero \ compilerplugins/clang/test/faileddyncast \ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index ae00770a3ee7..6eb9adf1d741 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -1840,12 +1840,10 @@ compilerplugins/clang/test/casttovoid.cxx compilerplugins/clang/test/commaoperator.cxx compilerplugins/clang/test/constmethod.cxx compilerplugins/clang/test/constparams.cxx -compilerplugins/clang/test/convertuintptr.cxx compilerplugins/clang/test/cppunitassertequals.cxx compilerplugins/clang/test/cppunitassertequals.hxx compilerplugins/clang/test/datamembershadow.cxx compilerplugins/clang/test/dodgyswitch.cxx -compilerplugins/clang/test/droplong.cxx compilerplugins/clang/test/expressionalwayszero.cxx compilerplugins/clang/test/externvar.cxx compilerplugins/clang/test/externvar.hxx diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 340b3202b342..be6aa1bf2d36 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -177,9 +177,9 @@ void SotStorageStream::SetSize(sal_uInt64 const nNewSize) sal_uInt32 SotStorageStream::GetSize() const { - sal_uLong nPos = Tell(); + sal_uInt64 nPos = Tell(); const_cast<SotStorageStream *>(this)->Seek( STREAM_SEEK_TO_END ); - sal_uLong nSize = Tell(); + sal_uInt64 nSize = Tell(); const_cast<SotStorageStream *>(this)->Seek( nPos ); return nSize; } @@ -199,7 +199,7 @@ void SotStorageStream::CopyTo( SotStorageStream * pDestStm ) if( !pOwnStm || !pDestStm->pOwnStm ) { // If Ole2 or not only own StorageStreams - sal_uLong nPos = Tell(); // save position + sal_uInt64 nPos = Tell(); // save position Seek( 0 ); pDestStm->SetSize( 0 ); // empty target stream @@ -497,7 +497,7 @@ bool SotStorage::IsStorageFile( SvStream* pStream ) /** code for new storages must come first! **/ if ( pStream ) { - long nPos = pStream->Tell(); + sal_uInt64 nPos = pStream->Tell(); bool bRet = UCBStorage::IsStorageFile( pStream ); if ( !bRet ) bRet = Storage::IsStorageFile( pStream ); diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 6ec64d83ba83..272e65a82fdc 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -825,7 +825,7 @@ void UCBStorageStream_Impl::CopySourceToTemporary() // current position of the temporary stream is not changed if( m_bSourceRead ) { - sal_uLong aPos = m_pStream->Tell(); + sal_uInt64 aPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); ReadSourceWriteTemporary(); m_pStream->Seek( aPos ); @@ -1010,10 +1010,10 @@ sal_uLong UCBStorageStream_Impl::GetSize() if( !Init() ) return 0; - sal_uLong nPos = m_pStream->Tell(); + sal_uInt64 nPos = m_pStream->Tell(); m_pStream->Seek( STREAM_SEEK_TO_END ); ReadSourceWriteTemporary(); - sal_uLong nRet = m_pStream->Tell(); + sal_uInt64 nRet = m_pStream->Tell(); m_pStream->Seek( nPos ); return nRet; @@ -2884,7 +2884,7 @@ bool UCBStorage::IsStorageFile( SvStream* pFile ) if ( !pFile ) return false; - sal_uLong nPos = pFile->Tell(); + sal_uInt64 nPos = pFile->Tell(); pFile->Seek( STREAM_SEEK_TO_END ); if ( pFile->Tell() < 4 ) return false; @@ -2914,7 +2914,7 @@ bool UCBStorage::IsStorageFile( SvStream* pFile ) OUString UCBStorage::GetLinkedFile( SvStream &rStream ) { OUString aString; - sal_uLong nPos = rStream.Tell(); + sal_uInt64 nPos = rStream.Tell(); rStream.Seek( STREAM_SEEK_TO_END ); if ( !rStream.Tell() ) return aString; diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index f520b26a7371..7e99dfa098fb 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -708,7 +708,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges ) } // create new item-array (by iterating through all new ranges) - sal_uLong nSize = Capacity_Impl(pNewRanges); + sal_uInt16 nSize = Capacity_Impl(pNewRanges); SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ]; sal_uInt16 nNewCount = 0; if (m_nCount == 0) diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 8f0a7b71f9ac..e47623228814 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -627,7 +627,7 @@ Color* ImpSvNumberformatScan::GetColor(OUString& sStr) if ( CharClass::isAsciiNumeric( sString ) ) { - long nIndex = sString.toInt32(); + sal_Int32 nIndex = sString.toInt32(); if (nIndex > 0 && nIndex <= 64) { pResult = pFormatter->GetUserDefColor((sal_uInt16)nIndex-1); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 19ac62c9bf0c..36cb5c69e90d 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1041,7 +1041,7 @@ void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags ) { tools::Polygon aNewPoly; const Point& rFirst = mpImplPolygon->mxPointAry[ 0 ]; - const long nReduce = ( nOptimizeFlags & PolyOptimizeFlags::REDUCE ) ? 4 : 0; + const int nReduce = ( nOptimizeFlags & PolyOptimizeFlags::REDUCE ) ? 4 : 0; while( nSize && ( mpImplPolygon->mxPointAry[ nSize - 1 ] == rFirst ) ) nSize--; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index bf317594f4af..258677952a3d 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -400,7 +400,7 @@ void ZCodec::UpdateCRC ( sal_uInt8 const * pSource, long nDatSize) bool ZCodec::AttemptDecompression(SvStream& rIStm, SvStream& rOStm) { assert(meState == STATE_INIT); - sal_uLong nStreamPos = rIStm.Tell(); + sal_uInt64 nStreamPos = rIStm.Tell(); BeginCompression(ZCODEC_DEFAULT_COMPRESSION, false/*updateCrc*/, true/*gzLib*/); InitDecompress(rIStm); EndCompression(); |