mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Replace std::auto_ptr with std::unique_ptr
This commit is contained in:
parent
c8137afab6
commit
bbb9dc66ff
@ -87,8 +87,8 @@ private:
|
||||
ICondition *unlock_cond;
|
||||
ISharedMutex* single_user_mutex;
|
||||
|
||||
std::auto_ptr<IScopedReadLock> transaction_read_lock;
|
||||
std::auto_ptr<IScopedWriteLock> write_lock;
|
||||
std::unique_ptr<IScopedReadLock> transaction_read_lock;
|
||||
std::unique_ptr<IScopedWriteLock> write_lock;
|
||||
|
||||
std::vector<std::pair<std::string,std::string> > attached_dbs;
|
||||
str_map params;
|
||||
|
||||
@ -67,7 +67,7 @@ std::vector<std::string> CFileSettingsReader::getKeys()
|
||||
|
||||
void CFileSettingsReader::read(const std::string& pFile )
|
||||
{
|
||||
std::auto_ptr<IFile> file(Server->openFile(pFile));
|
||||
std::unique_ptr<IFile> file(Server->openFile(pFile));
|
||||
if (file.get() == NULL)
|
||||
{
|
||||
return;
|
||||
|
||||
@ -31,7 +31,7 @@ private:
|
||||
size_t curr_bytes;
|
||||
int64 lastresettime;
|
||||
int64 lastupdatetime;
|
||||
std::auto_ptr<IPipeThrottlerUpdater> updater;
|
||||
std::unique_ptr<IPipeThrottlerUpdater> updater;
|
||||
ThrottleState throttle_state;
|
||||
int64 lastprobetime;
|
||||
float probe_bps;
|
||||
|
||||
2
Query.h
2
Query.h
@ -75,7 +75,7 @@ private:
|
||||
static std::vector<std::string> active_queries;
|
||||
#endif
|
||||
|
||||
std::auto_ptr<IScopedReadLock> single_use_lock;
|
||||
std::unique_ptr<IScopedReadLock> single_use_lock;
|
||||
|
||||
friend class ScopedAddActiveQuery;
|
||||
};
|
||||
|
||||
8
Server.h
8
Server.h
@ -45,10 +45,10 @@ struct SDatabase
|
||||
std::map<THREAD_ID, IDatabaseInt*> tmap;
|
||||
std::vector<std::pair<std::string,std::string> > attach;
|
||||
size_t allocation_chunk_size;
|
||||
std::auto_ptr<ISharedMutex> single_user_mutex;
|
||||
std::auto_ptr<IMutex> lock_mutex;
|
||||
std::auto_ptr<int> lock_count;
|
||||
std::auto_ptr<ICondition> unlock_cond;
|
||||
std::unique_ptr<ISharedMutex> single_user_mutex;
|
||||
std::unique_ptr<IMutex> lock_mutex;
|
||||
std::unique_ptr<int> lock_count;
|
||||
std::unique_ptr<ICondition> unlock_cond;
|
||||
str_map params;
|
||||
|
||||
private:
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
std::auto_ptr<std::shared_lock<std::shared_timed_mutex> > read_lock;
|
||||
std::unique_ptr<std::shared_lock<std::shared_timed_mutex> > read_lock;
|
||||
|
||||
#ifdef SHARED_MUTEX_CHECK
|
||||
SharedMutex* shared_mutex;
|
||||
@ -61,5 +61,5 @@ public:
|
||||
WriteLock(std::unique_lock<std::shared_timed_mutex>* write_lock);
|
||||
|
||||
private:
|
||||
std::auto_ptr<std::unique_lock<std::shared_timed_mutex> > write_lock;
|
||||
std::unique_ptr<std::unique_lock<std::shared_timed_mutex> > write_lock;
|
||||
};
|
||||
@ -78,13 +78,13 @@ public:
|
||||
private:
|
||||
|
||||
std::vector<char, aligned_allocator<char> > data;
|
||||
std::auto_ptr<ISharedMutex> mutex;
|
||||
std::unique_ptr<ISharedMutex> mutex;
|
||||
size_t pos;
|
||||
bool mlock_mem;
|
||||
std::string name;
|
||||
static int page_size;
|
||||
int memory_protected;
|
||||
std::auto_ptr<IMutex> mprotect_mutex;
|
||||
std::unique_ptr<IMutex> mprotect_mutex;
|
||||
};
|
||||
|
||||
namespace
|
||||
|
||||
@ -639,7 +639,7 @@ namespace
|
||||
|
||||
attr_buf.resize((attrlist->last_vnc - attrlist->starting_vnc + 1) * vol_data.BytesPerCluster);
|
||||
|
||||
std::auto_ptr<IFsFile> dev(Server->openFileFromHandle(vol, "vol"));
|
||||
std::unique_ptr<IFsFile> dev(Server->openFileFromHandle(vol, "vol"));
|
||||
if (dev.get() == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
@ -1826,7 +1826,7 @@ bool CClientThread::GetFileBlockdiff(CRData *data, bool with_metadata)
|
||||
|
||||
ScopedShareActive scoped_share_active;
|
||||
|
||||
std::auto_ptr<ScopedPipeFileUser> pipe_file_user;
|
||||
std::unique_ptr<ScopedPipeFileUser> pipe_file_user;
|
||||
IFile* srv_file = NULL;
|
||||
IFileServ::CbtHashFileInfo cbt_hash_file_info;
|
||||
IFileServ::IMetadataCallback* metadata_callback = NULL;
|
||||
@ -2198,7 +2198,7 @@ bool CClientThread::GetFileHashAndMetadata( CRData* data )
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> tf(Server->openFileFromHandle((void*)hFile, filename));
|
||||
std::unique_ptr<IFile> tf(Server->openFileFromHandle((void*)hFile, filename));
|
||||
if(tf.get()==NULL)
|
||||
{
|
||||
Log("Could not open file from handle -hash", LL_ERROR);
|
||||
@ -2603,7 +2603,7 @@ std::string CClientThread::getDummyMetadata(std::string output_fn, int64 folder_
|
||||
data.addVarInt(0);
|
||||
data.addVarInt(folder_items);
|
||||
data.addVarInt(metadata_id);
|
||||
std::auto_ptr<IFileServ::ITokenCallback> token_callback(FileServ::newTokenCallback());
|
||||
std::unique_ptr<IFileServ::ITokenCallback> token_callback(FileServ::newTokenCallback());
|
||||
std::string ttokens;
|
||||
if (token_callback.get() != NULL)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ private:
|
||||
IFile *file;
|
||||
std::string s_filename;
|
||||
size_t share_active_gen;
|
||||
std::auto_ptr<ScopedPipeFileUser> pipe_file_user;
|
||||
std::unique_ptr<ScopedPipeFileUser> pipe_file_user;
|
||||
_i64 curr_hash_size;
|
||||
_i64 curr_file_size;
|
||||
_i64 curr_max_vdl;
|
||||
|
||||
@ -70,8 +70,7 @@ FileMetadataPipe::FileMetadataPipe( IPipe* pipe, const std::string& cmd )
|
||||
backup_state(BackupState_StatInit),
|
||||
#endif
|
||||
metadata_state(MetadataState_Wait),
|
||||
errpipe(Server->createMemoryPipe()),
|
||||
metadata_file(NULL)
|
||||
errpipe(Server->createMemoryPipe())
|
||||
{
|
||||
metadata_buffer.resize(4096);
|
||||
init();
|
||||
@ -86,8 +85,7 @@ FileMetadataPipe::FileMetadataPipe()
|
||||
backup_state(BackupState_StatInit),
|
||||
#endif
|
||||
metadata_state(MetadataState_Wait),
|
||||
errpipe(Server->createMemoryPipe()),
|
||||
metadata_file(NULL)
|
||||
errpipe(Server->createMemoryPipe())
|
||||
{
|
||||
metadata_buffer.resize(4096);
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ private:
|
||||
int64 folder_items;
|
||||
IFileServ::IMetadataCallback* callback;
|
||||
std::string server_token;
|
||||
std::auto_ptr<IFile> metadata_file;
|
||||
std::unique_ptr<IFile> metadata_file;
|
||||
int64 metadata_file_off;
|
||||
int64 metadata_file_size;
|
||||
int64 metadata_id;
|
||||
@ -122,7 +122,7 @@ private:
|
||||
MetadataState metadata_state;
|
||||
|
||||
std::string stderr_buf;
|
||||
std::auto_ptr<IPipe> errpipe;
|
||||
std::unique_ptr<IPipe> errpipe;
|
||||
IPipe* pipe;
|
||||
|
||||
size_t metadata_buffer_size;
|
||||
@ -137,7 +137,7 @@ private:
|
||||
IPipe* transmit_wait_pipe;
|
||||
sha512_ctx transmit_file_ctx;
|
||||
|
||||
std::auto_ptr<IFileServ::ITokenCallback> token_callback;
|
||||
std::unique_ptr<IFileServ::ITokenCallback> token_callback;
|
||||
};
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
@ -106,7 +106,7 @@ private:
|
||||
bool buf_circle;
|
||||
std::vector<char> buffer;
|
||||
std::string stderr_ret;
|
||||
std::auto_ptr<IMutex> buffer_mutex;
|
||||
std::unique_ptr<IMutex> buffer_mutex;
|
||||
size_t threadidx;
|
||||
bool has_eof;
|
||||
int64 stream_size;
|
||||
|
||||
@ -18,5 +18,5 @@ protected:
|
||||
virtual void finishStdout();
|
||||
virtual bool readStderrIntoBuffer(char* buf, size_t buf_avail, size_t& read_bytes);
|
||||
private:
|
||||
std::auto_ptr<IPipeFileExt> file_ext;
|
||||
std::unique_ptr<IPipeFileExt> file_ext;
|
||||
};
|
||||
@ -365,7 +365,7 @@ std::string PipeFileTar::buildCurrMetadata()
|
||||
data.addVarInt(0);
|
||||
data.addVarInt(0);
|
||||
data.addVarInt(0);
|
||||
std::auto_ptr<IFileServ::ITokenCallback> token_callback(FileServ::newTokenCallback());
|
||||
std::unique_ptr<IFileServ::ITokenCallback> token_callback(FileServ::newTokenCallback());
|
||||
std::string ttokens;
|
||||
if (token_callback.get() != NULL)
|
||||
{
|
||||
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
size_t refcount;
|
||||
IPipeFile* pipe_file;
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::set<std::string> paths;
|
||||
};
|
||||
|
||||
@ -140,7 +140,7 @@ private:
|
||||
sha_def_ctx sha_ctx;
|
||||
int64 hash_pos;
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
|
||||
PipeFileStore* pipe_file;
|
||||
|
||||
|
||||
@ -503,7 +503,7 @@ void PipeSessions::transmitFileMetadataAndFiledataWait(const std::string & publi
|
||||
datamsg.addChar(METADATA_PIPE_SEND_RAW_FILEDATA);
|
||||
datamsg.addString("f" + public_fn);
|
||||
datamsg.addVoidPtr(file);
|
||||
std::auto_ptr<IPipe> waitpipe(Server->createMemoryPipe());
|
||||
std::unique_ptr<IPipe> waitpipe(Server->createMemoryPipe());
|
||||
datamsg.addVoidPtr(waitpipe.get());
|
||||
datamsg.addString(server_token);
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ namespace
|
||||
ClientBitmap::ClientBitmap(std::string fn)
|
||||
: has_error(false)
|
||||
{
|
||||
std::auto_ptr<IFile> bitmap_file(Server->openFile(fn, MODE_READ));
|
||||
std::unique_ptr<IFile> bitmap_file(Server->openFile(fn, MODE_READ));
|
||||
|
||||
init(bitmap_file.get());
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ const size_t c_header_size = sizeof(headerMagic) + sizeof(headerVersionV1_0) + s
|
||||
|
||||
|
||||
CompressedFile::CompressedFile( std::string pFilename, int pMode, size_t n_threads)
|
||||
: hotCache(NULL), error(false), currentPosition(0),
|
||||
: error(false), currentPosition(0),
|
||||
finished(false), filesize(0), noMagic(false),
|
||||
mutex(Server->createMutex()), n_threads(n_threads), numBlockOffsets(0)
|
||||
{
|
||||
@ -80,7 +80,7 @@ CompressedFile::CompressedFile( std::string pFilename, int pMode, size_t n_threa
|
||||
}
|
||||
|
||||
CompressedFile::CompressedFile(IFile* file, bool openExisting, bool readOnly, size_t n_threads)
|
||||
: hotCache(NULL), error(false), currentPosition(0),
|
||||
: error(false), currentPosition(0),
|
||||
finished(false), uncompressedFile(file), filesize(0), readOnly(readOnly),
|
||||
noMagic(false), n_threads(n_threads), numBlockOffsets(0)
|
||||
{
|
||||
|
||||
@ -85,7 +85,7 @@ private:
|
||||
IFile* uncompressedFile;
|
||||
int64 uncompressedFileSize;
|
||||
|
||||
std::auto_ptr<LRUMemCache> hotCache;
|
||||
std::unique_ptr<LRUMemCache> hotCache;
|
||||
|
||||
//for reading
|
||||
std::vector<char> compressedBuffer;
|
||||
@ -101,7 +101,7 @@ private:
|
||||
|
||||
bool noMagic;
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
|
||||
size_t n_threads;
|
||||
};
|
||||
|
||||
@ -224,9 +224,9 @@ namespace
|
||||
|
||||
std::string ext = findextension(img_fn);
|
||||
|
||||
std::auto_ptr<IFile> imgf;
|
||||
std::unique_ptr<IFile> imgf;
|
||||
|
||||
std::auto_ptr<VHDFile> vhdfile;
|
||||
std::unique_ptr<VHDFile> vhdfile;
|
||||
if (ext == "raw")
|
||||
{
|
||||
imgf.reset(Server->openFile(img_fn, MODE_READ));
|
||||
|
||||
@ -43,9 +43,9 @@ private:
|
||||
std::vector<SCacheItem> evictedItems;
|
||||
std::vector<char*> lruItemBuffers;
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::auto_ptr<ICondition> cond;
|
||||
std::auto_ptr<ICondition> cond_wait;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::unique_ptr<ICondition> cond;
|
||||
std::unique_ptr<ICondition> cond_wait;
|
||||
|
||||
size_t buffersize;
|
||||
size_t nbuffers;
|
||||
|
||||
@ -204,7 +204,7 @@ CowFile::CowFile(const std::string &fn, const std::string &parent_fn, bool pRead
|
||||
read_only = pRead_only;
|
||||
|
||||
{
|
||||
std::auto_ptr<IFile> parentf(Server->openFile(parent_fn, MODE_READ));
|
||||
std::unique_ptr<IFile> parentf(Server->openFile(parent_fn, MODE_READ));
|
||||
if (parentf.get() != NULL)
|
||||
{
|
||||
filesize = parentf->Size();
|
||||
@ -639,7 +639,7 @@ void CowFile::setBitmapBit(uint64 offset, bool v)
|
||||
|
||||
bool CowFile::saveBitmap()
|
||||
{
|
||||
std::auto_ptr<IFile> bitmap_file(Server->openFile(filename+".bitmap", MODE_WRITE));
|
||||
std::unique_ptr<IFile> bitmap_file(Server->openFile(filename+".bitmap", MODE_WRITE));
|
||||
|
||||
if(!bitmap_file.get())
|
||||
{
|
||||
@ -658,7 +658,7 @@ bool CowFile::saveBitmap()
|
||||
|
||||
bool CowFile::loadBitmap(const std::string& bitmap_fn)
|
||||
{
|
||||
std::auto_ptr<IFile> bitmap_file(Server->openFile(bitmap_fn, MODE_READ));
|
||||
std::unique_ptr<IFile> bitmap_file(Server->openFile(bitmap_fn, MODE_READ));
|
||||
|
||||
if(!bitmap_file.get())
|
||||
{
|
||||
@ -825,7 +825,7 @@ bool CowFile::setUnused(_i64 unused_start, _i64 unused_end)
|
||||
bool CowFile::trimUnused(_i64 fs_offset, _i64 trim_blocksize, ITrimCallback* trim_callback)
|
||||
{
|
||||
FileWrapper devfile(this, fs_offset);
|
||||
std::auto_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
std::unique_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
|
||||
bitmap_source.reset(new ClientBitmap(filename + ".cbitmap"));
|
||||
|
||||
@ -935,7 +935,7 @@ bool CowFile::trimUnused(_i64 fs_offset, _i64 trim_blocksize, ITrimCallback* tri
|
||||
bool CowFile::syncBitmap(_i64 fs_offset)
|
||||
{
|
||||
FileWrapper devfile(this, fs_offset);
|
||||
std::auto_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
std::unique_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
|
||||
bitmap_source.reset(new ClientBitmap(filename + ".cbitmap"));
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ namespace
|
||||
|
||||
if(findextension(fn)=="vhdz")
|
||||
{
|
||||
std::auto_ptr<VHDFile> vhdfile(new VHDFile(fn, true, 0));
|
||||
std::unique_ptr<VHDFile> vhdfile(new VHDFile(fn, true, 0));
|
||||
|
||||
if(vhdfile->isOpen() && vhdfile->getParent()!=NULL)
|
||||
{
|
||||
@ -262,7 +262,7 @@ namespace
|
||||
|
||||
for(size_t i=0;i<fn.size();++i)
|
||||
{
|
||||
std::auto_ptr<IFile> f(Server->openFile(fn[i]+".mbr", MODE_READ));
|
||||
std::unique_ptr<IFile> f(Server->openFile(fn[i]+".mbr", MODE_READ));
|
||||
if(f.get()==NULL)
|
||||
{
|
||||
Server->Log("Could not open MBR file "+fn[i]+".mbr", LL_ERROR);
|
||||
@ -469,7 +469,7 @@ namespace
|
||||
#ifdef FIBMAP
|
||||
//leaks
|
||||
|
||||
std::auto_ptr<IFile> f(Server->openFile(fn, MODE_READ));
|
||||
std::unique_ptr<IFile> f(Server->openFile(fn, MODE_READ));
|
||||
|
||||
int fd = open64(fn.c_str(), O_RDONLY| O_LARGEFILE);
|
||||
|
||||
@ -1102,7 +1102,7 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
std::string image_verify=Server->getServerParameter("image_verify");
|
||||
if(!image_verify.empty())
|
||||
{
|
||||
std::auto_ptr<IVHDFile> in(open_device_file(image_verify));
|
||||
std::unique_ptr<IVHDFile> in(open_device_file(image_verify));
|
||||
|
||||
if(in.get()==NULL || in->isOpen()==false)
|
||||
{
|
||||
@ -1231,7 +1231,7 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
std::string device_verify=Server->getServerParameter("device_verify");
|
||||
if(!device_verify.empty())
|
||||
{
|
||||
std::auto_ptr<IVHDFile> in(open_device_file(device_verify));
|
||||
std::unique_ptr<IVHDFile> in(open_device_file(device_verify));
|
||||
|
||||
if(in.get()==NULL || in->isOpen()==false)
|
||||
{
|
||||
|
||||
@ -229,9 +229,9 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::auto_ptr<ICondition> start_readahead_cond;
|
||||
std::auto_ptr<ICondition> read_block_cond;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::unique_ptr<ICondition> start_readahead_cond;
|
||||
std::unique_ptr<ICondition> read_block_cond;
|
||||
Filesystem& fs;
|
||||
|
||||
std::map<int64, IFilesystem::IFsBuffer*> read_blocks;
|
||||
@ -925,7 +925,7 @@ bool Filesystem::excludeFile(const std::string& path)
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(path, MODE_READ));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(path, MODE_READ));
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
Server->Log("Error opening file " + path + ". " + os_last_error_str(), LL_DEBUG);
|
||||
|
||||
@ -130,8 +130,8 @@ protected:
|
||||
IFsBuffer* getBuffer();
|
||||
|
||||
std::vector<SSimpleBuffer*> buffers;
|
||||
std::auto_ptr<IMutex> buffer_mutex;
|
||||
std::auto_ptr<Filesystem_ReadaheadThread> readahead_thread;
|
||||
std::unique_ptr<IMutex> buffer_mutex;
|
||||
std::unique_ptr<Filesystem_ReadaheadThread> readahead_thread;
|
||||
THREADPOOL_TICKET readahead_thread_ticket;
|
||||
|
||||
size_t num_uncompleted_blocks;
|
||||
|
||||
@ -1428,7 +1428,7 @@ bool VHDFile::isCompressed()
|
||||
bool VHDFile::makeFull( _i64 fs_offset, IVHDWriteCallback* write_callback)
|
||||
{
|
||||
FileWrapper devfile(this, fs_offset);
|
||||
std::auto_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
std::unique_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
|
||||
bitmap_source.reset(new ClientBitmap(backing_file->getFilename() + ".cbitmap"));
|
||||
|
||||
|
||||
@ -956,7 +956,7 @@ bool VHDXFile::syncBitmap(_i64 fs_offset)
|
||||
bool VHDXFile::makeFull(_i64 fs_offset, IVHDWriteCallback* write_callback)
|
||||
{
|
||||
FileWrapper devfile(this, fs_offset);
|
||||
std::auto_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
std::unique_ptr<IReadOnlyBitmap> bitmap_source;
|
||||
|
||||
bitmap_source.reset(new ClientBitmap(backing_file->getFilename() + ".cbitmap"));
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
*.web.vodafone.de 500
|
||||
*.dyn.telefonica.de 1000
|
||||
*.rr.com -1
|
||||
*.dyn.telefonica.de -1
|
||||
*.pool.telefonica.de -1
|
||||
*.kabel-badenwuerttemberg.de -1
|
||||
*.cablesurf.de -1
|
||||
|
||||
@ -80,7 +80,7 @@ ClientHash::~ClientHash()
|
||||
|
||||
bool ClientHash::getShaBinary(const std::string & fn, IHashFunc & hf, bool with_cbt)
|
||||
{
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
|
||||
@ -627,7 +627,7 @@ bool ClientConnector::Run(IRunOtherCallback* p_run_other)
|
||||
if (crypto_fak->verifyFile(pubkey,
|
||||
UPDATE_FILE_PREFIX "UrBackupUpdate_untested.dat", UPDATE_FILE_PREFIX "UrBackupUpdate.sig2"))
|
||||
{
|
||||
std::auto_ptr<IFile> updatefile(Server->openFile(UPDATE_FILE_PREFIX "UrBackupUpdate_untested.dat"));
|
||||
std::unique_ptr<IFile> updatefile(Server->openFile(UPDATE_FILE_PREFIX "UrBackupUpdate_untested.dat"));
|
||||
if(updatefile.get()!=NULL)
|
||||
{
|
||||
if(checkHash(getSha512Hash(updatefile.get()))
|
||||
@ -1846,7 +1846,7 @@ std::vector<std::string> getSettingsList(void);
|
||||
void ClientConnector::updateSettings(const std::string &pData, const std::string& server_identity)
|
||||
{
|
||||
IDatabase *db = Server->getDatabase(Server->getThreadID(), URBACKUPDB_CLIENT);
|
||||
std::auto_ptr<ISettingsReader> new_settings(Server->createMemorySettingsReader(pData));
|
||||
std::unique_ptr<ISettingsReader> new_settings(Server->createMemorySettingsReader(pData));
|
||||
|
||||
int facet_id = getFacetId(ServerIdentityMgr::getIdentityFromSessionIdentity(server_identity));
|
||||
std::string facet_dir = "data_" + convert(facet_id);
|
||||
@ -1887,7 +1887,7 @@ void ClientConnector::updateSettings(const std::string &pData, const std::string
|
||||
facet_id, group_offset);
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
|
||||
std::vector<std::string> critical_settings;
|
||||
critical_settings.push_back("internet_mode_enabled");
|
||||
@ -1977,7 +1977,7 @@ void ClientConnector::updateSettings(const std::string &pData, const std::string
|
||||
if(mod
|
||||
|| getFile(settings_fn)!= pData)
|
||||
{
|
||||
std::auto_ptr<IFile> newf(Server->openFile(settings_fn + ".new", MODE_WRITE));
|
||||
std::unique_ptr<IFile> newf(Server->openFile(settings_fn + ".new", MODE_WRITE));
|
||||
if (newf.get() != NULL
|
||||
&& newf->Write(pData+ settings_add) == pData.size()+settings_add.size()
|
||||
&& newf->Sync())
|
||||
@ -1995,7 +1995,7 @@ void ClientConnector::updateSettings(const std::string &pData, const std::string
|
||||
|
||||
void ClientConnector::replaceSettings(const std::string &pData)
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> new_settings(Server->createMemorySettingsReader(pData));
|
||||
std::unique_ptr<ISettingsReader> new_settings(Server->createMemorySettingsReader(pData));
|
||||
|
||||
std::string facet_name = new_settings->getValue("facet_name", "default");
|
||||
|
||||
@ -2025,7 +2025,7 @@ void ClientConnector::replaceSettings(const std::string &pData)
|
||||
settings_fn = "urbackup/data_"+convert(facet_id)+"/settings_"+conv_filename(clientsubname)+".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> old_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> old_settings(Server->createFileSettingsReader(settings_fn));
|
||||
|
||||
std::vector<std::string> new_keys = new_settings->getKeys();
|
||||
bool modified_settings=true;
|
||||
@ -2591,7 +2591,7 @@ bool ClientConnector::sendMBR(std::string dl, std::string &errmsg)
|
||||
}
|
||||
|
||||
{
|
||||
std::auto_ptr<VOLUME_DISK_EXTENTS> vde((VOLUME_DISK_EXTENTS*)new char[sizeof(VOLUME_DISK_EXTENTS)]);
|
||||
std::unique_ptr<VOLUME_DISK_EXTENTS> vde((VOLUME_DISK_EXTENTS*)new char[sizeof(VOLUME_DISK_EXTENTS)]);
|
||||
b=DeviceIoControl(hVolume, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, vde.get(), sizeof(VOLUME_DISK_EXTENTS), &ret_bytes, NULL);
|
||||
if(b==0 && GetLastError()==ERROR_MORE_DATA)
|
||||
{
|
||||
@ -2631,7 +2631,7 @@ bool ClientConnector::sendMBR(std::string dl, std::string &errmsg)
|
||||
DWORD numPartitions=10;
|
||||
DWORD inf_size=sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1);
|
||||
|
||||
std::auto_ptr<DRIVE_LAYOUT_INFORMATION_EX> inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]);
|
||||
std::unique_ptr<DRIVE_LAYOUT_INFORMATION_EX> inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]);
|
||||
|
||||
b=DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0, inf.get(), inf_size, &ret_bytes, NULL);
|
||||
while(b==0 && GetLastError()==ERROR_INSUFFICIENT_BUFFER && numPartitions<1000)
|
||||
@ -3973,7 +3973,7 @@ std::string ClientConnector::getAccessTokensParams(const std::string& tokens, bo
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> access_keys(
|
||||
std::unique_ptr<ISettingsReader> access_keys(
|
||||
Server->createFileSettingsReader("urbackup/access_keys.properties"));
|
||||
|
||||
std::vector<std::string> server_token_keys = access_keys->getKeys();
|
||||
@ -4022,7 +4022,7 @@ std::string ClientConnector::getAccessTokensParams(const std::string& tokens, bo
|
||||
|
||||
if(with_clientname)
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> settings(
|
||||
std::unique_ptr<ISettingsReader> settings(
|
||||
Server->createFileSettingsReader("urbackup/data/settings.cfg"));
|
||||
|
||||
std::string computername;
|
||||
@ -4348,7 +4348,7 @@ bool ClientConnector::updateDefaultDirsSetting(IDatabase* db, bool all_virtual_c
|
||||
settings_fn = "urbackup/data_"+convert(facet_id)+"/settings_" + conv_filename(res_virtual_client["virtual_client"]) + ".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
@ -4408,7 +4408,7 @@ bool ClientConnector::updateDefaultDirsSetting(IDatabase* db, bool all_virtual_c
|
||||
new_data += keys[i] + "=" + val + "\n";
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> settings_f(Server->openFile(settings_fn+".new_2", MODE_WRITE));
|
||||
std::unique_ptr<IFile> settings_f(Server->openFile(settings_fn+".new_2", MODE_WRITE));
|
||||
|
||||
if (settings_f.get() != NULL)
|
||||
{
|
||||
|
||||
@ -156,7 +156,7 @@ void ClientConnector::CMD_GET_CHALLENGE(const std::string &identity, const std::
|
||||
|
||||
if (!internet_conn)
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> settings(
|
||||
std::unique_ptr<ISettingsReader> settings(
|
||||
Server->createFileSettingsReader("urbackup/data/settings.cfg"));
|
||||
|
||||
local_encrypted = settings->getValue("local_encrypted", true);
|
||||
@ -2836,7 +2836,7 @@ void ClientConnector::CMD_GET_ACCESS_PARAMS(str_map ¶ms)
|
||||
|
||||
std::string tokens=params["tokens"];
|
||||
|
||||
std::auto_ptr<ISettingsReader> settings(
|
||||
std::unique_ptr<ISettingsReader> settings(
|
||||
Server->createFileSettingsReader("urbackup/data/settings.cfg"));
|
||||
|
||||
std::string server_url;
|
||||
@ -2959,7 +2959,7 @@ void ClientConnector::CMD_FILE_RESTORE(const std::string& cmd)
|
||||
if (crypto_fak != NULL
|
||||
&& client_token_encrypted)
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> access_keys(
|
||||
std::unique_ptr<ISettingsReader> access_keys(
|
||||
Server->createFileSettingsReader("urbackup/access_keys.properties"));
|
||||
|
||||
if (access_keys.get() != NULL)
|
||||
|
||||
@ -83,7 +83,7 @@ private:
|
||||
|
||||
int64 last_backup_filetime;
|
||||
|
||||
std::auto_ptr<ContinuousWatchEnqueue> continuous_watch;
|
||||
std::unique_ptr<ContinuousWatchEnqueue> continuous_watch;
|
||||
|
||||
static std::vector<std::string> open_files;
|
||||
};
|
||||
@ -109,7 +109,7 @@ FileMetadataDownloadThread::FileMetadataDownloadThread(RestoreFiles& restore, Fi
|
||||
|
||||
void FileMetadataDownloadThread::operator()()
|
||||
{
|
||||
std::auto_ptr<IFsFile> tmp_f(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFsFile> tmp_f(Server->openTemporaryFile());
|
||||
|
||||
if(tmp_f.get()==NULL)
|
||||
{
|
||||
@ -141,7 +141,7 @@ void FileMetadataDownloadThread::operator()()
|
||||
bool FileMetadataDownloadThread::applyMetadata(const str_map& path_mapping)
|
||||
{
|
||||
buffer.resize(32768);
|
||||
std::auto_ptr<IFile> metadata_f(Server->openFile(metadata_tmp_fn, MODE_READ_SEQUENTIAL));
|
||||
std::unique_ptr<IFile> metadata_f(Server->openFile(metadata_tmp_fn, MODE_READ_SEQUENTIAL));
|
||||
|
||||
if(metadata_f.get()==NULL)
|
||||
{
|
||||
@ -374,7 +374,7 @@ bool FileMetadataDownloadThread::applyOsMetadata( IFile* metadata_f, const std::
|
||||
&& (os_get_file_type(os_file_prefix(output_fn)) & EFileType_Directory) )
|
||||
{
|
||||
os_remove_dir(os_file_prefix(output_fn));
|
||||
std::auto_ptr<IFile> touch_file(Server->openFile(os_file_prefix(output_fn), MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_file(Server->openFile(os_file_prefix(output_fn), MODE_WRITE));
|
||||
}
|
||||
|
||||
HANDLE hFile = CreateFileW(Server->ConvertToWchar(os_file_prefix(output_fn)).c_str(), GENERIC_WRITE | ACCESS_SYSTEM_SECURITY | WRITE_OWNER | WRITE_DAC, FILE_SHARE_READ, NULL,
|
||||
|
||||
@ -133,7 +133,7 @@ bool ImageThread::sendFullImageThread(void)
|
||||
|
||||
int64 last_shadowcopy_update = Server->getTimeMS();
|
||||
|
||||
std::auto_ptr<IFile> hdat_img;
|
||||
std::unique_ptr<IFile> hdat_img;
|
||||
std::string hdat_vol;
|
||||
int r_shadow_id = -1;
|
||||
str_map other_vols;
|
||||
@ -206,7 +206,7 @@ bool ImageThread::sendFullImageThread(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFilesystem> fs;
|
||||
std::unique_ptr<IFilesystem> fs;
|
||||
FsShutdownHelper shutdown_helper;
|
||||
if(!image_inf->shadowdrive.empty())
|
||||
{
|
||||
@ -522,7 +522,7 @@ bool ImageThread::sendIncrImageThread(void)
|
||||
lastsendtime=Server->getTimeMS();
|
||||
int64 last_shadowcopy_update = Server->getTimeMS();
|
||||
|
||||
std::auto_ptr<IFile> hdat_img;
|
||||
std::unique_ptr<IFile> hdat_img;
|
||||
std::string hdat_vol;
|
||||
int r_shadow_id = -1;
|
||||
str_map other_vols;
|
||||
@ -591,7 +591,7 @@ bool ImageThread::sendIncrImageThread(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFilesystem> fs;
|
||||
std::unique_ptr<IFilesystem> fs;
|
||||
FsShutdownHelper shutdown_helper;
|
||||
if (!image_inf->shadowdrive.empty())
|
||||
{
|
||||
@ -615,7 +615,7 @@ bool ImageThread::sendIncrImageThread(void)
|
||||
int64 changed_blocks = 0;
|
||||
int64 unchanged_blocks = 0;
|
||||
|
||||
std::auto_ptr<IReadOnlyBitmap> previous_bitmap;
|
||||
std::unique_ptr<IReadOnlyBitmap> previous_bitmap;
|
||||
if (bitmapfile != NULL
|
||||
&& hdat_img.get() != NULL)
|
||||
{
|
||||
@ -1217,7 +1217,7 @@ std::string ImageThread::getFsErrMsg()
|
||||
std::string extra_info;
|
||||
if (!image_inf->shadowdrive.empty())
|
||||
{
|
||||
std::auto_ptr<IFile> dev(Server->openFile(image_inf->shadowdrive, MODE_READ_DEVICE));
|
||||
std::unique_ptr<IFile> dev(Server->openFile(image_inf->shadowdrive, MODE_READ_DEVICE));
|
||||
if (dev.get() == NULL)
|
||||
{
|
||||
extra_info += ". Shadow copy " + image_inf->shadowdrive + " not present anymore. May have been removed";
|
||||
|
||||
@ -420,7 +420,7 @@ bool InternetClient::tryToConnect(IScopedLock *lock)
|
||||
|
||||
lock->relock(NULL);
|
||||
Server->Log("Trying to connect to internet server "+ formatServerForLog(selected_server_settings), LL_DEBUG);
|
||||
std::auto_ptr<CTCPStack> tcpstack(new CTCPStack(true));
|
||||
std::unique_ptr<CTCPStack> tcpstack(new CTCPStack(true));
|
||||
IPipe *cs = connect(selected_server_settings, *tcpstack);
|
||||
lock->relock(mutex);
|
||||
if(cs!=NULL)
|
||||
@ -702,7 +702,7 @@ void InternetClientThread::operator()(void)
|
||||
|
||||
if(token.second.empty())
|
||||
{
|
||||
std::auto_ptr<IECDHKeyExchange> ecdh_key_exchange(crypto_fak->createECDHKeyExchange());
|
||||
std::unique_ptr<IECDHKeyExchange> ecdh_key_exchange(crypto_fak->createECDHKeyExchange());
|
||||
|
||||
std::string shared_key = ecdh_key_exchange->getSharedKey(server_pubkey);
|
||||
if (shared_key.empty())
|
||||
|
||||
@ -107,8 +107,8 @@ namespace
|
||||
}
|
||||
|
||||
private:
|
||||
std::auto_ptr<IMutex> update_mutex;
|
||||
std::auto_ptr<ICondition> update_cond;
|
||||
std::unique_ptr<IMutex> update_mutex;
|
||||
std::unique_ptr<ICondition> update_cond;
|
||||
bool stopped;
|
||||
int curr_pc;
|
||||
std::string curr_details;
|
||||
|
||||
@ -36,7 +36,7 @@ protected:
|
||||
|
||||
bool writeOsMetadata(const std::string& sourcefn, int64 dest_start_offset, IFile* dest);
|
||||
|
||||
std::auto_ptr<IFileMetadataPipe> file_metadata_pipe;
|
||||
std::unique_ptr<IFileMetadataPipe> file_metadata_pipe;
|
||||
|
||||
private:
|
||||
};
|
||||
@ -131,7 +131,7 @@ bool LocalFullFileBackup::run()
|
||||
if (filelistpath.empty())
|
||||
return false;
|
||||
|
||||
std::auto_ptr<IFile> curr_file_list(Server->openFile(filelistpath, MODE_READ));
|
||||
std::unique_ptr<IFile> curr_file_list(Server->openFile(filelistpath, MODE_READ));
|
||||
if (curr_file_list.get() == NULL)
|
||||
{
|
||||
log("Error opening current file list. " + os_last_error_str(), LL_ERROR);
|
||||
@ -147,7 +147,7 @@ bool LocalFullFileBackup::run()
|
||||
std::string curr_path;
|
||||
std::string curr_os_path;
|
||||
|
||||
std::auto_ptr<IFile> filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE));
|
||||
std::unique_ptr<IFile> filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE));
|
||||
|
||||
int depth = 0;
|
||||
FileListParser list_parser;
|
||||
@ -213,7 +213,7 @@ bool LocalFullFileBackup::run()
|
||||
std::string sourcepath = IndexThread::getFileSrv()->getShareDir(curr_path, std::string());
|
||||
std::string metadatapath = ".hashes\\" + curr_os_path + "\\"+ metadata_dir_fn;
|
||||
|
||||
std::auto_ptr<IFsFile> metadataf(backup_files->openFile(metadatapath, MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> metadataf(backup_files->openFile(metadatapath, MODE_WRITE));
|
||||
|
||||
if (metadataf.get() == NULL)
|
||||
{
|
||||
@ -277,7 +277,7 @@ bool LocalFullFileBackup::run()
|
||||
if (metadatapath.find("btrfs.h") != std::string::npos)
|
||||
int abc = 5;
|
||||
|
||||
std::auto_ptr<IFsFile> metadataf(backup_files->openFile(metadatapath, MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> metadataf(backup_files->openFile(metadatapath, MODE_WRITE));
|
||||
|
||||
if (metadataf.get() == NULL)
|
||||
{
|
||||
@ -291,7 +291,7 @@ bool LocalFullFileBackup::run()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> sourcef(Server->openFile(sourcepath, MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFile> sourcef(Server->openFile(sourcepath, MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if (sourcef.get() == NULL)
|
||||
{
|
||||
@ -302,7 +302,7 @@ bool LocalFullFileBackup::run()
|
||||
if (sourcepath.find("btrfs.c") != std::string::npos)
|
||||
int abct = 5;
|
||||
|
||||
std::auto_ptr<IFsFile> destf(backup_files->openFile(targetpath, MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> destf(backup_files->openFile(targetpath, MODE_WRITE));
|
||||
|
||||
bool b = build_chunk_hashs(sourcef.get(),
|
||||
metadataf.get(), NULL, destf.get(), false);
|
||||
|
||||
@ -197,7 +197,7 @@ bool LocalIncrFileBackup::run()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE));
|
||||
std::unique_ptr<IFile> filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE));
|
||||
|
||||
const std::string last_backuppath_hashes = last_backuppath + "\\.hashes\\";
|
||||
bool c_has_error = false;
|
||||
@ -690,7 +690,7 @@ bool LocalIncrFileBackup::run()
|
||||
else if (extra_params.find("special") != extra_params.end() && (indirchange || file_changed))
|
||||
{
|
||||
std::string touch_path = local_curr_os_path;
|
||||
std::auto_ptr<IFile> touch_file(backup_files->openFile(touch_path, MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_file(backup_files->openFile(touch_path, MODE_WRITE));
|
||||
if (touch_file.get() == NULL)
|
||||
{
|
||||
log("Error touching file at \"" + touch_path + "\". " + backup_files->lastError(), LL_ERROR);
|
||||
|
||||
@ -55,5 +55,5 @@ private:
|
||||
std::string last_backuppath;
|
||||
int backupgroup;
|
||||
std::string clientsubname;
|
||||
std::auto_ptr<IFileMetadataPipe> file_metadata_pipe;
|
||||
std::unique_ptr<IFileMetadataPipe> file_metadata_pipe;
|
||||
};
|
||||
@ -127,7 +127,7 @@ void ParallelHash::operator()()
|
||||
#ifdef _WIN32
|
||||
mode = MODE_READ_DEVICE;
|
||||
#endif
|
||||
std::auto_ptr<IFile> phashf(Server->openFile(phash_queue->phash_queue->getFilename(), mode));
|
||||
std::unique_ptr<IFile> phashf(Server->openFile(phash_queue->phash_queue->getFilename(), mode));
|
||||
|
||||
while (!do_quit
|
||||
&& phashf.get()!=NULL)
|
||||
@ -340,7 +340,7 @@ bool ParallelHash::hashFile(int64 working_file_id, CRData & data, ClientDAO& cli
|
||||
|
||||
std::string full_path = dir->snapshot_dir + os_file_sep() + fn;
|
||||
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(os_file_prefix(full_path), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(os_file_prefix(full_path), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
SFileAndHash fandhash;
|
||||
std::string ph_action;
|
||||
|
||||
@ -70,13 +70,13 @@ private:
|
||||
volatile bool has_read;
|
||||
int64 phash_queue_pos;
|
||||
SQueueRef* phash_queue;
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
|
||||
std::map<int64, SCurrDir> curr_dirs;
|
||||
|
||||
std::deque<std::string> postponed_finish;
|
||||
|
||||
std::auto_ptr<ClientHash> client_hash;
|
||||
std::unique_ptr<ClientHash> client_hash;
|
||||
int sha_version;
|
||||
THREADPOOL_TICKET ticket;
|
||||
std::vector<THREADPOOL_TICKET> extra_tickets;
|
||||
@ -94,7 +94,7 @@ private:
|
||||
bool insert;
|
||||
};
|
||||
|
||||
std::auto_ptr<IMutex> modify_file_buffer_mutex;
|
||||
std::unique_ptr<IMutex> modify_file_buffer_mutex;
|
||||
std::vector< SBufferItem > modify_file_buffer;
|
||||
size_t modify_file_buffer_size;
|
||||
int64 last_file_buffer_commit_time;
|
||||
@ -102,6 +102,6 @@ private:
|
||||
bool extra_thread;
|
||||
|
||||
std::deque<std::pair<int64, std::string> > extra_queue;
|
||||
std::auto_ptr<IMutex> extra_mutex;
|
||||
std::auto_ptr<ICondition> extra_cond;
|
||||
std::unique_ptr<IMutex> extra_mutex;
|
||||
std::unique_ptr<ICondition> extra_cond;
|
||||
};
|
||||
|
||||
@ -205,7 +205,7 @@ void RestoreDownloadThread::queueStop()
|
||||
|
||||
bool RestoreDownloadThread::load_file( SQueueItem todl )
|
||||
{
|
||||
std::auto_ptr<IFsFile> dest_f;
|
||||
std::unique_ptr<IFsFile> dest_f;
|
||||
|
||||
if(!todl.metadata_only)
|
||||
{
|
||||
|
||||
@ -113,8 +113,8 @@ private:
|
||||
bool all_downloads_ok;
|
||||
std::vector<size_t> download_nok_ids;
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::auto_ptr<ICondition> cond;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::unique_ptr<ICondition> cond;
|
||||
|
||||
bool skipping;
|
||||
bool is_offline;
|
||||
|
||||
@ -126,8 +126,8 @@ namespace
|
||||
}
|
||||
|
||||
private:
|
||||
std::auto_ptr<IMutex> update_mutex;
|
||||
std::auto_ptr<ICondition> update_cond;
|
||||
std::unique_ptr<IMutex> update_mutex;
|
||||
std::unique_ptr<ICondition> update_cond;
|
||||
bool stopped;
|
||||
int curr_pc;
|
||||
std::string curr_fn;
|
||||
@ -296,7 +296,7 @@ void RestoreFiles::operator()()
|
||||
"Running a file backup may fix this issue.", LL_ERROR);
|
||||
}
|
||||
|
||||
std::auto_ptr<RestoreFiles> delete_this(this);
|
||||
std::unique_ptr<RestoreFiles> delete_this(this);
|
||||
if (restore_declined)
|
||||
{
|
||||
log("Restore was declined by client", LL_ERROR);
|
||||
@ -352,7 +352,7 @@ void RestoreFiles::operator()()
|
||||
return;
|
||||
}
|
||||
|
||||
std::auto_ptr<client::FileMetadataDownloadThread> metadata_thread(new client::FileMetadataDownloadThread(*this, fc_metadata, client_token));
|
||||
std::unique_ptr<client::FileMetadataDownloadThread> metadata_thread(new client::FileMetadataDownloadThread(*this, fc_metadata, client_token));
|
||||
THREADPOOL_TICKET metadata_dl = Server->getThreadPool()->execute(metadata_thread.get(), "file restore metadata download");
|
||||
|
||||
int64 starttime = Server->getTimeMS();
|
||||
@ -904,7 +904,7 @@ bool RestoreFiles::openFiles(std::map<std::string, IFsFile*>& open_files, bool&
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFsFile> orig_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_RESTORE));
|
||||
std::unique_ptr<IFsFile> orig_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_RESTORE));
|
||||
|
||||
if (orig_file.get() == NULL)
|
||||
{
|
||||
@ -928,7 +928,7 @@ bool RestoreFiles::openFiles(std::map<std::string, IFsFile*>& open_files, bool&
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFsFile> restore_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_CREATE_RESTORE));
|
||||
std::unique_ptr<IFsFile> restore_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_CREATE_RESTORE));
|
||||
|
||||
if (restore_file.get() == NULL)
|
||||
{
|
||||
@ -958,7 +958,7 @@ bool RestoreFiles::downloadFiles(FileClient& fc, int64 total_size, ScopedRestore
|
||||
|
||||
FileListParser filelist_parser;
|
||||
|
||||
std::auto_ptr<FileClientChunked> fc_chunked = createFcChunked();
|
||||
std::unique_ptr<FileClientChunked> fc_chunked = createFcChunked();
|
||||
|
||||
if(fc_chunked.get()==NULL)
|
||||
{
|
||||
@ -978,7 +978,7 @@ bool RestoreFiles::downloadFiles(FileClient& fc, int64 total_size, ScopedRestore
|
||||
std::string share_path;
|
||||
std::string server_path = "clientdl";
|
||||
|
||||
std::auto_ptr<RestoreDownloadThread> restore_download(new RestoreDownloadThread(fc, *fc_chunked, client_token, metadata_path_mapping, *this));
|
||||
std::unique_ptr<RestoreDownloadThread> restore_download(new RestoreDownloadThread(fc, *fc_chunked, client_token, metadata_path_mapping, *this));
|
||||
THREADPOOL_TICKET restore_download_ticket = Server->getThreadPool()->execute(restore_download.get(), "file restore download");
|
||||
|
||||
std::string curr_files_dir;
|
||||
@ -1468,7 +1468,7 @@ bool RestoreFiles::downloadFiles(FileClient& fc, int64 total_size, ScopedRestore
|
||||
}
|
||||
}
|
||||
|
||||
std::auto_ptr<IFsFile> orig_file;
|
||||
std::unique_ptr<IFsFile> orig_file;
|
||||
bool use_open_fallback = true;
|
||||
|
||||
if (restore_flags & restore_flag_open_all_files_first)
|
||||
@ -1614,8 +1614,8 @@ bool RestoreFiles::downloadFiles(FileClient& fc, int64 total_size, ScopedRestore
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IHashFunc> hashf;
|
||||
std::auto_ptr<IHashFunc> hashf2;
|
||||
std::unique_ptr<IHashFunc> hashf;
|
||||
std::unique_ptr<IHashFunc> hashf2;
|
||||
|
||||
std::string hash_key;
|
||||
|
||||
@ -1720,7 +1720,7 @@ bool RestoreFiles::downloadFiles(FileClient& fc, int64 total_size, ScopedRestore
|
||||
|
||||
if (data.size == 0)
|
||||
{
|
||||
std::auto_ptr<IFile> touch_file;
|
||||
std::unique_ptr<IFile> touch_file;
|
||||
if (orig_file == NULL)
|
||||
{
|
||||
touch_file.reset(Server->openFile(os_file_prefix(local_fn), MODE_RW_CREATE_RESTORE));
|
||||
@ -1848,16 +1848,16 @@ void RestoreFiles::log( const std::string& msg, int loglevel )
|
||||
}
|
||||
}
|
||||
|
||||
std::auto_ptr<FileClientChunked> RestoreFiles::createFcChunked()
|
||||
std::unique_ptr<FileClientChunked> RestoreFiles::createFcChunked()
|
||||
{
|
||||
IPipe* conn = new_fileclient_connection();
|
||||
|
||||
if(conn==NULL)
|
||||
{
|
||||
return std::auto_ptr<FileClientChunked>();
|
||||
return std::unique_ptr<FileClientChunked>();
|
||||
}
|
||||
|
||||
return std::auto_ptr<FileClientChunked>(new FileClientChunked(conn, true, &tcpstack, this,
|
||||
return std::unique_ptr<FileClientChunked>(new FileClientChunked(conn, true, &tcpstack, this,
|
||||
NULL, client_token, NULL));
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ private:
|
||||
|
||||
bool renameFilesOnRestart(std::vector<std::pair<std::string, std::string> >& rename_queue);
|
||||
|
||||
std::auto_ptr<FileClientChunked> createFcChunked();
|
||||
std::unique_ptr<FileClientChunked> createFcChunked();
|
||||
|
||||
void calculateDownloadSpeed(FileClient & fc, FileClientChunked * fc_chunked);
|
||||
|
||||
|
||||
@ -401,7 +401,7 @@ bool ServerIdentityMgr::write_file_admin_atomic(const std::string & data, const
|
||||
}
|
||||
|
||||
{
|
||||
std::auto_ptr<IFile> f(Server->openFile(fn + ".new", MODE_RW));
|
||||
std::unique_ptr<IFile> f(Server->openFile(fn + ".new", MODE_RW));
|
||||
if (f.get() != NULL)
|
||||
f->Sync();
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ namespace
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFile> journal_info(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$Max", MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFile> journal_info(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$Max", MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if(journal_info.get()==NULL) return -1;
|
||||
|
||||
@ -234,7 +234,7 @@ namespace
|
||||
|
||||
sequence_id = journal_data.UsnJournalID;
|
||||
|
||||
std::auto_ptr<IFile> journal(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$J", MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFile> journal(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$J", MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if(journal.get()==NULL) return -1;
|
||||
|
||||
@ -5550,7 +5550,7 @@ bool IndexThread::backgroundBackupsEnabled(const std::string& clientsubname)
|
||||
settings_fn = "urbackup/data/settings_"+conv_filename(clientsubname)+".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
if(curr_settings.get()!=NULL)
|
||||
{
|
||||
std::string background_backups;
|
||||
@ -5565,7 +5565,7 @@ bool IndexThread::backgroundBackupsEnabled(const std::string& clientsubname)
|
||||
|
||||
void IndexThread::writeTokens()
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> access_keys(
|
||||
std::unique_ptr<ISettingsReader> access_keys(
|
||||
Server->createFileSettingsReader("urbackup/access_keys.properties"));
|
||||
|
||||
std::string access_keys_data;
|
||||
@ -6076,7 +6076,7 @@ bool IndexThread::cbtIsEnabled(std::string clientsubname, std::string volume)
|
||||
settings_fn = "urbackup/data_"+ convert(index_facet_id) + "/settings_" + conv_filename(clientsubname) + ".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
std::string cbt_volumes;
|
||||
@ -6098,7 +6098,7 @@ bool IndexThread::crashPersistentCbtIsEnabled(std::string clientsubname, std::st
|
||||
settings_fn = "urbackup/data/settings_" + conv_filename(clientsubname) + ".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
std::string cbt_crash_persistent_volumes;
|
||||
@ -6149,7 +6149,7 @@ namespace
|
||||
|
||||
PURBCT_BITMAP_DATA readBitmap(std::string fn, std::vector<char>& data)
|
||||
{
|
||||
std::auto_ptr<IFile> f(Server->openFile(fn, MODE_READ));
|
||||
std::unique_ptr<IFile> f(Server->openFile(fn, MODE_READ));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
@ -6260,7 +6260,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> f(Server->openFile(fn+".new", MODE_WRITE));
|
||||
std::unique_ptr<IFile> f(Server->openFile(fn+".new", MODE_WRITE));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
@ -6469,7 +6469,7 @@ inline int64 roundDown(int64 numToRound, int64 multiple)
|
||||
|
||||
bool IndexThread::addFileToCbt(const std::string& fpath, const DWORD& blocksize, const PURBCT_BITMAP_DATA& bitmap_data)
|
||||
{
|
||||
std::auto_ptr<IFsFile> hive_file(Server->openFile(fpath, MODE_READ));
|
||||
std::unique_ptr<IFsFile> hive_file(Server->openFile(fpath, MODE_READ));
|
||||
|
||||
if (hive_file.get() != nullptr)
|
||||
{
|
||||
@ -7088,7 +7088,7 @@ bool IndexThread::finishCbt(std::string volume, int shadow_id, std::string snap_
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFsFile> hdat_img(ImageThread::openHdatF(volume, false));
|
||||
std::unique_ptr<IFsFile> hdat_img(ImageThread::openHdatF(volume, false));
|
||||
|
||||
bool concurrent_active = false;
|
||||
|
||||
@ -7188,7 +7188,7 @@ bool IndexThread::finishCbt(std::string volume, int shadow_id, std::string snap_
|
||||
++index_hdat_sequence_ids[strlower(volume)];
|
||||
}
|
||||
|
||||
std::auto_ptr<IFsFile> hdat_file(Server->openFile("urbackup\\hdat_file_" + conv_filename(strlower(volume)) + ".dat", MODE_RW_CREATE_DELETE));
|
||||
std::unique_ptr<IFsFile> hdat_file(Server->openFile("urbackup\\hdat_file_" + conv_filename(strlower(volume)) + ".dat", MODE_RW_CREATE_DELETE));
|
||||
|
||||
if (hdat_file.get() == NULL)
|
||||
{
|
||||
@ -7303,8 +7303,8 @@ bool IndexThread::finishCbt(std::string volume, int shadow_id, std::string snap_
|
||||
Server->deleteFile("urbackup/hdat_img_" + conv_filename(fs_dev) + ".dat");
|
||||
}
|
||||
|
||||
std::auto_ptr<IFsFile> hdat_file(Server->openFile("urbackup/hdat_file_" + conv_filename(fs_dev) + ".dat", MODE_RW_CREATE_DELETE));
|
||||
std::auto_ptr<IFsFile> hdat_img(ImageThread::openHdatF(fs_dev, false));
|
||||
std::unique_ptr<IFsFile> hdat_file(Server->openFile("urbackup/hdat_file_" + conv_filename(fs_dev) + ".dat", MODE_RW_CREATE_DELETE));
|
||||
std::unique_ptr<IFsFile> hdat_img(ImageThread::openHdatF(fs_dev, false));
|
||||
|
||||
if (hdat_img.get() == NULL && hdat_file.get() == NULL)
|
||||
{
|
||||
@ -7320,7 +7320,7 @@ bool IndexThread::finishCbt(std::string volume, int shadow_id, std::string snap_
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> volfile(Server->openFile(orig_dev, MODE_READ_DEVICE));
|
||||
std::unique_ptr<IFile> volfile(Server->openFile(orig_dev, MODE_READ_DEVICE));
|
||||
|
||||
if (volfile.get() == NULL)
|
||||
{
|
||||
@ -7502,7 +7502,7 @@ bool IndexThread::finishCbtDatto(IFile* volfile, IFsFile* hdat_file, IFsFile* hd
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> cowfile(Server->openFile(cbt_file, MODE_READ));
|
||||
std::unique_ptr<IFile> cowfile(Server->openFile(cbt_file, MODE_READ));
|
||||
|
||||
if (cowfile.get() == NULL)
|
||||
{
|
||||
@ -7972,7 +7972,7 @@ bool IndexThread::finishCbtEra2(IFsFile* hdat, int64 hdat_era)
|
||||
{
|
||||
if (hdat != NULL)
|
||||
{
|
||||
std::auto_ptr<IFile> hdat_file_era_new(Server->openFile(hdat->getFilename() + ".era.new", MODE_WRITE));
|
||||
std::unique_ptr<IFile> hdat_file_era_new(Server->openFile(hdat->getFilename() + ".era.new", MODE_WRITE));
|
||||
|
||||
if (hdat_file_era_new.get() == NULL)
|
||||
{
|
||||
@ -8107,7 +8107,7 @@ void IndexThread::updateCbt()
|
||||
std::set<std::string> vols;
|
||||
|
||||
std::string settings_fn = "urbackup/data/settings.cfg";
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::string volumes;
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
@ -8191,7 +8191,7 @@ void IndexThread::createMd5sumsFile(const std::string & path, std::string vol)
|
||||
normalizeVolume(vol);
|
||||
|
||||
std::string fn = "md5sums-"+conv_filename(vol)+"-"+db->Read("SELECT strftime('%Y-%m-%d %H-%M', 'now', 'localtime') AS fn")[0]["fn"]+".txt";
|
||||
std::auto_ptr<IFile> output_f(Server->openFile(fn, MODE_WRITE));
|
||||
std::unique_ptr<IFile> output_f(Server->openFile(fn, MODE_WRITE));
|
||||
|
||||
if (output_f.get() == NULL)
|
||||
{
|
||||
@ -8216,7 +8216,7 @@ void IndexThread::createMd5sumsFile(const std::string & path, const std::string&
|
||||
}
|
||||
else if (!files[i].isspecialf)
|
||||
{
|
||||
std::auto_ptr<IFile> f(Server->openFile(os_file_prefix(path + os_file_sep() + files[i].name), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFile> f(Server->openFile(os_file_prefix(path + os_file_sep() + files[i].name), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
@ -8773,7 +8773,7 @@ bool IndexThread::start_shadowcopy_lin( SCDirs * dir, std::string &wpath, bool f
|
||||
for (size_t i = 0; i < flock_files.size(); ++i)
|
||||
{
|
||||
std::string flock_fp = flock_files[i].fn;
|
||||
std::auto_ptr<IFsFile> flock_f(Server->openFile(flock_fp, MODE_RW));
|
||||
std::unique_ptr<IFsFile> flock_f(Server->openFile(flock_fp, MODE_RW));
|
||||
if (flock_f.get() == NULL)
|
||||
{
|
||||
VSSLog("Error opening file to lock: " + flock_fp + ". " + os_last_error_str(), LL_WARNING);
|
||||
@ -8894,7 +8894,7 @@ std::string IndexThread::get_snapshot_script_location(const std::string & name,
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
std::auto_ptr<ISettingsReader> settings(Server->createFileSettingsReader(conffile));
|
||||
std::unique_ptr<ISettingsReader> settings(Server->createFileSettingsReader(conffile));
|
||||
|
||||
std::string ret;
|
||||
if (!index_clientsubname.empty()
|
||||
@ -9092,7 +9092,7 @@ void IndexThread::readSnapshotGroups()
|
||||
image_snapshot_groups.clear();
|
||||
file_snapshot_groups.clear();
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
readSnapshotGroup(curr_settings.get(), "image_snapshot_groups", image_snapshot_groups);
|
||||
@ -9367,7 +9367,7 @@ void IndexThread::initParallelHashing(const std::string & async_ticket)
|
||||
settings_fn = "urbackup/data/settings_" + conv_filename(index_clientsubname) + ".cfg";
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
size_t client_hash_threads = 1;
|
||||
if (curr_settings.get() != NULL)
|
||||
{
|
||||
|
||||
@ -297,7 +297,7 @@ public:
|
||||
|
||||
struct SQueueRef
|
||||
{
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
IFile* phash_queue;
|
||||
size_t refcount;
|
||||
IDeregisterFileSrvScriptFn* dereg_fn;
|
||||
@ -650,7 +650,7 @@ private:
|
||||
|
||||
SVolumesCache* volumes_cache;
|
||||
|
||||
std::auto_ptr<ScopedBackgroundPrio> background_prio;
|
||||
std::unique_ptr<ScopedBackgroundPrio> background_prio;
|
||||
|
||||
std::string starttoken;
|
||||
|
||||
@ -711,7 +711,7 @@ private:
|
||||
int64 target_generation;
|
||||
};
|
||||
|
||||
std::auto_ptr<ClientHash> client_hash;
|
||||
std::unique_ptr<ClientHash> client_hash;
|
||||
|
||||
std::vector< SBufferItem > modify_file_buffer;
|
||||
size_t modify_file_buffer_size;
|
||||
@ -861,12 +861,12 @@ private:
|
||||
const std::vector<std::string>& exclude_dirs,
|
||||
const std::vector<SIndexInclude>& include_dirs, const std::string& orig_path);
|
||||
|
||||
std::auto_ptr<SLastFileList> last_filelist;
|
||||
std::unique_ptr<SLastFileList> last_filelist;
|
||||
|
||||
std::vector<SReadError> read_errors;
|
||||
IMutex* read_error_mutex;
|
||||
|
||||
std::auto_ptr<IFsFile> index_hdat_file;
|
||||
std::unique_ptr<IFsFile> index_hdat_file;
|
||||
std::map<std::string, size_t> index_hdat_sequence_ids;
|
||||
int64 index_hdat_fs_block_size;
|
||||
int64 index_chunkhash_pos;
|
||||
|
||||
@ -574,7 +574,7 @@ EDownloadResult downloadImage(int img_id, std::string img_time, std::string outf
|
||||
CTCPStack tcpstack;
|
||||
std::vector<SImage> ret;
|
||||
|
||||
std::auto_ptr<IPipe> client_pipe(Server->ConnectStream("localhost", 35623, 60000));
|
||||
std::unique_ptr<IPipe> client_pipe(Server->ConnectStream("localhost", 35623, 60000));
|
||||
if(client_pipe.get()==NULL)
|
||||
{
|
||||
Server->Log("Error connecting to client service -1", LL_ERROR);
|
||||
@ -602,7 +602,7 @@ EDownloadResult downloadImage(int img_id, std::string img_time, std::string outf
|
||||
|
||||
std::string restore_out=outfile;
|
||||
Server->Log("Restoring to "+restore_out);
|
||||
std::auto_ptr<IFile> out_file(Server->openFile(restore_out, MODE_RW_READNONE));
|
||||
std::unique_ptr<IFile> out_file(Server->openFile(restore_out, MODE_RW_READNONE));
|
||||
if(out_file.get()==NULL)
|
||||
{
|
||||
Server->Log("Could not open \""+restore_out+"\" for writing", LL_ERROR);
|
||||
@ -816,7 +816,7 @@ int downloadFiles(int backupid, std::string backup_time)
|
||||
CTCPStack tcpstack;
|
||||
std::vector<SImage> ret;
|
||||
|
||||
std::auto_ptr<IPipe> client_pipe(Server->ConnectStream("localhost", 35623, 60000));
|
||||
std::unique_ptr<IPipe> client_pipe(Server->ConnectStream("localhost", 35623, 60000));
|
||||
if(client_pipe.get()==NULL)
|
||||
{
|
||||
Server->Log("Error connecting to client service -1", LL_ERROR);
|
||||
@ -1245,7 +1245,7 @@ void do_restore(void)
|
||||
else if (cmd == "read_mbr")
|
||||
{
|
||||
std::string dev_fn = Server->getServerParameter("device_fn");
|
||||
std::auto_ptr<IFile> dev(Server->openFile(dev_fn, MODE_READ_DEVICE));
|
||||
std::unique_ptr<IFile> dev(Server->openFile(dev_fn, MODE_READ_DEVICE));
|
||||
|
||||
if (dev.get() == NULL)
|
||||
{
|
||||
|
||||
@ -1100,7 +1100,7 @@ bool IndexThread::deleteSavedShadowCopyWin(SShadowCopy& scs, SShadowCopyContext&
|
||||
bool IndexThread::getVssSettings()
|
||||
{
|
||||
std::string settings_fn = "urbackup/data/settings.cfg";
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader(settings_fn));
|
||||
vss_select_components.clear();
|
||||
vss_select_all_components = false;
|
||||
bool select_default_components = false;
|
||||
|
||||
@ -100,7 +100,7 @@ void read_config_file(std::string fn, std::vector<std::string>& real_args)
|
||||
}
|
||||
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> settings(Server->createFileSettingsReader(fn));
|
||||
std::unique_ptr<ISettingsReader> settings(Server->createFileSettingsReader(fn));
|
||||
std::string val;
|
||||
if(settings->getValue("LOGFILE", &val))
|
||||
{
|
||||
|
||||
@ -169,7 +169,7 @@ namespace
|
||||
|
||||
void do_print_dm_file_extents(const std::string& fn)
|
||||
{
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(fn, MODE_READ));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(fn, MODE_READ));
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
std::cerr << "Error opening file " << fn << " " << os_last_error_str() << std::endl;
|
||||
@ -449,7 +449,7 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
|
||||
if( !FileExists("urbackup/data/settings.cfg") && FileExists(INITIAL_SETTINGS_PREFIX "initial_settings.cfg") )
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> settings_reader(Server->createFileSettingsReader(INITIAL_SETTINGS_PREFIX "initial_settings.cfg"));
|
||||
std::unique_ptr<ISettingsReader> settings_reader(Server->createFileSettingsReader(INITIAL_SETTINGS_PREFIX "initial_settings.cfg"));
|
||||
std::string access_keys;
|
||||
std::string client_access_keys;
|
||||
if (settings_reader->getValue("access_keys", &access_keys) && !access_keys.empty())
|
||||
|
||||
@ -34,7 +34,7 @@ namespace tokens
|
||||
void operator=(const TokenCache& other);
|
||||
TokenCache(const TokenCache& other);
|
||||
|
||||
std::auto_ptr<TokenCacheInt> token_cache;
|
||||
std::unique_ptr<TokenCacheInt> token_cache;
|
||||
};
|
||||
|
||||
enum ETokenRight
|
||||
|
||||
@ -340,7 +340,7 @@ void ContinuousWatchEnqueue::readIncludeExcludePatterns()
|
||||
|
||||
update_patterns=false;
|
||||
|
||||
std::auto_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader("urbackup/data/settings.cfg"));
|
||||
std::unique_ptr<ISettingsReader> curr_settings(Server->createFileSettingsReader("urbackup/data/settings.cfg"));
|
||||
|
||||
if(curr_settings.get())
|
||||
{
|
||||
|
||||
@ -93,7 +93,7 @@ private:
|
||||
std::vector<int> include_depth;
|
||||
std::vector<std::string> include_prefix;
|
||||
|
||||
std::auto_ptr<JournalDAO> journal_dao;
|
||||
std::unique_ptr<JournalDAO> journal_dao;
|
||||
|
||||
CWData queue;
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ std::string get_all_volumes_list(bool filter_usb, SVolumesCache*& cache)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFile> dev(Server->openFile(dev_fn, MODE_READ_DEVICE));
|
||||
std::unique_ptr<IFile> dev(Server->openFile(dev_fn, MODE_READ_DEVICE));
|
||||
|
||||
if(!dev.get())
|
||||
{
|
||||
|
||||
@ -253,7 +253,7 @@ std::string findGptUuid(int device_num, GUID uuid)
|
||||
DWORD numPartitions=10;
|
||||
DWORD inf_size=sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1);
|
||||
|
||||
std::auto_ptr<DRIVE_LAYOUT_INFORMATION_EX> inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]);
|
||||
std::unique_ptr<DRIVE_LAYOUT_INFORMATION_EX> inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]);
|
||||
|
||||
DWORD ret_bytes;
|
||||
BOOL b=DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0, inf.get(), inf_size, &ret_bytes, NULL);
|
||||
|
||||
@ -56,7 +56,7 @@ TokenCache::TokenCache( const TokenCache& other )
|
||||
assert(false);
|
||||
}
|
||||
|
||||
TokenCache::TokenCache() : token_cache(NULL)
|
||||
TokenCache::TokenCache()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -81,6 +81,6 @@ private:
|
||||
z_stream inf_stream;
|
||||
z_stream def_stream;
|
||||
|
||||
std::auto_ptr<IMutex> read_mutex;
|
||||
std::auto_ptr<IMutex> write_mutex;
|
||||
std::unique_ptr<IMutex> read_mutex;
|
||||
std::unique_ptr<IMutex> write_mutex;
|
||||
};
|
||||
@ -77,8 +77,8 @@ private:
|
||||
ZSTD_CCtx* def_stream;
|
||||
ZSTD_inBuffer inf_in_last;
|
||||
|
||||
std::auto_ptr<IMutex> read_mutex;
|
||||
std::auto_ptr<IMutex> write_mutex;
|
||||
std::unique_ptr<IMutex> read_mutex;
|
||||
std::unique_ptr<IMutex> write_mutex;
|
||||
};
|
||||
|
||||
#endif //NO_ZSTD_COMPRESSION
|
||||
@ -23,7 +23,7 @@ public:
|
||||
virtual void reset();
|
||||
|
||||
private:
|
||||
std::auto_ptr<IFile> sparse_extents_f;
|
||||
std::unique_ptr<IFile> sparse_extents_f;
|
||||
int64 num_sparse_extents;
|
||||
int64 next_sparse_extent_num;
|
||||
bool take_file_ownership;
|
||||
|
||||
@ -75,8 +75,8 @@ public:
|
||||
int64 getEncryptionOverheadBytes();
|
||||
|
||||
private:
|
||||
std::auto_ptr<IAESGCMDecryption> dec;
|
||||
std::auto_ptr<IAESGCMEncryption> enc;
|
||||
std::unique_ptr<IAESGCMDecryption> dec;
|
||||
std::unique_ptr<IAESGCMEncryption> enc;
|
||||
|
||||
IPipe *cs;
|
||||
bool destroy_cs;
|
||||
@ -85,6 +85,6 @@ private:
|
||||
size_t curr_write_chunk_size;
|
||||
int64 last_flush_time;
|
||||
|
||||
std::auto_ptr<IMutex> read_mutex;
|
||||
std::auto_ptr<IMutex> write_mutex;
|
||||
std::unique_ptr<IMutex> read_mutex;
|
||||
std::unique_ptr<IMutex> write_mutex;
|
||||
};
|
||||
@ -107,6 +107,6 @@ private:
|
||||
char masking_key[4];
|
||||
bool destroy_pipe;
|
||||
|
||||
std::auto_ptr<IMutex> read_mutex;
|
||||
std::auto_ptr<IMutex> write_mutex;
|
||||
std::unique_ptr<IMutex> read_mutex;
|
||||
std::unique_ptr<IMutex> write_mutex;
|
||||
};
|
||||
@ -126,7 +126,7 @@ bool build_chunk_hashs(IFile *f, IFile *hashoutput, INotEnoughSpaceCallback *cb,
|
||||
bool copy_read_eof=false;
|
||||
_i64 hashoutputpos=sizeof(_i64);
|
||||
|
||||
std::auto_ptr<SChunkHashes> chunk_hashes;
|
||||
std::unique_ptr<SChunkHashes> chunk_hashes;
|
||||
if(hashinput!=NULL)
|
||||
{
|
||||
chunk_hashes.reset(new SChunkHashes);
|
||||
|
||||
@ -249,7 +249,7 @@ bool write_file_metadata(IFile* out, INotEnoughSpaceCallback *cb, const FileMeta
|
||||
|
||||
bool write_file_metadata(const std::string& out_fn, INotEnoughSpaceCallback *cb, const FileMetadata& metadata, bool overwrite_existing)
|
||||
{
|
||||
std::auto_ptr<IFile> out(Server->openFile(os_file_prefix(out_fn), MODE_RW_CREATE));
|
||||
std::unique_ptr<IFile> out(Server->openFile(os_file_prefix(out_fn), MODE_RW_CREATE));
|
||||
|
||||
if(!out.get())
|
||||
{
|
||||
@ -284,7 +284,7 @@ bool is_metadata_only(IFile* hash_file)
|
||||
|
||||
bool read_metadata(const std::string& in_fn, FileMetadata& metadata)
|
||||
{
|
||||
std::auto_ptr<IFile> in(Server->openFile(os_file_prefix(in_fn)));
|
||||
std::unique_ptr<IFile> in(Server->openFile(os_file_prefix(in_fn)));
|
||||
|
||||
if(!in.get())
|
||||
{
|
||||
@ -423,8 +423,8 @@ int64 os_metadata_offset( IFile* meta_file )
|
||||
|
||||
bool copy_os_metadata( const std::string& in_fn, const std::string& out_fn, INotEnoughSpaceCallback *cb)
|
||||
{
|
||||
std::auto_ptr<IFile> in_f(Server->openFile(os_file_prefix(in_fn), MODE_READ));
|
||||
std::auto_ptr<IFile> out_f(Server->openFile(os_file_prefix(out_fn), MODE_RW));
|
||||
std::unique_ptr<IFile> in_f(Server->openFile(os_file_prefix(in_fn), MODE_READ));
|
||||
std::unique_ptr<IFile> out_f(Server->openFile(os_file_prefix(out_fn), MODE_RW));
|
||||
|
||||
if(in_f.get()==NULL)
|
||||
{
|
||||
|
||||
@ -1077,7 +1077,7 @@ bool FileClient::Reconnect(void)
|
||||
_u32 hash_r;
|
||||
MD5 hash_func;
|
||||
IFile* file = backing_file;
|
||||
std::auto_ptr<SparseFile> sparse_file;
|
||||
std::unique_ptr<SparseFile> sparse_file;
|
||||
|
||||
char* buf = dl_buf;
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ _u32 FileClientChunked::GetFile(std::string remotefn, _i64& filesize_out, int64
|
||||
|
||||
if(!queued_fcs.empty())
|
||||
{
|
||||
std::auto_ptr<FileClientChunked> next(queued_fcs.front());
|
||||
std::unique_ptr<FileClientChunked> next(queued_fcs.front());
|
||||
|
||||
queued_fcs.pop_front();
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ private:
|
||||
|
||||
bool curr_is_script;
|
||||
|
||||
std::auto_ptr<ExtentIterator> extent_iterator;
|
||||
std::unique_ptr<ExtentIterator> extent_iterator;
|
||||
IFsFile::SSparseExtent curr_sparse_extent;
|
||||
|
||||
int reconnect_tries;
|
||||
|
||||
@ -191,7 +191,7 @@ namespace
|
||||
{
|
||||
bool is_disk_mbr(const std::string& mbrfn)
|
||||
{
|
||||
std::auto_ptr<IFile> mbrf(Server->openFile(os_file_prefix(mbrfn), MODE_READ));
|
||||
std::unique_ptr<IFile> mbrf(Server->openFile(os_file_prefix(mbrfn), MODE_READ));
|
||||
if (mbrf.get() != NULL)
|
||||
{
|
||||
std::string mbr_header = mbrf->Read(2);
|
||||
|
||||
@ -114,7 +114,7 @@ protected:
|
||||
LogAction log_action;
|
||||
|
||||
IDatabase* db;
|
||||
std::auto_ptr<ServerSettings> server_settings;
|
||||
std::unique_ptr<ServerSettings> server_settings;
|
||||
ServerBackupDao* backup_dao;
|
||||
|
||||
bool log_backup;
|
||||
|
||||
@ -108,7 +108,7 @@ ICondition* ClientMain::client_uid_reset_cond = NULL;
|
||||
ClientMain::ClientMain(IPipe *pPipe, FileClient::SAddrHint pAddr, const std::string &pName,
|
||||
const std::string& pSubName, const std::string& pMainName, int filebackup_group_offset, bool internet_connection,
|
||||
bool use_file_snapshots, bool use_image_snapshots, bool use_reflink)
|
||||
: internet_connection(internet_connection), server_settings(NULL), client_throttler(NULL),
|
||||
: internet_connection(internet_connection), client_throttler(NULL),
|
||||
use_file_snapshots(use_file_snapshots), use_image_snapshots(use_image_snapshots), use_reflink(use_reflink),
|
||||
backup_dao(NULL), client_updated_time(0), continuous_backup(NULL),
|
||||
clientsubname(pSubName), filebackup_group_offset(filebackup_group_offset), needs_authentification(false),
|
||||
@ -292,7 +292,7 @@ void ClientMain::operator ()(void)
|
||||
|
||||
std::string identity = getIdentity();
|
||||
|
||||
std::auto_ptr<ServerBackupDao> local_server_backup_dao(new ServerBackupDao(db));
|
||||
std::unique_ptr<ServerBackupDao> local_server_backup_dao(new ServerBackupDao(db));
|
||||
backup_dao = local_server_backup_dao.get();
|
||||
|
||||
clientid=getClientID(db, clientname, server_settings.get(), NULL, nullptr, nullptr, &perm_uid);
|
||||
@ -1404,7 +1404,7 @@ std::string ClientMain::sendClientMessage(const std::string &msg, const std::str
|
||||
{
|
||||
CTCPStack tcpstack(internet_connection);
|
||||
|
||||
std::auto_ptr<IPipe> cc;
|
||||
std::unique_ptr<IPipe> cc;
|
||||
if (conn != NULL
|
||||
&& conn->conn.get() != NULL
|
||||
&& conn->internet_connection == internet_connection)
|
||||
@ -1508,7 +1508,7 @@ bool ClientMain::sendClientMessage(const std::string &msg, const std::string &re
|
||||
{
|
||||
CTCPStack tcpstack(internet_connection);
|
||||
|
||||
std::auto_ptr<IPipe> cc;
|
||||
std::unique_ptr<IPipe> cc;
|
||||
if (conn != NULL
|
||||
&& conn->conn.get() != NULL
|
||||
&& conn->internet_connection == internet_connection)
|
||||
@ -1928,7 +1928,7 @@ void ClientMain::sendSettings(void)
|
||||
std::vector<std::string> settings_names=getSettingsList();
|
||||
std::vector<std::string> global_settings_names=getGlobalizedSettingsList();
|
||||
|
||||
std::auto_ptr<ISettingsReader> settings_client, settings_default, settings_global;
|
||||
std::unique_ptr<ISettingsReader> settings_client, settings_default, settings_global;
|
||||
int settings_default_id;
|
||||
server_settings->createSettingsReaders(db, clientid, settings_default, settings_client, settings_global, settings_default_id);
|
||||
|
||||
@ -2067,7 +2067,7 @@ bool ClientMain::getClientSettings(bool& doesnt_exist)
|
||||
ScopedDeleteFn delete_fn(tmp_fn);
|
||||
Server->destroy(tmp);
|
||||
|
||||
std::auto_ptr<ISettingsReader> sr(Server->createFileSettingsReader(tmp_fn));
|
||||
std::unique_ptr<ISettingsReader> sr(Server->createFileSettingsReader(tmp_fn));
|
||||
|
||||
std::vector<std::string> setting_names=getSettingsList();
|
||||
|
||||
@ -2322,13 +2322,13 @@ void ClientMain::checkClientVersion(void)
|
||||
}
|
||||
|
||||
|
||||
std::auto_ptr<IFile> sigfile(Server->openFile(signature_file, MODE_READ));
|
||||
std::unique_ptr<IFile> sigfile(Server->openFile(signature_file, MODE_READ));
|
||||
if(sigfile.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error opening sigfile", LL_ERROR);
|
||||
return;
|
||||
}
|
||||
std::auto_ptr<IFile> updatefile(Server->openFile(installer_file, MODE_READ));
|
||||
std::unique_ptr<IFile> updatefile(Server->openFile(installer_file, MODE_READ));
|
||||
if(updatefile.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error opening updatefile", LL_ERROR);
|
||||
@ -2337,7 +2337,7 @@ void ClientMain::checkClientVersion(void)
|
||||
size_t datasize=3*sizeof(_u32)+version.size()+(size_t)sigfile->Size()+(size_t)updatefile->Size();
|
||||
|
||||
CTCPStack tcpstack(internet_connection);
|
||||
std::auto_ptr<IPipe> cc(getClientCommandConnection(server_settings.get(), 10000));
|
||||
std::unique_ptr<IPipe> cc(getClientCommandConnection(server_settings.get(), 10000));
|
||||
if(cc.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Connecting to ClientService of \""+clientname+"\" failed - CONNECT error", LL_ERROR);
|
||||
@ -2912,7 +2912,7 @@ _u32 ClientMain::getClientFilesrvConnection(FileClient *fc, ServerSettings* serv
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientMain::getClientChunkedFilesrvConnection(std::auto_ptr<FileClientChunked>& fc_chunked,
|
||||
bool ClientMain::getClientChunkedFilesrvConnection(std::unique_ptr<FileClientChunked>& fc_chunked,
|
||||
ServerSettings* server_settings, FileClientChunked::NoFreeSpaceCallback* no_free_space_callback, int timeoutms)
|
||||
{
|
||||
if (no_free_space_callback == NULL)
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
internet_connection(false)
|
||||
{}
|
||||
|
||||
std::auto_ptr<IPipe> conn;
|
||||
std::unique_ptr<IPipe> conn;
|
||||
bool internet_connection;
|
||||
};
|
||||
|
||||
@ -210,7 +210,7 @@ public:
|
||||
|
||||
_u32 getClientFilesrvConnection(FileClient *fc, ServerSettings* server_settings, int timeoutms=10000);
|
||||
|
||||
bool getClientChunkedFilesrvConnection(std::auto_ptr<FileClientChunked>& fc_chunked,
|
||||
bool getClientChunkedFilesrvConnection(std::unique_ptr<FileClientChunked>& fc_chunked,
|
||||
ServerSettings* server_settings, FileClientChunked::NoFreeSpaceCallback* no_free_space_callback, int timeoutms=10000);
|
||||
|
||||
bool isOnInternetConnection()
|
||||
@ -384,7 +384,7 @@ private:
|
||||
int clientid;
|
||||
std::string perm_uid;
|
||||
|
||||
std::auto_ptr<ServerSettings> server_settings;
|
||||
std::unique_ptr<ServerSettings> server_settings;
|
||||
|
||||
IQuery *q_update_lastseen;
|
||||
IQuery *q_update_setting;
|
||||
@ -467,7 +467,7 @@ private:
|
||||
std::string curr_server_token;
|
||||
bool needs_authentification;
|
||||
|
||||
std::auto_ptr<IMutex> restore_mutex;
|
||||
std::unique_ptr<IMutex> restore_mutex;
|
||||
std::vector<SRunningRestore> running_restores;
|
||||
|
||||
std::mutex local_backup_mutex;
|
||||
|
||||
@ -26,7 +26,7 @@ public:
|
||||
|
||||
private:
|
||||
static DataplanDb* instance;
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::vector<SDataplanItem> items;
|
||||
common::lrucache<std::string, SDataplanItem> cache;
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ bool FileBackup::request_filelist_construct(bool full, bool resume, int group,
|
||||
bool FileBackup::wait_for_async(const std::string& async_id, int64 timeout_time)
|
||||
{
|
||||
int64 starttime = Server->getTimeMS();
|
||||
std::auto_ptr<IPipe> cc;
|
||||
std::unique_ptr<IPipe> cc;
|
||||
CTCPStack tcpstack(client_main->isOnInternetConnection());
|
||||
|
||||
while (Server->getTimeMS() - starttime <= timeout_time)
|
||||
@ -553,7 +553,7 @@ bool FileBackup::getTokenFile(FileClient &fc, bool hashed_transfer, bool request
|
||||
Server->destroy(tokens_file);
|
||||
|
||||
|
||||
std::auto_ptr<ISettingsReader> urbackup_tokens(
|
||||
std::unique_ptr<ISettingsReader> urbackup_tokens(
|
||||
Server->createFileSettingsReader(os_file_prefix(backuppath_hashes+os_file_sep()+".urbackup_tokens.properties")));
|
||||
|
||||
std::string access_key;
|
||||
@ -1481,7 +1481,7 @@ std::string FileBackup::getSHA512(const std::string& fn)
|
||||
|
||||
std::string FileBackup::getSHADef(const std::string& fn)
|
||||
{
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(os_file_prefix(fn), MODE_READ));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(os_file_prefix(fn), MODE_READ));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
@ -1553,7 +1553,7 @@ bool FileBackup::constructBackupPath(bool on_snapshot, bool create_fs, std::stri
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> touch_f(Server->openFile(backuppath, MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_f(Server->openFile(backuppath, MODE_WRITE));
|
||||
if (touch_f.get() == NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not touch file " + backuppath + ". " + os_last_error_str(), LL_ERROR);
|
||||
@ -1661,7 +1661,7 @@ bool FileBackup::constructBackupPathCdp()
|
||||
|
||||
void FileBackup::createUserViews(IFile* file_list_f)
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> urbackup_tokens(
|
||||
std::unique_ptr<ISettingsReader> urbackup_tokens(
|
||||
Server->createFileSettingsReader(os_file_prefix(backuppath_hashes+os_file_sep()+".urbackup_tokens.properties")));
|
||||
|
||||
if(urbackup_tokens.get()==NULL)
|
||||
@ -2073,7 +2073,7 @@ bool FileBackup::createUserView(IFile* file_list_f, const std::vector<int64>& id
|
||||
|
||||
void FileBackup::saveUsersOnClient()
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> urbackup_tokens(
|
||||
std::unique_ptr<ISettingsReader> urbackup_tokens(
|
||||
Server->createFileSettingsReader(os_file_prefix(backuppath_hashes+os_file_sep()+".urbackup_tokens.properties")));
|
||||
|
||||
if(urbackup_tokens.get()==NULL)
|
||||
@ -2223,7 +2223,7 @@ bool FileBackup::startFileMetadataDownloadThread()
|
||||
if(client_main->getProtocolVersions().file_meta>0)
|
||||
{
|
||||
std::string identity = client_main->getIdentity();
|
||||
std::auto_ptr<FileClient> fc_metadata_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
std::unique_ptr<FileClient> fc_metadata_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
client_main->isOnInternetConnection(), client_main, use_tmpfiles?NULL:this));
|
||||
|
||||
_u32 rc=client_main->getClientFilesrvConnection(fc_metadata_stream.get(), server_settings.get(), 60000);
|
||||
@ -2290,7 +2290,7 @@ bool FileBackup::stopFileMetadataDownloadThread(bool stopped, size_t expected_em
|
||||
do
|
||||
{
|
||||
std::string identity = client_main->getIdentity();
|
||||
std::auto_ptr<FileClient> fc_metadata_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
std::unique_ptr<FileClient> fc_metadata_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
client_main->isOnInternetConnection(), client_main, use_tmpfiles ? NULL : this));
|
||||
|
||||
_u32 rc = client_main->getClientFilesrvConnection(fc_metadata_stream_end.get(), server_settings.get(), 10000);
|
||||
@ -2406,7 +2406,7 @@ bool FileBackup::loadWindowsBackupComponentConfigXml(FileClient &fc)
|
||||
if (os_directory_exists(os_file_prefix(component_config_dir)))
|
||||
{
|
||||
ServerLogger::Log(logid, "Loading Windows backup component config XML...", LL_DEBUG);
|
||||
std::auto_ptr<IFsFile> component_config_xml(Server->openFile(os_file_prefix(component_config_dir+os_file_sep()+"backupcom.xml"), MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> component_config_xml(Server->openFile(os_file_prefix(component_config_dir+os_file_sep()+"backupcom.xml"), MODE_WRITE));
|
||||
_u32 rc = fc.GetFile(server_token + "|windows_components_config/backupcom.xml", component_config_xml.get(), true, false, 0, false, 0);
|
||||
if (rc != ERR_SUCCESS)
|
||||
{
|
||||
@ -2426,7 +2426,7 @@ bool FileBackup::loadWindowsBackupComponentConfigXml(FileClient &fc)
|
||||
bool FileBackup::startPhashDownloadThread(const std::string& async_id)
|
||||
{
|
||||
std::string identity = client_main->getIdentity();
|
||||
std::auto_ptr<FileClient> fc_phash_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
std::unique_ptr<FileClient> fc_phash_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
client_main->isOnInternetConnection(), client_main, use_tmpfiles ? NULL : this));
|
||||
|
||||
_u32 rc = client_main->getClientFilesrvConnection(fc_phash_stream.get(), server_settings.get(), 60000);
|
||||
@ -2477,7 +2477,7 @@ bool FileBackup::stopPhashDownloadThread(const std::string& async_id)
|
||||
do
|
||||
{
|
||||
std::string identity = client_main->getIdentity();
|
||||
std::auto_ptr<FileClient> fc_phash_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
std::unique_ptr<FileClient> fc_phash_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version,
|
||||
client_main->isOnInternetConnection(), client_main, use_tmpfiles ? NULL : this));
|
||||
|
||||
_u32 rc = client_main->getClientFilesrvConnection(fc_phash_stream_end.get(), server_settings.get(), 10000);
|
||||
@ -2674,13 +2674,13 @@ void FileBackup::save_debug_data(const std::string& rfn, const std::string& loca
|
||||
|
||||
fc.setProgressLogCallback(this);
|
||||
|
||||
std::auto_ptr<IFile> tmpfile(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFile> tmpfile(Server->openTemporaryFile());
|
||||
std::string tmpdirname = tmpfile->getFilename();
|
||||
tmpfile.reset();
|
||||
Server->deleteFile(tmpdirname);
|
||||
os_create_dir(tmpdirname);
|
||||
|
||||
std::auto_ptr<IFsFile> output_file(Server->openFile(tmpdirname+os_file_sep()+"verify_failed.file", MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> output_file(Server->openFile(tmpdirname+os_file_sep()+"verify_failed.file", MODE_WRITE));
|
||||
rc = fc.GetFile((rfn), output_file.get(), true, false, 0, false, 0);
|
||||
|
||||
if(rc!=ERR_SUCCESS)
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::map<std::string, std::string> filepath_corrections;
|
||||
};
|
||||
|
||||
@ -163,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
size_t max_downloaded;
|
||||
size_t max_preprocessed;
|
||||
size_t min_downloaded;
|
||||
@ -274,8 +274,8 @@ protected:
|
||||
std::vector<THREADPOOL_TICKET> bsh_ticket;
|
||||
std::vector<BackupServerPrepareHash*> bsh_prepare;
|
||||
std::vector<THREADPOOL_TICKET> bsh_prepare_ticket;
|
||||
std::auto_ptr<BackupServerHash> local_hash;
|
||||
std::auto_ptr<BackupServerHash> local_hash2;
|
||||
std::unique_ptr<BackupServerHash> local_hash;
|
||||
std::unique_ptr<BackupServerHash> local_hash2;
|
||||
|
||||
std::string filelist_async_id;
|
||||
|
||||
@ -284,15 +284,15 @@ protected:
|
||||
|
||||
std::map<std::string, SContinuousSequence> continuous_sequences;
|
||||
|
||||
std::auto_ptr<FileIndex> fileindex;
|
||||
std::unique_ptr<FileIndex> fileindex;
|
||||
|
||||
bool disk_error;
|
||||
|
||||
int backupid;
|
||||
|
||||
std::auto_ptr<server::FileMetadataDownloadThread> metadata_download_thread;
|
||||
std::unique_ptr<server::FileMetadataDownloadThread> metadata_download_thread;
|
||||
THREADPOOL_TICKET metadata_download_thread_ticket;
|
||||
std::auto_ptr<server::FileMetadataDownloadThread::FileMetadataApplyThread> metadata_apply_thread;
|
||||
std::unique_ptr<server::FileMetadataDownloadThread::FileMetadataApplyThread> metadata_apply_thread;
|
||||
THREADPOOL_TICKET metadata_apply_thread_ticket;
|
||||
|
||||
FilePathCorrections filepath_corrections;
|
||||
@ -302,7 +302,7 @@ protected:
|
||||
int64 last_speed_received_bytes;
|
||||
int64 speed_set_time;
|
||||
|
||||
std::auto_ptr<PhashLoad> phash_load;
|
||||
std::unique_ptr<PhashLoad> phash_load;
|
||||
THREADPOOL_TICKET phash_load_ticket;
|
||||
|
||||
MaxFileId max_file_id;
|
||||
|
||||
@ -47,7 +47,7 @@ FileMetadataDownloadThread::FileMetadataDownloadThread(FileClient* fc, const std
|
||||
|
||||
FileMetadataDownloadThread::FileMetadataDownloadThread(const std::string& server_token, std::string metadata_tmp_fn,
|
||||
int backupid, int clientid, bool use_tmpfiles, std::string tmpfile_path)
|
||||
: fc(NULL), server_token(server_token), has_error(false), metadata_tmp_fn(metadata_tmp_fn),
|
||||
: server_token(server_token), has_error(false), metadata_tmp_fn(metadata_tmp_fn),
|
||||
dry_run(true), backupid(backupid), max_metadata_id(0), clientid(clientid), has_fatal_error(false), has_timeout_error(false),
|
||||
use_tmpfiles(use_tmpfiles), tmpfile_path(tmpfile_path), is_complete(false), is_finished(true), force_start(false)
|
||||
{
|
||||
@ -56,7 +56,7 @@ FileMetadataDownloadThread::FileMetadataDownloadThread(const std::string& server
|
||||
|
||||
void FileMetadataDownloadThread::operator()()
|
||||
{
|
||||
std::auto_ptr<IFsFile> tmp_f(ClientMain::getTemporaryFileRetry(use_tmpfiles, tmpfile_path, logid));
|
||||
std::unique_ptr<IFsFile> tmp_f(ClientMain::getTemporaryFileRetry(use_tmpfiles, tmpfile_path, logid));
|
||||
metadata_tmp_fn = tmp_f->getFilename();
|
||||
|
||||
std::string remote_fn = "SCRIPT|urbackup/FILE_METADATA|"+server_token+"|"+convert(backupid);
|
||||
@ -96,7 +96,7 @@ bool FileMetadataDownloadThread::applyMetadata( const std::string& backup_metada
|
||||
#ifdef _WIN32
|
||||
mode = MODE_READ_DEVICE;
|
||||
#endif
|
||||
std::auto_ptr<IFile> metadata_f(Server->openFile(metadata_tmp_fn, mode));
|
||||
std::unique_ptr<IFile> metadata_f(Server->openFile(metadata_tmp_fn, mode));
|
||||
|
||||
if(metadata_f.get()==NULL)
|
||||
{
|
||||
@ -356,7 +356,7 @@ bool FileMetadataDownloadThread::applyMetadata( const std::string& backup_metada
|
||||
cond->wait(&lock, 60000);
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> output_f;
|
||||
std::unique_ptr<IFile> output_f;
|
||||
bool new_metadata_file = false;
|
||||
|
||||
int ftype = 0;
|
||||
@ -716,7 +716,7 @@ bool FileMetadataDownloadThread::applyMetadata( const std::string& backup_metada
|
||||
{
|
||||
ServerLogger::Log(logid, "META: Copying file: \"" + os_path + "\"", LL_DEBUG);
|
||||
|
||||
std::auto_ptr<IFile> output_f(Server->openFile(os_file_prefix(os_path), MODE_WRITE));
|
||||
std::unique_ptr<IFile> output_f(Server->openFile(os_file_prefix(os_path), MODE_WRITE));
|
||||
|
||||
if (output_f.get() == NULL)
|
||||
{
|
||||
@ -821,7 +821,7 @@ bool FileMetadataDownloadThread::applyMetadata( const std::string& backup_metada
|
||||
{
|
||||
ServerLogger::Log(logid, "Error applying meta data. Unknown meta data.", LL_ERROR);
|
||||
|
||||
std::auto_ptr<IFile> tmp(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFile> tmp(Server->openTemporaryFile());
|
||||
|
||||
if(copy_file(metadata_f.get(), tmp.get()))
|
||||
{
|
||||
@ -1433,7 +1433,7 @@ void FileMetadataDownloadThread::setFinished()
|
||||
|
||||
void FileMetadataDownloadThread::copyForAnalysis(IFile* metadata_f)
|
||||
{
|
||||
std::auto_ptr<IFile> tmp(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFile> tmp(Server->openTemporaryFile());
|
||||
|
||||
if (copy_file(metadata_f, tmp.get()))
|
||||
{
|
||||
|
||||
@ -115,7 +115,7 @@ private:
|
||||
|
||||
std::vector<SFolderItem> saved_folder_items;
|
||||
|
||||
std::auto_ptr<FileClient> fc;
|
||||
std::unique_ptr<FileClient> fc;
|
||||
const std::string& server_token;
|
||||
|
||||
bool has_error;
|
||||
@ -141,8 +141,8 @@ private:
|
||||
bool is_complete;
|
||||
bool is_finished;
|
||||
bool force_start;
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::auto_ptr<ICondition> cond;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::unique_ptr<ICondition> cond;
|
||||
};
|
||||
|
||||
int check_metadata();
|
||||
|
||||
@ -224,7 +224,7 @@ bool FullFileBackup::doFileBackup()
|
||||
|
||||
std::string last_backuppath;
|
||||
std::string last_backuppath_complete;
|
||||
std::auto_ptr<ServerDownloadThreadGroup> server_download(new ServerDownloadThreadGroup(fc, NULL, backuppath,
|
||||
std::unique_ptr<ServerDownloadThreadGroup> server_download(new ServerDownloadThreadGroup(fc, NULL, backuppath,
|
||||
backuppath_hashes, last_backuppath, last_backuppath_complete,
|
||||
hashed_transfer, save_incomplete_files, clientid, clientname, clientsubname,
|
||||
use_tmpfiles, tmpfile_path, server_token, use_reflink,
|
||||
@ -511,7 +511,7 @@ bool FullFileBackup::doFileBackup()
|
||||
else if(extra_params.find("special")!=extra_params.end())
|
||||
{
|
||||
std::string touch_path = backuppath + convertToOSPathFromFileClient(curr_os_path)+os_file_sep()+osspecific_name;
|
||||
std::auto_ptr<IFile> touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE));
|
||||
if(touch_file.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error touching file at \""+touch_path+"\". " + systemErrorInfo(), LL_ERROR);
|
||||
@ -895,7 +895,7 @@ bool FullFileBackup::doFileBackup()
|
||||
c_has_error = true;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> sync_f;
|
||||
std::unique_ptr<IFile> sync_f;
|
||||
if (!c_has_error)
|
||||
{
|
||||
sync_f.reset(Server->openFile(os_file_prefix(backuppath_hashes + os_file_sep() + sync_fn), MODE_WRITE));
|
||||
|
||||
@ -387,7 +387,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFsFile> mbr_file(Server->openFile(os_file_prefix(imagefn + ".mbr"), MODE_WRITE));
|
||||
std::unique_ptr<IFsFile> mbr_file(Server->openFile(os_file_prefix(imagefn + ".mbr"), MODE_WRITE));
|
||||
|
||||
if (mbr_file.get() != NULL)
|
||||
{
|
||||
@ -591,7 +591,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFile> hashfile(Server->openFile(os_file_prefix(pParentvhd + ".hash")));
|
||||
std::unique_ptr<IFile> hashfile(Server->openFile(os_file_prefix(pParentvhd + ".hash")));
|
||||
if(hashfile.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error opening hashfile ("+ pParentvhd + ".hash). "+os_last_error_str(), LL_ERROR);
|
||||
@ -600,7 +600,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
Server->destroy(cc);
|
||||
return false;
|
||||
}
|
||||
std::auto_ptr<IFile> prevbitmap;
|
||||
std::unique_ptr<IFile> prevbitmap;
|
||||
std::string prevbitmap_str;
|
||||
if (transfer_prev_cbitmap)
|
||||
{
|
||||
@ -675,7 +675,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
IVHDFile *r_vhdfile=NULL;
|
||||
IFile *hashfile=NULL;
|
||||
IFile *parenthashfile=NULL;
|
||||
std::auto_ptr<IFile> bitmap_file;
|
||||
std::unique_ptr<IFile> bitmap_file;
|
||||
int64 blockcnt=0;
|
||||
int64 numblocks=0;
|
||||
int64 blocks=0;
|
||||
@ -870,7 +870,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
ts += "&clientsubname=" + EscapeParamString(clientsubname);
|
||||
}
|
||||
ts += "&zero_skipped=1";
|
||||
std::auto_ptr<IFile> prevbitmap;
|
||||
std::unique_ptr<IFile> prevbitmap;
|
||||
if (transfer_prev_cbitmap)
|
||||
{
|
||||
prevbitmap.reset(Server->openFile(os_file_prefix(pParentvhd + ".cbitmap")));
|
||||
@ -1569,7 +1569,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent
|
||||
int64 image_size = t_file->RealSize();
|
||||
Server->destroy(t_file);
|
||||
|
||||
std::auto_ptr<IFile> sync_f;
|
||||
std::unique_ptr<IFile> sync_f;
|
||||
if (!vhdfile_err)
|
||||
{
|
||||
if (!os_sync(imagefn))
|
||||
@ -2146,7 +2146,7 @@ std::string ImageBackup::constructImagePath(const std::string &letter, std::stri
|
||||
{
|
||||
if (BackupServer::getSnapshotMethod(true) == BackupServer::ESnapshotMethod_Zfs)
|
||||
{
|
||||
std::auto_ptr<IFile> touch_f(Server->openFile(image_folder, MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_f(Server->openFile(image_folder, MODE_WRITE));
|
||||
if (touch_f.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not touch file " + image_folder + ". " + os_last_error_str(), LL_ERROR);
|
||||
@ -2231,7 +2231,7 @@ std::string ImageBackup::constructImagePath(const std::string &letter, std::stri
|
||||
{
|
||||
if (BackupServer::getSnapshotMethod(true) == BackupServer::ESnapshotMethod_Zfs)
|
||||
{
|
||||
std::auto_ptr<IFile> touch_f(Server->openFile(image_folder, MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_f(Server->openFile(image_folder, MODE_WRITE));
|
||||
if (touch_f.get() == NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not touch file " + image_folder + ". " + os_last_error_str(), LL_ERROR);
|
||||
|
||||
@ -85,7 +85,7 @@ protected:
|
||||
|
||||
int64 snapshot_id;
|
||||
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
|
||||
std::string snapshot_group_loginfo;
|
||||
|
||||
|
||||
@ -742,7 +742,7 @@ void ImageMount::mount_image_thread(int backupid, int partition, std::string& er
|
||||
if (partition >= 0)
|
||||
{
|
||||
std::string ext = findextension(image_inf.path);
|
||||
std::auto_ptr<IVHDFile> vhdfile;
|
||||
std::unique_ptr<IVHDFile> vhdfile;
|
||||
if (ext == "raw")
|
||||
{
|
||||
vhdfile.reset(image_fak->createVHDFile(image_inf.path, true, 0, 2 * 1024 * 1024, false, IFSImageFactory::ImageFormat_RawCowFile));
|
||||
|
||||
@ -170,7 +170,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
Server->Log(clientname+": Connecting to client...", LL_DEBUG);
|
||||
std::string identity = client_main->getIdentity();
|
||||
FileClient fc(false, identity, client_main->getProtocolVersions().filesrv_protocol_version, client_main->isOnInternetConnection(), client_main, use_tmpfiles?NULL:this);
|
||||
std::auto_ptr<FileClientChunked> fc_chunked;
|
||||
std::unique_ptr<FileClientChunked> fc_chunked;
|
||||
if(intra_file_diffs)
|
||||
{
|
||||
if(client_main->getClientChunkedFilesrvConnection(fc_chunked, server_settings.get(), this, 60000))
|
||||
@ -313,7 +313,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> touch_f(Server->openFile(backuppath, MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_f(Server->openFile(backuppath, MODE_WRITE));
|
||||
if (touch_f.get() == NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not touch file " + backuppath + ". " + os_last_error_str(), LL_ERROR);
|
||||
@ -524,7 +524,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
bool backup_with_components;
|
||||
_i64 files_size = getIncrementalSize(tmp_filelist, diffs, backup_with_components);
|
||||
|
||||
std::auto_ptr<ServerDownloadThreadGroup> server_download(new ServerDownloadThreadGroup(fc, fc_chunked.get(), backuppath,
|
||||
std::unique_ptr<ServerDownloadThreadGroup> server_download(new ServerDownloadThreadGroup(fc, fc_chunked.get(), backuppath,
|
||||
backuppath_hashes, last_backuppath, last_backuppath_complete,
|
||||
hashed_transfer, intra_file_diffs, clientid, clientname, clientsubname,
|
||||
use_tmpfiles, tmpfile_path, server_token, use_reflink,
|
||||
@ -817,7 +817,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<DBScopedSynchronous> link_dao_synchronous;
|
||||
std::unique_ptr<DBScopedSynchronous> link_dao_synchronous;
|
||||
if (!remove_directory_link(backuppath + local_curr_os_path, *link_dao, clientid, link_dao_synchronous))
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not remove symlinked directory \"" + backuppath + local_curr_os_path + "\" after symlinking metadata directory failed.", LL_ERROR);
|
||||
@ -1166,7 +1166,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
else if(extra_params.find("special")!=extra_params.end() && (indirchange || file_changed || !use_snapshots) )
|
||||
{
|
||||
std::string touch_path = backuppath+local_curr_os_path;
|
||||
std::auto_ptr<IFile> touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE));
|
||||
if(touch_file.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error touching file at \""+touch_path+"\". " + systemErrorInfo(), LL_ERROR);
|
||||
@ -1659,7 +1659,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
c_has_error = true;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> sync_f;
|
||||
std::unique_ptr<IFile> sync_f;
|
||||
if (!c_has_error)
|
||||
{
|
||||
sync_f.reset(Server->openFile(os_file_prefix(backuppath_hashes + os_file_sep() + sync_fn), MODE_WRITE));
|
||||
@ -1766,7 +1766,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
c_has_error = true;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> sync_f;
|
||||
std::unique_ptr<IFile> sync_f;
|
||||
if (!c_has_error)
|
||||
{
|
||||
sync_f.reset(Server->openFile(os_file_prefix(backuppath_hashes + os_file_sep() + sync_fn), MODE_WRITE));
|
||||
@ -1812,7 +1812,7 @@ bool IncrFileBackup::doFileBackup()
|
||||
{
|
||||
if (phash_load.get() != NULL)
|
||||
{
|
||||
std::auto_ptr<IFile> tf(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFile> tf(Server->openTemporaryFile());
|
||||
if (tf.get() != NULL)
|
||||
{
|
||||
if(copy_file(tmp_filelist, tf.get()))
|
||||
@ -1906,7 +1906,7 @@ bool IncrFileBackup::deleteFilesInSnapshot(const std::string clientlist_fn, cons
|
||||
|
||||
FileListParser list_parser;
|
||||
|
||||
std::auto_ptr<IFile> tmp(Server->openFile(clientlist_fn, MODE_READ));
|
||||
std::unique_ptr<IFile> tmp(Server->openFile(clientlist_fn, MODE_READ));
|
||||
if(tmp.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not open clientlist in ::deleteFilesInSnapshot", LL_ERROR);
|
||||
@ -2008,7 +2008,7 @@ bool IncrFileBackup::deleteFilesInSnapshot(const std::string clientlist_fn, cons
|
||||
if(ftype & EFileType_File && !keep_inplace
|
||||
&& !Server->deleteFile(os_file_prefix(curr_fn)) )
|
||||
{
|
||||
std::auto_ptr<IFile> tf(Server->openFile(os_file_prefix(curr_fn), MODE_READ));
|
||||
std::unique_ptr<IFile> tf(Server->openFile(os_file_prefix(curr_fn), MODE_READ));
|
||||
if(tf.get()!=NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Could not remove file \""+curr_fn+"\" in ::deleteFilesInSnapshot - " + systemErrorInfo(), no_error ? LL_WARNING : LL_ERROR);
|
||||
@ -2128,7 +2128,7 @@ void IncrFileBackup::addSparseFileEntry( std::string curr_path, SFile &cf, int c
|
||||
if( (*md5ptr>=0 ? *md5ptr : -1* *md5ptr ) % copy_file_entries_sparse_modulo == incremental_num % copy_file_entries_sparse_modulo )
|
||||
{
|
||||
FileMetadata metadata;
|
||||
std::auto_ptr<IFile> last_file(Server->openFile(os_file_prefix(backuppath+local_curr_os_path), MODE_READ));
|
||||
std::unique_ptr<IFile> last_file(Server->openFile(os_file_prefix(backuppath+local_curr_os_path), MODE_READ));
|
||||
if(!read_metadata(backuppath_hashes+local_curr_os_path, metadata) || last_file.get()==NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error adding sparse file entry. Could not read metadata from "+backuppath_hashes+local_curr_os_path, LL_WARNING);
|
||||
|
||||
@ -501,7 +501,7 @@ bool LMDBFileIndex::create_env()
|
||||
}
|
||||
|
||||
{
|
||||
std::auto_ptr<IFile> lmdb_f(Server->openFile("urbackup/fileindex/backup_server_files_index.lmdb", MODE_READ));
|
||||
std::unique_ptr<IFile> lmdb_f(Server->openFile("urbackup/fileindex/backup_server_files_index.lmdb", MODE_READ));
|
||||
if(lmdb_f.get()!=NULL)
|
||||
{
|
||||
while(lmdb_f->Size()>static_cast<_i64>(map_size))
|
||||
|
||||
@ -62,7 +62,7 @@ private:
|
||||
static MDB_dbi dbi;
|
||||
size_t map_size;
|
||||
|
||||
std::auto_ptr<IScopedReadLock> read_transaction_lock;
|
||||
std::unique_ptr<IScopedReadLock> read_transaction_lock;
|
||||
|
||||
void put_internal(const SIndexKey& key, int64 value, int flags, bool log, bool handle_enosp);
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ bool LocalBackup::queryBackupFinished(int64 timeout_time, bool& finished)
|
||||
|
||||
finished = false;
|
||||
int64 starttime = Server->getTimeMS();
|
||||
std::auto_ptr<IPipe> cc;
|
||||
std::unique_ptr<IPipe> cc;
|
||||
CTCPStack tcpstack(client_main->isOnInternetConnection());
|
||||
|
||||
while (Server->getTimeMS() - starttime <= timeout_time)
|
||||
@ -446,7 +446,7 @@ bool LocalBackup::finishLocalBackup(std::vector<std::string>& del_files)
|
||||
|
||||
const int64 timeout_time = 60000;
|
||||
int64 starttime = Server->getTimeMS();
|
||||
std::auto_ptr<IPipe> cc;
|
||||
std::unique_ptr<IPipe> cc;
|
||||
CTCPStack tcpstack(client_main->isOnInternetConnection());
|
||||
|
||||
while (Server->getTimeMS() - starttime <= timeout_time)
|
||||
|
||||
@ -33,7 +33,7 @@ void PhashLoad::operator()()
|
||||
fc->setNoFreeSpaceCallback(NULL);
|
||||
|
||||
std::string cfn = "SCRIPT|phash_{9c28ff72-5a74-487b-b5e1-8f1c96cd0cf4}/phash_" + async_id + "|0|0|" + server_token;
|
||||
std::auto_ptr<IFsFile> phash_file_dl(Server->openTemporaryFile());
|
||||
std::unique_ptr<IFsFile> phash_file_dl(Server->openTemporaryFile());
|
||||
|
||||
if (phash_file_dl.get() == NULL)
|
||||
{
|
||||
|
||||
@ -1334,7 +1334,7 @@ SPatchDownloadFiles ServerDownloadThread::preparePatchDownloadFiles( const SQueu
|
||||
std::string hashpath_old=last_backuppath+os_file_sep()+".hashes"+os_file_sep()+FileBackup::convertToOSPathFromFileClient(cfn_short);
|
||||
std::string filepath_old=last_backuppath+os_file_sep()+FileBackup::convertToOSPathFromFileClient(cfn_short);
|
||||
|
||||
std::auto_ptr<IFsFile> file_old(Server->openFile(os_file_prefix(filepath_old), MODE_READ));
|
||||
std::unique_ptr<IFsFile> file_old(Server->openFile(os_file_prefix(filepath_old), MODE_READ));
|
||||
|
||||
if(file_old.get()==NULL)
|
||||
{
|
||||
@ -1373,7 +1373,7 @@ SPatchDownloadFiles ServerDownloadThread::preparePatchDownloadFiles( const SQueu
|
||||
cfn=server_token+"|"+cfn;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> hashfile_old(Server->openFile(os_file_prefix(hashpath_old), MODE_READ));
|
||||
std::unique_ptr<IFile> hashfile_old(Server->openFile(os_file_prefix(hashpath_old), MODE_READ));
|
||||
|
||||
dlfiles.delete_chunkhashes=false;
|
||||
if( (hashfile_old.get()==NULL ||
|
||||
@ -1821,7 +1821,7 @@ bool ServerDownloadThread::logScriptOutput(std::string cfn, const SQueueItem &to
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<IFile> touch_file(Server->openFile(os_file_prefix(backuppath + os_path), MODE_WRITE));
|
||||
std::unique_ptr<IFile> touch_file(Server->openFile(os_file_prefix(backuppath + os_path), MODE_WRITE));
|
||||
if (touch_file.get() == NULL)
|
||||
{
|
||||
ServerLogger::Log(logid, "Error touching TAR special file at \"" + backuppath + os_path + "\"", LL_ERROR);
|
||||
|
||||
@ -142,7 +142,7 @@ class ServerDownloadThread : public IThread, public FileClient::QueueCallback, p
|
||||
public:
|
||||
class ActiveDlIds
|
||||
{
|
||||
std::auto_ptr<IMutex> mutex;
|
||||
std::unique_ptr<IMutex> mutex;
|
||||
std::set<size_t> ids;
|
||||
public:
|
||||
ActiveDlIds()
|
||||
|
||||
@ -41,7 +41,7 @@ ServerDownloadThreadGroup::ServerDownloadThreadGroup(FileClient& fc, FileClientC
|
||||
if (incremental_num > 0 &&
|
||||
intra_file_diffs)
|
||||
{
|
||||
std::auto_ptr<FileClientChunked> new_fc;
|
||||
std::unique_ptr<FileClientChunked> new_fc;
|
||||
if (client_main->getClientChunkedFilesrvConnection(new_fc, server_settings, client_main, 60000))
|
||||
{
|
||||
new_fc->setProgressLogCallback(client_main);
|
||||
|
||||
@ -60,7 +60,7 @@ int check_files_index()
|
||||
|
||||
IDatabaseCursor* cursor = q_iterate->Cursor();
|
||||
|
||||
std::auto_ptr<FileIndex> fileindex(create_lmdb_files_index());
|
||||
std::unique_ptr<FileIndex> fileindex(create_lmdb_files_index());
|
||||
|
||||
if(!fileindex.get())
|
||||
{
|
||||
|
||||
@ -45,7 +45,7 @@ int md5sum_check()
|
||||
#endif
|
||||
fn = check_workingdir + fn;
|
||||
|
||||
std::auto_ptr<IFile> f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
std::unique_ptr<IFile> f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP));
|
||||
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ int patch_hash()
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> f(Server->openFile(source_file, MODE_READ));
|
||||
std::unique_ptr<IFile> f(Server->openFile(source_file, MODE_READ));
|
||||
if (f.get() == NULL)
|
||||
{
|
||||
Server->Log("Cannot open source file " + source_file + ". " + os_last_error_str(), LL_ERROR);
|
||||
@ -74,14 +74,14 @@ int patch_hash()
|
||||
}
|
||||
|
||||
std::string patch_file_fn = Server->getServerParameter("patch_file");
|
||||
std::auto_ptr<IFile> patch_file(Server->openFile(patch_file_fn, MODE_READ));
|
||||
std::unique_ptr<IFile> patch_file(Server->openFile(patch_file_fn, MODE_READ));
|
||||
if (patch_file.get() == NULL)
|
||||
{
|
||||
Server->Log("Cannot open patch file " + patch_file_fn + ". " + os_last_error_str(), LL_ERROR);
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::auto_ptr<ExtentIterator> extent_iterator;
|
||||
std::unique_ptr<ExtentIterator> extent_iterator;
|
||||
|
||||
if (!sparse_extents_file.empty())
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@ bool skiphash_copy(const std::string& src_path,
|
||||
const std::string& dst_path,
|
||||
const std::string& hashinput_path)
|
||||
{
|
||||
std::auto_ptr<IFile> src(Server->openFile(os_file_prefix(src_path), MODE_READ_SEQUENTIAL));
|
||||
std::unique_ptr<IFile> src(Server->openFile(os_file_prefix(src_path), MODE_READ_SEQUENTIAL));
|
||||
|
||||
if(!src.get())
|
||||
{
|
||||
@ -17,7 +17,7 @@ bool skiphash_copy(const std::string& src_path,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> hashoutput(Server->openFile(os_file_prefix(dst_path+".hash"), MODE_WRITE));
|
||||
std::unique_ptr<IFile> hashoutput(Server->openFile(os_file_prefix(dst_path+".hash"), MODE_WRITE));
|
||||
|
||||
if(!hashoutput.get())
|
||||
{
|
||||
@ -27,7 +27,7 @@ bool skiphash_copy(const std::string& src_path,
|
||||
|
||||
bool dst_exists = Server->fileExists(dst_path);
|
||||
|
||||
std::auto_ptr<IFsFile> dst(Server->openFile(os_file_prefix(dst_path), MODE_RW));
|
||||
std::unique_ptr<IFsFile> dst(Server->openFile(os_file_prefix(dst_path), MODE_RW));
|
||||
|
||||
if(!dst.get())
|
||||
{
|
||||
@ -40,7 +40,7 @@ bool skiphash_copy(const std::string& src_path,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> hashinput;
|
||||
std::unique_ptr<IFile> hashinput;
|
||||
|
||||
if(!hashinput_path.empty())
|
||||
{
|
||||
|
||||
@ -141,7 +141,7 @@ void read_config_file(std::string fn, std::vector<std::string>& real_args)
|
||||
}
|
||||
|
||||
{
|
||||
std::auto_ptr<ISettingsReader> settings(Server->createFileSettingsReader(fn));
|
||||
std::unique_ptr<ISettingsReader> settings(Server->createFileSettingsReader(fn));
|
||||
std::string val;
|
||||
if(settings->getValue("FASTCGI_PORT", &val))
|
||||
{
|
||||
|
||||
@ -190,7 +190,7 @@ bool create_files_index_common(FileIndex& fileindex, SStartupStatus& status)
|
||||
|
||||
Server->destroyAllDatabases();
|
||||
|
||||
std::auto_ptr<IFile> db_file(Server->openFile("urbackup/backup_server_files_new.db", MODE_RW));
|
||||
std::unique_ptr<IFile> db_file(Server->openFile("urbackup/backup_server_files_new.db", MODE_RW));
|
||||
|
||||
if (db_file.get() == NULL)
|
||||
{
|
||||
|
||||
@ -514,7 +514,7 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
}
|
||||
else if (app == "hash")
|
||||
{
|
||||
std::auto_ptr<IFsFile> f(Server->openFile(Server->getServerParameter("hash_file"), MODE_READ_SEQUENTIAL));
|
||||
std::unique_ptr<IFsFile> f(Server->openFile(Server->getServerParameter("hash_file"), MODE_READ_SEQUENTIAL));
|
||||
if (f.get() != NULL)
|
||||
{
|
||||
std::string h = BackupServerPrepareHash::calc_hash(f.get(), Server->getServerParameter("hash_method"));
|
||||
@ -889,7 +889,7 @@ DLLEXPORT void LoadActions(IServer* pServer)
|
||||
port = 55415;
|
||||
}
|
||||
|
||||
std::auto_ptr<ISettingsReader> settings_db(Server->createDBSettingsReader(db, "settings_db.settings",
|
||||
std::unique_ptr<ISettingsReader> settings_db(Server->createDBSettingsReader(db, "settings_db.settings",
|
||||
"SELECT value FROM settings_db.settings WHERE key=? AND clientid=0"));
|
||||
|
||||
std::string port_str = settings_db->getValue("internet_server_bind_port", std::string());
|
||||
@ -1508,7 +1508,7 @@ bool upgrade35_36()
|
||||
{
|
||||
IDatabase *db=Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER);
|
||||
|
||||
std::auto_ptr<IFile> db_file(Server->openFile("urbackup/backup_server.db", MODE_READ));
|
||||
std::unique_ptr<IFile> db_file(Server->openFile("urbackup/backup_server.db", MODE_READ));
|
||||
|
||||
if(db_file.get() && Server->getServerParameter("override_freespace_check")==std::string())
|
||||
{
|
||||
|
||||
@ -62,8 +62,8 @@ private:
|
||||
int64 curr_chunk_patch_pos;
|
||||
|
||||
CTCPStack tcpstack;
|
||||
std::auto_ptr<FileClientChunked> fc_chunked;
|
||||
std::auto_ptr<FileClient> fc;
|
||||
std::unique_ptr<FileClientChunked> fc_chunked;
|
||||
std::unique_ptr<FileClient> fc;
|
||||
|
||||
std::vector<FileDownloadQueueItemChunked> dlqueueChunked;
|
||||
std::vector<FileDownloadQueueItemFull> dlqueueFull;
|
||||
|
||||
@ -108,7 +108,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
std::auto_ptr<IFile> metadata_file(Server->openFile(os_file_prefix(metadata_path), MODE_READ));
|
||||
std::unique_ptr<IFile> metadata_file(Server->openFile(os_file_prefix(metadata_path), MODE_READ));
|
||||
|
||||
if(metadata_file.get()==NULL)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user