summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-26 15:04:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-27 11:06:44 +0200
commit82a4ef72d6e34c2f5075069a1b353f7fd41c7595 (patch)
tree460ef9ebde66e8a23da59df76db0fa18426504ca /vcl/unx
parentcacbb0faef77ae8462de9ff5c7307a6a2e28b2bb (diff)
loplugin:stringloop in vcl
Change-Id: I086a809b6541041b627daa93f9a08be2a9218550 Reviewed-on: https://gerrit.libreoffice.org/58117 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/dtrans/X11_selection.cxx6
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx6
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx19
3 files changed, 16 insertions, 15 deletions
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index c2d8858d1c61..40455e4756b5 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -521,7 +521,7 @@ SelectionAdaptor* SelectionManager::getAdaptor( Atom selection )
OUString SelectionManager::convertFromCompound( const char* pText, int nLen )
{
osl::MutexGuard aGuard( m_aMutex );
- OUString aRet;
+ OUStringBuffer aRet;
if( nLen < 0 )
nLen = strlen( pText );
@@ -539,12 +539,12 @@ OUString SelectionManager::convertFromCompound( const char* pText, int nLen )
&nTexts );
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
for( int i = 0; i < nTexts; i++ )
- aRet += OStringToOUString( pTextList[i], aEncoding );
+ aRet.append(OStringToOUString( pTextList[i], aEncoding ));
if( pTextList )
XFreeStringList( pTextList );
- return aRet;
+ return aRet.makeStringAndClear();
}
OString SelectionManager::convertToCompound( const OUString& rText )
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index dc61baab503b..951c758eeac7 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -55,6 +55,7 @@
#include <com/sun/star/beans/Property.hpp>
#include <rtl/ref.hxx>
+#include <rtl/strbuf.hxx>
#include <osl/diagnose.h>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/queryinterface.hxx>
@@ -751,17 +752,18 @@ ensureTypeFor( uno::XInterface *pAccessible )
{
int i;
bool bTypes[ aTypeTableSize ] = { false, };
- OString aTypeName( "OOoAtkObj" );
+ OStringBuffer aTypeNameBuf( "OOoAtkObj" );
for( i = 0; i < aTypeTableSize; i++ )
{
if( isOfType( pAccessible, aTypeTable[i].aGetUnoType() ) )
{
- aTypeName += aTypeTable[i].name;
+ aTypeNameBuf.append(aTypeTable[i].name);
bTypes[i] = true;
}
}
+ OString aTypeName = aTypeNameBuf.makeStringAndClear();
GType nType = g_type_from_name( aTypeName.getStr() );
if( nType == G_TYPE_INVALID )
{
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index e4f5ac395b8d..fd65f6b380d2 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -1844,7 +1844,7 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
OString aFilterName = OUStringToOString( aShrunkName, RTL_TEXTENCODING_UTF8 );
gtk_file_filter_set_name( filter, aFilterName.getStr() );
- OUString aTokens;
+ OUStringBuffer aTokens;
bool bAllGlob = rType == "*.*" || rType == "*";
if (bAllGlob)
@@ -1852,10 +1852,9 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
else
{
sal_Int32 nIndex = 0;
- OUString aToken;
do
{
- aToken = rType.getToken( 0, ';', nIndex );
+ OUString aToken = rType.getToken( 0, ';', nIndex );
// Assume all have the "*.<extn>" syntax
sal_Int32 nStarDot = aToken.lastIndexOf( "*." );
if (nStarDot >= 0)
@@ -1863,8 +1862,8 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
if (!aToken.isEmpty())
{
if (!aTokens.isEmpty())
- aTokens += ",";
- aTokens = aTokens += aToken;
+ aTokens.append(",");
+ aTokens.append(aToken);
gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_URI,
case_insensitive_filter,
g_strdup( OUStringToOString(aToken, RTL_TEXTENCODING_UTF8).getStr() ),
@@ -1892,7 +1891,7 @@ GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const O
gtk_list_store_append (m_pFilterStore, &iter);
gtk_list_store_set (m_pFilterStore, &iter,
0, OUStringToOString(shrinkFilterName( rFilter, true ), RTL_TEXTENCODING_UTF8).getStr(),
- 1, OUStringToOString(aTokens, RTL_TEXTENCODING_UTF8).getStr(),
+ 1, OUStringToOString(aTokens.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr(),
2, aFilterName.getStr(),
3, OUStringToOString(rType, RTL_TEXTENCODING_UTF8).getStr(),
-1);
@@ -1938,15 +1937,15 @@ void SalGtkFilePicker::SetFilters()
}
if (aAllFormats.size() > 1)
{
- OUString sAllFilter;
+ OUStringBuffer sAllFilter;
for (auto const& format : aAllFormats)
{
if (!sAllFilter.isEmpty())
- sAllFilter += ";";
- sAllFilter += format;
+ sAllFilter.append(";");
+ sAllFilter.append(format);
}
sPseudoFilter = getResString(FILE_PICKER_ALLFORMATS);
- m_pPseudoFilter = implAddFilter( sPseudoFilter, sAllFilter );
+ m_pPseudoFilter = implAddFilter( sPseudoFilter, sAllFilter.makeStringAndClear() );
}
}