[Libreoffice-commits] core.git: onlineupdate/source opencl/inc svtools/source vcl/source
Jochen Nitschke
j.nitschke+logerrit at ok.de
Sun Jun 4 18:43:10 UTC 2017
onlineupdate/source/update/updater/updater.cxx | 8 ++++----
opencl/inc/opencl_device_selection.h | 2 +-
svtools/source/contnr/treelist.cxx | 4 ++--
vcl/source/filter/graphicfilter.cxx | 8 ++++----
4 files changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 8511ee5cd11a5143a4476c0152f0ede0f2b6b87e
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Sun Jun 4 13:43:12 2017 +0200
no need to construct unique_ptr here
and std::move is not needed when returning unique_ptr
Change-Id: I9b4d2d6b8a41b570a9bd99e44a743ff161b78c59
Reviewed-on: https://gerrit.libreoffice.org/38385
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index cd63539edfb4..f1800448087f 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -1134,7 +1134,7 @@ RemoveFile::Parse(NS_tchar *line)
if (!validPath)
return PARSE_ERROR;
- mRelPath = std::unique_ptr<NS_tchar>(new NS_tchar[MAXPATHLEN]);
+ mRelPath.reset(new NS_tchar[MAXPATHLEN]);
NS_tstrcpy(mRelPath.get(), validPath);
mFile.reset(get_full_path(validPath));
@@ -1261,7 +1261,7 @@ RemoveDir::Parse(NS_tchar *line)
NS_tchar* validPath = get_valid_path(&line, true);
if (!validPath)
return PARSE_ERROR;
- mRelPath = std::unique_ptr<NS_tchar>(new NS_tchar[MAXPATHLEN]);
+ mRelPath.reset(new NS_tchar[MAXPATHLEN]);
NS_tstrcpy(mRelPath.get(), validPath);
mDir.reset(get_full_path(validPath));
@@ -1386,7 +1386,7 @@ AddFile::Parse(NS_tchar *line)
if (!validPath)
return PARSE_ERROR;
- mRelPath = std::unique_ptr<NS_tchar>(new NS_tchar[MAXPATHLEN]);
+ mRelPath.reset(new NS_tchar[MAXPATHLEN]);
NS_tstrcpy(mRelPath.get(), validPath);
@@ -1582,7 +1582,7 @@ PatchFile::Parse(NS_tchar *line)
NS_tchar* validPath = get_valid_path(&line);
if (!validPath)
return PARSE_ERROR;
- mFileRelPath = std::unique_ptr<NS_tchar>(new NS_tchar[MAXPATHLEN]);
+ mFileRelPath.reset(new NS_tchar[MAXPATHLEN]);
NS_tstrcpy(mFileRelPath.get(), validPath);
mFile.reset(get_full_path(validPath));
diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h
index 3a47ff6d8d5e..79f88894c378 100644
--- a/opencl/inc/opencl_device_selection.h
+++ b/opencl/inc/opencl_device_selection.h
@@ -148,7 +148,7 @@ inline ds_status initDSProfile(std::unique_ptr<ds_profile>& rProfile, OString co
unsigned int next;
unsigned int i;
- rProfile = std::unique_ptr<ds_profile>(new ds_profile(rVersion));
+ rProfile.reset(new ds_profile(rVersion));
clGetPlatformIDs(0, nullptr, &numPlatforms);
if (numPlatforms != 0)
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index bd8d55e3a1b6..76fb434aaa6c 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -1040,7 +1040,7 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
bLastEntry = (nListPos == (rList.size()-1));
SvTreeListEntries::iterator it = rList.begin();
std::advance(it, nListPos);
- pEntryDeleter = std::unique_ptr<SvTreeListEntry>(std::move(*it));
+ pEntryDeleter = std::move(*it);
rList.erase(it);
}
else
@@ -1049,7 +1049,7 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
std::find_if(rList.begin(), rList.end(), FindByPointer(pEntry));
if (it != rList.end())
{
- pEntryDeleter = std::unique_ptr<SvTreeListEntry>(std::move(*it));
+ pEntryDeleter = std::move(*it);
rList.erase(it);
}
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 495d85d6b8c9..e148287038f7 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1439,7 +1439,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
{
try
{
- pGraphicContent = std::unique_ptr<sal_uInt8[]>(new sal_uInt8[nGraphicContentSize]);
+ pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
}
catch (const std::bad_alloc&)
{
@@ -1606,7 +1606,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
const std::vector<sal_uInt8>& rData = aIter->aData;
nGraphicContentSize = nChunkSize - 11;
SvMemoryStream aIStrm(const_cast<sal_uInt8*>(&rData[11]), nGraphicContentSize, StreamMode::READ);
- pGraphicContent = std::unique_ptr<sal_uInt8[]>(new sal_uInt8[nGraphicContentSize]);
+ pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
sal_uInt64 aCurrentPosition = aIStrm.Tell();
aIStrm.ReadBytes(pGraphicContent.get(), nGraphicContentSize);
aIStrm.Seek(aCurrentPosition);
@@ -1690,7 +1690,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
// Make a uncompressed copy for GfxLink
nGraphicContentSize = nMemoryLength;
- pGraphicContent = std::unique_ptr<sal_uInt8[]>(new sal_uInt8[nGraphicContentSize]);
+ pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
std::copy(aNewData.begin(), aNewData.end(), pGraphicContent.get());
if(!aMemStream.GetError() )
@@ -1911,7 +1911,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
{
try
{
- pGraphicContent = std::unique_ptr<sal_uInt8[]>(new sal_uInt8[nGraphicContentSize]);
+ pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
}
catch (const std::bad_alloc&)
{
More information about the Libreoffice-commits
mailing list