summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 11:37:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 13:23:36 +0200
commit524c4c61ebd985ab6721d8c7e5f8f85f273883cb (patch)
treec9ea154e3610d2cf1196eb90ce2e6d98614639cf /linguistic
parent23a3727dc6bdb1a3266f71a58cca0bea8f70ac04 (diff)
loplugin:makeshared in linguistic
Change-Id: Id852ace32903e8bae622be36a7318d0f4f201832 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/convdic.cxx2
-rw-r--r--linguistic/source/dicimp.cxx28
-rw-r--r--linguistic/source/dicimp.hxx2
-rw-r--r--linguistic/source/dlistimp.cxx4
4 files changed, 18 insertions, 18 deletions
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index e4d1b4e82dfc..b67558954a2a 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -224,7 +224,7 @@ void ConvDic::Save()
if (!xStream.is())
return;
- SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+ std::unique_ptr<SvStream> pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
// get XML writer
uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(xContext);
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index de8d5326c22a..ef348f75a594 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -107,7 +107,7 @@ static bool getTag(const OString &rLine, const char *pTagName,
}
-sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool &bNeg, OUString &aDicName )
+sal_Int16 ReadDicVersion( SvStream& rStream, LanguageType &nLng, bool &bNeg, OUString &aDicName )
{
// Sniff the header
sal_Int16 nDicVersion = DIC_VERSION_DONTKNOW;
@@ -116,13 +116,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool
nLng = LANGUAGE_NONE;
bNeg = false;
- if (!rpStream.get() || rpStream->GetError())
+ if (rStream.GetError())
return -1;
- sal_uInt64 const nSniffPos = rpStream->Tell();
+ sal_uInt64 const nSniffPos = rStream.Tell();
static std::size_t nVerOOo7Len = sal::static_int_cast< std::size_t >(strlen( pVerOOo7 ));
pMagicHeader[ nVerOOo7Len ] = '\0';
- if ((rpStream->ReadBytes(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len) &&
+ if ((rStream.ReadBytes(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len) &&
!strcmp(pMagicHeader, pVerOOo7))
{
bool bSuccess;
@@ -131,10 +131,10 @@ sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool
nDicVersion = DIC_VERSION_7;
// 1st skip magic / header line
- rpStream->ReadLine(aLine);
+ rStream.ReadLine(aLine);
// 2nd line: language all | en-US | pt-BR ...
- while ((bSuccess = rpStream->ReadLine(aLine)))
+ while ((bSuccess = rStream.ReadLine(aLine)))
{
OString aTagValue;
@@ -177,13 +177,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool
{
sal_uInt16 nLen;
- rpStream->Seek (nSniffPos );
+ rStream.Seek (nSniffPos );
- rpStream->ReadUInt16( nLen );
+ rStream.ReadUInt16( nLen );
if (nLen >= MAX_HEADER_LENGTH)
return -1;
- rpStream->ReadBytes(pMagicHeader, nLen);
+ rStream.ReadBytes(pMagicHeader, nLen);
pMagicHeader[nLen] = '\0';
// Check version magic
@@ -202,13 +202,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool
{
// The language of the dictionary
sal_uInt16 nTmp = 0;
- rpStream->ReadUInt16( nTmp );
+ rStream.ReadUInt16( nTmp );
nLng = LanguageType(nTmp);
if (VERS2_NOLANGUAGE == static_cast<sal_uInt16>(nLng))
nLng = LANGUAGE_NONE;
// Negative Flag
- rpStream->ReadCharAsBool( bNeg );
+ rStream.ReadCharAsBool( bNeg );
}
}
@@ -290,12 +290,12 @@ ErrCode DictionaryNeo::loadEntries(const OUString &rMainURL)
if (!xStream.is())
return ErrCode(sal_uInt32(-1));
- SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+ std::unique_ptr<SvStream> pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
// read header
bool bNegativ;
LanguageType nLang;
- nDicVersion = ReadDicVersion(pStream, nLang, bNegativ, aDicName);
+ nDicVersion = ReadDicVersion(*pStream, nLang, bNegativ, aDicName);
ErrCode nErr = pStream->GetError();
if (nErr != ERRCODE_NONE)
return nErr;
@@ -424,7 +424,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString &rURL)
if (!xStream.is())
return ErrCode(sal_uInt32(-1));
- SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+ std::unique_ptr<SvStream> pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
// Always write as the latest version, i.e. DIC_VERSION_7
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 37221736d70c..dc7c94c3e91f 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -32,7 +32,7 @@
#define DIC_MAX_ENTRIES 30000
-sal_Int16 ReadDicVersion( SvStreamPtr const &rpStream, LanguageType &nLng, bool &bNeg, OUString &aDicName );
+sal_Int16 ReadDicVersion( SvStream& rStream, LanguageType &nLng, bool &bNeg, OUString &aDicName );
class DictionaryNeo :
public ::cppu::WeakImplHelper
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 98ed47202f55..26e4e48868e9 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -809,9 +809,9 @@ static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool&
if (!xStream.is())
return false;
- SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+ std::unique_ptr<SvStream> pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
- int nDicVersion = ReadDicVersion(pStream, nLng, bNeg, aDicName);
+ int nDicVersion = ReadDicVersion(*pStream, nLng, bNeg, aDicName);
return 2 == nDicVersion || nDicVersion >= 5;
}