[Libreoffice-commits] core.git: 2 commits - bin/find-can-be-private-symbols.py editeng/source helpcompiler/inc include/basic include/filter include/opencl include/sfx2 include/svtools include/svx include/vcl include/xmloff oox/inc oox/source sc/source sfx2/source svl/source svx/inc sw/inc sw/source tools/source unotools/source vcl/inc vcl/source xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Nov 3 16:13:13 UTC 2019
bin/find-can-be-private-symbols.py | 38 +++++++++++++-
editeng/source/outliner/outliner.cxx | 2
helpcompiler/inc/BasCodeTagger.hxx | 4 -
include/basic/basmgr.hxx | 2
include/filter/msfilter/msdffimp.hxx | 2
include/opencl/platforminfo.hxx | 4 -
include/sfx2/notebookbar/NotebookbarTabControl.hxx | 2
include/svtools/ctrlbox.hxx | 2
include/svtools/svmedit2.hxx | 2
include/svx/AffineMatrixItem.hxx | 2
include/svx/Palette.hxx | 2
include/svx/galctrl.hxx | 24 ++++-----
include/vcl/animate/AnimationBitmap.hxx | 2
include/vcl/button.hxx | 6 +-
include/vcl/commandevent.hxx | 6 +-
include/vcl/debugevent.hxx | 2
include/vcl/graph.hxx | 2
include/vcl/imapobj.hxx | 2
include/vcl/salnativewidgets.hxx | 4 -
include/vcl/uitest/uiobject.hxx | 14 ++---
include/xmloff/xmlnumfi.hxx | 4 -
include/xmloff/xmluconv.hxx | 3 +
oox/inc/drawingml/presetgeometrynames.hxx | 4 -
oox/source/core/relationshandler.cxx | 10 +--
oox/source/ole/olehelper.cxx | 2
oox/source/ole/vbamodule.cxx | 4 -
sc/source/core/tool/calcconfig.cxx | 2
sc/source/core/tool/userlist.cxx | 4 -
sc/source/filter/excel/xipage.cxx | 10 +--
sc/source/filter/excel/xistream.cxx | 2
sc/source/filter/xml/xmlcelli.hxx | 2
sfx2/source/appl/linkmgr2.cxx | 2
sfx2/source/doc/SfxDocumentMetaData.cxx | 2
sfx2/source/notebookbar/DropdownBox.hxx | 3 -
sfx2/source/notebookbar/NotebookbarPopup.hxx | 2
sfx2/source/notebookbar/PriorityHBox.hxx | 2
sfx2/source/notebookbar/PriorityMergedHBox.cxx | 2
sfx2/source/view/lokhelper.cxx | 2
svl/source/numbers/zformat.cxx | 2
svx/inc/palettes.hxx | 6 +-
sw/inc/PageColumnPopup.hxx | 2
sw/inc/PageMarginPopup.hxx | 2
sw/inc/PageOrientationPopup.hxx | 2
sw/inc/PageSizePopup.hxx | 2
sw/source/uibase/inc/actctrl.hxx | 2
tools/source/debug/debug.cxx | 2
tools/source/fsys/urlobj.cxx | 8 +--
unotools/source/config/docinfohelper.cxx | 2
unotools/source/misc/datetime.cxx | 2
vcl/inc/bitmap/Octree.hxx | 4 -
vcl/inc/impfontcharmap.hxx | 2
vcl/inc/opengl/program.hxx | 2
vcl/inc/sallayout.hxx | 4 -
vcl/inc/unx/freetype_glyphcache.hxx | 2
vcl/inc/unx/glyphcache.hxx | 2
vcl/inc/unx/gtk/gtkprn.hxx | 2
vcl/inc/unx/saldisp.hxx | 2
vcl/source/gdi/impgraph.cxx | 5 +
vcl/source/uitest/logger.cxx | 3 -
xmloff/source/core/xmluconv.cxx | 12 ++++
xmloff/source/style/xmlnume.cxx | 54 +++++++++------------
61 files changed, 173 insertions(+), 139 deletions(-)
New commits:
commit 781c4402f1a8c64f87bc81e866bc444b9ed97948
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Nov 2 07:46:49 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Nov 3 17:12:00 2019 +0100
make some classes module-private
improve the script, but it still generates some false positives
Change-Id: If8ee1cba8c04ac0be11f73220149e6de15f24f44
Reviewed-on: https://gerrit.libreoffice.org/81929
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/bin/find-can-be-private-symbols.py b/bin/find-can-be-private-symbols.py
index baaba9e924ff..0ff17072361a 100755
--- a/bin/find-can-be-private-symbols.py
+++ b/bin/find-can-be-private-symbols.py
@@ -1,10 +1,20 @@
#!/usr/bin/python
#
-# Find exported symbols that can be made private.
+# Find exported symbols that can be made non-exported.
#
# Noting that (a) parsing these commands is a pain, the output is quite irregular and (b) I'm fumbling in the
# dark here, trying to guess what exactly constitutes an "import" vs an "export" of a symbol, linux linking
# is rather complex.
+#
+# Takes about 5min to run on a decent machine.
+#
+# The standalone function analysis is reasonable reliable, but the class/method analysis is less so
+# (something to do with destructor thunks not showing up in my results?)
+#
+# Also, the class/method analysis will not catch problems like
+# 'dynamic_cast from 'Foo' with hidden type visibility to 'Bar' with default type visibility'
+# but loplugin:dyncastvisibility will do that for you
+#
import subprocess
import sys
@@ -74,20 +84,28 @@ classes_with_imported_symbols = set()
for sym in exported_symbols:
filtered_sym = subprocess.check_output(["c++filt", sym]).strip()
if filtered_sym.startswith("non-virtual thunk to "): filtered_sym = filtered_sym[21:]
+ elif filtered_sym.startswith("virtual thunk to "): filtered_sym = filtered_sym[17:]
i = filtered_sym.find("(")
i = filtered_sym.rfind("::", 0, i)
if i != -1:
classname = filtered_sym[:i]
- func = filtered_sym[i+2:]
# find classes where all of the exported symbols are not imported
classes_with_exported_symbols.add(classname)
- if sym in imported_symbols: classes_with_imported_symbols.add(classname)
else:
- package = ""
func = filtered_sym
# find standalone functions which are exported but not imported
if not(sym in imported_symbols): unused_function_exports.add(func)
+for sym in imported_symbols:
+ filtered_sym = subprocess.check_output(["c++filt", sym]).strip()
+ if filtered_sym.startswith("non-virtual thunk to "): filtered_sym = filtered_sym[21:]
+ elif filtered_sym.startswith("virtual thunk to "): filtered_sym = filtered_sym[17:]
+ i = filtered_sym.find("(")
+ i = filtered_sym.rfind("::", 0, i)
+ if i != -1:
+ classname = filtered_sym[:i]
+ classes_with_imported_symbols.add(classname)
+
with open("bin/find-can-be-private-symbols.functions.results", "wt") as f:
for sym in sorted(unused_function_exports):
# Filter out most of the noise.
@@ -175,4 +193,16 @@ with open("bin/find-can-be-private-symbols.functions.results", "wt") as f:
with open("bin/find-can-be-private-symbols.classes.results", "wt") as f:
for sym in sorted(classes_with_exported_symbols - classes_with_imported_symbols):
+ # externals
+ if sym.startswith("libcdr"): continue
+ elif sym.startswith("libabw"): continue
+ elif sym.startswith("libebook"): continue
+ elif sym.startswith("libepubgen"): continue
+ elif sym.startswith("libfreehand"): continue
+ elif sym.startswith("libmspub"): continue
+ elif sym.startswith("libpagemaker"): continue
+ elif sym.startswith("libqxp"): continue
+ elif sym.startswith("libvisio"): continue
+ elif sym.startswith("libzmf"): continue
+ elif sym.startswith("lucene::"): continue
f.write(sym + "\n")
diff --git a/helpcompiler/inc/BasCodeTagger.hxx b/helpcompiler/inc/BasCodeTagger.hxx
index 93dfd70f137b..d897afb4fe1d 100644
--- a/helpcompiler/inc/BasCodeTagger.hxx
+++ b/helpcompiler/inc/BasCodeTagger.hxx
@@ -20,7 +20,7 @@
class LibXmlTreeWalker;
//!Tagger class.
-class L10N_DLLPUBLIC BasicCodeTagger
+class BasicCodeTagger
{
private:
xmlDocPtr m_pDocument;
@@ -42,7 +42,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
//================LibXmlTreeWalker===========================================================
-class L10N_DLLPUBLIC LibXmlTreeWalker
+class LibXmlTreeWalker
{
private:
xmlNodePtr m_pCurrentNode;
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 95e5a7c11d22..64e4ac597df7 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -49,7 +49,7 @@ enum class BasicErrorReason
STDLIB = 0x0100
};
-class BASIC_DLLPUBLIC BasicError
+class BasicError
{
private:
ErrCode nErrorId;
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 981ab4dd49db..4defc7f0b8bb 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -130,7 +130,7 @@ struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
};
-struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
+struct CompareSvxMSDffShapeInfoByTxBxComp
{
bool operator()(std::shared_ptr<SvxMSDffShapeInfo> const& lhs,
std::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
diff --git a/include/opencl/platforminfo.hxx b/include/opencl/platforminfo.hxx
index ac3f144f9d9f..5e54c052fc51 100644
--- a/include/opencl/platforminfo.hxx
+++ b/include/opencl/platforminfo.hxx
@@ -20,7 +20,7 @@
// Struct that describs an actual instance of an OpenCL device
-struct OPENCL_DLLPUBLIC OpenCLDeviceInfo
+struct OpenCLDeviceInfo
{
cl_device_id device;
OUString maName;
@@ -35,7 +35,7 @@ struct OPENCL_DLLPUBLIC OpenCLDeviceInfo
// Struct that describs an actual instance of an OpenCL platform implementation
-struct OPENCL_DLLPUBLIC OpenCLPlatformInfo
+struct OpenCLPlatformInfo
{
cl_platform_id platform;
OUString maVendor;
diff --git a/include/sfx2/notebookbar/NotebookbarTabControl.hxx b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
index 68d7b4ef252d..440148beff0d 100644
--- a/include/sfx2/notebookbar/NotebookbarTabControl.hxx
+++ b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
@@ -18,7 +18,7 @@ namespace com { namespace sun { namespace star { namespace ui {
} } } }
namespace com::sun::star::uno { class XComponentContext; }
-class SFX2_DLLPUBLIC NotebookbarTabControl final : public NotebookbarTabControlBase
+class NotebookbarTabControl final : public NotebookbarTabControlBase
{
friend class ChangedUIEventListener;
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index fbde3fc5dacc..1805778aa3d2 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -356,7 +356,7 @@ private:
FontNameBox& operator =( const FontNameBox& ) = delete;
};
-class SVT_DLLPUBLIC FontStyleBox final : public ComboBox
+class FontStyleBox final : public ComboBox
{
Size aOptimalSize;
diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx
index e2b7b1f5a238..6387bbd42921 100644
--- a/include/svtools/svmedit2.hxx
+++ b/include/svtools/svmedit2.hxx
@@ -24,7 +24,7 @@
class TextAttrib;
-class SVT_DLLPUBLIC ExtMultiLineEdit final : public MultiLineEdit
+class ExtMultiLineEdit final : public MultiLineEdit
{
public:
ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle );
diff --git a/include/svx/AffineMatrixItem.hxx b/include/svx/AffineMatrixItem.hxx
index b9559147c58e..6b3cbebf872f 100644
--- a/include/svx/AffineMatrixItem.hxx
+++ b/include/svx/AffineMatrixItem.hxx
@@ -26,7 +26,7 @@
class SfxItemPool;
-class SVX_DLLPUBLIC AffineMatrixItem final : public SfxPoolItem
+class AffineMatrixItem final : public SfxPoolItem
{
private:
css::geometry::AffineMatrix2D maMatrix;
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index f66d06b30b05..0ce1722ff130 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -28,7 +28,7 @@ class SvxColorValueSet;
typedef std::pair<Color, OUString> NamedColor;
-class SVX_DLLPUBLIC Palette
+class Palette
{
public:
virtual ~Palette();
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index e43453c5b2de..ddbcbb3a60cf 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -32,7 +32,7 @@ class GalleryTheme;
class GalleryBrowser2;
class INetURLObject;
-class SVX_DLLPUBLIC GalleryPreview final : public vcl::Window, public DropTargetHelper, public DragSourceHelper
+class GalleryPreview final : public vcl::Window, public DropTargetHelper, public DragSourceHelper
{
private:
@@ -40,24 +40,24 @@ private:
tools::Rectangle aPreviewRect;
GalleryTheme* const mpTheme;
- SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
- SVX_DLLPRIVATE void InitSettings();
+ bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
+ void InitSettings();
// Window
- SVX_DLLPRIVATE virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
- SVX_DLLPRIVATE virtual Size GetOptimalSize() const override;
- SVX_DLLPRIVATE virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
- SVX_DLLPRIVATE virtual void Command(const CommandEvent& rCEvt) override;
- SVX_DLLPRIVATE virtual void KeyInput( const KeyEvent& rKEvt ) override;
- SVX_DLLPRIVATE virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ virtual Size GetOptimalSize() const override;
+ virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual void Command(const CommandEvent& rCEvt) override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
// DropTargetHelper
- SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
- SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
// DragSourceHelper
- SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
public:
diff --git a/include/vcl/animate/AnimationBitmap.hxx b/include/vcl/animate/AnimationBitmap.hxx
index ae8aaab1634f..5b438f8c4d6a 100644
--- a/include/vcl/animate/AnimationBitmap.hxx
+++ b/include/vcl/animate/AnimationBitmap.hxx
@@ -30,7 +30,7 @@ enum class Disposal
Previous
};
-struct VCL_DLLPUBLIC AnimationBitmap
+struct AnimationBitmap
{
BitmapEx maBitmapEx;
Point maPositionPixel;
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 0b32b85f341c..c39c466d1afe 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -247,7 +247,7 @@ public:
virtual void Click() override;
};
-class VCL_DLLPUBLIC CloseButton final : public CancelButton
+class CloseButton final : public CancelButton
{
public:
explicit CloseButton(vcl::Window* pParent, WinBits nStyle = 0);
@@ -517,9 +517,9 @@ public:
explicit TriStateBox( vcl::Window* pParent, WinBits nStyle );
};
-class VCL_DLLPUBLIC DisclosureButton final : public CheckBox
+class DisclosureButton final : public CheckBox
{
- SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) override;
+ virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext) override;
public:
explicit DisclosureButton( vcl::Window* pParent );
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index a3ee2fb73c99..bf446e7f4f83 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -170,7 +170,7 @@ public:
{ return ((mnCode & KEY_MOD2) != 0); }
};
-class VCL_DLLPUBLIC CommandScrollData
+class CommandScrollData
{
private:
long mnDeltaX;
@@ -183,7 +183,7 @@ public:
long GetDeltaY() const { return mnDeltaY; }
};
-class VCL_DLLPUBLIC CommandModKeyData
+class CommandModKeyData
{
private:
bool mbDown;
@@ -256,7 +256,7 @@ public:
bool GetPassThroughToOS() const { return m_bPassThroughToOS; }
};
-class VCL_DLLPUBLIC CommandSelectionChangeData
+class CommandSelectionChangeData
{
private:
sal_uLong mnStart;
diff --git a/include/vcl/debugevent.hxx b/include/vcl/debugevent.hxx
index e0d498761d29..a6f458265cbb 100644
--- a/include/vcl/debugevent.hxx
+++ b/include/vcl/debugevent.hxx
@@ -16,7 +16,7 @@
namespace vcl { class Window; }
-class VCL_DLLPUBLIC DebugEventInjector final : private Timer {
+class DebugEventInjector final : private Timer {
sal_uInt32 mnEventsLeft;
DebugEventInjector( sal_uInt32 nMaxEvents );
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index bc2e6cc03a75..a30b3909e899 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -51,7 +51,7 @@ class ImpGraphic;
class OutputDevice;
class ReaderData;
-class VCL_DLLPUBLIC GraphicReader
+class GraphicReader
{
public:
virtual ~GraphicReader();
diff --git a/include/vcl/imapobj.hxx b/include/vcl/imapobj.hxx
index a9bf0ce7bc8f..2310328904e9 100644
--- a/include/vcl/imapobj.hxx
+++ b/include/vcl/imapobj.hxx
@@ -47,7 +47,7 @@ class SvStream;
#define IMAP_ERR_OK 0x00000000L
#define IMAP_ERR_FORMAT 0x00000001L
-class VCL_DLLPUBLIC IMapObject
+class IMapObject
{
friend class ImageMap;
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 5e7ebc47de73..8108abe046dc 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -472,7 +472,7 @@ public:
*
* Value container for menubars specifying height of adjacent docking area
*/
-class VCL_DLLPUBLIC MenubarValue final : public ImplControlValue
+class MenubarValue final : public ImplControlValue
{
public:
MenubarValue() : ImplControlValue( ControlType::Menubar, 0 )
@@ -491,7 +491,7 @@ public:
* Value container for menu items; specifies the rectangle for the whole item which
* may be useful when drawing parts with a smaller rectangle.
*/
-class VCL_DLLPUBLIC MenupopupValue final : public ImplControlValue
+class MenupopupValue final : public ImplControlValue
{
public:
MenupopupValue( long i_nGutterWidth, const tools::Rectangle& i_rItemRect )
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index a8722c46fed4..34aa048e5abd 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -135,7 +135,7 @@ protected:
};
// TODO: moggi: what about push buttons?
-class UITEST_DLLPUBLIC ButtonUIObject final : public WindowUIObject
+class ButtonUIObject final : public WindowUIObject
{
VclPtr<Button> mxButton;
public:
@@ -157,7 +157,7 @@ private:
virtual OUString get_name() const override;
};
-class UITEST_DLLPUBLIC DialogUIObject final : public WindowUIObject
+class DialogUIObject final : public WindowUIObject
{
VclPtr<Dialog> mxDialog;
@@ -175,7 +175,7 @@ private:
virtual OUString get_name() const override;
};
-class UITEST_DLLPUBLIC EditUIObject : public WindowUIObject
+class EditUIObject : public WindowUIObject
{
VclPtr<Edit> mxEdit;
@@ -198,7 +198,7 @@ protected:
virtual OUString get_name() const override;
};
-class UITEST_DLLPUBLIC MultiLineEditUIObject final : public WindowUIObject
+class MultiLineEditUIObject final : public WindowUIObject
{
VclPtr<VclMultiLineEdit> mxEdit;
@@ -220,7 +220,7 @@ private:
};
// TODO: moggi: maybe let it inherit from the button case
-class UITEST_DLLPUBLIC CheckBoxUIObject final : public WindowUIObject
+class CheckBoxUIObject final : public WindowUIObject
{
private:
VclPtr<CheckBox> mxCheckBox;
@@ -286,7 +286,7 @@ private:
virtual OUString get_name() const override;
};
-class UITEST_DLLPUBLIC ListBoxUIObject final : public WindowUIObject
+class ListBoxUIObject final : public WindowUIObject
{
private:
VclPtr<ListBox> mxListBox;
@@ -311,7 +311,7 @@ private:
};
// TODO: moggi: should it inherit from EditUIObject?
-class UITEST_DLLPUBLIC ComboBoxUIObject final : public WindowUIObject
+class ComboBoxUIObject final : public WindowUIObject
{
private:
VclPtr<ComboBox> mxComboBox;
diff --git a/oox/inc/drawingml/presetgeometrynames.hxx b/oox/inc/drawingml/presetgeometrynames.hxx
index 358fc9acefb6..f3ab92c2347a 100644
--- a/oox/inc/drawingml/presetgeometrynames.hxx
+++ b/oox/inc/drawingml/presetgeometrynames.hxx
@@ -15,8 +15,8 @@
namespace PresetGeometryTypeNames
{
-OOX_DLLPUBLIC OUString GetFontworkType(const OUString& rMsoType);
-OOX_DLLPUBLIC OUString GetMsoName(const OUString& rFontworkType);
+OUString GetFontworkType(const OUString& rMsoType);
+OUString GetMsoName(const OUString& rFontworkType);
}
#endif
diff --git a/sfx2/source/notebookbar/DropdownBox.hxx b/sfx2/source/notebookbar/DropdownBox.hxx
index 6cb62d4e2f93..0fd1b687ea2c 100644
--- a/sfx2/source/notebookbar/DropdownBox.hxx
+++ b/sfx2/source/notebookbar/DropdownBox.hxx
@@ -30,8 +30,7 @@
#include <sfx2/tbxctrl.hxx>
#include "NotebookbarPopup.hxx"
-class SFX2_DLLPUBLIC DropdownBox : public VclHBox,
- public vcl::IPrioritable
+class DropdownBox : public VclHBox, public vcl::IPrioritable
{
private:
bool m_bInFullView;
diff --git a/sfx2/source/notebookbar/NotebookbarPopup.hxx b/sfx2/source/notebookbar/NotebookbarPopup.hxx
index 1bbb15133bbe..5ac1377c02a7 100644
--- a/sfx2/source/notebookbar/NotebookbarPopup.hxx
+++ b/sfx2/source/notebookbar/NotebookbarPopup.hxx
@@ -30,7 +30,7 @@
* and after close moved to the original parent
*/
-class SFX2_DLLPUBLIC NotebookbarPopup : public FloatingWindow
+class NotebookbarPopup : public FloatingWindow
{
private:
VclPtr<VclHBox> m_pBox;
diff --git a/sfx2/source/notebookbar/PriorityHBox.hxx b/sfx2/source/notebookbar/PriorityHBox.hxx
index 8248264093f5..4c5bbc7ac9f8 100644
--- a/sfx2/source/notebookbar/PriorityHBox.hxx
+++ b/sfx2/source/notebookbar/PriorityHBox.hxx
@@ -34,7 +34,7 @@
* priority assigned (VCL_PRIORITY_DEFAULT), it is always shown.
*/
-class SFX2_DLLPUBLIC PriorityHBox : public VclHBox
+class PriorityHBox : public VclHBox
{
private:
bool m_bInitialized;
diff --git a/sfx2/source/notebookbar/PriorityMergedHBox.cxx b/sfx2/source/notebookbar/PriorityMergedHBox.cxx
index e187306ff437..328241ae67d8 100644
--- a/sfx2/source/notebookbar/PriorityMergedHBox.cxx
+++ b/sfx2/source/notebookbar/PriorityMergedHBox.cxx
@@ -30,7 +30,7 @@
* PriorityMergedHBox is a VclHBox which hides its own children if there is no sufficient space.
*/
-class SFX2_DLLPUBLIC PriorityMergedHBox : public PriorityHBox
+class PriorityMergedHBox : public PriorityHBox
{
private:
VclPtr<PushButton> m_pButton;
diff --git a/svx/inc/palettes.hxx b/svx/inc/palettes.hxx
index c02ffae7fbbe..fe88af7f2b5a 100644
--- a/svx/inc/palettes.hxx
+++ b/svx/inc/palettes.hxx
@@ -29,7 +29,7 @@ typedef std::vector< NamedColor > ColorList;
// ASE = Adobe Swatch Exchange
-class SVX_DLLPUBLIC PaletteASE : public Palette
+class PaletteASE : public Palette
{
bool mbValidPalette;
OUString const maFPath;
@@ -51,7 +51,7 @@ public:
// GPL - this is *not* GNU Public License, but is the Gimp PaLette
-class SVX_DLLPUBLIC PaletteGPL : public Palette
+class PaletteGPL : public Palette
{
bool mbLoadedPalette;
bool mbValidPalette;
@@ -77,7 +77,7 @@ public:
// SOC - Star Office Color-table
-class SVX_DLLPUBLIC PaletteSOC : public Palette
+class PaletteSOC : public Palette
{
bool mbLoadedPalette;
OUString const maFPath;
diff --git a/sw/inc/PageColumnPopup.hxx b/sw/inc/PageColumnPopup.hxx
index 3753596a4e6f..f01a9116deb6 100644
--- a/sw/inc/PageColumnPopup.hxx
+++ b/sw/inc/PageColumnPopup.hxx
@@ -22,7 +22,7 @@
#include <sfx2/tbxctrl.hxx>
#include "swdllapi.h"
-class SW_DLLPUBLIC PageColumnPopup : public SfxToolBoxControl
+class PageColumnPopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/inc/PageMarginPopup.hxx b/sw/inc/PageMarginPopup.hxx
index 7a66ca8e3db9..2bb9617858f0 100644
--- a/sw/inc/PageMarginPopup.hxx
+++ b/sw/inc/PageMarginPopup.hxx
@@ -22,7 +22,7 @@
#include <sfx2/tbxctrl.hxx>
#include "swdllapi.h"
-class SW_DLLPUBLIC PageMarginPopup : public SfxToolBoxControl
+class PageMarginPopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/inc/PageOrientationPopup.hxx b/sw/inc/PageOrientationPopup.hxx
index b8cdacb79dfb..ff88d7af5300 100644
--- a/sw/inc/PageOrientationPopup.hxx
+++ b/sw/inc/PageOrientationPopup.hxx
@@ -22,7 +22,7 @@
#include <sfx2/tbxctrl.hxx>
#include "swdllapi.h"
-class SW_DLLPUBLIC PageOrientationPopup : public SfxToolBoxControl
+class PageOrientationPopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/inc/PageSizePopup.hxx b/sw/inc/PageSizePopup.hxx
index a604accde35e..b67779552201 100644
--- a/sw/inc/PageSizePopup.hxx
+++ b/sw/inc/PageSizePopup.hxx
@@ -22,7 +22,7 @@
#include <sfx2/tbxctrl.hxx>
#include "swdllapi.h"
-class SW_DLLPUBLIC PageSizePopup : public SfxToolBoxControl
+class PageSizePopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/source/uibase/inc/actctrl.hxx b/sw/source/uibase/inc/actctrl.hxx
index 93dae6f72f99..cd5fb964205c 100644
--- a/sw/source/uibase/inc/actctrl.hxx
+++ b/sw/source/uibase/inc/actctrl.hxx
@@ -23,7 +23,7 @@
#include <swdllapi.h>
// numerical input
-class SW_DLLPUBLIC NumEditAction: public NumericField
+class NumEditAction: public NumericField
{
Link<NumEditAction&,void> aActionLink;
diff --git a/vcl/inc/bitmap/Octree.hxx b/vcl/inc/bitmap/Octree.hxx
index 86a911fa4adf..59246ae5053d 100644
--- a/vcl/inc/bitmap/Octree.hxx
+++ b/vcl/inc/bitmap/Octree.hxx
@@ -63,13 +63,13 @@ public:
sal_uInt16 GetBestPaletteIndex(const BitmapColor& rColor);
};
-class VCL_PLUGIN_PUBLIC InverseColorMap
+class InverseColorMap
{
private:
std::vector<sal_uInt8> mpBuffer;
std::vector<sal_uInt8> mpMap;
- SAL_DLLPRIVATE void ImplCreateBuffers();
+ void ImplCreateBuffers();
public:
explicit InverseColorMap(const BitmapPalette& rPal);
diff --git a/vcl/inc/impfontcharmap.hxx b/vcl/inc/impfontcharmap.hxx
index 2d3c5ac16c89..297cd5fa359a 100644
--- a/vcl/inc/impfontcharmap.hxx
+++ b/vcl/inc/impfontcharmap.hxx
@@ -28,7 +28,7 @@ typedef tools::SvRef<ImplFontCharMap> ImplFontCharMapRef;
class CmapResult;
-class VCL_PLUGIN_PUBLIC ImplFontCharMap : public SvRefBase
+class ImplFontCharMap : public SvRefBase
{
public:
explicit ImplFontCharMap( const CmapResult& );
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
index cc1e28190916..bff248d9bfab 100644
--- a/vcl/inc/opengl/program.hxx
+++ b/vcl/inc/opengl/program.hxx
@@ -39,7 +39,7 @@ enum class DrawShaderType
Line
};
-class VCL_PLUGIN_PUBLIC OpenGLProgram
+class OpenGLProgram
{
private:
GLuint mnId;
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 06300760f60e..be66bafd87e3 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -50,7 +50,7 @@ namespace vcl {
}
// used for managing runs e.g. for BiDi, glyph and script fallback
-class VCL_PLUGIN_PUBLIC ImplLayoutRuns
+class ImplLayoutRuns
{
private:
int mnRunIndex;
@@ -122,7 +122,7 @@ private:
// For nice SAL_INFO logging of ImplLayoutArgs values
std::ostream &operator <<(std::ostream& s, ImplLayoutArgs const &rArgs);
-class VCL_PLUGIN_PUBLIC MultiSalLayout final : public SalLayout
+class MultiSalLayout final : public SalLayout
{
public:
void DrawText(SalGraphics&) const override;
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index 17084fcf5a75..f000264ac3dd 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -102,7 +102,7 @@ public:
};
// a class for cache entries for physical font instances that are based on serverfonts
-class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
+class FreetypeFontInstance : public LogicalFontInstance
{
friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const;
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index ccb25cab87e2..b9398ad57d0f 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -88,7 +88,7 @@ private:
sal_IntPtr m_nMaxFontId;
};
-class VCL_DLLPUBLIC FreetypeFont final
+class FreetypeFont final
{
public:
FreetypeFont(LogicalFontInstance* pFontInstance, FreetypeFontInfo*);
diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx
index e33d3f606b10..c958e0c69bb2 100644
--- a/vcl/inc/unx/gtk/gtkprn.hxx
+++ b/vcl/inc/unx/gtk/gtkprn.hxx
@@ -40,7 +40,7 @@ private:
std::unique_ptr<GtkSalPrinter_Impl> m_xImpl;
};
-class VCL_DLLPUBLIC GtkSalInfoPrinter : public PspSalInfoPrinter
+class GtkSalInfoPrinter : public PspSalInfoPrinter
{
public:
sal_uInt32 GetCapabilities(const ImplJobSetup* i_pSetupData, PrinterCapType i_nType) override;
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 8f4bceba0fc8..56006781f8f8 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -208,7 +208,7 @@ extern "C" {
typedef Bool(*X_if_predicate)(Display*,XEvent*,XPointer);
}
-class VCLPLUG_GEN_PUBLIC GLX11Window : public GLWindow
+class GLX11Window : public GLWindow
{
public:
Display* dpy;
commit 48101a1a0d574db3db1f99c782bd67e885b232bb
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Oct 17 20:33:50 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Nov 3 17:11:32 2019 +0100
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512.
Change-Id: I55fe36b31cd3d40f86e5729337a927cf920f2af6
Reviewed-on: https://gerrit.libreoffice.org/81960
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 9da8710c328a..16a3833eeea2 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1641,7 +1641,7 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
OUString Outliner::GetText( Paragraph const * pParagraph, sal_Int32 nCount ) const
{
- OUStringBuffer aText;
+ OUStringBuffer aText(128);
sal_Int32 nStartPara = pParaList->GetAbsPos( pParagraph );
for ( sal_Int32 n = 0; n < nCount; n++ )
{
diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
index de071b6ec624..4a1eaca5b256 100644
--- a/include/xmloff/xmlnumfi.hxx
+++ b/include/xmloff/xmlnumfi.hxx
@@ -132,8 +132,8 @@ class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext
bool bAutoDec; // set in AddNumber
bool bAutoInt; // set in AddNumber
bool bHasExtraText;
- OUStringBuffer aFormatCode;
- OUStringBuffer aConditions;
+ OUStringBuffer aFormatCode{64};
+ OUStringBuffer aConditions{32};
bool bHasLongDoW;
bool bHasEra;
bool bHasDateTime;
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index cc7c4736e6c7..d791f6cb633d 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -119,6 +119,9 @@ public:
void convertMeasureToXML( OUStringBuffer& rBuffer,
sal_Int32 nMeasure ) const;
+ /** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */
+ OUString convertMeasureToXML( sal_Int32 nMeasure ) const;
+
/** convert string to enum using given enum map, if the enum is
not found in the map, this method will return false */
template<typename EnumT>
diff --git a/oox/source/core/relationshandler.cxx b/oox/source/core/relationshandler.cxx
index 9b7675ff2cb1..fe448bc43a7b 100644
--- a/oox/source/core/relationshandler.cxx
+++ b/oox/source/core/relationshandler.cxx
@@ -45,12 +45,10 @@ namespace {
OUString lclGetRelationsPath( const OUString& rFragmentPath )
{
sal_Int32 nPathLen = ::std::max< sal_Int32 >( rFragmentPath.lastIndexOf( '/' ) + 1, 0 );
- return
- OUStringBuffer( rFragmentPath.copy( 0, nPathLen ) ). // file path including slash
- append( "_rels/" ). // additional '_rels/' path
- append( std::u16string_view(rFragmentPath).substr(nPathLen) ). // file name after path
- append( ".rels" ). // '.rels' suffix
- makeStringAndClear();
+ return rtl::OUStringView(rFragmentPath.getStr(), nPathLen ) + // file path including slash
+ "_rels/" + // additional '_rels/' path
+ rtl::OUStringView(rFragmentPath.getStr() + nPathLen) + // file name after path
+ ".rels"; // '.rels' suffix
}
} // namespace
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index d2dd4899d2e6..05b787d9f85a 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -261,7 +261,7 @@ void OleHelper::exportGuid( BinaryOutputStream& rOStr, const SvGlobalName& rId )
OUString OleHelper::importGuid( BinaryInputStream& rInStrm )
{
- OUStringBuffer aBuffer;
+ OUStringBuffer aBuffer(40);
aBuffer.append( '{' );
lclAppendHex( aBuffer, rInStrm.readuInt32() );
aBuffer.append( '-' );
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index b7ff5edb7aec..82a368934794 100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -143,7 +143,7 @@ void VbaModule::createEmptyModule( const Reference< container::XNameContainer >&
OUString VbaModule::readSourceCode( StorageBase& rVbaStrg ) const
{
- OUStringBuffer aSourceCode;
+ OUStringBuffer aSourceCode(512);
static const char sUnmatchedRemovedTag[] = "Rem removed unmatched Sub/End: ";
if( !maStreamName.isEmpty() && (mnOffset != SAL_MAX_UINT32) )
{
@@ -264,7 +264,7 @@ void VbaModule::createModule( const OUString& rVBASourceCode,
// prepare the Basic module
script::ModuleInfo aModuleInfo;
aModuleInfo.ModuleType = mnType;
- OUStringBuffer aSourceCode;
+ OUStringBuffer aSourceCode(512);
aSourceCode.append( "Rem Attribute VBA_ModuleType=" );
switch( mnType )
{
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 6bafa226e8b5..9f9bf35bacc0 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -193,7 +193,7 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
{
- OUStringBuffer result;
+ OUStringBuffer result(256);
formula::FormulaCompiler aCompiler;
formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 96e6983ac712..60d6a163ec60 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -212,7 +212,7 @@ ScUserList::ScUserList()
xCal = rCalendar.Days;
if ( xCal.hasElements() )
{
- OUStringBuffer aDayShortBuf, aDayLongBuf;
+ OUStringBuffer aDayShortBuf(32), aDayLongBuf(64);
sal_Int32 i;
sal_Int32 nLen = xCal.getLength();
sal_Int16 nStart = sal::static_int_cast<sal_Int16>(nLen);
@@ -244,7 +244,7 @@ ScUserList::ScUserList()
xCal = rCalendar.Months;
if ( xCal.hasElements() )
{
- OUStringBuffer aMonthShortBuf, aMonthLongBuf;
+ OUStringBuffer aMonthShortBuf(128), aMonthLongBuf(128);
sal_Int32 i;
sal_Int32 nLen = xCal.getLength() - 1;
for (i = 0; i < nLen; i++)
diff --git a/sc/source/filter/excel/xipage.cxx b/sc/source/filter/excel/xipage.cxx
index 29110f79b363..db8f4377a1c2 100644
--- a/sc/source/filter/excel/xipage.cxx
+++ b/sc/source/filter/excel/xipage.cxx
@@ -224,17 +224,15 @@ void XclImpPageSettings::Finalize()
// *** create page style sheet ***
- OUStringBuffer aStyleName;
- aStyleName.append("PageStyle_");
-
+ OUString aStyleName;
OUString aTableName;
if( GetDoc().GetName( nScTab, aTableName ) )
- aStyleName.append(aTableName);
+ aStyleName = "PageStyle_" + aTableName;
else
- aStyleName.append(static_cast<sal_Int32>(nScTab+1));
+ aStyleName = "PageStyle_" + OUString::number(static_cast<sal_Int32>(nScTab+1));
ScStyleSheet& rStyleSheet = ScfTools::MakePageStyleSheet(
- GetStyleSheetPool(), aStyleName.makeStringAndClear(), false);
+ GetStyleSheetPool(), aStyleName, false);
SfxItemSet& rItemSet = rStyleSheet.GetItemSet();
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index 8e48027cdf1b..f7427b9295ed 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -831,7 +831,7 @@ std::size_t XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlag
OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit )
{
- OUStringBuffer aRet;
+ OUStringBuffer aRet(nChars);
sal_uInt16 nCharsLeft = nChars;
sal_uInt16 nReadSize;
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index d80cfa759619..10aeb2dda44a 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -68,7 +68,7 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
boost::optional<OUString> maFirstParagraph; /// unformatted first paragraph, for better performance.
ScEditEngineDefaulter* mpEditEngine;
- OUStringBuffer maParagraph;
+ OUStringBuffer maParagraph{32};
sal_Int32 mnCurParagraph;
ParaFormatsType maFormats;
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 3109ac7ff28a..4f9c109a23d1 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -452,7 +452,7 @@ void LinkManager::InsertFileLink(
if (!(OBJECT_CLIENT_SO & rLink.GetObjType()))
return;
- OUStringBuffer aBuf;
+ OUStringBuffer aBuf(64);
aBuf.append(rFileNm);
aBuf.append(sfx2::cTokenSeparator);
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index ad5417688fdc..8e6bf6f29c39 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -509,7 +509,7 @@ dateTimeToText(css::util::DateTime const& i_rdt,
sal_Int16 const*const pTimeZone = nullptr) throw ()
{
if (isValidDateTime(i_rdt)) {
- OUStringBuffer buf;
+ OUStringBuffer buf(32);
::sax::Converter::convertDateTime(buf, i_rdt, pTimeZone, true);
return buf.makeStringAndClear();
} else {
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 09e6d59129f3..6dea1bc3d125 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -213,7 +213,7 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView,
void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload)
{
- OStringBuffer aBuf;
+ OStringBuffer aBuf(32);
aBuf.append(rPayload);
if (comphelper::LibreOfficeKit::isPartInInvalidation())
{
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index e7b430b20986..eb2b47dc80af 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1647,7 +1647,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
sal_Unicode cLetter = ' '; // Preliminary result
sal_Int32 nLen = rString.getLength();
ScanState eState = SsStart;
- OUStringBuffer sBuffSymbol(64);
+ OUStringBuffer sBuffSymbol(128);
const NfKeywordTable & rKeywords = rScan.GetKeywords();
while (nPos < nLen && eState != SsStop)
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index 3ab901c1aee9..6bfb9a42612f 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -398,7 +398,7 @@ static void exceptionToStringImpl(OStringBuffer& sMessage, const css::uno::Any &
OString exceptionToString(const css::uno::Any & caught)
{
- OStringBuffer sMessage;
+ OStringBuffer sMessage(512);
exceptionToStringImpl(sMessage, caught);
return sMessage.makeStringAndClear();
}
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 636bfe42ff32..e07cfd04035e 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -1369,7 +1369,7 @@ bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
}
break;
}
- OUStringBuffer aSynHost;
+ OUStringBuffer aSynHost(64);
if (!parseHostOrNetBiosName(
pHostPortBegin, pPort, eMechanism, eCharset,
bNetBiosName, &aSynHost))
@@ -1614,7 +1614,7 @@ bool INetURLObject::convertRelToAbs(OUString const & rTheRelURIRef,
enum State { STATE_AUTH, STATE_ABS_PATH, STATE_REL_PATH, STATE_FRAGMENT,
STATE_DONE };
- OUStringBuffer aSynAbsURIRef;
+ OUStringBuffer aSynAbsURIRef(128);
// make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
// is empty ("") in that case, so take the scheme from m_aAbsURIRef
if (m_eScheme != INetProtocol::Generic)
@@ -2342,7 +2342,7 @@ bool INetURLObject::parseHost(sal_Unicode const *& rBegin, sal_Unicode const * p
STATE_IP6_HEXSEQ1_MAYBE_IP4, STATE_IP6_HEXSEQ2,
STATE_IP6_HEXSEQ2_COLON, STATE_IP6_HEXSEQ2_MAYBE_IP4,
STATE_IP6_IP4, STATE_IP6_IP4_DOT, STATE_IP6_DONE };
- OUStringBuffer aTheCanonic;
+ OUStringBuffer aTheCanonic(32);
sal_uInt32 nNumber = 0;
int nDigits = 0;
int nOctets = 0;
@@ -4320,7 +4320,7 @@ OUString INetURLObject::getFSysPath(FSysStyle eStyle,
if (pDelimiter)
*pDelimiter = '\\';
- OUStringBuffer aSynFSysPath;
+ OUStringBuffer aSynFSysPath(64);
if (m_aHost.isPresent() && m_aHost.getLength() > 0)
{
aSynFSysPath.append("\\\\");
diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx
index cf77b11404d8..7e605d187c75 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -30,7 +30,7 @@ namespace utl
OUString DocInfoHelper::GetGeneratorString()
{
- OUStringBuffer aResult;
+ OUStringBuffer aResult(128);
// First product: branded name + version
// version is <product_versions>_<product_extension>$<platform>
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index 7b2ef0eb2c40..ca5c2c110057 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -259,7 +259,7 @@ void typeConvert(const css::util::DateTime& _rDateTime, DateTime& _rOut)
OUString toISO8601(const css::util::DateTime& rDateTime)
{
- OUStringBuffer rBuffer;
+ OUStringBuffer rBuffer(32);
rBuffer.append(static_cast<sal_Int32>(rDateTime.Year));
rBuffer.append('-');
if( rDateTime.Month < 10 )
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 2fbd6795394c..824caae1698f 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -167,9 +167,10 @@ OString GraphicID::getIDString() const
{
static const char aHexData[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- OStringBuffer aHexStr;
sal_Int32 nShift, nIndex = 0;
- aHexStr.setLength(24 + (2 * BITMAP_CHECKSUM_SIZE));
+ sal_Int32 nLen = 24 + (2 * BITMAP_CHECKSUM_SIZE);
+ OStringBuffer aHexStr(nLen);
+ aHexStr.setLength(nLen);
for( nShift = 28; nShift >= 0; nShift -= 4 )
aHexStr[nIndex++] = aHexData[ ( mnID1 >> static_cast<sal_uInt32>(nShift) ) & 0xf ];
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 858dd0353d14..d7fd1dcf7392 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -309,7 +309,8 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
if (rParameters.empty())
return "";
- OUStringBuffer aParameterString = " {";
+ OUStringBuffer aParameterString(static_cast<int>(rParameters.size()*32));
+ aParameterString.append(" {");
for (std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
itr != rParameters.end(); ++itr)
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index dcfae65672f1..dfff05c31f7e 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -185,6 +185,16 @@ void SvXMLUnitConverter::convertMeasureToXML( OUStringBuffer& rString,
m_pImpl->m_eXMLMeasureUnit );
}
+/** convert measure to string */
+OUString SvXMLUnitConverter::convertMeasureToXML( sal_Int32 nMeasure ) const
+{
+ OUStringBuffer s;
+ ::sax::Converter::convertMeasure( s, nMeasure,
+ m_pImpl->m_eCoreMeasureUnit,
+ m_pImpl->m_eXMLMeasureUnit );
+ return s.makeStringAndClear();
+}
+
/** convert string to enum using given enum map, if the enum is
not found in the map, this method will return false
*/
@@ -733,7 +743,7 @@ OUString SvXMLUnitConverter::encodeStyleName(
*pEncoded = false;
sal_Int32 nLen = rName.getLength();
- OUStringBuffer aBuffer( nLen );
+ OUStringBuffer aBuffer( nLen*2 );
for( sal_Int32 i = 0; i < nLen; i++ )
{
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index e9908c8991a5..0f5a45dc40da 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -344,31 +344,26 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
true, true );
- OUStringBuffer sBuffer;
if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
{
nSpaceBefore += nMinLabelWidth;
nMinLabelWidth = -nMinLabelWidth;
if( nSpaceBefore != 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nSpaceBefore );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
- sBuffer.makeStringAndClear() );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nSpaceBefore );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, sAttr );
}
if( nMinLabelWidth != 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nMinLabelWidth );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
- sBuffer.makeStringAndClear() );
+ OUString s = GetExport().GetMM100UnitConverter().convertMeasureToXML( nMinLabelWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, s);
}
if( nMinLabelDist > 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nMinLabelDist );
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
- sBuffer.makeStringAndClear() );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nMinLabelDist );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, sAttr);
}
}
/* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
@@ -443,18 +438,16 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
if( nImageWidth > 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nImageWidth );
- GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH,
- sBuffer.makeStringAndClear() );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nImageWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH, sAttr );
}
if( nImageHeight > 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nImageHeight );
- GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT,
- sBuffer.makeStringAndClear() );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nImageHeight );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT, sAttr );
}
}
@@ -490,29 +483,29 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
nListtabStopPosition > 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nListtabStopPosition );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nListtabStopPosition );
GetExport().AddAttribute( XML_NAMESPACE_TEXT,
XML_LIST_TAB_STOP_POSITION,
- sBuffer.makeStringAndClear() );
+ sAttr );
}
if ( nFirstLineIndent != 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nFirstLineIndent );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nFirstLineIndent );
GetExport().AddAttribute( XML_NAMESPACE_FO,
XML_TEXT_INDENT,
- sBuffer.makeStringAndClear() );
+ sAttr );
}
if ( nIndentAt != 0 )
{
- GetExport().GetMM100UnitConverter().convertMeasureToXML(
- sBuffer, nIndentAt );
+ OUString sAttr = GetExport().GetMM100UnitConverter().convertMeasureToXML(
+ nIndentAt );
GetExport().AddAttribute( XML_NAMESPACE_FO,
XML_MARGIN_LEFT,
- sBuffer.makeStringAndClear() );
+ sAttr );
}
SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
@@ -582,6 +575,7 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
}
else
{
+ OUStringBuffer sBuffer;
::sax::Converter::convertColor( sBuffer, nColor );
GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
sBuffer.makeStringAndClear() );
More information about the Libreoffice-commits
mailing list