[Libreoffice-commits] core.git: 2 commits - basic/qa basic/source include/basic include/vcl vcl/inc vcl/qa vcl/source vcl/unx
Noel Grandin
noel at peralex.com
Wed Mar 12 23:40:11 PDT 2014
basic/qa/cppunit/basic_coverage.cxx | 8 +++---
basic/source/basmgr/basmgr.cxx | 10 ++++----
basic/source/classes/image.cxx | 2 -
basic/source/classes/sbxmod.cxx | 2 -
basic/source/inc/image.hxx | 2 -
basic/source/runtime/methods.cxx | 2 -
basic/source/sbx/sbxform.cxx | 23 +++++++++---------
include/basic/sbmod.hxx | 2 -
include/basic/sbxform.hxx | 22 ++++++++---------
include/vcl/GraphicNativeTransform.hxx | 2 -
include/vcl/builder.hxx | 32 +++++++++++++-------------
include/vcl/outdev.hxx | 4 +--
vcl/inc/graphite_features.hxx | 4 +--
vcl/inc/outfont.hxx | 6 ++--
vcl/inc/unx/saldisp.hxx | 2 -
vcl/qa/cppunit/graphicfilter/filters-test.cxx | 4 +--
vcl/source/filter/GraphicNativeTransform.cxx | 2 -
vcl/source/filter/wmf/emfwr.cxx | 2 -
vcl/source/filter/wmf/emfwr.hxx | 2 -
vcl/source/gdi/outdev3.cxx | 3 +-
vcl/source/gdi/outdevnative.cxx | 4 +--
vcl/source/glyphs/graphite_features.cxx | 4 +--
vcl/source/window/builder.cxx | 22 ++++++++---------
vcl/unx/generic/app/keysymnames.cxx | 2 -
vcl/unx/gtk/a11y/atkimage.cxx | 2 -
vcl/unx/gtk/a11y/atktable.cxx | 2 -
26 files changed, 87 insertions(+), 85 deletions(-)
New commits:
commit 78a2020846b855ed925ab88f06fa70a282a75e5a
Author: Noel Grandin <noel at peralex.com>
Date: Thu Mar 13 08:38:29 2014 +0200
vcl: prefer passing OUString and OString by reference
Change-Id: I6c2c6f597ca62c004ad7dc606cef3a3b10e810b6
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index f90499a..b6b66fc 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -28,7 +28,7 @@ class VCL_DLLPUBLIC GraphicNativeTransform
bool rotateBitmapOnly (sal_uInt16 aRotation);
bool rotateJPEG (sal_uInt16 aRotation);
- bool rotateGeneric (sal_uInt16 aRotation, OUString aType);
+ bool rotateGeneric (sal_uInt16 aRotation, const OUString& aType);
public:
GraphicNativeTransform(Graphic& rGraphic);
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index b545df0..f8208f5 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -145,15 +145,15 @@ private:
typedef std::vector<OString> row;
std::vector<row> m_aEntries;
};
- const ListStore* get_model_by_name(OString sID) const;
+ const ListStore* get_model_by_name(const OString& sID) const;
static void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
typedef stringmap TextBuffer;
- const TextBuffer* get_buffer_by_name(OString sID) const;
+ const TextBuffer* get_buffer_by_name(const OString& sID) const;
static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer);
typedef stringmap Adjustment;
- const Adjustment *get_adjustment_by_name(OString sID) const;
+ const Adjustment *get_adjustment_by_name(const OString& sID) const;
static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment);
static void mungeAdjustment(DateField &rTarget, const Adjustment &rAdjustment);
static void mungeAdjustment(TimeField &rTarget, const Adjustment &rAdjustment);
@@ -236,8 +236,8 @@ private:
bool m_bToplevelParentFound;
ParserState *m_pParserState;
- ::Window *get_by_name(OString sID);
- void delete_by_name(OString sID);
+ ::Window *get_by_name(const OString& sID);
+ void delete_by_name(const OString& sID);
class sortIntoBestTabTraversalOrder
: public std::binary_function<const ::Window*, const ::Window*, bool>
@@ -255,13 +255,13 @@ private:
css::uno::Reference<css::frame::XFrame> m_xFrame;
public:
- VclBuilder(::Window *pParent, OUString sUIRootDir, OUString sUIFile,
- OString sID = OString(),
+ VclBuilder(::Window *pParent, const OUString& sUIRootDir, const OUString& sUIFile,
+ const OString& sID = OString(),
const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame = com::sun::star::uno::Reference<com::sun::star::frame::XFrame>());
~VclBuilder();
::Window *get_widget_root();
//sID must exist and be of type T
- template <typename T> T* get(T*& ret, OString sID)
+ template <typename T> T* get(T*& ret, const OString& sID)
{
::Window *w = get_by_name(sID);
SAL_WARN_IF(!w, "vcl.layout", "widget \"" << sID.getStr() << "\" not found in .ui");
@@ -271,7 +271,7 @@ public:
ret = static_cast<T*>(w);
return ret;
}
- PopupMenu* get_menu(PopupMenu*& ret, OString sID)
+ PopupMenu* get_menu(PopupMenu*& ret, const OString& sID)
{
ret = get_menu(sID);
SAL_WARN_IF(!ret, "vcl.layout", "menu \"" << sID.getStr() << "\" not found in .ui");
@@ -279,7 +279,7 @@ public:
return ret;
}
//sID may not exist, but must be of type T if it does
- template <typename T /*= ::Window if we had c++11*/> T* get(OString sID)
+ template <typename T /*= ::Window if we had c++11*/> T* get(const OString& sID)
{
::Window *w = get_by_name(sID);
SAL_WARN_IF(w && !dynamic_cast<T*>(w),
@@ -288,7 +288,7 @@ public:
return static_cast<T*>(w);
}
//sID may not exist
- PopupMenu* get_menu(OString sID);
+ PopupMenu* get_menu(const OString& sID);
//given an sID return the response value for that widget
short get_response(const ::Window *pWindow) const;
@@ -378,7 +378,7 @@ private:
::Window* prepareWidgetOwnScrolling(::Window *pParent, WinBits &rWinStyle);
void cleanupWidgetOwnScrolling(::Window *pScrollParent, ::Window *pWindow, stringmap &rMap);
- void set_response(OString sID, short nResponse);
+ void set_response(const OString& sID, short nResponse);
};
@@ -403,19 +403,19 @@ public:
static OUString getUIRootDir();
bool hasBuilder() const { return m_pUIBuilder != NULL; }
css::uno::Reference<css::frame::XFrame> getFrame() { return m_pUIBuilder->getFrame(); }
- template <typename T> T* get(T*& ret, OString sID)
+ template <typename T> T* get(T*& ret, const OString& sID)
{
return m_pUIBuilder->get<T>(ret, sID);
}
- template <typename T /*= ::Window if we had c++11*/> T* get(OString sID)
+ template <typename T /*= ::Window if we had c++11*/> T* get(const OString & sID)
{
return m_pUIBuilder->get<T>(sID);
}
- PopupMenu* get_menu(PopupMenu*& ret, OString sID)
+ PopupMenu* get_menu(PopupMenu*& ret, const OString & sID)
{
return m_pUIBuilder->get_menu(ret, sID);
}
- PopupMenu* get_menu(OString sID)
+ PopupMenu* get_menu(const OString & sID)
{
return m_pUIBuilder->get_menu(sID);
}
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 125948f..951a26b 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1463,7 +1463,7 @@ public:
const Rectangle& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- OUString aCaption );
+ const OUString& aCaption );
// Query the native control's actual drawing region (including adornment)
bool GetNativeControlRegion( ControlType nType,
@@ -1471,7 +1471,7 @@ public:
const Rectangle& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- OUString aCaption,
+ const OUString& aCaption,
Rectangle &rNativeBoundingRegion,
Rectangle &rNativeContentRegion ) const;
diff --git a/vcl/inc/graphite_features.hxx b/vcl/inc/graphite_features.hxx
index 0202497..d1587fd 100644
--- a/vcl/inc/graphite_features.hxx
+++ b/vcl/inc/graphite_features.hxx
@@ -41,8 +41,8 @@ namespace grutils
static const char FEAT_PREFIX;
static const char FEAT_SEPARATOR;
static const char FEAT_ID_VALUE_SEPARATOR;
- GrFeatureParser(const gr_face * face, const OString features, const OString lang);
- GrFeatureParser(const gr_face * face, const OString lang);
+ GrFeatureParser(const gr_face * face, const OString& features, const OString& lang);
+ GrFeatureParser(const gr_face * face, const OString& lang);
~GrFeatureParser();
//size_t getFontFeatures(gr::FeatureSetting settings[MAX_FEATURES]) const;
bool parseErrors() { return mbErrors; };
diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx
index 77a3520..a6d4def 100644
--- a/vcl/inc/outfont.hxx
+++ b/vcl/inc/outfont.hxx
@@ -61,9 +61,9 @@ public: // TODO: create matching interface class
FontPitch GetPitch() const { return mePitch; }
FontWidth GetWidthType() const { return meWidthType; }
bool IsSymbolFont() const { return mbSymbolFlag; }
- void SetFamilyName(const OUString sFamilyName) { maName = sFamilyName; }
- void SetStyleName( const OUString sStyleName) { maStyleName = sStyleName; }
- void SetFamilyType(const FontFamily eFontFamily) { meFamily = eFontFamily; }
+ void SetFamilyName(const OUString& sFamilyName) { maName = sFamilyName; }
+ void SetStyleName( const OUString& sStyleName) { maStyleName = sStyleName; }
+ void SetFamilyType(const FontFamily eFontFamily) { meFamily = eFontFamily; }
void SetPitch(const FontPitch ePitch ) { mePitch = ePitch; }
void SetItalic(const FontItalic eItalic ) { meItalic = eItalic; }
void SetWeight(const FontWeight eWeight ) { meWeight = eWeight; }
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index 9b98a76..5d179e7 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -409,7 +409,7 @@ public:
// get foreign key names
namespace vcl_sal {
OUString getKeysymReplacementName(
- OUString pLang,
+ const OUString& pLang,
KeySym nSymbol );
}
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index 811c2a1..f7faae4 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -34,7 +34,7 @@ public:
const OUString &rURL, const OUString &,
unsigned int, unsigned int, unsigned int);
- void checkExportImport(OUString aFilterShortName);
+ void checkExportImport(const OUString& aFilterShortName);
/**
* Ensure CVEs remain unbroken
@@ -77,7 +77,7 @@ void VclFiltersTest::testScaling()
}
}
-void VclFiltersTest::checkExportImport(OUString aFilterShortName)
+void VclFiltersTest::checkExportImport(const OUString& aFilterShortName)
{
Bitmap aBitmap( Size( 100, 100 ), 24 );
aBitmap.Erase(COL_WHITE);
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index 69a10bd..9661d4a 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -104,7 +104,7 @@ bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation)
return true;
}
-bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, OUString aType)
+bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString& aType)
{
// Can't rotate animations yet
if (mrGraphic.IsAnimated())
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index abd2ada..ea0e32c 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -872,7 +872,7 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
}
}
-void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString rText, const sal_Int32* pDXArray, sal_uInt32 nWidth )
+void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_uInt32 nWidth )
{
sal_Int32 nLen = rText.getLength(), i;
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index 03b5225..62f0b28 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -79,7 +79,7 @@ private:
void ImplWritePolygonRecord( const Polygon& rPoly, bool bClose );
void ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly );
void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP );
- void ImplWriteTextRecord( const Point& rPos, const OUString rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
+ void ImplWriteTextRecord( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
void ImplWrite( const GDIMetaFile& rMtf );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 628d309..bfcccbd 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -2341,7 +2341,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList,
namespace
{
- OUString stripCharSetFromName(OUString aName)
+ OUString stripCharSetFromName(const OUString& _aName)
{
// I worry that someone will have a font which *does* have
// e.g. "Greek" legitimately at the end of its name :-(
@@ -2358,6 +2358,7 @@ namespace
" (vietnamese)"
};
+ OUString aName = _aName;
// These can be crazily piled up, e.g. Times New Roman CYR Greek
bool bFinished = false;
while (!bFinished)
diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx
index 3329690..bef50d8 100644
--- a/vcl/source/gdi/outdevnative.cxx
+++ b/vcl/source/gdi/outdevnative.cxx
@@ -268,7 +268,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType,
const Rectangle& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- OUString aCaption )
+ const OUString& aCaption )
{
if( !lcl_enableNativeWidget( *this ) )
return false;
@@ -310,7 +310,7 @@ bool OutputDevice::GetNativeControlRegion( ControlType nType,
const Rectangle& rControlRegion,
ControlState nState,
const ImplControlValue& aValue,
- OUString aCaption,
+ const OUString& aCaption,
Rectangle &rNativeBoundingRegion,
Rectangle &rNativeContentRegion ) const
{
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index 6901931..2e999b4 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -38,14 +38,14 @@ const char GrFeatureParser::FEAT_PREFIX = ':';
const char GrFeatureParser::FEAT_SEPARATOR = '&';
const char GrFeatureParser::FEAT_ID_VALUE_SEPARATOR = '=';
-GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString lang)
+GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& lang)
: mnNumSettings(0), mbErrors(false), mpSettings(NULL)
{
maLang.label[0] = maLang.label[1] = maLang.label[2] = maLang.label[3] = '\0';
setLang(pFace, lang);
}
-GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString features, const OString lang)
+GrFeatureParser::GrFeatureParser(const gr_face * pFace, const OString& features, const OString& lang)
: mnNumSettings(0), mbErrors(false), mpSettings(NULL)
{
sal_Int32 nEquals = 0;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 535222c..c4fe9ac 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -45,7 +45,7 @@ using namespace com::sun::star;
namespace
{
- sal_uInt16 mapStockToImageResource(OString sType)
+ sal_uInt16 mapStockToImageResource(const OString& sType)
{
sal_uInt16 nRet = 0;
if (sType == "gtk-index")
@@ -55,7 +55,7 @@ namespace
return nRet;
}
- SymbolType mapStockToSymbol(OString sType)
+ SymbolType mapStockToSymbol(const OString& sType)
{
SymbolType eRet = SYMBOL_NOSYMBOL;
if (sType == "gtk-media-next")
@@ -167,7 +167,7 @@ namespace
}
#endif
-VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID, const uno::Reference<frame::XFrame>& rFrame)
+VclBuilder::VclBuilder(Window *pParent, const OUString& sUIDir, const OUString& sUIFile, const OString& sID, const uno::Reference<frame::XFrame>& rFrame)
: m_sID(sID)
, m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
, m_pStringReplace(ResMgr::GetReadStringHook())
@@ -851,7 +851,7 @@ namespace
return nDigits;
}
- FieldUnit detectMetricUnit(OString sUnit)
+ FieldUnit detectMetricUnit(const OString& sUnit)
{
FieldUnit eUnit = FUNIT_NONE;
@@ -2906,7 +2906,7 @@ Window *VclBuilder::get_widget_root()
return m_aChildren.empty() ? NULL : m_aChildren[0].m_pWindow;
}
-Window *VclBuilder::get_by_name(OString sID)
+Window *VclBuilder::get_by_name(const OString& sID)
{
for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(),
aEnd = m_aChildren.end(); aI != aEnd; ++aI)
@@ -2918,7 +2918,7 @@ Window *VclBuilder::get_by_name(OString sID)
return NULL;
}
-PopupMenu *VclBuilder::get_menu(OString sID)
+PopupMenu *VclBuilder::get_menu(const OString& sID)
{
for (std::vector<MenuAndId>::iterator aI = m_aMenus.begin(),
aEnd = m_aMenus.end(); aI != aEnd; ++aI)
@@ -2946,7 +2946,7 @@ short VclBuilder::get_response(const Window *pWindow) const
return RET_CANCEL;
}
-void VclBuilder::set_response(OString sID, short nResponse)
+void VclBuilder::set_response(const OString& sID, short nResponse)
{
for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(),
aEnd = m_aChildren.end(); aI != aEnd; ++aI)
@@ -2962,7 +2962,7 @@ void VclBuilder::set_response(OString sID, short nResponse)
assert(false);
}
-void VclBuilder::delete_by_name(OString sID)
+void VclBuilder::delete_by_name(const OString& sID)
{
for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(),
aEnd = m_aChildren.end(); aI != aEnd; ++aI)
@@ -3031,7 +3031,7 @@ void VclBuilder::set_window_packing_position(const Window *pWindow, sal_Int32 nP
}
}
-const VclBuilder::ListStore *VclBuilder::get_model_by_name(OString sID) const
+const VclBuilder::ListStore *VclBuilder::get_model_by_name(const OString& sID) const
{
std::map<OString, ListStore>::const_iterator aI = m_pParserState->m_aModels.find(sID);
if (aI != m_pParserState->m_aModels.end())
@@ -3039,7 +3039,7 @@ const VclBuilder::ListStore *VclBuilder::get_model_by_name(OString sID) const
return NULL;
}
-const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(OString sID) const
+const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(const OString& sID) const
{
std::map<OString, TextBuffer>::const_iterator aI = m_pParserState->m_aTextBuffers.find(sID);
if (aI != m_pParserState->m_aTextBuffers.end())
@@ -3047,7 +3047,7 @@ const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(OString sID) const
return NULL;
}
-const VclBuilder::Adjustment *VclBuilder::get_adjustment_by_name(OString sID) const
+const VclBuilder::Adjustment *VclBuilder::get_adjustment_by_name(const OString& sID) const
{
std::map<OString, Adjustment>::const_iterator aI = m_pParserState->m_aAdjustments.find(sID);
if (aI != m_pParserState->m_aAdjustments.end())
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx
index 50c5369..a2d4117 100644
--- a/vcl/unx/generic/app/keysymnames.cxx
+++ b/vcl/unx/generic/app/keysymnames.cxx
@@ -474,7 +474,7 @@ namespace vcl_sal {
};
// translate keycodes, used within the displayed menu shortcuts
- OUString getKeysymReplacementName( OUString pLang, KeySym nSymbol )
+ OUString getKeysymReplacementName( const OUString& pLang, KeySym nSymbol )
{
for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ )
{
diff --git a/vcl/unx/gtk/a11y/atkimage.cxx b/vcl/unx/gtk/a11y/atkimage.cxx
index b413daa..d9f93ed 100644
--- a/vcl/unx/gtk/a11y/atkimage.cxx
+++ b/vcl/unx/gtk/a11y/atkimage.cxx
@@ -28,7 +28,7 @@ using namespace ::com::sun::star;
// FIXME
static G_CONST_RETURN gchar *
-getAsConst( OUString rString )
+getAsConst( const OUString& rString )
{
static const int nMax = 10;
static OString aUgly[nMax];
diff --git a/vcl/unx/gtk/a11y/atktable.cxx b/vcl/unx/gtk/a11y/atktable.cxx
index bf30e41..7094a7c 100644
--- a/vcl/unx/gtk/a11y/atktable.cxx
+++ b/vcl/unx/gtk/a11y/atktable.cxx
@@ -45,7 +45,7 @@ atk_object_wrapper_conditional_ref( const uno::Reference< accessibility::XAccess
// FIXME
static G_CONST_RETURN gchar *
-getAsConst( OUString rString )
+getAsConst( const OUString& rString )
{
static const int nMax = 10;
static OString aUgly[nMax];
commit 39c7532933bb4f1630e821a2a38b213eb05dcc59
Author: Noel Grandin <noel at peralex.com>
Date: Wed Mar 12 15:36:41 2014 +0200
basic: prefer passing OUString and OString by reference
Change-Id: I8121204cdb37d4e1d8967397f3e45bdab6aaddad
diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx
index f05771c..8e145d0 100644
--- a/basic/qa/cppunit/basic_coverage.cxx
+++ b/basic/qa/cppunit/basic_coverage.cxx
@@ -24,8 +24,8 @@ private:
int m_nb_tests_ok;
int m_nb_tests_skipped;
OUString m_sCurrentTest;
- void process_directory(OUString sDirName);
- void run_test(OUString sFileName);
+ void process_directory(const OUString& sDirName);
+ void run_test(const OUString& sFileName);
void test_failed(void);
void test_success(void);
StringVec get_subdirnames( const OUString& sDirName );
@@ -70,7 +70,7 @@ void Coverage::test_success()
fprintf(stderr,"%s,PASS\n", OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr() );
}
-void Coverage::run_test(OUString sFileURL)
+void Coverage::run_test(const OUString& sFileURL)
{
m_sCurrentTest = sFileURL;
bool result = false;
@@ -113,7 +113,7 @@ Coverage::StringVec Coverage::get_subdirnames( const OUString& sDirName )
}
return sSubDirNames;
}
-void Coverage::process_directory(OUString sDirName)
+void Coverage::process_directory(const OUString& sDirName)
{
osl::Directory aDir(sDirName);
osl::DirectoryItem aItem;
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 0718391..3c0e936 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -146,14 +146,14 @@ class BasMgrContainerListenerImpl: public ContainerListenerHelper
OUString maLibName; // empty -> no lib, but lib container
public:
- BasMgrContainerListenerImpl( BasicManager* pMgr, OUString aLibName )
+ BasMgrContainerListenerImpl( BasicManager* pMgr, const OUString& aLibName )
: mpMgr( pMgr )
, maLibName( aLibName ) {}
static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr,
- uno::Any aLibAny, OUString aLibName );
+ uno::Any aLibAny, const OUString& aLibName );
static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess,
- OUString aLibName );
+ const OUString& aLibName );
// XEventListener
@@ -175,7 +175,7 @@ public:
void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont,
- BasicManager* pMgr, uno::Any aLibAny, OUString aLibName )
+ BasicManager* pMgr, uno::Any aLibAny, const OUString& aLibName )
{
Reference< container::XNameAccess > xLibNameAccess;
aLibAny >>= xLibNameAccess;
@@ -208,7 +208,7 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip
void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
- uno::Reference< container::XNameAccess > xLibNameAccess, OUString aLibName )
+ uno::Reference< container::XNameAccess > xLibNameAccess, const OUString& aLibName )
{
uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames();
sal_Int32 nModuleCount = aModuleNames.getLength();
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 6445dd2..ae016b1 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -484,7 +484,7 @@ OUString SbiImage::GetString( short nId ) const
return OUString();
}
-const SbxObject* SbiImage::FindType (OUString aTypeName) const
+const SbxObject* SbiImage::FindType (const OUString& aTypeName) const
{
return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL;
}
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 910f323..ae393d7 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -524,7 +524,7 @@ sal_Bool SbModule::IsCompiled() const
return sal_Bool( pImage != 0 );
}
-const SbxObject* SbModule::FindType( OUString aTypeName ) const
+const SbxObject* SbModule::FindType( const OUString& aTypeName ) const
{
return pImage ? pImage->FindType( aTypeName ) : NULL;
}
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 81e369d..095c715 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -75,7 +75,7 @@ public:
OUString& GetSource32() { return aOUSource; }
sal_uInt16 GetBase() const { return nDimBase; }
OUString GetString( short nId ) const;
- const SbxObject* FindType (OUString aTypeName) const;
+ const SbxObject* FindType (const OUString& aTypeName) const;
SbxArrayRef GetEnums() { return rEnums; }
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4f45619..0cc3db1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2800,7 +2800,7 @@ inline sal_Bool implCheckWildcard( const OUString& rName, SbiRTLData* pRTLData )
}
-bool isRootDir( OUString aDirURLStr )
+bool isRootDir( const OUString& aDirURLStr )
{
INetURLObject aDirURLObj( aDirURLStr );
bool bRoot = false;
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index dbc11a5..5b059e3 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -104,14 +104,14 @@ double get_number_of_digits( double dNumber )
SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
- OUString _sOnStrg,
- OUString _sOffStrg,
- OUString _sYesStrg,
- OUString _sNoStrg,
- OUString _sTrueStrg,
- OUString _sFalseStrg,
- OUString _sCurrencyStrg,
- OUString _sCurrencyFormatStrg )
+ const OUString& _sOnStrg,
+ const OUString& _sOffStrg,
+ const OUString& _sYesStrg,
+ const OUString& _sNoStrg,
+ const OUString& _sTrueStrg,
+ const OUString& _sFalseStrg,
+ const OUString& _sCurrencyStrg,
+ const OUString& _sCurrencyFormatStrg )
: cDecPoint(_cDecPoint)
, cThousandSep(_cThousandSep)
, sOnStrg(_sOnStrg)
@@ -954,7 +954,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
sReturnStrgFinal = sReturnStrg.makeStringAndClear();
}
-OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
+OUString SbxBasicFormater::BasicFormatNull( const OUString& sFormatStrg )
{
sal_Bool bNullFormatFound;
OUString sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
@@ -966,9 +966,10 @@ OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
return OUString("null");
}
-OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
+OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormatStrg )
{
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
+ OUString sFormatStrg = _sFormatStrg;
// analyse format-string concerning predefined formats:
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
@@ -1071,7 +1072,7 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
return sReturnStrg;
}
-sal_Bool SbxBasicFormater::isBasicFormat( OUString sFormatStrg )
+sal_Bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg )
{
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
{
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index 62e3ebe..b0b8ce3 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -109,7 +109,7 @@ public:
virtual sal_Bool Compile();
virtual sal_Bool IsCompiled() const;
- const SbxObject* FindType( OUString aTypeName ) const;
+ const SbxObject* FindType( const OUString& aTypeName ) const;
virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
diff --git a/include/basic/sbxform.hxx b/include/basic/sbxform.hxx
index 0e4eb6d..e77879f 100644
--- a/include/basic/sbxform.hxx
+++ b/include/basic/sbxform.hxx
@@ -84,14 +84,14 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
// Constructor takes signs for decimal point, thousand separation sign
// and necessary resource strings.
SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
- OUString _sOnStrg,
- OUString _sOffStrg,
- OUString _sYesStrg,
- OUString _sNoStrg,
- OUString _sTrueStrg,
- OUString _sFalseStrg,
- OUString _sCurrencyStrg,
- OUString _sCurrencyFormatStrg );
+ const OUString& _sOnStrg,
+ const OUString& _sOffStrg,
+ const OUString& _sYesStrg,
+ const OUString& _sNoStrg,
+ const OUString& _sTrueStrg,
+ const OUString& _sFalseStrg,
+ const OUString& _sCurrencyStrg,
+ const OUString& _sCurrencyFormatStrg );
/* Basic command: Format$( number,format-string )
@@ -102,10 +102,10 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
Return value:
String containing the formatted output
*/
- OUString BasicFormat( double dNumber, OUString sFormatStrg );
- OUString BasicFormatNull( OUString sFormatStrg );
+ OUString BasicFormat( double dNumber, const OUString& sFormatStrg );
+ OUString BasicFormatNull( const OUString& sFormatStrg );
- static sal_Bool isBasicFormat( OUString sFormatStrg );
+ static sal_Bool isBasicFormat( const OUString& sFormatStrg );
private:
BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
More information about the Libreoffice-commits
mailing list