Use make_unique when appropriate

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-05-25 21:08:43 +02:00
parent 4825c472f6
commit 9e20a0fecf
2 changed files with 6 additions and 2 deletions

View file

@ -26,6 +26,8 @@
#include <dirent.h>
#include <stdio.h>
#include <memory>
#include "c_private.h"
#include "c_lib.h"
#include "c_string.h"
@ -101,7 +103,7 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *d
return {};
} while (qstrcmp(dirent->d_name, ".") == 0 || qstrcmp(dirent->d_name, "..") == 0);
file_stat.reset(new csync_file_stat_t);
file_stat = std::make_unique<csync_file_stat_t>();
file_stat->path = c_utf8_from_locale(dirent->d_name);
QByteArray fullPath = QByteArray() % const_cast<const char *>(handle->path) % '/' % QByteArray() % const_cast<const char *>(dirent->d_name);
if (file_stat->path.isNull()) {

View file

@ -25,6 +25,8 @@
#include <fcntl.h>
#include <stdio.h>
#include <memory>
#include "windows.h"
#include "c_private.h"
@ -166,7 +168,7 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *d
if (path == "." || path == "..")
return csync_vio_local_readdir(dhandle);
file_stat.reset(new csync_file_stat_t);
file_stat = std::make_unique<csync_file_stat_t>();
file_stat->path = path;
if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {