summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-04-03 22:25:19 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-05 06:25:39 +0000
commitdb43ef00c12bc0f7fefd6d028c9a2ed8f771cd47 (patch)
tree62f08a44e99513251324f8972d257d8fd3be2b2c /desktop
parente72c80c01629798a93948d4419f109ac324de4ef (diff)
sequence->vector in xmlscript
Change-Id: I4f99cd9dc659f54bd4818559dd3e0dbce1e8f5d4 Reviewed-on: https://gerrit.libreoffice.org/23795 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/inc/dp_ucb.h3
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx3
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx9
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx3
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx16
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx6
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx30
-rw-r--r--desktop/source/deployment/registry/dp_backenddb.cxx2
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx12
9 files changed, 39 insertions, 45 deletions
diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h
index 324e39896e59..174af57c87e9 100644
--- a/desktop/source/deployment/inc/dp_ucb.h
+++ b/desktop/source/deployment/inc/dp_ucb.h
@@ -21,6 +21,7 @@
#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_UCB_H
#include <list>
+#include <vector>
#include <rtl/byteseq.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -80,7 +81,7 @@ DESKTOP_DEPLOYMENTMISC_DLLPUBLIC bool erase_path(
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
-::rtl::ByteSequence readFile( ::ucbhelper::Content & ucb_content );
+std::vector<sal_Int8> readFile( ::ucbhelper::Content & ucb_content );
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 9e9d95ea404e..ddcb155eae13 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -109,9 +109,8 @@ void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const
OString stamp("1" );
Reference<css::io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
- stamp.getLength() ) ) );
+ stamp.getLength() ) );
ucbStamp.writeStream( xData, true /* replace existing */ );
}
catch(...)
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 1cd7349bb13c..864d852c0a58 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -245,9 +245,9 @@ void PackageManagerImpl::initActivationLayer(
aSecurity.getUserName( aUserName );
ucbhelper::Content remFileContent(
url + "removed", Reference<XCommandEnvironment>(), m_xComponentContext);
- ::rtl::ByteSequence data = dp_misc::readFile(remFileContent);
- OString osData(reinterpret_cast<const sal_Char*>(data.getConstArray()),
- data.getLength());
+ std::vector<sal_Int8> data = dp_misc::readFile(remFileContent);
+ OString osData(reinterpret_cast<const sal_Char*>(data.data()),
+ data.size());
OUString sData = OStringToOUString(
osData, RTL_TEXTENCODING_UTF8);
if (!sData.equals(aUserName))
@@ -890,9 +890,8 @@ void PackageManagerImpl::removePackage(
OString stamp = OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8);
Reference<css::io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
- stamp.getLength() ) ) );
+ stamp.getLength() ) );
contentRemoved.writeStream( xData, true /* replace existing */ );
}
m_activePackagesDB->erase( id, fileName ); // to be removed upon next start
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 38f29182f352..a3f5ac54ef33 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -119,9 +119,8 @@ void ExtensionProperties::write()
buf.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
Reference<css::io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(stamp.getStr()),
- stamp.getLength() ) ) );
+ stamp.getLength() ) );
contentProps.writeStream( xData, true /* replace existing */ );
}
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index ba0a9c0f0365..eda1d50f74b3 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -184,9 +184,9 @@ bool erase_path( OUString const & url,
}
-::rtl::ByteSequence readFile( ::ucbhelper::Content & ucb_content )
+std::vector<sal_Int8> readFile( ::ucbhelper::Content & ucb_content )
{
- ::rtl::ByteSequence bytes;
+ std::vector<sal_Int8> bytes;
Reference<io::XOutputStream> xStream(
::xmlscript::createOutputStream( &bytes ) );
if (! ucb_content.openStream( xStream ))
@@ -201,9 +201,9 @@ bool readLine( OUString * res, OUString const & startingWith,
::ucbhelper::Content & ucb_content, rtl_TextEncoding textenc )
{
// read whole file:
- ::rtl::ByteSequence bytes( readFile( ucb_content ) );
- OUString file( reinterpret_cast<sal_Char const *>(bytes.getConstArray()),
- bytes.getLength(), textenc );
+ std::vector<sal_Int8> bytes( readFile( ucb_content ) );
+ OUString file( reinterpret_cast<sal_Char const *>(bytes.data()),
+ bytes.size(), textenc );
sal_Int32 pos = 0;
for (;;)
{
@@ -257,9 +257,9 @@ bool readProperties( ::std::list< ::std::pair< OUString, OUString> > & out_resul
::ucbhelper::Content & ucb_content )
{
// read whole file:
- ::rtl::ByteSequence bytes( readFile( ucb_content ) );
- OUString file( reinterpret_cast<sal_Char const *>(bytes.getConstArray()),
- bytes.getLength(), RTL_TEXTENCODING_UTF8);
+ std::vector<sal_Int8> bytes( readFile( ucb_content ) );
+ OUString file( reinterpret_cast<sal_Char const *>(bytes.data()),
+ bytes.size(), RTL_TEXTENCODING_UTF8);
sal_Int32 pos = 0;
for (;;)
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 61bba1def6a1..51d0f078d42b 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -953,9 +953,8 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
const Reference<io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(buf2.getStr()),
- buf2.getLength() ) ) );
+ buf2.getLength() ) );
::ucbhelper::Content ucb_content(
makeURL( getCachePath(), getPlatformString() + "rc" ),
xCmdEnv, m_xComponentContext );
@@ -978,9 +977,8 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
// write unorc:
const Reference<io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(buf.getStr()),
- buf.getLength() ) ) );
+ buf.getLength() ) );
::ucbhelper::Content ucb_content(
makeURL( getCachePath(), "unorc" ), xCmdEnv, m_xComponentContext );
ucb_content.writeStream( xData, true /* replace existing */ );
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index b8e68bb2ca8b..27e229a4da87 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -458,9 +458,8 @@ void BackendImpl::configmgrini_flush(
// write configmgr.ini:
const Reference<io::XInputStream> xData(
::xmlscript::createInputStream(
- ::rtl::ByteSequence(
reinterpret_cast<sal_Int8 const *>(buf.getStr()),
- buf.getLength() ) ) );
+ buf.getLength() ) );
::ucbhelper::Content ucb_content(
makeURL( getCachePath(), "configmgr.ini" ), xCmdEnv, m_xComponentContext );
ucb_content.writeStream( xData, true /* replace existing */ );
@@ -597,15 +596,14 @@ OUString replaceOrigin(
{
// looking for %origin%:
::ucbhelper::Content ucb_content( url, xCmdEnv, xContext );
- ::rtl::ByteSequence bytes( readFile( ucb_content ) );
- ::rtl::ByteSequence filtered( bytes.getLength() * 2,
- ::rtl::BYTESEQ_NODEFAULT );
+ std::vector<sal_Int8> bytes( readFile( ucb_content ) );
+ std::vector<sal_Int8> filtered( bytes.size() * 2 );
bool use_filtered = false;
OString origin;
sal_Char const * pBytes = reinterpret_cast<sal_Char const *>(
- bytes.getConstArray());
- sal_Size nBytes = bytes.getLength();
- sal_Int32 write_pos = 0;
+ bytes.data());
+ sal_Size nBytes = bytes.size();
+ size_t write_pos = 0;
while (nBytes > 0)
{
sal_Int32 index = rtl_str_indexOfChar_WithLength( pBytes, nBytes, '%' );
@@ -615,9 +613,9 @@ OUString replaceOrigin(
index = nBytes;
}
- if ((write_pos + index) > filtered.getLength())
- filtered.realloc( (filtered.getLength() + index) * 2 );
- memcpy( filtered.getArray() + write_pos, pBytes, index );
+ if ((write_pos + index) > filtered.size())
+ filtered.resize( (filtered.size() + index) * 2 );
+ memcpy( filtered.data() + write_pos, pBytes, index );
write_pos += index;
pBytes += index;
nBytes -= index;
@@ -655,15 +653,15 @@ OUString replaceOrigin(
nBytes -= RTL_CONSTASCII_LENGTH("origin%");
use_filtered = true;
}
- if ((write_pos + nAdd) > filtered.getLength())
- filtered.realloc( (filtered.getLength() + nAdd) * 2 );
- memcpy( filtered.getArray() + write_pos, pAdd, nAdd );
+ if ((write_pos + nAdd) > filtered.size())
+ filtered.resize( (filtered.size() + nAdd) * 2 );
+ memcpy( filtered.data() + write_pos, pAdd, nAdd );
write_pos += nAdd;
}
if (!use_filtered)
return url;
- if (write_pos < filtered.getLength())
- filtered.realloc( write_pos );
+ if (write_pos < filtered.size())
+ filtered.resize( write_pos );
OUString newUrl(url);
if (!destFolder.isEmpty())
{
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index 3cd4185c3f8d..535d9a4ba327 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -52,7 +52,7 @@ BackendDb::BackendDb(
void BackendDb::save()
{
const Reference<css::io::XActiveDataSource> xDataSource(m_doc,css::uno::UNO_QUERY_THROW);
- ::rtl::ByteSequence bytes;
+ std::vector<sal_Int8> bytes;
xDataSource->setOutputStream(::xmlscript::createOutputStream(&bytes));
const Reference<css::io::XActiveDataControl> xDataControl(m_doc,css::uno::UNO_QUERY_THROW);
xDataControl->start();
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 58b302e0ea80..5ee41ed53929 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -578,9 +578,9 @@ OUString BackendImpl::PackageImpl::getTextFromURL(
{
::ucbhelper::Content descContent(
licenseUrl, xCmdEnv, getMyBackend()->getComponentContext());
- ::rtl::ByteSequence seq = dp_misc::readFile(descContent);
+ std::vector<sal_Int8> seq = dp_misc::readFile(descContent);
return OUString( reinterpret_cast<sal_Char const *>(
- seq.getConstArray()), seq.getLength(), RTL_TEXTENCODING_UTF8);
+ seq.data()), seq.size(), RTL_TEXTENCODING_UTF8);
}
catch (const css::uno::Exception&)
{
@@ -1544,13 +1544,13 @@ void BackendImpl::PackageImpl::scanBundle(
xCmdEnv, false /* no throw */ ))
{
// patch description:
- ::rtl::ByteSequence bytes( readFile( descrFileContent ) );
+ std::vector<sal_Int8> bytes( readFile( descrFileContent ) );
OUStringBuffer buf;
- if ( bytes.getLength() )
+ if ( bytes.size() )
{
buf.append( OUString( reinterpret_cast<sal_Char const *>(
- bytes.getConstArray() ),
- bytes.getLength(), RTL_TEXTENCODING_UTF8 ) );
+ bytes.data() ),
+ bytes.size(), RTL_TEXTENCODING_UTF8 ) );
}
else
{