tdf#123936 Formatting files in module comphelper with clang-format

Change-Id: I01cf258f8fedb4d98f64d2a18735764463f1b2af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105653
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Philipp Hofer
2020-11-12 12:51:27 +01:00
committed by Christian Lohmaier
parent 79368f8102
commit d66683f86a
7 changed files with 52 additions and 74 deletions

View File

@@ -30,12 +30,11 @@
using namespace css;
namespace {
namespace
{
class Base64Test : public CppUnit::TestFixture
{
public:
void testBase64Encode();
void testBase64Decode();
void testBase64EncodeForOStringBuffer();
@@ -73,15 +72,18 @@ void Base64Test::testBase64Decode()
uno::Sequence<sal_Int8> expectedSequence = { 0, 0, 0, 0, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "AAAAAAABAgM=");
CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
CPPUNIT_ASSERT(
std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
expectedSequence = { 5, 2, 3, 0, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "BQIDAAABAgM=");
CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
CPPUNIT_ASSERT(
std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
expectedSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "yB9NbwABAgM=");
CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
CPPUNIT_ASSERT(
std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
}
void Base64Test::testBase64EncodeForOStringBuffer()
@@ -105,7 +107,6 @@ void Base64Test::testBase64EncodeForOStringBuffer()
}
CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -26,15 +26,17 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
namespace {
class Test: public CppUnit::TestFixture {
namespace
{
class Test : public CppUnit::TestFixture
{
public:
void test() {
css::uno::Reference< css::uno::XInterface > ref1(new cppu::OWeakObject);
css::uno::Reference< css::uno::XInterface > ref2(new cppu::OWeakObject);
css::uno::Reference< css::uno::XInterface > ref3(new cppu::OWeakObject);
comphelper::WeakBag< css::uno::XInterface > bag;
void test()
{
css::uno::Reference<css::uno::XInterface> ref1(new cppu::OWeakObject);
css::uno::Reference<css::uno::XInterface> ref2(new cppu::OWeakObject);
css::uno::Reference<css::uno::XInterface> ref3(new cppu::OWeakObject);
comphelper::WeakBag<css::uno::XInterface> bag;
bag.add(ref1);
bag.add(ref1);
bag.add(ref2);
@@ -54,7 +56,6 @@ public:
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -22,8 +22,6 @@
#include <comphelper/fileurl.hxx>
#include <rtl/ustring.hxx>
bool comphelper::isFileUrl(OUString const & url) {
return url.startsWithIgnoreAsciiCase("file:");
}
bool comphelper::isFileUrl(OUString const& url) { return url.startsWithIgnoreAsciiCase("file:"); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -27,17 +27,16 @@
namespace comphelper::rng
{
// underlying random number generator
// std::mt19937 implements the Mersenne twister algorithm which
// is fast and has good statistical properties, it produces integers
// in the range of [0, 2^32-1] internally
// memory requirement: 625*sizeof(uint32_t)
// http://en.wikipedia.org/wiki/Mersenne_twister
#define STD_RNG_ALGO std::mt19937
namespace {
#define STD_RNG_ALGO std::mt19937
namespace
{
struct RandomNumberGenerator
{
std::mutex mutex;
@@ -75,15 +74,16 @@ struct RandomNumberGenerator
}
};
class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator> {};
class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator>
{
};
}
// uniform ints [a,b] distribution
int uniform_int_distribution(int a, int b)
{
std::uniform_int_distribution<int> dist(a, b);
auto & gen = theRandomNumberGenerator::get();
auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -92,7 +92,7 @@ int uniform_int_distribution(int a, int b)
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
{
std::uniform_int_distribution<unsigned int> dist(a, b);
auto & gen = theRandomNumberGenerator::get();
auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -101,7 +101,7 @@ unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
size_t uniform_size_distribution(size_t a, size_t b)
{
std::uniform_int_distribution<size_t> dist(a, b);
auto & gen = theRandomNumberGenerator::get();
auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -111,7 +111,7 @@ double uniform_real_distribution(double a, double b)
{
assert(a < b);
std::uniform_real_distribution<double> dist(a, b);
auto & gen = theRandomNumberGenerator::get();
auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}

View File

@@ -16,8 +16,8 @@
#include <com/sun/star/ucb/InteractiveNetworkException.hpp>
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
namespace comphelper {
namespace comphelper
{
/// Will handle com::sun::star::ucb::InteractiveIOException and derived classes
const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
/// Will handle com::sun::star::ucb::UnsupportedDataSinkException
@@ -30,10 +30,10 @@ const sal_Int32 HANDLE_CERTIFICATEREQUEST = 3;
const sal_Int32 HANDLE_AUTHENTICATIONREQUEST = 4;
SimpleFileAccessInteraction::SimpleFileAccessInteraction(
const css::uno::Reference< css::task::XInteractionHandler >& xHandler )
const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
{
std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
std::vector<::ucbhelper::InterceptedInteraction::InterceptedRequest> lInterceptions;
::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
//intercept standard IO error exception (local file and WebDAV)
aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
@@ -69,16 +69,14 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction(
setInterceptions(lInterceptions);
}
SimpleFileAccessInteraction::~SimpleFileAccessInteraction()
{
}
SimpleFileAccessInteraction::~SimpleFileAccessInteraction() {}
ucbhelper::InterceptedInteraction::EInterceptionState SimpleFileAccessInteraction::intercepted(
const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
const css::uno::Reference<css::task::XInteractionRequest>& xRequest)
{
bool bAbort = false;
switch(aRequest.Handle)
switch (aRequest.Handle)
{
case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
case HANDLE_INTERACTIVENETWORKEXCEPTION:
@@ -119,10 +117,9 @@ ucbhelper::InterceptedInteraction::EInterceptionState SimpleFileAccessInteractio
// any selection...
if (bAbort)
{
css::uno::Reference< css::task::XInteractionContinuation > xAbort =
::ucbhelper::InterceptedInteraction::extractContinuation(
xRequest->getContinuations(),
cppu::UnoType<css::task::XInteractionAbort>::get() );
css::uno::Reference<css::task::XInteractionContinuation> xAbort
= ::ucbhelper::InterceptedInteraction::extractContinuation(
xRequest->getContinuations(), cppu::UnoType<css::task::XInteractionAbort>::get());
if (!xAbort.is())
return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;

View File

@@ -27,11 +27,8 @@
#include <typelib/typedescription.hxx>
#include <sal/log.hxx>
namespace comphelper
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
@@ -39,57 +36,51 @@ using namespace ::com::sun::star::lang;
sal_Int64 getINT64(const Any& _rAny)
{
sal_Int64 nReturn = 0;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int64 failed");
return nReturn;
}
sal_Int32 getINT32(const Any& _rAny)
{
sal_Int32 nReturn = 0;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int32 failed");
return nReturn;
}
sal_Int16 getINT16(const Any& _rAny)
{
sal_Int16 nReturn = 0;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int16 failed");
return nReturn;
}
double getDouble(const Any& _rAny)
{
double nReturn = 0.0;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to double failed");
return nReturn;
}
float getFloat(const Any& _rAny)
{
float nReturn = 0.0;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to float failed");
return nReturn;
}
OUString getString(const Any& _rAny)
{
OUString nReturn;
if(!(_rAny >>= nReturn))
if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to OUString failed");
return nReturn;
}
bool getBOOL(const Any& _rAny)
{
bool bReturn = false;
@@ -100,17 +91,15 @@ bool getBOOL(const Any& _rAny)
return bReturn;
}
sal_Int32 getEnumAsINT32(const Any& _rAny)
{
sal_Int32 nReturn = 0;
if (! ::cppu::enum2int(nReturn,_rAny) )
if (!::cppu::enum2int(nReturn, _rAny))
throw IllegalArgumentException();
return nReturn;
}
FontDescriptor getDefaultFont()
FontDescriptor getDefaultFont()
{
FontDescriptor aReturn;
aReturn.Slant = FontSlant_DONTKNOW;
@@ -119,7 +108,6 @@ FontDescriptor getDefaultFont()
return aReturn;
}
bool isAssignableFrom(const Type& _rAssignable, const Type& _rFrom)
{
// get the type lib descriptions
@@ -136,14 +124,14 @@ bool isAssignableFrom(const Type& _rAssignable, const Type& _rFrom)
Type getSequenceElementType(const Type& _rSequenceType)
{
OSL_ENSURE(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE,
"getSequenceElementType: must be called with a sequence type!");
"getSequenceElementType: must be called with a sequence type!");
if (_rSequenceType.getTypeClass() != TypeClass_SEQUENCE)
return Type();
TypeDescription aTD(_rSequenceType);
typelib_IndirectTypeDescription* pSequenceTD =
reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get());
typelib_IndirectTypeDescription* pSequenceTD
= reinterpret_cast<typelib_IndirectTypeDescription*>(aTD.get());
OSL_ASSERT(pSequenceTD && pSequenceTD->pType);
if (pSequenceTD && pSequenceTD->pType)
@@ -152,7 +140,6 @@ Type getSequenceElementType(const Type& _rSequenceType)
return Type();
}
} // namespace comphelper
} // namespace comphelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1460,11 +1460,9 @@ codemaker/source/javamaker/javatype.hxx
comphelper/qa/container/comphelper_ifcontainer.cxx
comphelper/qa/container/testifcontainer.cxx
comphelper/qa/string/test_string.cxx
comphelper/qa/unit/base64_test.cxx
comphelper/qa/unit/syntaxhighlighttest.cxx
comphelper/qa/unit/test_hash.cxx
comphelper/qa/unit/variadictemplates.cxx
comphelper/qa/weakbag/test_weakbag.cxx
comphelper/source/compare/AnyCompareFactory.cxx
comphelper/source/container/IndexedPropertyValuesContainer.cxx
comphelper/source/container/NamedPropertyValuesContainer.cxx
@@ -1499,7 +1497,6 @@ comphelper/source/misc/docpasswordrequest.cxx
comphelper/source/misc/documentinfo.cxx
comphelper/source/misc/evtlistenerhlp.cxx
comphelper/source/misc/evtmethodhelper.cxx
comphelper/source/misc/fileurl.cxx
comphelper/source/misc/getexpandeduri.cxx
comphelper/source/misc/hash.cxx
comphelper/source/misc/instancelocker.cxx
@@ -1516,11 +1513,9 @@ comphelper/source/misc/officerestartmanager.cxx
comphelper/source/misc/officerestartmanager.hxx
comphelper/source/misc/profilezone.cxx
comphelper/source/misc/proxyaggregation.cxx
comphelper/source/misc/random.cxx
comphelper/source/misc/sequenceashashmap.cxx
comphelper/source/misc/servicedecl.cxx
comphelper/source/misc/sharedmutex.cxx
comphelper/source/misc/simplefileaccessinteraction.cxx
comphelper/source/misc/solarmutex.cxx
comphelper/source/misc/stillreadwriteinteraction.cxx
comphelper/source/misc/storagehelper.cxx
@@ -1528,7 +1523,6 @@ comphelper/source/misc/string.cxx
comphelper/source/misc/synchronousdispatch.cxx
comphelper/source/misc/syntaxhighlight.cxx
comphelper/source/misc/threadpool.cxx
comphelper/source/misc/types.cxx
comphelper/source/misc/weak.cxx
comphelper/source/misc/weakeventlistener.cxx
comphelper/source/misc/xmlsechelper.cxx