summaryrefslogtreecommitdiff
path: root/comphelper/source/misc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-04-27 09:52:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-04-27 13:47:30 +0200
commitd3f80583ee90c9b652ac5d1ef8957ec0db65fdd2 (patch)
treee1784e2afedaac96124317eb2e7900e9c10d7528 /comphelper/source/misc
parent49f2d7cd98cefdbe9e179a8558cf89e09d8019e5 (diff)
-Werror,-Wvarargs
"passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]" just replace the variadic function with one taking an initializer list Change-Id: Ied3dfe835dcebef48cf35374ec4d8835f98e6779
Diffstat (limited to 'comphelper/source/misc')
-rw-r--r--comphelper/source/misc/serviceinfohelper.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/comphelper/source/misc/serviceinfohelper.cxx b/comphelper/source/misc/serviceinfohelper.cxx
index ad85110907e9..838f4fec11eb 100644
--- a/comphelper/source/misc/serviceinfohelper.cxx
+++ b/comphelper/source/misc/serviceinfohelper.cxx
@@ -19,7 +19,6 @@
#include <comphelper/serviceinfohelper.hxx>
-#include <stdarg.h>
// #####################################################################
@@ -39,20 +38,17 @@ css::uno::Sequence< OUString > ServiceInfoHelper::getSupportedServiceNames() thr
return aSeq;
}
-/** this method adds a variable number of char pointer to a given Sequence
+/** this method adds a variable number of OUString to a given Sequence
*/
-void ServiceInfoHelper::addToSequence( css::uno::Sequence< OUString >& rSeq, sal_uInt16 nServices, /* char * */ ... ) throw()
+void ServiceInfoHelper::addToSequence( css::uno::Sequence< OUString >& rSeq, std::initializer_list<OUString> services ) throw()
{
sal_uInt32 nCount = rSeq.getLength();
- rSeq.realloc( nCount + nServices );
+ rSeq.realloc( nCount + services.size() );
OUString* pStrings = rSeq.getArray();
- va_list marker;
- va_start( marker, nServices );
- for( sal_uInt16 i = 0 ; i < nServices; i++ )
- pStrings[nCount++] = OUString::createFromAscii(va_arg( marker, char*));
- va_end( marker );
+ for( auto const & s: services )
+ pStrings[nCount++] = s;
}
}