basegfx/source/polygon/b2dlinegeometry.cxx | 8 basic/source/classes/sbunoobj.cxx | 4 basic/source/comp/scanner.cxx | 2 basic/source/runtime/methods.cxx | 16 canvas/source/opengl/ogl_canvascustomsprite.cxx | 2 chart2/source/controller/dialogs/DataBrowser.cxx | 8 chart2/source/tools/ChartTypeHelper.cxx | 2 compilerplugins/clang/indentation.cxx | 140 +++++ compilerplugins/clang/test/indentation.cxx | 10 connectivity/source/drivers/evoab2/NCatalog.cxx | 5 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx | 24 connectivity/source/parse/sqlnode.cxx | 2 cppu/source/typelib/typelib.cxx | 2 cui/source/dialogs/cuigaldlg.cxx | 2 cui/source/options/optdict.cxx | 2 dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 20 dbaccess/source/core/dataaccess/documentcontainer.cxx | 2 dbaccess/source/core/dataaccess/documentdefinition.cxx | 2 dbaccess/source/ui/browser/formadapter.cxx | 4 dbaccess/source/ui/browser/sbagrid.cxx | 121 ++-- dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 2 desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 2 desktop/source/deployment/misc/dp_misc.cxx | 2 desktop/source/deployment/registry/executable/dp_executable.cxx | 2 desktop/source/deployment/registry/package/dp_package.cxx | 2 desktop/unx/source/start.c | 2 editeng/source/accessibility/AccessibleEditableTextPara.cxx | 2 editeng/source/editeng/impedit4.cxx | 5 editeng/source/misc/svxacorr.cxx | 2 filter/source/msfilter/msvbahelper.cxx | 18 filter/source/msfilter/svdfppt.cxx | 2 filter/source/odfflatxml/OdfFlatXml.cxx | 46 - filter/source/svg/svgwriter.cxx | 18 filter/source/xsltdialog/xmlfiltertestdialog.cxx | 8 filter/source/xsltfilter/LibXSLTTransformer.cxx | 6 filter/source/xsltfilter/XSLTFilter.cxx | 100 ++-- formula/source/core/api/token.cxx | 4 fpicker/source/office/iodlg.cxx | 2 framework/source/jobs/jobdata.cxx | 8 framework/source/layoutmanager/layoutmanager.cxx | 4 framework/source/recording/dispatchrecorder.cxx | 9 hwpfilter/source/drawing.h | 2 hwpfilter/source/hcode.cxx | 18 hwpfilter/source/hiodev.cxx | 2 hwpfilter/source/hwpfile.cxx | 2 hwpfilter/source/hwpread.cxx | 46 - hwpfilter/source/hwpreader.cxx | 13 hwpfilter/source/lexer.cxx | 102 ++-- i18npool/source/breakiterator/breakiterator_th.cxx | 20 i18npool/source/breakiterator/breakiterator_unicode.cxx | 244 +++++----- i18npool/source/localedata/LocaleNode.cxx | 5 i18nutil/source/utility/widthfolding.cxx | 140 ++--- idl/source/objects/object.cxx | 4 idlc/source/astscope.cxx | 2 l10ntools/source/cfgmerge.cxx | 2 l10ntools/source/helpmerge.cxx | 2 l10ntools/source/xrmmerge.cxx | 2 lotuswordpro/source/filter/lwppara.cxx | 18 oox/source/export/chartexport.cxx | 2 oox/source/ppt/pptshapecontext.cxx | 6 reportdesign/source/ui/report/ReportController.cxx | 2 sal/osl/all/log.cxx | 32 - sal/osl/unx/file_stat.cxx | 10 sal/qa/osl/file/osl_File.cxx | 2 sc/qa/extras/check_data_pilot_table.cxx | 2 sc/source/core/data/documen2.cxx | 2 sc/source/core/data/postit.cxx | 4 sc/source/core/data/table1.cxx | 4 sc/source/core/data/table2.cxx | 16 sc/source/core/opencl/op_financial.cxx | 16 sc/source/core/opencl/op_logical.cxx | 24 sc/source/core/opencl/op_math.cxx | 4 sc/source/core/opencl/op_statistical.cxx | 14 sc/source/filter/excel/excform8.cxx | 2 sc/source/filter/excel/excimp8.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/excel/xlroot.cxx | 2 sc/source/ui/app/seltrans.cxx | 4 sc/source/ui/miscdlgs/anyrefdg.cxx | 2 sc/source/ui/miscdlgs/dataproviderdlg.cxx | 2 sc/source/ui/unoobj/chartuno.cxx | 2 sc/source/ui/unoobj/confuno.cxx | 2 sc/source/ui/unoobj/dapiuno.cxx | 3 sc/source/ui/unoobj/docuno.cxx | 4 sc/source/ui/vba/vbainterior.cxx | 2 sc/source/ui/vba/vbarange.cxx | 34 - sc/source/ui/view/dbfunc3.cxx | 2 sc/source/ui/view/editsh.cxx | 2 sc/source/ui/view/gridwin.cxx | 2 sc/source/ui/view/preview.cxx | 2 sc/source/ui/view/printfun.cxx | 8 scripting/source/vbaevents/eventhelper.cxx | 6 sd/source/core/sdpage.cxx | 4 sd/source/filter/grf/sdgrffilter.cxx | 2 sd/source/filter/ppt/propread.cxx | 25 - sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx | 2 sd/source/ui/app/sdmod1.cxx | 2 sd/source/ui/func/fusel.cxx | 12 sd/source/ui/slideshow/slideshowimpl.cxx | 2 sd/source/ui/tools/PreviewRenderer.cxx | 2 sd/source/ui/unoidl/unosrch.cxx | 6 sd/source/ui/view/GraphicObjectBar.cxx | 2 sd/source/ui/view/ViewShellManager.cxx | 2 sdext/source/pdfimport/tree/writertreevisiting.cxx | 2 sdext/source/presenter/PresenterController.cxx | 4 sdext/source/presenter/PresenterNotesView.cxx | 24 sdext/source/presenter/PresenterSlideSorter.cxx | 32 - sdext/source/presenter/PresenterToolBar.cxx | 8 sfx2/source/appl/appuno.cxx | 2 sfx2/source/appl/newhelp.cxx | 2 sfx2/source/bastyp/bitset.cxx | 2 sfx2/source/control/shell.cxx | 2 sfx2/source/doc/doctemplates.cxx | 2 slideshow/source/engine/slide/userpaintoverlay.cxx | 2 soltools/cpp/_tokens.c | 13 soltools/mkdepend/parse.c | 2 svgio/source/svgreader/svgsvgnode.cxx | 2 svl/source/numbers/zformat.cxx | 2 svtools/source/config/helpopt.cxx | 2 svtools/source/filter/SvFilterOptionsDialog.cxx | 2 svtools/source/table/tablecontrol_impl.cxx | 4 svx/source/accessibility/svxrectctaccessiblecontext.cxx | 2 svx/source/gallery2/galbrws2.cxx | 2 svx/source/gallery2/galmisc.cxx | 2 svx/source/sdr/animation/scheduler.cxx | 2 svx/source/sidebar/nbdtmg.cxx | 47 + svx/source/svdraw/svditer.cxx | 3 svx/source/table/tablecontroller.cxx | 5 svx/source/xml/xmlgrhlp.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 6 sw/source/core/access/accframebase.cxx | 2 sw/source/core/access/accmap.cxx | 4 sw/source/core/crsr/pam.cxx | 6 sw/source/core/crsr/viscrs.cxx | 2 sw/source/core/doc/DocumentRedlineManager.cxx | 2 sw/source/core/doc/doccorr.cxx | 2 sw/source/core/layout/dbg_lay.cxx | 4 sw/source/core/layout/fly.cxx | 8 sw/source/core/layout/flycnt.cxx | 12 sw/source/core/layout/frmtool.cxx | 4 sw/source/core/layout/paintfrm.cxx | 2 sw/source/core/text/EnhancedPDFExportHelper.cxx | 48 - sw/source/core/text/frmform.cxx | 2 sw/source/core/text/itrcrsr.cxx | 2 sw/source/core/text/porlay.cxx | 2 sw/source/core/txtnode/atrflyin.cxx | 2 sw/source/core/unocore/unodraw.cxx | 2 sw/source/core/unocore/unoportenum.cxx | 4 sw/source/core/unocore/unostyle.cxx | 2 sw/source/filter/ww8/wrtww8.cxx | 4 sw/source/filter/ww8/ww8glsy.cxx | 8 sw/source/filter/ww8/ww8par2.cxx | 2 sw/source/filter/ww8/ww8par6.cxx | 2 sw/source/filter/xml/xmliteme.cxx | 4 sw/source/filter/xml/xmlithlp.cxx | 4 sw/source/ui/dbui/addresslistdialog.cxx | 4 sw/source/ui/vba/vbafont.cxx | 2 sw/source/uibase/dbui/dbmgr.cxx | 18 sw/source/uibase/dochdl/swdtflvr.cxx | 2 sw/source/uibase/inc/usrpref.hxx | 10 sw/source/uibase/shells/textsh1.cxx | 2 sw/source/uibase/uitest/uiobject.cxx | 4 sw/source/uibase/wrtsh/wrtsh1.cxx | 2 toolkit/source/awt/vclxwindows.cxx | 2 toolkit/source/controls/controlmodelcontainerbase.cxx | 4 toolkit/source/controls/unocontrolmodel.cxx | 2 ucb/source/ucp/ext/ucpext_content.cxx | 2 ucb/source/ucp/tdoc/tdoc_provider.cxx | 4 ucb/source/ucp/webdav-neon/ContentProperties.cxx | 2 ucb/source/ucp/webdav-neon/DateTimeHelper.cxx | 2 unotools/source/misc/fontdefs.cxx | 2 unotools/source/ucbhelper/xtempfile.cxx | 4 vbahelper/source/msforms/vbacontrol.cxx | 2 vbahelper/source/vbahelper/vbafontbase.cxx | 2 vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 2 vcl/source/bitmap/BitmapTools.cxx | 2 vcl/source/control/edit.cxx | 2 vcl/source/control/notebookbar.cxx | 20 vcl/source/filter/ipict/ipict.cxx | 48 - vcl/source/font/PhysicalFontCollection.cxx | 6 vcl/source/gdi/embeddedfontshelper.cxx | 2 vcl/source/gdi/oldprintadaptor.cxx | 8 vcl/source/opengl/OpenGLHelper.cxx | 2 vcl/source/treelist/transfer.cxx | 8 vcl/source/window/brdwin.cxx | 16 vcl/unx/generic/app/saldisp.cxx | 15 vcl/unx/generic/app/wmadaptor.cxx | 4 vcl/unx/generic/gdi/freetypetextrender.cxx | 2 vcl/unx/generic/window/salframe.cxx | 4 vcl/unx/gtk3/a11y/atkwrapper.cxx | 4 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 16 vcl/unx/gtk3/hudawareness.cxx | 12 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 xmlhelp/source/cxxhelp/provider/databases.cxx | 4 xmlhelp/source/treeview/tvread.cxx | 16 xmloff/source/chart/SchXMLPlotAreaContext.cxx | 2 xmloff/source/draw/shapeexport.cxx | 6 xmloff/source/style/impastpl.cxx | 34 - xmloff/source/style/xmlnume.cxx | 2 xmloff/source/style/xmlstyle.cxx | 2 xmloff/source/table/XMLTableExport.cxx | 8 xmloff/source/text/txtflde.cxx | 6 xmloff/source/text/txtparai.cxx | 2 203 files changed, 1176 insertions(+), 1005 deletions(-)
New commits: commit bfc1600c6ade6f006eb774bffe7caa9c948e8603 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jun 22 10:21:21 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jun 28 10:47:34 2021 +0200 loplugin:indentation improve checks for brace alignment Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 72c25f0c0593..4bba7cb009f9 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -929,10 +929,10 @@ namespace basegfx if(aOrientation == B2VectorOrientation::Neutral) { - // they are parallel or empty; if they are both not zero and point - // in opposite direction, a half-circle is needed - if(!aTangentPrev.equalZero() && !aTangentEdge.equalZero()) - { + // they are parallel or empty; if they are both not zero and point + // in opposite direction, a half-circle is needed + if(!aTangentPrev.equalZero() && !aTangentEdge.equalZero()) + { const double fAngle(fabs(aTangentPrev.angle(aTangentEdge))); if(fTools::equal(fAngle, F_PI)) diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index f4dbd35e3b6c..edf112eca9e3 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -2132,7 +2132,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) aMember.setValue( aAnyValue ); } return; - } + } // take over the value from Uno to Sbx Any aAnyValue = sbxToUnoValue( pVar, pProp->aUnoProp.Type, &pProp->aUnoProp ); try @@ -4565,7 +4565,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP break; } } - } + } return bSuccess; } diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index f74259d7bbbf..268308ab13c1 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -440,7 +440,7 @@ bool SbiScanner::NextSym() { GenError( ERRCODE_BASIC_SYNTAX ); } - } + } } // Hex/octal number? Read in and convert: diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index fce05bf3e4d1..fb0e3e81aaa7 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -431,25 +431,25 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite) int nSize = PATH_INCR; std::unique_ptr<char[]> pMem; while( true ) - { + { pMem.reset(new char[nSize]); if( !pMem ) - { + { StarBASIC::Error( ERRCODE_BASIC_NO_MEMORY ); return; - } + } if( getcwd( pMem.get(), nSize-1 ) != nullptr ) - { + { rPar.Get(0)->PutString(OUString::createFromAscii(pMem.get())); return; - } + } if( errno != ERANGE ) - { + { StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR ); return; - } + } nSize += PATH_INCR; - }; + }; #endif } diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx index 2e930611f5bf..d15de6b31c0d 100644 --- a/canvas/source/opengl/ogl_canvascustomsprite.cxx +++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx @@ -217,7 +217,7 @@ namespace oglcanvas glVertex2d( rCandidate.getC().getX(), rCandidate.getC().getY()); - } + } glEnd(); } else diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index a58d24433b75..37e820eb5d94 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -908,9 +908,9 @@ void DataBrowser::RemoveColumn() void DataBrowser::InsertRow() { - sal_Int32 nRowIdx = GetCurRow(); + sal_Int32 nRowIdx = GetCurRow(); - if( nRowIdx >= 0 && m_apDataBrowserModel) + if( nRowIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -923,9 +923,9 @@ void DataBrowser::InsertRow() void DataBrowser::RemoveRow() { - sal_Int32 nRowIdx = GetCurRow(); + sal_Int32 nRowIdx = GetCurRow(); - if( nRowIdx >= 0 && m_apDataBrowserModel) + if( nRowIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index a4b8059ffb19..bb8f965ee199 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -113,7 +113,7 @@ bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartTy //@todo ask charttype itself --> need model change first if(xChartType.is()) { - if(nDimensionCount==2) + if(nDimensionCount==2) { OUString aChartTypeName = xChartType->getChartType(); if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ) diff --git a/compilerplugins/clang/indentation.cxx b/compilerplugins/clang/indentation.cxx index 088de1e702d6..345b33a5bd63 100644 --- a/compilerplugins/clang/indentation.cxx +++ b/compilerplugins/clang/indentation.cxx @@ -15,6 +15,7 @@ #include <iostream> #include <fstream> #include <set> +#include <unordered_set> #include "plugin.hxx" /* @@ -65,9 +66,17 @@ public: bool PostTraverseSwitchStmt(SwitchStmt*, bool); bool TraverseSwitchStmt(SwitchStmt*); bool VisitSwitchStmt(SwitchStmt const*); + bool VisitIfStmt(IfStmt const*); + bool VisitForStmt(ForStmt const*); + bool VisitWhileStmt(WhileStmt const*); + bool VisitDoStmt(DoStmt const*); + bool VisitCXXForRangeStmt(CXXForRangeStmt const*); private: + void checkCompoundStmtBraces(const Stmt* parentStmt, const CompoundStmt*); + std::vector<const Stmt*> switchStmtBodies; + std::unordered_set<const Stmt*> chainedSet; }; bool Indentation::PreTraverseSwitchStmt(SwitchStmt* switchStmt) @@ -258,9 +267,140 @@ bool Indentation::VisitCompoundStmt(CompoundStmt const* compoundStmt) } } } + + return true; +} + +bool Indentation::VisitIfStmt(IfStmt const* ifStmt) +{ + if (ignoreLocation(ifStmt)) + return true; + + // TODO - ignore chained if statements for now + if (auto chained = ifStmt->getElse()) + chainedSet.insert(chained); + if (chainedSet.find(ifStmt) != chainedSet.end()) + return true; + + if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(ifStmt->getThen())) + checkCompoundStmtBraces(ifStmt, compoundStmt); + // TODO - needs to be checked against the line that contains the else keyword, but not against the parent + // if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(ifStmt->getElse())) + // checkCompoundStmtBraces(ifStmt, compoundStmt); + return true; +} + +bool Indentation::VisitForStmt(ForStmt const* forStmt) +{ + if (ignoreLocation(forStmt)) + return true; + if (chainedSet.find(forStmt) != chainedSet.end()) + return true; + if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(forStmt->getBody())) + checkCompoundStmtBraces(forStmt, compoundStmt); + return true; +} + +bool Indentation::VisitWhileStmt(WhileStmt const* whileStmt) +{ + if (ignoreLocation(whileStmt)) + return true; + if (chainedSet.find(whileStmt) != chainedSet.end()) + return true; + if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(whileStmt->getBody())) + checkCompoundStmtBraces(whileStmt, compoundStmt); return true; } +bool Indentation::VisitDoStmt(DoStmt const* doStmt) +{ + if (ignoreLocation(doStmt)) + return true; + if (chainedSet.find(doStmt) != chainedSet.end()) + return true; + if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(doStmt->getBody())) + checkCompoundStmtBraces(doStmt, compoundStmt); + return true; +} + +bool Indentation::VisitCXXForRangeStmt(CXXForRangeStmt const* cxxForRangeStmt) +{ + if (ignoreLocation(cxxForRangeStmt)) + return true; + if (chainedSet.find(cxxForRangeStmt) != chainedSet.end()) + return true; + if (auto compoundStmt = dyn_cast_or_null<CompoundStmt>(cxxForRangeStmt->getBody())) + checkCompoundStmtBraces(cxxForRangeStmt, compoundStmt); + return true; +} + +void Indentation::checkCompoundStmtBraces(const Stmt* parentStmt, const CompoundStmt* compoundStmt) +{ + auto& SM = compiler.getSourceManager(); + bool invalid1 = false; + bool invalid2 = false; + + auto parentBeginLoc = compat::getBeginLoc(parentStmt); + unsigned parentColumn = SM.getPresumedColumnNumber(parentBeginLoc, &invalid1); + if (invalid1) + return; + + auto startBraceLoc = compat::getBeginLoc(compoundStmt); + auto endBraceLoc = compat::getEndLoc(compoundStmt); + unsigned beginColumn = SM.getPresumedColumnNumber(startBraceLoc, &invalid1); + unsigned beginLine = SM.getPresumedLineNumber(startBraceLoc, &invalid2); + if (invalid1 || invalid2) + return; + unsigned endColumn = SM.getPresumedColumnNumber(endBraceLoc, &invalid1); + unsigned endLine = SM.getPresumedLineNumber(endBraceLoc, &invalid2); + if (invalid1 || invalid2) + return; + if (beginLine == endLine) + return; + + // check for code to the left of the starting brace + bool foundCodeToLeft = false; + { + const char* p1 = SM.getCharacterData(startBraceLoc); + --p1; + while (*p1 && *p1 != '\n') + { + if (*p1 != ' ') + { + foundCodeToLeft = true; + break; + } + --p1; + } + } + + // if we found code to the left of the start brace, that means the end-brace needs + // to line up with the start of the parent statement + if (foundCodeToLeft) + { + if (parentColumn != endColumn) + { + report(DiagnosticsEngine::Warning, "end brace not aligned with beginning of statement", + endBraceLoc); + report(DiagnosticsEngine::Note, "statement beginning here", parentBeginLoc); + } + } + else + { + if (parentColumn != beginColumn) + { + report(DiagnosticsEngine::Warning, + "start brace not aligned with beginning of parent statement", startBraceLoc); + report(DiagnosticsEngine::Note, "statement beginning here", parentBeginLoc); + } + else if (beginColumn != endColumn) + { + report(DiagnosticsEngine::Warning, "start and end brace not aligned", endBraceLoc); + report(DiagnosticsEngine::Note, "start brace here", startBraceLoc); + } + } +} + bool Indentation::VisitSwitchStmt(SwitchStmt const* switchStmt) { if (ignoreLocation(switchStmt)) diff --git a/compilerplugins/clang/test/indentation.cxx b/compilerplugins/clang/test/indentation.cxx index e0e25884eebb..8ef6d2c03653 100644 --- a/compilerplugins/clang/test/indentation.cxx +++ b/compilerplugins/clang/test/indentation.cxx @@ -47,6 +47,16 @@ void top1(int x) { foo(); } + if (x) + { // expected-note {{start brace here [loplugin:indentation]}} + foo(); + } // expected-error {{start and end brace not aligned [loplugin:indentation]}} + + if (x) // expected-note {{statement beginning here [loplugin:indentation]}} + { // expected-error {{start brace not aligned with beginning of parent statement [loplugin:indentation]}} + foo(); + } + if (x) ; else diff --git a/connectivity/source/drivers/evoab2/NCatalog.cxx b/connectivity/source/drivers/evoab2/NCatalog.cxx index fb010b8dce5d..6b409ce66d65 100644 --- a/connectivity/source/drivers/evoab2/NCatalog.cxx +++ b/connectivity/source/drivers/evoab2/NCatalog.cxx @@ -67,9 +67,8 @@ Reference< XNameAccess > SAL_CALL OEvoabCatalog::getTables( ) try { - if (!m_pTables) { - refreshTables(); - } + if (!m_pTables) + refreshTables(); } catch( const RuntimeException& ) { diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index 6c798e5a166c..0e98a5944a3e 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -1083,20 +1083,20 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( bool bTableFound = true; sal_Int32 nLength = types.getLength(); if(nLength) - { - bTableFound = false; + { + bTableFound = false; - const OUString* pBegin = types.getConstArray(); - const OUString* pEnd = pBegin + nLength; - for(;pBegin != pEnd;++pBegin) - { - if(*pBegin == aTable) - { - bTableFound = true; - break; - } - } + const OUString* pBegin = types.getConstArray(); + const OUString* pEnd = pBegin + nLength; + for(;pBegin != pEnd;++pBegin) + { + if(*pBegin == aTable) + { + bTableFound = true; + break; + } } + } if(!bTableFound) return pResult; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index c4c28dc4a822..9902c571b7ea 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -823,7 +823,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral) } else pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace(',', sal_Unicode()); - } + } } OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType, OSQLParseNode* pLiteral) diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 26875778c22b..fa2a73d767ac 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -1655,7 +1655,7 @@ extern "C" sal_Int32 typelib_typedescription_getAlignedUnoSize( // inherit structs extends the base struct. nStructSize = pTmp->pBaseTypeDescription->aBase.nSize; rMaxIntegralTypeSize = pTmp->pBaseTypeDescription->aBase.nAlignment; - } + } for( sal_Int32 i = 0; i < pTmp->nMembers; i++ ) { typelib_TypeDescription * pMemberType = nullptr; diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 3a0dcb8a69c9..1c4b15576190 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -762,7 +762,7 @@ void TPGalleryThemeProperties::FillFilterList() aExtensions += ";"; aExtensions += aWildcard + aFilter.second.getToken( 0, ';', nIndex ); } - } + } #endif #if defined(_WIN32) diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 0a7a4ba74c5c..945202e75ce6 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -623,7 +623,7 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn) nAddRes = linguistic::AddEntryToDic( xDic, aNewWord, bIsNegEntry, aRplcText, false ); - } + } } if (DictionaryError::NONE != nAddRes) SvxDicError(m_xDialog.get(), nAddRes); diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 2284f1db3e3f..1153fb56714e 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -431,11 +431,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc || !m_aCurrentColumns[SelectColumns] || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) ) - { - OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); - SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); - throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); - } + { + OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); + SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); + throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); + } OUString aName, aNewName; column->getPropertyValue(PROPERTY_NAME) >>= aName; @@ -501,11 +501,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnNameOrderBy_throw(const Refer || !m_aCurrentColumns[SelectColumns] || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) ) - { - OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); - SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); - throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); - } + { + OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); + SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); + throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); + } OUString aName; column->getPropertyValue(PROPERTY_NAME) >>= aName; diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 472f60ad566f..4554a1fd4dcb 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -413,7 +413,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com aOpenCommand, Environment ); aRet <<= xSet; - } + } else { // Unsupported. diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 8291597870c5..b702d9133f94 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -883,7 +883,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons _rxEnvironment ); // Unreachable OSL_FAIL( "unreachable" ); - } + } OSL_ENSURE( !m_pImpl->m_aProps.sPersistentName.isEmpty(), "ODocumentDefinition::onCommandOpenSomething: no persistent name - cannot load!" ); diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 9620d5840a34..ee38f63609b0 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1376,7 +1376,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU if (!xElementSet.is()) { throw css::lang::IllegalArgumentException(); - } + } OUString sName; try { @@ -1545,7 +1545,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem if (!xElementSet.is()) { throw css::lang::IllegalArgumentException(); - } + } OUString sName; try { diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 7c6278d60fe2..795aae0350dc 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1142,82 +1142,83 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) if (!::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)).is()) return nAction; - if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) do - { // odd construction, but spares us a lot of (explicit ;) goto's + if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) + do + { // odd construction, but spares us a lot of (explicit ;) goto's - if (!GetEmptyRow().is()) - // without an empty row we're not in update mode - break; + if (!GetEmptyRow().is()) + // without an empty row we're not in update mode + break; - const sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false); - const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X())); + const sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false); + const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X())); - sal_Int32 nCorrectRowCount = GetRowCount(); - if (GetOptions() & DbGridControlOptions::Insert) - --nCorrectRowCount; // there is an empty row for inserting records - if (IsCurrentAppending()) - --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one + sal_Int32 nCorrectRowCount = GetRowCount(); + if (GetOptions() & DbGridControlOptions::Insert) + --nCorrectRowCount; // there is an empty row for inserting records + if (IsCurrentAppending()) + --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one - if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) ) - // no valid cell under the mouse cursor - break; + if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) ) + // no valid cell under the mouse cursor + break; - tools::Rectangle aRect = GetCellRect(nRow, nCol, false); - if (!aRect.IsInside(rEvt.maPosPixel)) - // not dropped within a cell (a cell isn't as wide as the column - the are small spaces) - break; + tools::Rectangle aRect = GetCellRect(nRow, nCol, false); + if (!aRect.IsInside(rEvt.maPosPixel)) + // not dropped within a cell (a cell isn't as wide as the column - the are small spaces) + break; - if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow)) - // there is a current and modified row or cell and he text is to be dropped into another one - break; + if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow)) + // there is a current and modified row or cell and he text is to be dropped into another one + break; - CellControllerRef xCurrentController = Controller(); - if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId()))) - // the current controller is modified and the user wants to drop in another cell -> no chance - // (when leaving the modified cell an error may occur - this is deadly while dragging) - break; + CellControllerRef xCurrentController = Controller(); + if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId()))) + // the current controller is modified and the user wants to drop in another cell -> no chance + // (when leaving the modified cell an error may occur - this is deadly while dragging) + break; - Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol)); - if (!xField.is()) - // the column is not valid bound (for instance a binary field) - break; + Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol)); + if (!xField.is()) + // the column is not valid bound (for instance a binary field) + break; - try - { - if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY))) + try + { + if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY))) + break; + } + catch (const Exception& ) + { + // assume RO break; - } - catch (const Exception& ) - { - // assume RO - break; - } + } - try - { - // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface - Reference< XIndexAccess > xColumnControls(static_cast<css::form::XGridPeer*>(GetPeer()), UNO_QUERY); - if (xColumnControls.is()) + try { - Reference< css::awt::XTextComponent > xColControl( - xColumnControls->getByIndex(GetViewColumnPos(nCol)), - css::uno::UNO_QUERY); - if (xColControl.is()) + // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface + Reference< XIndexAccess > xColumnControls(static_cast<css::form::XGridPeer*>(GetPeer()), UNO_QUERY); + if (xColumnControls.is()) { - m_bActivatingForDrop = true; - GoToRowColumnId(nRow, nCol); - m_bActivatingForDrop = false; - - nAction = DND_ACTION_COPY; + Reference< css::awt::XTextComponent > xColControl( + xColumnControls->getByIndex(GetViewColumnPos(nCol)), + css::uno::UNO_QUERY); + if (xColControl.is()) + { + m_bActivatingForDrop = true; + GoToRowColumnId(nRow, nCol); + m_bActivatingForDrop = false; + + nAction = DND_ACTION_COPY; + } } } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("dbaccess"); - } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } - } while (false); + } while (false); if(nAction != DND_ACTION_COPY && GetEmptyRow().is()) { diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index c036f8bdee82..74983ef30bb6 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -227,7 +227,7 @@ namespace dbaui [](const Type& type) { return type == cppu::UnoType<XScriptInvocationContext>::get(); } ); aTypes.realloc( std::distance(aTypes.begin(), newEnd) ); - } + } return aTypes; } diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index bda1b1678190..4db98a876b05 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -421,7 +421,7 @@ void UpdateInstallDialog::Thread::installExtensions() m_dialog.m_xStatusbar->set_percentage( (sal::static_int_cast<sal_uInt16>(100) * count) / sal::static_int_cast<sal_uInt16>(m_aVecUpdateData.size())); - } + } m_dialog.m_xFt_extension_name->set_label(updateData.aInstalledPackage->getDisplayName()); } bool bError = false; diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index d24811621d72..63f684666857 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -521,7 +521,7 @@ void syncRepositories( restarter->requestRestart(xCmdEnv.is() ? xCmdEnv->getInteractionHandler() : Reference<task::XInteractionHandler>()); } - } + } #endif } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index f41836f8e4d0..40b253587b81 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -114,7 +114,7 @@ BackendImpl::BackendImpl( OUString dbFile = makeURL(getCachePath(), "backenddb.xml"); m_backendDb.reset( new ExecutableBackendDb(getComponentContext(), dbFile)); - } + } } // XServiceInfo diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index f2dd75ccca6e..8d8d234858c9 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -285,7 +285,7 @@ BackendImpl::BackendImpl( dbFile = makeURL(dbFile, "backenddb.xml"); m_backendDb.reset( new ExtensionBackendDb(getComponentContext(), dbFile)); - } + } } diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index 76f3adcb6e9c..385761a81230 100644 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -786,7 +786,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) // Then send args bSentArgs = send_args(fd, pCwdPath); - } + } close(fd); } diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 624227a5f64e..bc72db490fe4 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1923,7 +1923,7 @@ namespace accessibility //while ( preWordStart > 0 && aBoundary.startPos == curWordStart) while ( (preWordStart >= 0 && !bWord ) || ( aBoundary.endPos > curWordStart ) ) - { + { preWordStart--; bWord = implGetWordBoundary( sText, aBoundary, preWordStart ); } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index ee199b663855..8a6e0a68baca 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -148,9 +148,8 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) // dependent on a secondary. SfxItemPool* pPool = &aEditDoc.GetItemPool(); while (pPool->GetSecondaryPool() && pPool->GetName() != "EditEngineItemPool") - { + { pPool = pPool->GetSecondaryPool(); - } DBG_ASSERT(pPool && pPool->GetName() == "EditEngineItemPool", @@ -1505,7 +1504,7 @@ bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) editeng::HangulHanjaConversion::IsChinese( nSrcLang )); if (bHasConvTxt) return bHasConvTxt; - } + } } return bHasConvTxt; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 4507cd5523b5..b58c19492650 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -834,7 +834,7 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rT SID_ATTR_CHAR_UNDERLINE, aSvxUnderlineItem); } - } + } return -1 != nFndPos; } diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 6d29cd972fae..3f28fb1385ff 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -108,17 +108,17 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath ) << " and we look for " << aURL); OUString aName = xModel->getURL() ; if (aName.isEmpty()) + { + uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); + xProps->getPropertyValue("Title") >>= aName; + aName = aName.getToken(0, '-').trim(); + if( sMacroURLOrPath.lastIndexOf( aName ) >= 0 ) { - uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_SET_THROW ); - uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW ); - xProps->getPropertyValue("Title") >>= aName; - aName = aName.getToken(0, '-').trim(); - if( sMacroURLOrPath.lastIndexOf( aName ) >= 0 ) - { - pFoundShell = pShell; - break; - } + pFoundShell = pShell; + break; } + } if ( sMacroURLOrPath.endsWithIgnoreAsciiCase( ".dot" ) ) { diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index df873c2bf122..1b5a30110a94 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2516,7 +2516,7 @@ void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind ) pMasterPersist = &(*pPageList)[ nMasterIndex ]; } m_pPPTStyleSheet = pMasterPersist->xStyleSheet.get(); - } + } } if ( !m_pPPTStyleSheet ) m_pPPTStyleSheet = m_pDefaultSheet; diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 69deeb36ee71..4d60054317c0 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -120,13 +120,13 @@ OdfFlatXml::importer( sal_Int32 paramCount = sourceData.getLength(); for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++) - { - paramName = sourceData[paramIdx].Name; - if ( paramName == "InputStream" ) - sourceData[paramIdx].Value >>= inputStream; - else if ( paramName == "URL" ) - sourceData[paramIdx].Value >>= url; - } + { + paramName = sourceData[paramIdx].Name; + if ( paramName == "InputStream" ) + sourceData[paramIdx].Value >>= inputStream; + else if ( paramName == "URL" ) + sourceData[paramIdx].Value >>= url; + } OSL_ASSERT(inputStream.is()); if (!inputStream.is()) @@ -179,13 +179,13 @@ OdfFlatXml::importer( sal_Int32 paramCount = sourceData.getLength(); for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++) - { - paramName = sourceData[paramIdx].Name; - if ( paramName == "InputStream" ) - sourceData[paramIdx].Value >>= inputStream; - else if ( paramName == "URL" ) - sourceData[paramIdx].Value >>= url; - } + { + paramName = sourceData[paramIdx].Name; + if ( paramName == "InputStream" ) + sourceData[paramIdx].Value >>= inputStream; + else if ( paramName == "URL" ) + sourceData[paramIdx].Value >>= url; + } OSL_ASSERT(inputStream.is()); if (!inputStream.is()) @@ -226,17 +226,17 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData, // Read output stream and target URL from the parameters given in sourceData. sal_Int32 paramCount = sourceData.getLength(); for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++) - { - paramName = sourceData[paramIdx].Name; - if ( paramName == "OutputStream" ) - sourceData[paramIdx].Value >>= outputStream; - } + { + paramName = sourceData[paramIdx].Name; + if ( paramName == "OutputStream" ) + sourceData[paramIdx].Value >>= outputStream; + } if (!getDelegate().is()) - { - Reference< XDocumentHandler > saxWriter = Writer::create(m_xContext); - setDelegate(saxWriter); - } + { + Reference< XDocumentHandler > saxWriter = Writer::create(m_xContext); + setDelegate(saxWriter); + } // get data source interface ... Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY); OSL_ASSERT(dataSource.is()); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index a5fe44536d32..fbf3561352c3 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1282,14 +1282,14 @@ void SVGTextWriter::startTextShape() // if text is rotated, set transform matrix at text element const vcl::Font& rFont = mpVDev->GetFont(); if( rFont.GetOrientation() ) - { - Point aRot( maTextPos ); - OUString aTransform = "rotate(" + - OUString::number( rFont.GetOrientation().get() * -0.1 ) + " " + - OUString::number( aRot.X() ) + " " + - OUString::number( aRot.Y() ) + ")"; - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); - } + { + Point aRot( maTextPos ); + OUString aTransform = "rotate(" + + OUString::number( rFont.GetOrientation().get() * -0.1 ) + " " + + OUString::number( aRot.X() ) + " " + + OUString::number( aRot.Y() ) + ")"; + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); + } mpTextShapeElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemText, true, mbIWS )); startTextParagraph(); @@ -2876,7 +2876,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx, SvXMLElementExport aRefElem( mrExport, XML_NAMESPACE_NONE, "use", true, true ); return; - } + } } BitmapEx aBmpEx( rBmpEx ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index c00301bacfc3..032e00782a7b 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -442,10 +442,10 @@ void XMLFilterTestDialog::doExport( const Reference< XComponent >& xComp ) aSourceData[i++].Value <<= true; if( bUseDocType ) - { - aSourceData[i ].Name = "DocType_Public"; - aSourceData[i++].Value <<= m_xFilterInfo->maDocType; - } + { + aSourceData[i ].Name = "DocType_Public"; + aSourceData[i++].Value <<= m_xFilterInfo->maDocType; + } Reference< XExportFilter > xExporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY ); Reference< XDocumentHandler > xHandler( xExporter, UNO_QUERY ); diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index e11777a59e8d..7ebc7aeb457d 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -217,9 +217,9 @@ namespace XSLT css::uno::Reference<XInputStream> xis = m_transformer->getInputStream(); n = xis->readBytes(m_readBuf, len); if (n > 0) - { - memcpy(buffer, m_readBuf.getArray(), n); - } + { + memcpy(buffer, m_readBuf.getArray(), n); + } return n; } diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index f98b83b73c48..f7dcab9e5cdd 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -316,16 +316,16 @@ namespace XSLT css::uno::Reference<XInputStream> xInputStream; css::uno::Reference<XInteractionHandler> xInterActionHandler; for (sal_Int32 i = 0; i < nLength; i++) - { - aName = aSourceData[i].Name; - Any value = aSourceData[i].Value; - if ( aName == "InputStream" ) - value >>= xInputStream; - else if ( aName == "URL" ) - value >>= aURL; - else if ( aName == "InteractionHandler" ) - value >>= xInterActionHandler; - } + { + aName = aSourceData[i].Name; + Any value = aSourceData[i].Value; + if ( aName == "InputStream" ) + value >>= xInputStream; + else if ( aName == "URL" ) + value >>= aURL; + else if ( aName == "InteractionHandler" ) + value >>= xInterActionHandler; + } OSL_ASSERT(xInputStream.is()); if (!xInputStream.is()) return false; @@ -350,7 +350,7 @@ namespace XSLT OSL_ASSERT(xInputStream.is()); OSL_ASSERT(m_tcontrol.is()); if (xHandler.is() && xInputStream.is() && m_tcontrol.is()) - { + { try { css::uno::Reference<css::io::XSeekable> xSeek(xInputStream, UNO_QUERY); @@ -430,11 +430,11 @@ namespace XSLT TOOLS_WARN_EXCEPTION("filter.xslt", ""); return false; } - } + } else - { - return false; - } + { + return false; + } } sal_Bool @@ -456,16 +456,16 @@ namespace XSLT css::uno::Reference<XInputStream> xInputStream; css::uno::Reference<XInteractionHandler> xInterActionHandler; for (sal_Int32 i = 0; i < nLength; i++) - { - aName = aSourceData[i].Name; - Any value = aSourceData[i].Value; - if ( aName == "InputStream" ) - value >>= xInputStream; - else if ( aName == "URL" ) - value >>= aURL; - else if ( aName == "InteractionHandler" ) - value >>= xInterActionHandler; - } + { + aName = aSourceData[i].Name; + Any value = aSourceData[i].Value; + if ( aName == "InputStream" ) + value >>= xInputStream; + else if ( aName == "URL" ) + value >>= aURL; + else if ( aName == "InteractionHandler" ) + value >>= xInterActionHandler; + } OSL_ASSERT(xInputStream.is()); if (!xInputStream.is()) return false; @@ -490,7 +490,7 @@ namespace XSLT OSL_ASSERT(xInputStream.is()); OSL_ASSERT(m_tcontrol.is()); if (xFastParser.is() && xInputStream.is() && m_tcontrol.is()) - { + { try { css::uno::Reference<css::io::XSeekable> xSeek(xInputStream, UNO_QUERY); @@ -556,11 +556,11 @@ namespace XSLT TOOLS_WARN_EXCEPTION("filter.xslt", ""); return false; } - } + } else - { - return false; - } + { + return false; + } } sal_Bool @@ -582,23 +582,23 @@ namespace XSLT // css::uno::Reference<XOutputStream> rOutputStream; sal_Int32 nLength = aSourceData.getLength(); for (sal_Int32 i = 0; i < nLength; i++) - { - aName = aSourceData[i].Name; - if ( aName == "DocType_Public" ) - aSourceData[i].Value >>= aDoctypePublic; - else if ( aName == "OutputStream" ) - aSourceData[i].Value >>= m_rOutputStream; - else if ( aName == "URL" ) - aSourceData[i].Value >>= sURL; - } + { + aName = aSourceData[i].Name; + if ( aName == "DocType_Public" ) + aSourceData[i].Value >>= aDoctypePublic; + else if ( aName == "OutputStream" ) + aSourceData[i].Value >>= m_rOutputStream; + else if ( aName == "URL" ) + aSourceData[i].Value >>= sURL; + } if (!getDelegate().is()) - { - // get the document writer - setDelegate(css::uno::Reference<XExtendedDocumentHandler>( - Writer::create(m_xContext), - UNO_QUERY_THROW)); - } + { + // get the document writer + setDelegate(css::uno::Reference<XExtendedDocumentHandler>( + Writer::create(m_xContext), + UNO_QUERY_THROW)); + } // create transformer Sequence<Any> args(4); @@ -624,7 +624,7 @@ namespace XSLT OSL_ASSERT(m_rOutputStream.is()); OSL_ASSERT(m_tcontrol.is()); if (m_tcontrol.is() && m_rOutputStream.is()) - { + { // we want to be notified when the processing is done... m_tcontrol->addListener(new XSLTFilterStreamListener(*this)); @@ -648,11 +648,11 @@ namespace XSLT // we will start the transformation as soon as we receive the startDocument // event. return true; - } + } else - { - return false; - } + { + return false; + } } // for the DocumentHandler implementation, we just proxy the diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 6464f3d52b0f..0af1f63f0e5e 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -1739,8 +1739,8 @@ FormulaToken* FormulaTokenArrayPlainIterator::GetNextReferenceOrName() // added to avoid warnings } } - } - } + } + } return nullptr; } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 2f22d3d48b19..1f94a58436ae 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -760,7 +760,7 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid) m_aContent.disableInteractionHandler(); else if ( eInterActionHandlerType == SmartContent::IHT_DEFAULT ) m_aContent.enableDefaultInteractionHandler(); - } + } if ( !bIsFolder // no existent folder && m_xImpl->m_xCbAutoExtension // auto extension is enabled in general diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 6013812e0e7f..1101d77a94da 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -468,10 +468,10 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const { sal_Int32 nIndex = m_sContext.indexOf( rModuleIdent ); if ( nIndex >= 0 && ( nIndex+nModuleIdLen <= nContextLen )) - { - OUString sContextModule = m_sContext.copy( nIndex, nModuleIdLen ); - return sContextModule == rModuleIdent; - } + { + OUString sContextModule = m_sContext.copy( nIndex, nModuleIdLen ); + return sContextModule == rModuleIdent; + } } return false; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 917e4182e1e2..a717de1fa00f 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -1626,8 +1626,8 @@ sal_Bool SAL_CALL LayoutManager::requestElement( const OUString& rResourceURL ) if ( pToolbarManager && bComponentAttached ) { - bNotify = pToolbarManager->requestToolbar( rResourceURL ); - } + bNotify = pToolbarManager->requestToolbar( rResourceURL ); + } } else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow")) { diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx index 70b6b9f41f2f..71639beb0bb5 100644 --- a/framework/source/recording/dispatchrecorder.cxx +++ b/framework/source/recording/dispatchrecorder.cxx @@ -392,9 +392,8 @@ sal_Int32 SAL_CALL DispatchRecorder::getCount() css::uno::Any SAL_CALL DispatchRecorder::getByIndex(sal_Int32 idx) { - if (idx >= static_cast<sal_Int32>(m_aStatements.size())) { + if (idx >= static_cast<sal_Int32>(m_aStatements.size())) throw css::lang::IndexOutOfBoundsException( "Dispatch recorder out of bounds" ); - } Any element(&m_aStatements[idx], cppu::UnoType<css::frame::DispatchStatement>::get()); @@ -411,12 +410,10 @@ void SAL_CALL DispatchRecorder::replaceByIndex(sal_Int32 idx, const css::uno::An Reference< XInterface >(), 2 ); } - if (idx >= static_cast<sal_Int32>(m_aStatements.size())) { - throw css::lang::IndexOutOfBoundsException( + if (idx >= static_cast<sal_Int32>(m_aStatements.size())) + throw css::lang::IndexOutOfBoundsException( "Dispatch recorder out of bounds" ); - } - auto pStatement = o3tl::doAccess<css::frame::DispatchStatement>(element); css::frame::DispatchStatement aStatement( diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 935b33171c15..c7526a4c591e 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -308,7 +308,7 @@ static bool LoadCommonHeader(HWPDrawingObject * hdo, unsigned short * link_info) return true; else return false; - } + } if (size <= common_size) return true; diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index a895caec1eab..dfd9af78b4b8 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -563,9 +563,9 @@ static hchar jaso2ks(hchar hh) { for (size_t i = 0; i < SAL_N_ELEMENTS(jaso_hh_code); i++) if (hh == jaso_hh_code[i]) - { - return sal::static_int_cast<hchar>(0xa4a1 + i); - } + { + return sal::static_int_cast<hchar>(0xa4a1 + i); + } return 0; } @@ -1050,7 +1050,7 @@ int hcharconv(hchar ch, hchar *dest, int codeType) else dest[0] = 0xA1E0; return 1; - } + } //printf("hcharconv Special[%04x]\n",ch); dest[0] = ch; return 1; @@ -1085,16 +1085,16 @@ int kssm_hangul_to_ucs2(hchar ch, hchar *dest) dest[0] = 0x25a1; // empty square. return 1; } - } - else if ( choseong == 1 && jongseong == 1 ){ /* Vowel */ + } + else if ( choseong == 1 && jongseong == 1 ){ /* Vowel */ dest[0] = joongseong_to_unicode[joongseong]; return 1; - } - else if ( joongseong == 2 && jongseong == 1 ){ /* Consonant */ + } + else if ( joongseong == 2 && jongseong == 1 ){ /* Consonant */ dest[0] = choseong_to_unicode[choseong]; return 1; } - else if( choseong > 20 || choseong == 0 || + else if( choseong > 20 || choseong == 0 || joongseong == 17 || joongseong == 24 || joongseong == 25 || joongseong > 29 || jongseong == 0 || jongseong == 18 || diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index a9bd14b57b11..6437004143cb 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -235,7 +235,7 @@ size_t HStreamIODev::skipBlock(size_t size) } return size - remain; } - } + } return _stream->skipBytes(size); } diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 8be445919ed4..4c79a6c1211f 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -291,7 +291,7 @@ void HWPFile::TagsRead() return; if (size <= 0 && tag > 0){ continue; - } + } if (tag == FILETAG_END_OF_COMPRESSED || tag == FILETAG_END_OF_UNCOMPRESSED) diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 28506b369dac..be8cdc7bb82d 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -125,12 +125,12 @@ bool Bookmark::Read(HWPFile & hwpf) return false; if (len != 34)// 2 * (BMK_COMMENT_LEN + 1) + 2 - { + { return hwpf.SetState(HWP_InvalidFileFormat); - } + } if (hh != dummy || dummy != CH_BOOKMARK) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.Read2b(id, BMK_COMMENT_LEN + 1); hwpf.Read2b(&type, 1); @@ -145,7 +145,7 @@ bool DateFormat::Read(HWPFile & hwpf) return false; if (hh != dummy || CH_DATE_FORM != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } return true; } @@ -158,7 +158,7 @@ bool DateCode::Read(HWPFile & hwpf) return false; if (hh != dummy || CH_DATE_CODE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.AddDateFormat(this); return true; } @@ -176,7 +176,7 @@ bool Tab::Read(HWPFile & hwpf) return false; if (hh != dummy || CH_TAB != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } return true; } @@ -217,7 +217,7 @@ bool TxtBox::Read(HWPFile & hwpf) if (hh != dummy || CH_TEXT_BOX != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.AddBox(this); hwpf.Read2b(&style.cap_len, 1); hwpf.Read2b(&dummy1, 1); @@ -539,7 +539,7 @@ bool Line::Read(HWPFile & hwpf) if (hh != dummy || CH_LINE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.AddBox(this); style.boxnum = fboxnum++; @@ -598,7 +598,7 @@ bool Hidden::Read(HWPFile & hwpf) hwpf.Read2b(&dummy, 1); if (hh != dummy || CH_HIDDEN != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.ReadBlock(info, 8); hwpf.ReadParaList(plist); @@ -623,7 +623,7 @@ bool HeaderFooter::Read(HWPFile & hwpf) hwpf.Read2b(&dummy, 1); if (hh != dummy || CH_HEADER_FOOTER != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.ReadBlock(info, 8); hwpf.Read1b(type); @@ -655,7 +655,7 @@ bool Footnote::Read(HWPFile & hwpf) hwpf.Read2b(&dummy, 1); if (hh != dummy || CH_FOOTNOTE != dummy) { return hwpf.SetState(HWP_InvalidFileFormat); - } + } hwpf.ReadBlock(info, 8); hwpf.Read2b(&number, 1); @@ -686,7 +686,7 @@ bool AutoNum::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -709,7 +709,7 @@ bool NewNum::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -731,7 +731,7 @@ bool ShowPageNum::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } m_nPageNumber = hwpf.getCurrentPage(); hwpf.setMaxSettedPage(); hwpf.AddPageNumber(this); @@ -755,7 +755,7 @@ bool PageNumCtrl::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -773,7 +773,7 @@ bool MailMerge::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -791,7 +791,7 @@ bool Compose::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -810,7 +810,7 @@ bool Hyphen::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -831,7 +831,7 @@ bool TocMark::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -852,7 +852,7 @@ bool IndexMark::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -878,7 +878,7 @@ bool Outline::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -897,7 +897,7 @@ bool KeepSpace::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } @@ -916,7 +916,7 @@ bool FixedSpace::Read(HWPFile & hwpf) if (hh != dummy){ return hwpf.SetState(HWP_InvalidFileFormat); - } + } return !hwpf.State(); } diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 3b69da304af4..45cb722561ca 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -2935,12 +2935,12 @@ void HwpReader::make_text_p3(HWPPara * para,bool bParaStart) { if( n > 0 ) if( para->GetCharShape(n)->index != para->GetCharShape(n-1)->index && !infield ) - { + { if( !pstart ) {STARTP;} if( !tstart ) {STARTT;} makeChars(str); ENDT; - } + } if( para->hhstr[n]->hh == CH_SPACE ) firstspace = 0; else @@ -3749,7 +3749,7 @@ void HwpReader::makeHyperText(TxtBox * hbox) OUString(tmp2.c_str(), tmp2.size()+1, RTL_TEXTENCODING_EUC_KR)); } - } + } else { padd("xlink:type", sXML_CDATA, "simple"); @@ -4297,8 +4297,9 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox) padd("draw:start-angle", sXML_CDATA, Double2Str(start_angle * 180. / PI)); padd("draw:end-angle", sXML_CDATA, Double2Str(end_angle * 180. / PI)); - } - else{ + } + else + { if( drawobj->u.line_arc.flip == 0 ) { padd("draw:start-angle", sXML_CDATA, "270"); @@ -4420,7 +4421,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox) oustr.append(ascii(buf)); } - } + } padd("svg:d", sXML_CDATA, oustr.makeStringAndClear()); diff --git a/hwpfilter/source/lexer.cxx b/hwpfilter/source/lexer.cxx index 2cf76bf3e49f..5d0cef7e2f9d 100644 --- a/hwpfilter/source/lexer.cxx +++ b/hwpfilter/source/lexer.cxx @@ -1085,7 +1085,7 @@ YY_DECL int yy_act; if ( yy_init ) - { + { yy_init = 0; #ifdef YY_USER_INIT @@ -1106,10 +1106,10 @@ YY_DECL yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); - } + } while ( true ) /* loops until end-of-file is reached */ - { + { yy_cp = yy_c_buf_p; /* Support of yytext. */ @@ -1123,32 +1123,32 @@ YY_DECL yy_current_state = yy_start; yy_match: do - { + { YY_CHAR yy_c = sal::static_int_cast<YY_CHAR>(yy_ec[YY_SC_TO_UI(*yy_cp)]); if ( yy_accept[yy_current_state] ) - { + { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { + { yy_current_state = static_cast<int>(yy_def[yy_current_state]); if ( yy_current_state >= 994 ) yy_c = sal::static_int_cast<YY_CHAR>(yy_meta[static_cast<unsigned int>(yy_c)]); - } + } yy_current_state = yy_nxt[yy_base[yy_current_state] + static_cast<unsigned int>(yy_c)]; ++yy_cp; - } + } while ( yy_base[yy_current_state] != 1315 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) - { /* have to back up */ + { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; - } + } YY_DO_BEFORE_ACTION; @@ -1362,7 +1362,7 @@ case YY_STATE_EOF(INITIAL): YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { + { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called @@ -1375,7 +1375,7 @@ case YY_STATE_EOF(INITIAL): yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will @@ -1385,7 +1385,7 @@ case YY_STATE_EOF(INITIAL): * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ + { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; @@ -1406,19 +1406,19 @@ case YY_STATE_EOF(INITIAL): yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) - { + { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; - } + } else - { + { yy_cp = yy_c_buf_p; goto yy_find_action; - } } + } else switch ( yy_get_next_buffer() ) { @@ -1427,7 +1427,7 @@ case YY_STATE_EOF(INITIAL): yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) - { + { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up @@ -1441,13 +1441,13 @@ case YY_STATE_EOF(INITIAL): yy_act = YY_STATE_EOF(YY_START); goto do_action; - } + } else - { + { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; - } + } } break; @@ -1480,7 +1480,7 @@ case YY_STATE_EOF(INITIAL): YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ - } /* end of scanning one token */ + } /* end of scanning one token */ } /* end of yylex */ @@ -1504,23 +1504,23 @@ static int yy_get_next_buffer() "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ + { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { + { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; - } + } else - { + { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; - } } + } /* Try to read more data. */ @@ -1537,12 +1537,12 @@ static int yy_get_next_buffer() yy_current_buffer->yy_n_chars = yy_n_chars = 0; else - { + { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); @@ -1555,7 +1555,7 @@ static int yy_get_next_buffer() static_cast<int>(yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) - { + { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) @@ -1567,7 +1567,7 @@ static int yy_get_next_buffer() /* Include room in for 2 EOB chars. */ yy_flex_realloc( static_cast<void *>(b->yy_ch_buf), b->yy_buf_size + 2 )); - } + } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = nullptr; @@ -1581,7 +1581,7 @@ static int yy_get_next_buffer() num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif - } + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; @@ -1591,23 +1591,23 @@ static int yy_get_next_buffer() yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; - } + } if ( yy_n_chars == 0 ) - { + { if ( number_to_move == YY_MORE_ADJ ) - { + { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); - } + } else - { + { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } } + } else ret_val = EOB_ACT_CONTINUE_SCAN; @@ -1632,21 +1632,21 @@ static yy_state_type yy_get_previous_state() yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { + { YY_CHAR yy_c = sal::static_int_cast<YY_CHAR>(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) - { + { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { + { yy_current_state = static_cast<int>(yy_def[yy_current_state]); if ( yy_current_state >= 994 ) yy_c = sal::static_int_cast<YY_CHAR>(yy_meta[static_cast<unsigned int>(yy_c)]); - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + static_cast<unsigned int>(yy_c)]; } + yy_current_state = yy_nxt[yy_base[yy_current_state] + static_cast<unsigned int>(yy_c)]; + } return yy_current_state; } @@ -1670,16 +1670,16 @@ yy_state_type yy_current_state; YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) - { + { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } + } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { + { yy_current_state = static_cast<int>(yy_def[yy_current_state]); if ( yy_current_state >= 994 ) yy_c = sal::static_int_cast<YY_CHAR>(yy_meta[static_cast<unsigned int>(yy_c)]); - } + } yy_current_state = yy_nxt[yy_base[yy_current_state] + static_cast<unsigned int>(yy_c)]; yy_is_jam = (yy_current_state == 993); @@ -1712,12 +1712,12 @@ YY_BUFFER_STATE new_buffer; return; if ( yy_current_buffer ) - { + { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; - } + } yy_current_buffer = new_buffer; yy_load_buffer_state(); diff --git a/i18npool/source/breakiterator/breakiterator_th.cxx b/i18npool/source/breakiterator/breakiterator_th.cxx index 659a50e44e70..df78aeab3afe 100644 --- a/i18npool/source/breakiterator/breakiterator_th.cxx +++ b/i18npool/source/breakiterator/breakiterator_th.cxx @@ -62,9 +62,13 @@ sal_Int32 SAL_CALL BreakIterator_th::previousCharacters( const OUString& Text, if (m_aNextCellIndex[nStartPos-1] == 0) // not a CTL character return BreakIterator_Unicode::previousCharacters(Text, nStartPos, rLocale, nCharacterIteratorMode, nCount, nDone); - else while (nCount > 0 && m_aNextCellIndex[nStartPos - 1] > 0) { - nCount--; nDone++; - nStartPos = m_aPreviousCellIndex[nStartPos - 1]; + else + { + while (nCount > 0 && m_aNextCellIndex[nStartPos - 1] > 0) + { + nCount--; nDone++; + nStartPos = m_aPreviousCellIndex[nStartPos - 1]; + } } } else nStartPos = 0; @@ -89,9 +93,13 @@ sal_Int32 SAL_CALL BreakIterator_th::nextCharacters(const OUString& Text, if (m_aNextCellIndex[nStartPos] == 0) // not a CTL character return BreakIterator_Unicode::nextCharacters(Text, nStartPos, rLocale, nCharacterIteratorMode, nCount, nDone); - else while (nCount > 0 && m_aNextCellIndex[nStartPos] > 0) { - nCount--; nDone++; - nStartPos = m_aNextCellIndex[nStartPos]; + else + { + while (nCount > 0 && m_aNextCellIndex[nStartPos] > 0) + { + nCount--; nDone++; + nStartPos = m_aNextCellIndex[nStartPos]; + } } } else nStartPos = len; diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index ca34f91e157b..a4a00c46a1ad 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -145,77 +145,52 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal else icuBI->mpValue.reset(); - if (!bInMap && rule) do { - const uno::Sequence< OUString > breakRules = LocaleDataImpl::get()->getBreakIteratorRules(rLocale); + if (!bInMap && rule) + do + { + const uno::Sequence< OUString > breakRules = LocaleDataImpl::get()->getBreakIteratorRules(rLocale); - status = U_ZERO_ERROR; - udata_setAppData("OpenOffice", OpenOffice_dat, &status); - if ( !U_SUCCESS(status) ) throw uno::RuntimeException(); + status = U_ZERO_ERROR; + udata_setAppData("OpenOffice", OpenOffice_dat, &status); + if ( !U_SUCCESS(status) ) throw uno::RuntimeException(); - std::shared_ptr<OOoRuleBasedBreakIterator> rbi; + std::shared_ptr<OOoRuleBasedBreakIterator> rbi; - if (breakRules.getLength() > breakType && !breakRules[breakType].isEmpty()) - { - // langtag;rule;breakType - const OString aBIMapRuleTypeKey( aLangtagStr + ";" + rule + ";" + OString::number(breakType)); - aMapIt = theBIMap.find( aBIMapRuleTypeKey); - bInMap = (aMapIt != theBIMap.end()); - if (bInMap) + if (breakRules.getLength() > breakType && !breakRules[breakType].isEmpty()) { - icuBI->mpValue = aMapIt->second; - icuBI->maBIMapKey = aBIMapGlobalKey; - theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); - break; // do - } + // langtag;rule;breakType + const OString aBIMapRuleTypeKey( aLangtagStr + ";" + rule + ";" + OString::number(breakType)); + aMapIt = theBIMap.find( aBIMapRuleTypeKey); + bInMap = (aMapIt != theBIMap.end()); + if (bInMap) + { + icuBI->mpValue = aMapIt->second; + icuBI->maBIMapKey = aBIMapGlobalKey; + theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); + break; // do + } - rbi = std::make_shared<OOoRuleBasedBreakIterator>(udata_open("OpenOffice", "brk", - OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status); + rbi = std::make_shared<OOoRuleBasedBreakIterator>(udata_open("OpenOffice", "brk", + OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status); - if (U_SUCCESS(status)) - { - icuBI->mpValue = std::make_shared<BI_ValueData>(); - icuBI->mpValue->mpBreakIterator = rbi; - theBIMap.insert( std::make_pair( aBIMapRuleTypeKey, icuBI->mpValue)); - } - else - { - rbi.reset(); - } - } - //use icu's breakiterator for Thai, Tibetan and Dzongkha - else if (rLocale.Language != "th" && rLocale.Language != "lo" && rLocale.Language != "bo" && rLocale.Language != "dz" && rLocale.Language != "km") - { - // language;rule (not langtag, unless we'd actually load such) - OString aLanguage( LanguageTag( rLocale).getLanguage().toUtf8()); - const OString aBIMapRuleKey( aLanguage + ";" + rule); - aMapIt = theBIMap.find( aBIMapRuleKey); - bInMap = (aMapIt != theBIMap.end()); - if (bInMap) - { - icuBI->mpValue = aMapIt->second; - icuBI->maBIMapKey = aBIMapGlobalKey; - theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); - break; // do - } - - status = U_ZERO_ERROR; - OString aUDName = OString::Concat(rule) + "_" + aLanguage; - UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status); - if( U_SUCCESS(status) ) - rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status); - if ( U_SUCCESS(status) ) - { - icuBI->mpValue = std::make_shared<BI_ValueData>(); - icuBI->mpValue->mpBreakIterator = rbi; - theBIMap.insert( std::make_pair( aBIMapRuleKey, icuBI->mpValue)); + if (U_SUCCESS(status)) + { + icuBI->mpValue = std::make_shared<BI_ValueData>(); + icuBI->mpValue->mpBreakIterator = rbi; + theBIMap.insert( std::make_pair( aBIMapRuleTypeKey, icuBI->mpValue)); + } + else + { + rbi.reset(); + } } - else + //use icu's breakiterator for Thai, Tibetan and Dzongkha + else if (rLocale.Language != "th" && rLocale.Language != "lo" && rLocale.Language != "bo" && rLocale.Language != "dz" && rLocale.Language != "km") { - rbi.reset(); - - // ;rule (only) - const OString aBIMapRuleOnlyKey( OString::Concat(";") + rule); - aMapIt = theBIMap.find( aBIMapRuleOnlyKey); + // language;rule (not langtag, unless we'd actually load such) + OString aLanguage( LanguageTag( rLocale).getLanguage().toUtf8()); + const OString aBIMapRuleKey( aLanguage + ";" + rule); + aMapIt = theBIMap.find( aBIMapRuleKey); bInMap = (aMapIt != theBIMap.end()); if (bInMap) { @@ -226,78 +201,107 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal } status = U_ZERO_ERROR; - pUData = udata_open("OpenOffice", "brk", rule, &status); + OString aUDName = OString::Concat(rule) + "_" + aLanguage; + UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status); if( U_SUCCESS(status) ) rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status); if ( U_SUCCESS(status) ) { icuBI->mpValue = std::make_shared<BI_ValueData>(); icuBI->mpValue->mpBreakIterator = rbi; - theBIMap.insert( std::make_pair( aBIMapRuleOnlyKey, icuBI->mpValue)); + theBIMap.insert( std::make_pair( aBIMapRuleKey, icuBI->mpValue)); } else { rbi.reset(); + + // ;rule (only) + const OString aBIMapRuleOnlyKey( OString::Concat(";") + rule); + aMapIt = theBIMap.find( aBIMapRuleOnlyKey); + bInMap = (aMapIt != theBIMap.end()); + if (bInMap) + { + icuBI->mpValue = aMapIt->second; + icuBI->maBIMapKey = aBIMapGlobalKey; + theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); + break; // do + } + + status = U_ZERO_ERROR; + pUData = udata_open("OpenOffice", "brk", rule, &status); + if( U_SUCCESS(status) ) + rbi = std::make_shared<OOoRuleBasedBreakIterator>( pUData, status); + if ( U_SUCCESS(status) ) + { + icuBI->mpValue = std::make_shared<BI_ValueData>(); + icuBI->mpValue->mpBreakIterator = rbi; + theBIMap.insert( std::make_pair( aBIMapRuleOnlyKey, icuBI->mpValue)); + } + else + { + rbi.reset(); + } } } - } - if (rbi) { -#if (U_ICU_VERSION_MAJOR_NUM < 58) - // ICU 58 made RuleBasedBreakIterator::setBreakType() private - // instead of protected, so the old workaround of - // https://ssl.icu-project.org/trac/ticket/5498 - // doesn't work anymore. However, they also claim to have fixed - // the cause that an initial fBreakType==-1 would lead to an - // endless loop under some circumstances. - // Let's see ... - switch (rBreakType) { - case LOAD_CHARACTER_BREAKITERATOR: rbi->publicSetBreakType(UBRK_CHARACTER); break; - case LOAD_WORD_BREAKITERATOR: rbi->publicSetBreakType(UBRK_WORD); break; - case LOAD_SENTENCE_BREAKITERATOR: rbi->publicSetBreakType(UBRK_SENTENCE); break; - case LOAD_LINE_BREAKITERATOR: rbi->publicSetBreakType(UBRK_LINE); break; + if (rbi) { + #if (U_ICU_VERSION_MAJOR_NUM < 58) + // ICU 58 made RuleBasedBreakIterator::setBreakType() private + // instead of protected, so the old workaround of + // https://ssl.icu-project.org/trac/ticket/5498 + // doesn't work anymore. However, they also claim to have fixed + // the cause that an initial fBreakType==-1 would lead to an + // endless loop under some circumstances. + // Let's see ... + switch (rBreakType) { + case LOAD_CHARACTER_BREAKITERATOR: rbi->publicSetBreakType(UBRK_CHARACTER); break; + case LOAD_WORD_BREAKITERATOR: rbi->publicSetBreakType(UBRK_WORD); break; + case LOAD_SENTENCE_BREAKITERATOR: rbi->publicSetBreakType(UBRK_SENTENCE); break; + case LOAD_LINE_BREAKITERATOR: rbi->publicSetBreakType(UBRK_LINE); break; + } + #endif } -#endif - } - } while (false); - - if (!icuBI->mpValue || !icuBI->mpValue->mpBreakIterator) do { - // langtag;;;rBreakType (empty rule; empty breakType) - const OString aBIMapLocaleTypeKey( aLangtagStr + ";;;" + OString::number(rBreakType)); - aMapIt = theBIMap.find( aBIMapLocaleTypeKey); - bInMap = (aMapIt != theBIMap.end()); - if (bInMap) + } while (false); + + if (!icuBI->mpValue || !icuBI->mpValue->mpBreakIterator) + do { - icuBI->mpValue = aMapIt->second; - icuBI->maBIMapKey = aBIMapGlobalKey; - theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); - break; // do - } + // langtag;;;rBreakType (empty rule; empty breakType) + const OString aBIMapLocaleTypeKey( aLangtagStr + ";;;" + OString::number(rBreakType)); + aMapIt = theBIMap.find( aBIMapLocaleTypeKey); + bInMap = (aMapIt != theBIMap.end()); + if (bInMap) + { + icuBI->mpValue = aMapIt->second; + icuBI->maBIMapKey = aBIMapGlobalKey; + theBIMap.insert( std::make_pair( aBIMapGlobalKey, icuBI->mpValue)); + break; // do + } - icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale))); - std::shared_ptr< icu::BreakIterator > pBI; - - status = U_ZERO_ERROR; - switch (rBreakType) { - case LOAD_CHARACTER_BREAKITERATOR: - pBI.reset( icu::BreakIterator::createCharacterInstance(icuLocale, status) ); - break; - case LOAD_WORD_BREAKITERATOR: - pBI.reset( icu::BreakIterator::createWordInstance(icuLocale, status) ); - break; - case LOAD_SENTENCE_BREAKITERATOR: - pBI.reset( icu::BreakIterator::createSentenceInstance(icuLocale, status) ); - break; - case LOAD_LINE_BREAKITERATOR: - pBI.reset( icu::BreakIterator::createLineInstance(icuLocale, status) ); - break; - } - if ( !U_SUCCESS(status) || !pBI ) { - throw uno::RuntimeException(); - } - icuBI->mpValue = std::make_shared<BI_ValueData>(); - icuBI->mpValue->mpBreakIterator = pBI; - theBIMap.insert( std::make_pair( aBIMapLocaleTypeKey, icuBI->mpValue)); - } while (false); + icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale))); + std::shared_ptr< icu::BreakIterator > pBI; + + status = U_ZERO_ERROR; + switch (rBreakType) { + case LOAD_CHARACTER_BREAKITERATOR: + pBI.reset( icu::BreakIterator::createCharacterInstance(icuLocale, status) ); + break; + case LOAD_WORD_BREAKITERATOR: + pBI.reset( icu::BreakIterator::createWordInstance(icuLocale, status) ); + break; + case LOAD_SENTENCE_BREAKITERATOR: + pBI.reset( icu::BreakIterator::createSentenceInstance(icuLocale, status) ); + break; + case LOAD_LINE_BREAKITERATOR: + pBI.reset( icu::BreakIterator::createLineInstance(icuLocale, status) ); + break; + } + if ( !U_SUCCESS(status) || !pBI ) { + throw uno::RuntimeException(); + } + icuBI->mpValue = std::make_shared<BI_ValueData>(); + icuBI->mpValue->mpBreakIterator = pBI; + theBIMap.insert( std::make_pair( aBIMapLocaleTypeKey, icuBI->mpValue)); + } while (false); if (!icuBI->mpValue || !icuBI->mpValue->mpBreakIterator) { throw uno::RuntimeException(); } diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 28ef390f4939..942e03271029 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -75,11 +75,12 @@ const LocaleNode* LocaleNode::getRoot() const const LocaleNode * LocaleNode::findNode ( const char *name) const { if (aName.equalsAscii(name)) return this; - for (size_t i = 0; i< children.size(); i++) { + for (size_t i = 0; i< children.size(); i++) + { const LocaleNode *n=children[i]->findNode(name); if (n) return n; - } + } return nullptr; } diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx index 6f572080689c..7efddd564f0a 100644 --- a/i18nutil/source/utility/widthfolding.cxx +++ b/i18nutil/source/utility/widthfolding.cxx @@ -115,82 +115,82 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal // This conversion algorithm requires at least one character. if (nCount > 0) { - // .. .. KA VOICE .. .. - // ^ ^ - // previousChar currentChar - // ^ - // position - // - // will be converted to - // .. .. GA .. .. - - sal_Int32 *p = nullptr; - sal_Int32 position = 0; - if (useOffset) { - // Allocate nCount length to offset argument. - offset.realloc( nCount ); - p = offset.getArray(); - position = startPos; - } - - // - sal_Unicode previousChar = *src ++; - sal_Unicode currentChar; - - // Composition: KA + voice-mark --> GA - while (-- nCount > 0) { - currentChar = *src ++; - // see http://charts.unicode.org/Web/U3040.html Hiragana (U+3040..U+309F) - // see http://charts.unicode.org/Web/U30A0.html Katakana (U+30A0..U+30FF) - // 0x3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK - // 0x309a COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK - // 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK - // 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK - int j = currentChar - 0x3099; // 0x3099, 0x309a, 0x309b, 0x309c ? - - if (2 <= j && j <= 3) // 0x309b or 0x309c - j -= 2; - - if (0 <= j && j <= 1) { - // 0 addresses a code point regarding 0x3099 or 0x309b (voiced sound mark), - // 1 is 0x309a or 0x309c (semi-voiced sound mark) - int i = int(previousChar - 0x3040); // i acts as an index of array - bool bCompose = false; - - if (0 <= i && i <= (0x30ff - 0x3040) && composition_table[i][j]) - bCompose = true; - - // not to use combined KATAKANA LETTER VU - if ( previousChar == 0x30a6 && (nFlags & WIDTHFOLDING_DONT_USE_COMBINED_VU) ) - bCompose = false; + // .. .. KA VOICE .. .. + // ^ ^ + // previousChar currentChar + // ^ + // position + // + // will be converted to + // .. .. GA .. .. + + sal_Int32 *p = nullptr; + sal_Int32 position = 0; + if (useOffset) { + // Allocate nCount length to offset argument. + offset.realloc( nCount ); + p = offset.getArray(); + position = startPos; + } - if( bCompose ){ - if (useOffset) { - position ++; - *p ++ = position ++; + // + sal_Unicode previousChar = *src ++; + sal_Unicode currentChar; + + // Composition: KA + voice-mark --> GA + while (-- nCount > 0) { + currentChar = *src ++; + // see http://charts.unicode.org/Web/U3040.html Hiragana (U+3040..U+309F) + // see http://charts.unicode.org/Web/U30A0.html Katakana (U+30A0..U+30FF) + // 0x3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK + // 0x309a COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK + // 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK + // 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK + int j = currentChar - 0x3099; // 0x3099, 0x309a, 0x309b, 0x309c ? + + if (2 <= j && j <= 3) // 0x309b or 0x309c + j -= 2; + + if (0 <= j && j <= 1) { + // 0 addresses a code point regarding 0x3099 or 0x309b (voiced sound mark), + // 1 is 0x309a or 0x309c (semi-voiced sound mark) + int i = int(previousChar - 0x3040); // i acts as an index of array + bool bCompose = false; + + if (0 <= i && i <= (0x30ff - 0x3040) && composition_table[i][j]) + bCompose = true; + + // not to use combined KATAKANA LETTER VU + if ( previousChar == 0x30a6 && (nFlags & WIDTHFOLDING_DONT_USE_COMBINED_VU) ) + bCompose = false; + + if( bCompose ){ + if (useOffset) { + position ++; + *p ++ = position ++; + } + *dst ++ = composition_table[i][j]; + previousChar = *src ++; + nCount --; + continue; + } } - *dst ++ = composition_table[i][j]; - previousChar = *src ++; - nCount --; - continue; + if (useOffset) + *p ++ = position ++; + *dst ++ = previousChar; + previousChar = currentChar; } - } - if (useOffset) - *p ++ = position ++; - *dst ++ = previousChar; - previousChar = currentChar; - } - if (nCount == 0) { - if (useOffset) - *p = position; - *dst ++ = previousChar; - } + if (nCount == 0) { + if (useOffset) + *p = position; + *dst ++ = previousChar; + } - *dst = u'\0'; + *dst = u'\0'; - newStr->length = sal_Int32(dst - newStr->buffer); - } + newStr->length = sal_Int32(dst - newStr->buffer); + } if (useOffset) offset.realloc(newStr->length); return OUString(newStr, SAL_NO_ACQUIRE); // take ownership diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 627b158b3da4..6fc0a5e0af7c 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -115,7 +115,7 @@ bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() ) { throw SvParseException( rInStm, "Attribute's " + pS->GetName() + " with different id's"); - } + } } else { @@ -125,7 +125,7 @@ bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, { OString aStr = "Attribute " + pS->GetName() + " and Attribute " + rAttr.GetName() + " with equal id's"; throw SvParseException(rInStm, aStr); - } + } } } SvMetaClass * pSC = aSuperClass.get(); diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index c77ad48ceb1d..d4c0f954367c 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -146,7 +146,7 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName) // have to look in the inherited interfaces as well. if ( !pDecl && m_nodeType == NT_interface ) pDecl = lookupInInherited(scopedName); - } + } } if ( bFindFirstScope && (firstScope != scopedName) ) diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index 5715bd1c1d14..3fc24d50d5ca 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -206,7 +206,7 @@ void CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) case CFG_TEXT_START: { if ( sCurrentResTyp != sTokenName ) { WorkOnResourceEnd(); - } + } sCurrentResTyp = sTokenName; OString sTemp = sToken.copy( sToken.indexOf( "xml:lang=" )); diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 460acb50b253..ed5e1c8777aa 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -183,7 +183,7 @@ void HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile* pMergeDataFile s_ResData.sFilename = sHelpFile; ProcessHelp( aLangHM , sLanguage, &s_ResData , pMergeDataFile ); - } + } file->Write(sPath); } diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 6059ad19160d..a30feb000c3a 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -313,7 +313,7 @@ void XRMResExport::WorkOnDesc( file.close(); memblock[size] = '\0'; rText = OString(memblock.get()); - } + } WorkOnText( rOpenTag, rText ); EndOfText( rOpenTag, rOpenTag ); } diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index a98e4df84707..2a7f3843a5c5 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -426,17 +426,17 @@ void LwpPara::RegisterStyle() else //use named style { if (m_pIndentOverride) + { + if (m_pIndentOverride->IsUseRelative() && GetParent()) { - if (m_pIndentOverride->IsUseRelative() && GetParent()) - { - xOverStyle.reset(new XFParaStyle); - *xOverStyle = *pBaseStyle; - OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get()); - if (!m_ParentStyleName.isEmpty()) - xOverStyle->SetParentStyleName(m_ParentStyleName); - m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName(); - } + xOverStyle.reset(new XFParaStyle); + *xOverStyle = *pBaseStyle; + OverrideIndent(nullptr,m_pIndentOverride.get(),xOverStyle.get()); + if (!m_ParentStyleName.isEmpty()) + xOverStyle->SetParentStyleName(m_ParentStyleName); + m_StyleName = pXFStyleManager->AddStyle(std::move(xOverStyle)).m_pStyle->GetStyleName(); } + } } if (IsInCell()) diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 63f29a245ddc..12a996a45161 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -3470,7 +3470,7 @@ void ChartExport::_exportAxis( pFS->singleElement(FSNS( XML_c, XML_dispUnitsLbl )); pFS->endElement( FSNS( XML_c, XML_dispUnits ) ); } - } + } } } diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index a853843930a6..62351c913567 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -133,7 +133,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con break; } if ( nFirstPlaceholder ) - { + { oox::drawingml::ShapePtr pPlaceholder; if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits