From b536e10390c171e96b6477c04d66023a1da543c4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 8 Nov 2017 11:28:04 +0100 Subject: Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format ...even if that can cause reformatting of already formatted code. The problem I came across is that without this something like > namespace { > > void f1(); > > void f2(); > > } (which is quite a common style in the current code base) would be changed to > namespace > { > > void f1(); > > void f2(); > } instead of > namespace > { > void f1(); > > void f2(); > } and I found no other clang-format style option that would result in the presence or absence of an empty line be identical at the start and end of the namespace block. vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the same time, so this commit includes that. Some of those new files had not been formatted at all, so this commit includes their full reformatting changes. Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c Reviewed-on: https://gerrit.libreoffice.org/44450 Reviewed-by: Thorsten Behrens Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- tools/source/xml/XmlWalker.cxx | 25 +++++++++++-------------- tools/source/xml/XmlWriter.cxx | 25 ++++++++++++------------- 2 files changed, 23 insertions(+), 27 deletions(-) (limited to 'tools') diff --git a/tools/source/xml/XmlWalker.cxx b/tools/source/xml/XmlWalker.cxx index 9bec6d9dd534..61aedee7e6e4 100644 --- a/tools/source/xml/XmlWalker.cxx +++ b/tools/source/xml/XmlWalker.cxx @@ -15,17 +15,18 @@ #include #include -namespace tools { - +namespace tools +{ struct XmlWalkerImpl { XmlWalkerImpl() : mpDocPtr(nullptr) , mpRoot(nullptr) , mpCurrent(nullptr) - {} + { + } - xmlDocPtr mpDocPtr; + xmlDocPtr mpDocPtr; xmlNodePtr mpRoot; xmlNodePtr mpCurrent; @@ -34,7 +35,8 @@ struct XmlWalkerImpl XmlWalker::XmlWalker() : mpImpl(o3tl::make_unique()) -{} +{ +} XmlWalker::~XmlWalker() { @@ -67,7 +69,8 @@ OString XmlWalker::content() OString aContent; if (mpImpl->mpCurrent->xmlChildrenNode != nullptr) { - xmlChar* pContent = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); + xmlChar* pContent + = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); aContent = OString(reinterpret_cast(pContent)); xmlFree(pContent); } @@ -97,15 +100,9 @@ OString XmlWalker::attribute(OString sName) return aAttributeContent; } -void XmlWalker::next() -{ - mpImpl->mpCurrent = mpImpl->mpCurrent->next; -} +void XmlWalker::next() { mpImpl->mpCurrent = mpImpl->mpCurrent->next; } -bool XmlWalker::isValid() const -{ - return mpImpl->mpCurrent != nullptr; -} +bool XmlWalker::isValid() const { return mpImpl->mpCurrent != nullptr; } } // end tools namespace diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 014252bc39aa..5952dde13c96 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -12,10 +12,10 @@ #include -namespace tools { - -namespace { - +namespace tools +{ +namespace +{ int funcWriteCallback(void* pContext, const char* sBuffer, int nLen) { SvStream* pStream = static_cast(pContext); @@ -36,7 +36,8 @@ struct XmlWriterImpl XmlWriterImpl(SvStream* pStream) : mpStream(pStream) , mpWriter(nullptr) - {} + { + } SvStream* mpStream; xmlTextWriterPtr mpWriter; @@ -44,18 +45,19 @@ struct XmlWriterImpl XmlWriter::XmlWriter(SvStream* pStream) : mpImpl(o3tl::make_unique(pStream)) -{} +{ +} XmlWriter::~XmlWriter() { - if (mpImpl && mpImpl->mpWriter != nullptr) endDocument(); } bool XmlWriter::startDocument() { - xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); + xmlOutputBufferPtr xmlOutBuffer + = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); mpImpl->mpWriter = xmlNewTextWriter(xmlOutBuffer); if (mpImpl->mpWriter == nullptr) return false; @@ -78,12 +80,9 @@ void XmlWriter::startElement(const OString& sName) xmlFree(xmlName); } -void XmlWriter::endElement() -{ - xmlTextWriterEndElement(mpImpl->mpWriter); -} +void XmlWriter::endElement() { xmlTextWriterEndElement(mpImpl->mpWriter); } -void XmlWriter::attribute(const OString& name, const OString & value) +void XmlWriter::attribute(const OString& name, const OString& value) { xmlChar* xmlName = xmlCharStrdup(name.getStr()); xmlChar* xmlValue = xmlCharStrdup(value.getStr()); -- cgit option value='distro/collabora/lov-6.0.5'>distro/collabora/lov-6.0.5 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
2015-11-04tdf#95298: corrected some out-of-bound accesses to arrayArmin Le Grand
2015-10-19loplugin:defaultparamsStephan Bergmann
2015-10-16convert Link<> to typedNoel Grandin
2015-10-06 tdf#94559: 4th step to remove rtti.hxxOliver Specht
2015-08-26Convert vcl Button Link<> click handler to typed Link<Button*,void>Noel Grandin
2015-06-16Fix typosAndrea Gelmini
2015-05-29dispose SfxControllerItem objects correctlyLászló Németh
2015-05-20convert DRAWMODE constants to scoped enumNoel Grandin
2015-05-11loplugin:cstylecast: nop between pointer types of exactly same spellingStephan Bergmann
2015-04-29convert SDRINSERT constants to scoped enumNoel Grandin
2015-04-29mass rewrite Paint(Rect&) to Paint(RenderContext&, Rect&)Tomaž Vajngerl
2015-04-28Merge remote-tracking branch 'origin/feature/vclptr'Michael Meeks
2015-04-20sd: convert new to ::Create.Noel Grandin
2015-04-10Automated conversion of VclPtr construction to use Instance template.Michael Meeks
2015-04-10vclwidget: fixup locally allocated vcl::Window objectsNoel Grandin
2015-04-10Fix OutputDevice members / stack allocation: slideshow, starmath, sd, sc.Michael Meeks
2015-04-10vclwidget: only call dispose() onceNoel Grandin
2015-04-10Audit and correct misc. clears -> disposeAndClears.Michael Meeks
2015-04-10vclwidget: change all vcl::window fields to be wrapped in VclPtrNoel Grandin
2015-04-09vclwidgets: wrap all vcl::Window subclasses allocated on stack in VclPtrNoel Grandin
2015-04-09vcl: VclPtr conversion in sdNoel Grandin
2015-04-09Change tools::Time::GetSystemTicks to sal_uInt64Stephan Bergmann
2015-02-23remove unnecessary parenthesis in return statementsNoel Grandin
2015-01-12convert SETTINGS_ #defines to 'enum class'Noel Grandin
2015-01-12fdo#84938: replace DATACHANGED_ constants with 'enum class'Noel Grandin
2014-12-17convert docking animation window to .uiCaolán McNamara
2014-12-17relax assert, 0 is fineCaolán McNamara
2014-12-17fix Windows buildLászló Németh
2014-12-16this horror depends on unsigned max increment to wrap-around to 0Caolán McNamara
2014-11-13loplugin: cstylecastNoel Grandin
2014-10-31Removed duplicated includesAndrea Gelmini
2014-10-28fdo#84938: replace TIMEF_ constants with enumNoel Grandin
2014-10-23Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - wip"Jan Holesovsky
2014-10-23Fraction: Revert "fdo#84854 it seems long is not enough on 32 bit"Jan Holesovsky
2014-10-21fdo#84938: replace WINDOW_BORDER constants with enumNoel Grandin
2014-10-16fdo#84854 it seems long is not enough on 32 bitDavid Tardon
2014-10-11convert SFX_CALLMODE constants to SfxCallMode enum classNoel Grandin
2014-10-09fdo#81356: convert Fraction to boost::rational<long> - wipJuan Picca
2014-10-01fdo#82577: Handle TimeNoel Grandin
2014-09-23fdo#82577: Handle WindowNoel Grandin
2014-09-12Turn SfxItemState into a C++11 scoped enumerationStephan Bergmann
2014-09-10Replace uses of old SFX_ITEM_AVAILABLE alias with SFX_ITEM_DEFAULTStephan Bergmann
2014-08-16Consistently use size_t and SAL_MAX_SIZEMatteo Casalin
2014-08-16Consistently use size_t and SAL_MAX_SIZEMatteo Casalin
2014-06-25remove whitespacesMarkus Mohrhard
2014-06-13loplugin:staticcallStephan Bergmann