diff --git a/Database.h b/Database.h index 65973e98..2ddcdd55 100644 --- a/Database.h +++ b/Database.h @@ -87,8 +87,8 @@ private: ICondition *unlock_cond; ISharedMutex* single_user_mutex; - std::auto_ptr transaction_read_lock; - std::auto_ptr write_lock; + std::unique_ptr transaction_read_lock; + std::unique_ptr write_lock; std::vector > attached_dbs; str_map params; diff --git a/FileSettingsReader.cpp b/FileSettingsReader.cpp index d9bb4a44..e52055b4 100644 --- a/FileSettingsReader.cpp +++ b/FileSettingsReader.cpp @@ -67,7 +67,7 @@ std::vector CFileSettingsReader::getKeys() void CFileSettingsReader::read(const std::string& pFile ) { - std::auto_ptr file(Server->openFile(pFile)); + std::unique_ptr file(Server->openFile(pFile)); if (file.get() == NULL) { return; diff --git a/PipeThrottler.h b/PipeThrottler.h index 3442f53f..ba24eacb 100644 --- a/PipeThrottler.h +++ b/PipeThrottler.h @@ -31,7 +31,7 @@ private: size_t curr_bytes; int64 lastresettime; int64 lastupdatetime; - std::auto_ptr updater; + std::unique_ptr updater; ThrottleState throttle_state; int64 lastprobetime; float probe_bps; diff --git a/Query.h b/Query.h index 0cc9f3f6..e257ef75 100644 --- a/Query.h +++ b/Query.h @@ -75,7 +75,7 @@ private: static std::vector active_queries; #endif - std::auto_ptr single_use_lock; + std::unique_ptr single_use_lock; friend class ScopedAddActiveQuery; }; diff --git a/Server.h b/Server.h index 2e9fd8f8..6271f5f6 100644 --- a/Server.h +++ b/Server.h @@ -45,10 +45,10 @@ struct SDatabase std::map tmap; std::vector > attach; size_t allocation_chunk_size; - std::auto_ptr single_user_mutex; - std::auto_ptr lock_mutex; - std::auto_ptr lock_count; - std::auto_ptr unlock_cond; + std::unique_ptr single_user_mutex; + std::unique_ptr lock_mutex; + std::unique_ptr lock_count; + std::unique_ptr unlock_cond; str_map params; private: diff --git a/SharedMutex_std.h b/SharedMutex_std.h index f34a8dea..f360c8f8 100644 --- a/SharedMutex_std.h +++ b/SharedMutex_std.h @@ -48,7 +48,7 @@ public: #endif private: - std::auto_ptr > read_lock; + std::unique_ptr > read_lock; #ifdef SHARED_MUTEX_CHECK SharedMutex* shared_mutex; @@ -61,5 +61,5 @@ public: WriteLock(std::unique_lock* write_lock); private: - std::auto_ptr > write_lock; + std::unique_ptr > write_lock; }; \ No newline at end of file diff --git a/file_memory.h b/file_memory.h index 5eac012e..a0e439bf 100644 --- a/file_memory.h +++ b/file_memory.h @@ -78,13 +78,13 @@ public: private: std::vector > data; - std::auto_ptr mutex; + std::unique_ptr mutex; size_t pos; bool mlock_mem; std::string name; static int page_size; int memory_protected; - std::auto_ptr mprotect_mutex; + std::unique_ptr mprotect_mutex; }; namespace diff --git a/file_win.cpp b/file_win.cpp index 6ce6bf7a..ae0d2efa 100644 --- a/file_win.cpp +++ b/file_win.cpp @@ -639,7 +639,7 @@ namespace attr_buf.resize((attrlist->last_vnc - attrlist->starting_vnc + 1) * vol_data.BytesPerCluster); - std::auto_ptr dev(Server->openFileFromHandle(vol, "vol")); + std::unique_ptr dev(Server->openFileFromHandle(vol, "vol")); if (dev.get() == NULL) return -1; diff --git a/fileservplugin/CClientThread.cpp b/fileservplugin/CClientThread.cpp index 392fca78..44164497 100644 --- a/fileservplugin/CClientThread.cpp +++ b/fileservplugin/CClientThread.cpp @@ -1826,7 +1826,7 @@ bool CClientThread::GetFileBlockdiff(CRData *data, bool with_metadata) ScopedShareActive scoped_share_active; - std::auto_ptr pipe_file_user; + std::unique_ptr 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 tf(Server->openFileFromHandle((void*)hFile, filename)); + std::unique_ptr 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 token_callback(FileServ::newTokenCallback()); + std::unique_ptr token_callback(FileServ::newTokenCallback()); std::string ttokens; if (token_callback.get() != NULL) { diff --git a/fileservplugin/ChunkSendThread.h b/fileservplugin/ChunkSendThread.h index 756ee857..35412a1a 100644 --- a/fileservplugin/ChunkSendThread.h +++ b/fileservplugin/ChunkSendThread.h @@ -29,7 +29,7 @@ private: IFile *file; std::string s_filename; size_t share_active_gen; - std::auto_ptr pipe_file_user; + std::unique_ptr pipe_file_user; _i64 curr_hash_size; _i64 curr_file_size; _i64 curr_max_vdl; diff --git a/fileservplugin/FileMetadataPipe.cpp b/fileservplugin/FileMetadataPipe.cpp index 1db63c39..ae5a7b5c 100644 --- a/fileservplugin/FileMetadataPipe.cpp +++ b/fileservplugin/FileMetadataPipe.cpp @@ -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); } diff --git a/fileservplugin/FileMetadataPipe.h b/fileservplugin/FileMetadataPipe.h index 8658a2d8..842f7e1c 100644 --- a/fileservplugin/FileMetadataPipe.h +++ b/fileservplugin/FileMetadataPipe.h @@ -113,7 +113,7 @@ private: int64 folder_items; IFileServ::IMetadataCallback* callback; std::string server_token; - std::auto_ptr metadata_file; + std::unique_ptr 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 errpipe; + std::unique_ptr 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 token_callback; + std::unique_ptr token_callback; }; #ifndef _WIN32 diff --git a/fileservplugin/PipeFileBase.h b/fileservplugin/PipeFileBase.h index 635501fd..5fc84146 100644 --- a/fileservplugin/PipeFileBase.h +++ b/fileservplugin/PipeFileBase.h @@ -106,7 +106,7 @@ private: bool buf_circle; std::vector buffer; std::string stderr_ret; - std::auto_ptr buffer_mutex; + std::unique_ptr buffer_mutex; size_t threadidx; bool has_eof; int64 stream_size; diff --git a/fileservplugin/PipeFileExt.h b/fileservplugin/PipeFileExt.h index 7451af96..f599ac50 100644 --- a/fileservplugin/PipeFileExt.h +++ b/fileservplugin/PipeFileExt.h @@ -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 file_ext; + std::unique_ptr file_ext; }; \ No newline at end of file diff --git a/fileservplugin/PipeFileTar.cpp b/fileservplugin/PipeFileTar.cpp index 2fe19764..349e1e9b 100644 --- a/fileservplugin/PipeFileTar.cpp +++ b/fileservplugin/PipeFileTar.cpp @@ -365,7 +365,7 @@ std::string PipeFileTar::buildCurrMetadata() data.addVarInt(0); data.addVarInt(0); data.addVarInt(0); - std::auto_ptr token_callback(FileServ::newTokenCallback()); + std::unique_ptr token_callback(FileServ::newTokenCallback()); std::string ttokens; if (token_callback.get() != NULL) { diff --git a/fileservplugin/PipeFileTar.h b/fileservplugin/PipeFileTar.h index 78dc5186..30bd1bdd 100644 --- a/fileservplugin/PipeFileTar.h +++ b/fileservplugin/PipeFileTar.h @@ -81,7 +81,7 @@ public: size_t refcount; IPipeFile* pipe_file; - std::auto_ptr mutex; + std::unique_ptr mutex; std::set paths; }; @@ -140,7 +140,7 @@ private: sha_def_ctx sha_ctx; int64 hash_pos; - std::auto_ptr mutex; + std::unique_ptr mutex; PipeFileStore* pipe_file; diff --git a/fileservplugin/PipeSessions.cpp b/fileservplugin/PipeSessions.cpp index 34bae72d..7f08ce37 100644 --- a/fileservplugin/PipeSessions.cpp +++ b/fileservplugin/PipeSessions.cpp @@ -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 waitpipe(Server->createMemoryPipe()); + std::unique_ptr waitpipe(Server->createMemoryPipe()); datamsg.addVoidPtr(waitpipe.get()); datamsg.addString(server_token); diff --git a/fsimageplugin/ClientBitmap.cpp b/fsimageplugin/ClientBitmap.cpp index f6e513f2..a67f24fe 100644 --- a/fsimageplugin/ClientBitmap.cpp +++ b/fsimageplugin/ClientBitmap.cpp @@ -13,7 +13,7 @@ namespace ClientBitmap::ClientBitmap(std::string fn) : has_error(false) { - std::auto_ptr bitmap_file(Server->openFile(fn, MODE_READ)); + std::unique_ptr bitmap_file(Server->openFile(fn, MODE_READ)); init(bitmap_file.get()); } diff --git a/fsimageplugin/CompressedFile.cpp b/fsimageplugin/CompressedFile.cpp index e26e03ec..b7bf8e6a 100644 --- a/fsimageplugin/CompressedFile.cpp +++ b/fsimageplugin/CompressedFile.cpp @@ -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) { diff --git a/fsimageplugin/CompressedFile.h b/fsimageplugin/CompressedFile.h index bafcaf34..58ab2e97 100644 --- a/fsimageplugin/CompressedFile.h +++ b/fsimageplugin/CompressedFile.h @@ -85,7 +85,7 @@ private: IFile* uncompressedFile; int64 uncompressedFileSize; - std::auto_ptr hotCache; + std::unique_ptr hotCache; //for reading std::vector compressedBuffer; @@ -101,7 +101,7 @@ private: bool noMagic; - std::auto_ptr mutex; + std::unique_ptr mutex; size_t n_threads; }; diff --git a/fsimageplugin/ImdiskSrv.cpp b/fsimageplugin/ImdiskSrv.cpp index 8e7b85bb..57cbd615 100644 --- a/fsimageplugin/ImdiskSrv.cpp +++ b/fsimageplugin/ImdiskSrv.cpp @@ -224,9 +224,9 @@ namespace std::string ext = findextension(img_fn); - std::auto_ptr imgf; + std::unique_ptr imgf; - std::auto_ptr vhdfile; + std::unique_ptr vhdfile; if (ext == "raw") { imgf.reset(Server->openFile(img_fn, MODE_READ)); diff --git a/fsimageplugin/LRUMemCache.h b/fsimageplugin/LRUMemCache.h index 0590019a..c7d5eb7d 100644 --- a/fsimageplugin/LRUMemCache.h +++ b/fsimageplugin/LRUMemCache.h @@ -43,9 +43,9 @@ private: std::vector evictedItems; std::vector lruItemBuffers; - std::auto_ptr mutex; - std::auto_ptr cond; - std::auto_ptr cond_wait; + std::unique_ptr mutex; + std::unique_ptr cond; + std::unique_ptr cond_wait; size_t buffersize; size_t nbuffers; diff --git a/fsimageplugin/cowfile.cpp b/fsimageplugin/cowfile.cpp index 57549908..9910aaea 100644 --- a/fsimageplugin/cowfile.cpp +++ b/fsimageplugin/cowfile.cpp @@ -204,7 +204,7 @@ CowFile::CowFile(const std::string &fn, const std::string &parent_fn, bool pRead read_only = pRead_only; { - std::auto_ptr parentf(Server->openFile(parent_fn, MODE_READ)); + std::unique_ptr 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 bitmap_file(Server->openFile(filename+".bitmap", MODE_WRITE)); + std::unique_ptr 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 bitmap_file(Server->openFile(bitmap_fn, MODE_READ)); + std::unique_ptr 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 bitmap_source; + std::unique_ptr 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 bitmap_source; + std::unique_ptr bitmap_source; bitmap_source.reset(new ClientBitmap(filename + ".cbitmap")); diff --git a/fsimageplugin/dllmain.cpp b/fsimageplugin/dllmain.cpp index 7564a84e..b961c908 100644 --- a/fsimageplugin/dllmain.cpp +++ b/fsimageplugin/dllmain.cpp @@ -110,7 +110,7 @@ namespace if(findextension(fn)=="vhdz") { - std::auto_ptr vhdfile(new VHDFile(fn, true, 0)); + std::unique_ptr vhdfile(new VHDFile(fn, true, 0)); if(vhdfile->isOpen() && vhdfile->getParent()!=NULL) { @@ -262,7 +262,7 @@ namespace for(size_t i=0;i f(Server->openFile(fn[i]+".mbr", MODE_READ)); + std::unique_ptr 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 f(Server->openFile(fn, MODE_READ)); + std::unique_ptr 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 in(open_device_file(image_verify)); + std::unique_ptr 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 in(open_device_file(device_verify)); + std::unique_ptr in(open_device_file(device_verify)); if(in.get()==NULL || in->isOpen()==false) { diff --git a/fsimageplugin/filesystem.cpp b/fsimageplugin/filesystem.cpp index f4209713..4c5a5120 100644 --- a/fsimageplugin/filesystem.cpp +++ b/fsimageplugin/filesystem.cpp @@ -229,9 +229,9 @@ private: } } - std::auto_ptr mutex; - std::auto_ptr start_readahead_cond; - std::auto_ptr read_block_cond; + std::unique_ptr mutex; + std::unique_ptr start_readahead_cond; + std::unique_ptr read_block_cond; Filesystem& fs; std::map read_blocks; @@ -925,7 +925,7 @@ bool Filesystem::excludeFile(const std::string& path) return false; } #else - std::auto_ptr f(Server->openFile(path, MODE_READ)); + std::unique_ptr f(Server->openFile(path, MODE_READ)); if (f.get() == NULL) { Server->Log("Error opening file " + path + ". " + os_last_error_str(), LL_DEBUG); diff --git a/fsimageplugin/filesystem.h b/fsimageplugin/filesystem.h index 031381ba..10ab1917 100644 --- a/fsimageplugin/filesystem.h +++ b/fsimageplugin/filesystem.h @@ -130,8 +130,8 @@ protected: IFsBuffer* getBuffer(); std::vector buffers; - std::auto_ptr buffer_mutex; - std::auto_ptr readahead_thread; + std::unique_ptr buffer_mutex; + std::unique_ptr readahead_thread; THREADPOOL_TICKET readahead_thread_ticket; size_t num_uncompleted_blocks; diff --git a/fsimageplugin/vhdfile.cpp b/fsimageplugin/vhdfile.cpp index 36856c67..7a77de11 100644 --- a/fsimageplugin/vhdfile.cpp +++ b/fsimageplugin/vhdfile.cpp @@ -1428,7 +1428,7 @@ bool VHDFile::isCompressed() bool VHDFile::makeFull( _i64 fs_offset, IVHDWriteCallback* write_callback) { FileWrapper devfile(this, fs_offset); - std::auto_ptr bitmap_source; + std::unique_ptr bitmap_source; bitmap_source.reset(new ClientBitmap(backing_file->getFilename() + ".cbitmap")); diff --git a/fsimageplugin/vhdxfile.cpp b/fsimageplugin/vhdxfile.cpp index 1ffc3af5..51907710 100644 --- a/fsimageplugin/vhdxfile.cpp +++ b/fsimageplugin/vhdxfile.cpp @@ -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 bitmap_source; + std::unique_ptr bitmap_source; bitmap_source.reset(new ClientBitmap(backing_file->getFilename() + ".cbitmap")); diff --git a/urbackup/dataplan_db.txt b/urbackup/dataplan_db.txt index e5b51076..0738a278 100644 --- a/urbackup/dataplan_db.txt +++ b/urbackup/dataplan_db.txt @@ -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 diff --git a/urbackupclient/ClientHash.cpp b/urbackupclient/ClientHash.cpp index c4a01e93..0baa429a 100644 --- a/urbackupclient/ClientHash.cpp +++ b/urbackupclient/ClientHash.cpp @@ -80,7 +80,7 @@ ClientHash::~ClientHash() bool ClientHash::getShaBinary(const std::string & fn, IHashFunc & hf, bool with_cbt) { - std::auto_ptr f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP)); if (f.get() == NULL) { diff --git a/urbackupclient/ClientService.cpp b/urbackupclient/ClientService.cpp index 60c776b4..e5129629 100644 --- a/urbackupclient/ClientService.cpp +++ b/urbackupclient/ClientService.cpp @@ -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 updatefile(Server->openFile(UPDATE_FILE_PREFIX "UrBackupUpdate_untested.dat")); + std::unique_ptr updatefile(Server->openFile(UPDATE_FILE_PREFIX "UrBackupUpdate_untested.dat")); if(updatefile.get()!=NULL) { if(checkHash(getSha512Hash(updatefile.get())) @@ -1846,7 +1846,7 @@ std::vector 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 new_settings(Server->createMemorySettingsReader(pData)); + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr curr_settings(Server->createFileSettingsReader(settings_fn)); std::vector 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 newf(Server->openFile(settings_fn + ".new", MODE_WRITE)); + std::unique_ptr 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 new_settings(Server->createMemorySettingsReader(pData)); + std::unique_ptr 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 old_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr old_settings(Server->createFileSettingsReader(settings_fn)); std::vector 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 vde((VOLUME_DISK_EXTENTS*)new char[sizeof(VOLUME_DISK_EXTENTS)]); + std::unique_ptr 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 inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]); + std::unique_ptr 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 access_keys( + std::unique_ptr access_keys( Server->createFileSettingsReader("urbackup/access_keys.properties")); std::vector 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 settings( + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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 settings_f(Server->openFile(settings_fn+".new_2", MODE_WRITE)); + std::unique_ptr settings_f(Server->openFile(settings_fn+".new_2", MODE_WRITE)); if (settings_f.get() != NULL) { diff --git a/urbackupclient/ClientServiceCMD.cpp b/urbackupclient/ClientServiceCMD.cpp index 21272aa6..c822661c 100644 --- a/urbackupclient/ClientServiceCMD.cpp +++ b/urbackupclient/ClientServiceCMD.cpp @@ -156,7 +156,7 @@ void ClientConnector::CMD_GET_CHALLENGE(const std::string &identity, const std:: if (!internet_conn) { - std::auto_ptr settings( + std::unique_ptr 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 settings( + std::unique_ptr 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 access_keys( + std::unique_ptr access_keys( Server->createFileSettingsReader("urbackup/access_keys.properties")); if (access_keys.get() != NULL) diff --git a/urbackupclient/DirectoryWatcherThread.h b/urbackupclient/DirectoryWatcherThread.h index b4df1717..39445aec 100644 --- a/urbackupclient/DirectoryWatcherThread.h +++ b/urbackupclient/DirectoryWatcherThread.h @@ -83,7 +83,7 @@ private: int64 last_backup_filetime; - std::auto_ptr continuous_watch; + std::unique_ptr continuous_watch; static std::vector open_files; }; \ No newline at end of file diff --git a/urbackupclient/FileMetadataDownloadThread.cpp b/urbackupclient/FileMetadataDownloadThread.cpp index c4aa5b40..5466b488 100644 --- a/urbackupclient/FileMetadataDownloadThread.cpp +++ b/urbackupclient/FileMetadataDownloadThread.cpp @@ -109,7 +109,7 @@ FileMetadataDownloadThread::FileMetadataDownloadThread(RestoreFiles& restore, Fi void FileMetadataDownloadThread::operator()() { - std::auto_ptr tmp_f(Server->openTemporaryFile()); + std::unique_ptr 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 metadata_f(Server->openFile(metadata_tmp_fn, MODE_READ_SEQUENTIAL)); + std::unique_ptr 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 touch_file(Server->openFile(os_file_prefix(output_fn), MODE_WRITE)); + std::unique_ptr 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, diff --git a/urbackupclient/ImageThread.cpp b/urbackupclient/ImageThread.cpp index f9a3a255..b1298567 100644 --- a/urbackupclient/ImageThread.cpp +++ b/urbackupclient/ImageThread.cpp @@ -133,7 +133,7 @@ bool ImageThread::sendFullImageThread(void) int64 last_shadowcopy_update = Server->getTimeMS(); - std::auto_ptr hdat_img; + std::unique_ptr 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 fs; + std::unique_ptr 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 hdat_img; + std::unique_ptr 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 fs; + std::unique_ptr 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 previous_bitmap; + std::unique_ptr 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 dev(Server->openFile(image_inf->shadowdrive, MODE_READ_DEVICE)); + std::unique_ptr 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"; diff --git a/urbackupclient/InternetClient.cpp b/urbackupclient/InternetClient.cpp index 514c1ac4..80d84649 100644 --- a/urbackupclient/InternetClient.cpp +++ b/urbackupclient/InternetClient.cpp @@ -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 tcpstack(new CTCPStack(true)); + std::unique_ptr 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 ecdh_key_exchange(crypto_fak->createECDHKeyExchange()); + std::unique_ptr ecdh_key_exchange(crypto_fak->createECDHKeyExchange()); std::string shared_key = ecdh_key_exchange->getSharedKey(server_pubkey); if (shared_key.empty()) diff --git a/urbackupclient/LocalBackup.cpp b/urbackupclient/LocalBackup.cpp index 1e9f6e73..1893015e 100644 --- a/urbackupclient/LocalBackup.cpp +++ b/urbackupclient/LocalBackup.cpp @@ -107,8 +107,8 @@ namespace } private: - std::auto_ptr update_mutex; - std::auto_ptr update_cond; + std::unique_ptr update_mutex; + std::unique_ptr update_cond; bool stopped; int curr_pc; std::string curr_details; diff --git a/urbackupclient/LocalFileBackup.h b/urbackupclient/LocalFileBackup.h index 3d13f9d2..13dcfcc1 100644 --- a/urbackupclient/LocalFileBackup.h +++ b/urbackupclient/LocalFileBackup.h @@ -36,7 +36,7 @@ protected: bool writeOsMetadata(const std::string& sourcefn, int64 dest_start_offset, IFile* dest); - std::auto_ptr file_metadata_pipe; + std::unique_ptr file_metadata_pipe; private: }; \ No newline at end of file diff --git a/urbackupclient/LocalFullFileBackup.cpp b/urbackupclient/LocalFullFileBackup.cpp index f995f4fe..01ab9758 100644 --- a/urbackupclient/LocalFullFileBackup.cpp +++ b/urbackupclient/LocalFullFileBackup.cpp @@ -131,7 +131,7 @@ bool LocalFullFileBackup::run() if (filelistpath.empty()) return false; - std::auto_ptr curr_file_list(Server->openFile(filelistpath, MODE_READ)); + std::unique_ptr 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 filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE)); + std::unique_ptr 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 metadataf(backup_files->openFile(metadatapath, MODE_WRITE)); + std::unique_ptr 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 metadataf(backup_files->openFile(metadatapath, MODE_WRITE)); + std::unique_ptr metadataf(backup_files->openFile(metadatapath, MODE_WRITE)); if (metadataf.get() == NULL) { @@ -291,7 +291,7 @@ bool LocalFullFileBackup::run() return false; } - std::auto_ptr sourcef(Server->openFile(sourcepath, MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr 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 destf(backup_files->openFile(targetpath, MODE_WRITE)); + std::unique_ptr destf(backup_files->openFile(targetpath, MODE_WRITE)); bool b = build_chunk_hashs(sourcef.get(), metadataf.get(), NULL, destf.get(), false); diff --git a/urbackupclient/LocalIncrFileBackup.cpp b/urbackupclient/LocalIncrFileBackup.cpp index 8ba42a26..20276f50 100644 --- a/urbackupclient/LocalIncrFileBackup.cpp +++ b/urbackupclient/LocalIncrFileBackup.cpp @@ -197,7 +197,7 @@ bool LocalIncrFileBackup::run() return false; } - std::auto_ptr filelist_out(backup_files->openFile(getBackupInternalDataDir() + "\\filelist.ub", MODE_WRITE)); + std::unique_ptr 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 touch_file(backup_files->openFile(touch_path, MODE_WRITE)); + std::unique_ptr 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); diff --git a/urbackupclient/LocalIncrFileBackup.h b/urbackupclient/LocalIncrFileBackup.h index 4a3f9bd8..7e3ff56b 100644 --- a/urbackupclient/LocalIncrFileBackup.h +++ b/urbackupclient/LocalIncrFileBackup.h @@ -55,5 +55,5 @@ private: std::string last_backuppath; int backupgroup; std::string clientsubname; - std::auto_ptr file_metadata_pipe; + std::unique_ptr file_metadata_pipe; }; \ No newline at end of file diff --git a/urbackupclient/ParallelHash.cpp b/urbackupclient/ParallelHash.cpp index 10450868..c314c99e 100644 --- a/urbackupclient/ParallelHash.cpp +++ b/urbackupclient/ParallelHash.cpp @@ -127,7 +127,7 @@ void ParallelHash::operator()() #ifdef _WIN32 mode = MODE_READ_DEVICE; #endif - std::auto_ptr phashf(Server->openFile(phash_queue->phash_queue->getFilename(), mode)); + std::unique_ptr 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 f(Server->openFile(os_file_prefix(full_path), MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr f(Server->openFile(os_file_prefix(full_path), MODE_READ_SEQUENTIAL_BACKUP)); SFileAndHash fandhash; std::string ph_action; diff --git a/urbackupclient/ParallelHash.h b/urbackupclient/ParallelHash.h index 8ef214c2..73334e2c 100644 --- a/urbackupclient/ParallelHash.h +++ b/urbackupclient/ParallelHash.h @@ -70,13 +70,13 @@ private: volatile bool has_read; int64 phash_queue_pos; SQueueRef* phash_queue; - std::auto_ptr mutex; + std::unique_ptr mutex; std::map curr_dirs; std::deque postponed_finish; - std::auto_ptr client_hash; + std::unique_ptr client_hash; int sha_version; THREADPOOL_TICKET ticket; std::vector extra_tickets; @@ -94,7 +94,7 @@ private: bool insert; }; - std::auto_ptr modify_file_buffer_mutex; + std::unique_ptr 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 > extra_queue; - std::auto_ptr extra_mutex; - std::auto_ptr extra_cond; + std::unique_ptr extra_mutex; + std::unique_ptr extra_cond; }; diff --git a/urbackupclient/RestoreDownloadThread.cpp b/urbackupclient/RestoreDownloadThread.cpp index 1ac21ac7..40ae2021 100644 --- a/urbackupclient/RestoreDownloadThread.cpp +++ b/urbackupclient/RestoreDownloadThread.cpp @@ -205,7 +205,7 @@ void RestoreDownloadThread::queueStop() bool RestoreDownloadThread::load_file( SQueueItem todl ) { - std::auto_ptr dest_f; + std::unique_ptr dest_f; if(!todl.metadata_only) { diff --git a/urbackupclient/RestoreDownloadThread.h b/urbackupclient/RestoreDownloadThread.h index 071e4883..59720a71 100644 --- a/urbackupclient/RestoreDownloadThread.h +++ b/urbackupclient/RestoreDownloadThread.h @@ -113,8 +113,8 @@ private: bool all_downloads_ok; std::vector download_nok_ids; - std::auto_ptr mutex; - std::auto_ptr cond; + std::unique_ptr mutex; + std::unique_ptr cond; bool skipping; bool is_offline; diff --git a/urbackupclient/RestoreFiles.cpp b/urbackupclient/RestoreFiles.cpp index 0b3856ef..644965b8 100644 --- a/urbackupclient/RestoreFiles.cpp +++ b/urbackupclient/RestoreFiles.cpp @@ -126,8 +126,8 @@ namespace } private: - std::auto_ptr update_mutex; - std::auto_ptr update_cond; + std::unique_ptr update_mutex; + std::unique_ptr 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 delete_this(this); + std::unique_ptr 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 metadata_thread(new client::FileMetadataDownloadThread(*this, fc_metadata, client_token)); + std::unique_ptr 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& open_files, bool& } else { - std::auto_ptr orig_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_RESTORE)); + std::unique_ptr 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& open_files, bool& } else { - std::auto_ptr restore_file(Server->openFile(os_file_prefix(local_fn), MODE_RW_CREATE_RESTORE)); + std::unique_ptr 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 fc_chunked = createFcChunked(); + std::unique_ptr 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 restore_download(new RestoreDownloadThread(fc, *fc_chunked, client_token, metadata_path_mapping, *this)); + std::unique_ptr 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 orig_file; + std::unique_ptr 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 hashf; - std::auto_ptr hashf2; + std::unique_ptr hashf; + std::unique_ptr 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 touch_file; + std::unique_ptr 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 RestoreFiles::createFcChunked() +std::unique_ptr RestoreFiles::createFcChunked() { IPipe* conn = new_fileclient_connection(); if(conn==NULL) { - return std::auto_ptr(); + return std::unique_ptr(); } - return std::auto_ptr(new FileClientChunked(conn, true, &tcpstack, this, + return std::unique_ptr(new FileClientChunked(conn, true, &tcpstack, this, NULL, client_token, NULL)); } diff --git a/urbackupclient/RestoreFiles.h b/urbackupclient/RestoreFiles.h index ffaebfbd..ba4d9669 100644 --- a/urbackupclient/RestoreFiles.h +++ b/urbackupclient/RestoreFiles.h @@ -89,7 +89,7 @@ private: bool renameFilesOnRestart(std::vector >& rename_queue); - std::auto_ptr createFcChunked(); + std::unique_ptr createFcChunked(); void calculateDownloadSpeed(FileClient & fc, FileClientChunked * fc_chunked); diff --git a/urbackupclient/ServerIdentityMgr.cpp b/urbackupclient/ServerIdentityMgr.cpp index dbf619c8..7c04de55 100644 --- a/urbackupclient/ServerIdentityMgr.cpp +++ b/urbackupclient/ServerIdentityMgr.cpp @@ -401,7 +401,7 @@ bool ServerIdentityMgr::write_file_admin_atomic(const std::string & data, const } { - std::auto_ptr f(Server->openFile(fn + ".new", MODE_RW)); + std::unique_ptr f(Server->openFile(fn + ".new", MODE_RW)); if (f.get() != NULL) f->Sync(); } diff --git a/urbackupclient/client.cpp b/urbackupclient/client.cpp index bab268dc..41cc25d5 100644 --- a/urbackupclient/client.cpp +++ b/urbackupclient/client.cpp @@ -222,7 +222,7 @@ namespace } else { - std::auto_ptr journal_info(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$Max", MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr 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 journal(Server->openFile(vol+"\\$Extend\\$UsnJrnl:$J", MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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 access_keys( + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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& data) { - std::auto_ptr f(Server->openFile(fn, MODE_READ)); + std::unique_ptr f(Server->openFile(fn, MODE_READ)); if (f.get() == NULL) { @@ -6260,7 +6260,7 @@ namespace } } - std::auto_ptr f(Server->openFile(fn+".new", MODE_WRITE)); + std::unique_ptr 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 hive_file(Server->openFile(fpath, MODE_READ)); + std::unique_ptr 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 hdat_img(ImageThread::openHdatF(volume, false)); + std::unique_ptr 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 hdat_file(Server->openFile("urbackup\\hdat_file_" + conv_filename(strlower(volume)) + ".dat", MODE_RW_CREATE_DELETE)); + std::unique_ptr 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 hdat_file(Server->openFile("urbackup/hdat_file_" + conv_filename(fs_dev) + ".dat", MODE_RW_CREATE_DELETE)); - std::auto_ptr hdat_img(ImageThread::openHdatF(fs_dev, false)); + std::unique_ptr hdat_file(Server->openFile("urbackup/hdat_file_" + conv_filename(fs_dev) + ".dat", MODE_RW_CREATE_DELETE)); + std::unique_ptr 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 volfile(Server->openFile(orig_dev, MODE_READ_DEVICE)); + std::unique_ptr 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 cowfile(Server->openFile(cbt_file, MODE_READ)); + std::unique_ptr 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 hdat_file_era_new(Server->openFile(hdat->getFilename() + ".era.new", MODE_WRITE)); + std::unique_ptr 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 vols; std::string settings_fn = "urbackup/data/settings.cfg"; - std::auto_ptr curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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 output_f(Server->openFile(fn, MODE_WRITE)); + std::unique_ptr 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 f(Server->openFile(os_file_prefix(path + os_file_sep() + files[i].name), MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr 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 flock_f(Server->openFile(flock_fp, MODE_RW)); + std::unique_ptr 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 settings(Server->createFileSettingsReader(conffile)); + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr 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 curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr curr_settings(Server->createFileSettingsReader(settings_fn)); size_t client_hash_threads = 1; if (curr_settings.get() != NULL) { diff --git a/urbackupclient/client.h b/urbackupclient/client.h index 439f4193..7db4e591 100644 --- a/urbackupclient/client.h +++ b/urbackupclient/client.h @@ -297,7 +297,7 @@ public: struct SQueueRef { - std::auto_ptr mutex; + std::unique_ptr mutex; IFile* phash_queue; size_t refcount; IDeregisterFileSrvScriptFn* dereg_fn; @@ -650,7 +650,7 @@ private: SVolumesCache* volumes_cache; - std::auto_ptr background_prio; + std::unique_ptr background_prio; std::string starttoken; @@ -711,7 +711,7 @@ private: int64 target_generation; }; - std::auto_ptr client_hash; + std::unique_ptr client_hash; std::vector< SBufferItem > modify_file_buffer; size_t modify_file_buffer_size; @@ -861,12 +861,12 @@ private: const std::vector& exclude_dirs, const std::vector& include_dirs, const std::string& orig_path); - std::auto_ptr last_filelist; + std::unique_ptr last_filelist; std::vector read_errors; IMutex* read_error_mutex; - std::auto_ptr index_hdat_file; + std::unique_ptr index_hdat_file; std::map index_hdat_sequence_ids; int64 index_hdat_fs_block_size; int64 index_chunkhash_pos; diff --git a/urbackupclient/client_restore.cpp b/urbackupclient/client_restore.cpp index a6a1f026..4f895ca4 100644 --- a/urbackupclient/client_restore.cpp +++ b/urbackupclient/client_restore.cpp @@ -574,7 +574,7 @@ EDownloadResult downloadImage(int img_id, std::string img_time, std::string outf CTCPStack tcpstack; std::vector ret; - std::auto_ptr client_pipe(Server->ConnectStream("localhost", 35623, 60000)); + std::unique_ptr 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 out_file(Server->openFile(restore_out, MODE_RW_READNONE)); + std::unique_ptr 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 ret; - std::auto_ptr client_pipe(Server->ConnectStream("localhost", 35623, 60000)); + std::unique_ptr 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 dev(Server->openFile(dev_fn, MODE_READ_DEVICE)); + std::unique_ptr dev(Server->openFile(dev_fn, MODE_READ_DEVICE)); if (dev.get() == NULL) { diff --git a/urbackupclient/client_winvss.cpp b/urbackupclient/client_winvss.cpp index 0cb486ad..22387259 100644 --- a/urbackupclient/client_winvss.cpp +++ b/urbackupclient/client_winvss.cpp @@ -1100,7 +1100,7 @@ bool IndexThread::deleteSavedShadowCopyWin(SShadowCopy& scs, SShadowCopyContext& bool IndexThread::getVssSettings() { std::string settings_fn = "urbackup/data/settings.cfg"; - std::auto_ptr curr_settings(Server->createFileSettingsReader(settings_fn)); + std::unique_ptr curr_settings(Server->createFileSettingsReader(settings_fn)); vss_select_components.clear(); vss_select_all_components = false; bool select_default_components = false; diff --git a/urbackupclient/cmdline_preprocessor.cpp b/urbackupclient/cmdline_preprocessor.cpp index 534ba44e..57a00b6c 100644 --- a/urbackupclient/cmdline_preprocessor.cpp +++ b/urbackupclient/cmdline_preprocessor.cpp @@ -100,7 +100,7 @@ void read_config_file(std::string fn, std::vector& real_args) } { - std::auto_ptr settings(Server->createFileSettingsReader(fn)); + std::unique_ptr settings(Server->createFileSettingsReader(fn)); std::string val; if(settings->getValue("LOGFILE", &val)) { diff --git a/urbackupclient/dllmain.cpp b/urbackupclient/dllmain.cpp index 83a2c2fa..aa43fe5d 100644 --- a/urbackupclient/dllmain.cpp +++ b/urbackupclient/dllmain.cpp @@ -169,7 +169,7 @@ namespace void do_print_dm_file_extents(const std::string& fn) { - std::auto_ptr f(Server->openFile(fn, MODE_READ)); + std::unique_ptr 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 settings_reader(Server->createFileSettingsReader(INITIAL_SETTINGS_PREFIX "initial_settings.cfg")); + std::unique_ptr 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()) diff --git a/urbackupclient/tokens.h b/urbackupclient/tokens.h index e41267aa..a588bb88 100644 --- a/urbackupclient/tokens.h +++ b/urbackupclient/tokens.h @@ -34,7 +34,7 @@ namespace tokens void operator=(const TokenCache& other); TokenCache(const TokenCache& other); - std::auto_ptr token_cache; + std::unique_ptr token_cache; }; enum ETokenRight diff --git a/urbackupclient/watchdir/ContinuousWatchEnqueue.cpp b/urbackupclient/watchdir/ContinuousWatchEnqueue.cpp index 5863bf91..21524c5d 100644 --- a/urbackupclient/watchdir/ContinuousWatchEnqueue.cpp +++ b/urbackupclient/watchdir/ContinuousWatchEnqueue.cpp @@ -340,7 +340,7 @@ void ContinuousWatchEnqueue::readIncludeExcludePatterns() update_patterns=false; - std::auto_ptr curr_settings(Server->createFileSettingsReader("urbackup/data/settings.cfg")); + std::unique_ptr curr_settings(Server->createFileSettingsReader("urbackup/data/settings.cfg")); if(curr_settings.get()) { diff --git a/urbackupclient/watchdir/ContinuousWatchEnqueue.h b/urbackupclient/watchdir/ContinuousWatchEnqueue.h index 3599fe1c..2f344104 100644 --- a/urbackupclient/watchdir/ContinuousWatchEnqueue.h +++ b/urbackupclient/watchdir/ContinuousWatchEnqueue.h @@ -93,7 +93,7 @@ private: std::vector include_depth; std::vector include_prefix; - std::auto_ptr journal_dao; + std::unique_ptr journal_dao; CWData queue; diff --git a/urbackupclient/win_all_volumes.cpp b/urbackupclient/win_all_volumes.cpp index f6dede1f..90e155bb 100644 --- a/urbackupclient/win_all_volumes.cpp +++ b/urbackupclient/win_all_volumes.cpp @@ -207,7 +207,7 @@ std::string get_all_volumes_list(bool filter_usb, SVolumesCache*& cache) } else { - std::auto_ptr dev(Server->openFile(dev_fn, MODE_READ_DEVICE)); + std::unique_ptr dev(Server->openFile(dev_fn, MODE_READ_DEVICE)); if(!dev.get()) { diff --git a/urbackupclient/win_sysvol.cpp b/urbackupclient/win_sysvol.cpp index f9489fb2..46ca211a 100644 --- a/urbackupclient/win_sysvol.cpp +++ b/urbackupclient/win_sysvol.cpp @@ -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 inf((DRIVE_LAYOUT_INFORMATION_EX*)new char[sizeof(DRIVE_LAYOUT_INFORMATION_EX)+sizeof(PARTITION_INFORMATION_EX)*(numPartitions-1)]); + std::unique_ptr 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); diff --git a/urbackupclient/win_tokens.cpp b/urbackupclient/win_tokens.cpp index c69e46af..e9912163 100644 --- a/urbackupclient/win_tokens.cpp +++ b/urbackupclient/win_tokens.cpp @@ -56,7 +56,7 @@ TokenCache::TokenCache( const TokenCache& other ) assert(false); } -TokenCache::TokenCache() : token_cache(NULL) +TokenCache::TokenCache() { } diff --git a/urbackupcommon/CompressedPipe2.h b/urbackupcommon/CompressedPipe2.h index ea6eea91..9b1b727b 100644 --- a/urbackupcommon/CompressedPipe2.h +++ b/urbackupcommon/CompressedPipe2.h @@ -81,6 +81,6 @@ private: z_stream inf_stream; z_stream def_stream; - std::auto_ptr read_mutex; - std::auto_ptr write_mutex; + std::unique_ptr read_mutex; + std::unique_ptr write_mutex; }; \ No newline at end of file diff --git a/urbackupcommon/CompressedPipeZstd.h b/urbackupcommon/CompressedPipeZstd.h index a4cdd749..14364bdb 100644 --- a/urbackupcommon/CompressedPipeZstd.h +++ b/urbackupcommon/CompressedPipeZstd.h @@ -77,8 +77,8 @@ private: ZSTD_CCtx* def_stream; ZSTD_inBuffer inf_in_last; - std::auto_ptr read_mutex; - std::auto_ptr write_mutex; + std::unique_ptr read_mutex; + std::unique_ptr write_mutex; }; #endif //NO_ZSTD_COMPRESSION \ No newline at end of file diff --git a/urbackupcommon/ExtentIterator.h b/urbackupcommon/ExtentIterator.h index d2796383..c83b6e5b 100644 --- a/urbackupcommon/ExtentIterator.h +++ b/urbackupcommon/ExtentIterator.h @@ -23,7 +23,7 @@ public: virtual void reset(); private: - std::auto_ptr sparse_extents_f; + std::unique_ptr sparse_extents_f; int64 num_sparse_extents; int64 next_sparse_extent_num; bool take_file_ownership; diff --git a/urbackupcommon/InternetServicePipe2.h b/urbackupcommon/InternetServicePipe2.h index 3882d9e0..5064aa0f 100644 --- a/urbackupcommon/InternetServicePipe2.h +++ b/urbackupcommon/InternetServicePipe2.h @@ -75,8 +75,8 @@ public: int64 getEncryptionOverheadBytes(); private: - std::auto_ptr dec; - std::auto_ptr enc; + std::unique_ptr dec; + std::unique_ptr enc; IPipe *cs; bool destroy_cs; @@ -85,6 +85,6 @@ private: size_t curr_write_chunk_size; int64 last_flush_time; - std::auto_ptr read_mutex; - std::auto_ptr write_mutex; + std::unique_ptr read_mutex; + std::unique_ptr write_mutex; }; \ No newline at end of file diff --git a/urbackupcommon/WebSocketPipe.h b/urbackupcommon/WebSocketPipe.h index b4bbe060..22d17cc5 100644 --- a/urbackupcommon/WebSocketPipe.h +++ b/urbackupcommon/WebSocketPipe.h @@ -107,6 +107,6 @@ private: char masking_key[4]; bool destroy_pipe; - std::auto_ptr read_mutex; - std::auto_ptr write_mutex; + std::unique_ptr read_mutex; + std::unique_ptr write_mutex; }; \ No newline at end of file diff --git a/urbackupcommon/chunk_hasher.cpp b/urbackupcommon/chunk_hasher.cpp index b5b1b06b..6c2b1fee 100644 --- a/urbackupcommon/chunk_hasher.cpp +++ b/urbackupcommon/chunk_hasher.cpp @@ -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 chunk_hashes; + std::unique_ptr chunk_hashes; if(hashinput!=NULL) { chunk_hashes.reset(new SChunkHashes); diff --git a/urbackupcommon/file_metadata.cpp b/urbackupcommon/file_metadata.cpp index 45a4065f..005974c8 100644 --- a/urbackupcommon/file_metadata.cpp +++ b/urbackupcommon/file_metadata.cpp @@ -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 out(Server->openFile(os_file_prefix(out_fn), MODE_RW_CREATE)); + std::unique_ptr 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 in(Server->openFile(os_file_prefix(in_fn))); + std::unique_ptr 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 in_f(Server->openFile(os_file_prefix(in_fn), MODE_READ)); - std::auto_ptr out_f(Server->openFile(os_file_prefix(out_fn), MODE_RW)); + std::unique_ptr in_f(Server->openFile(os_file_prefix(in_fn), MODE_READ)); + std::unique_ptr out_f(Server->openFile(os_file_prefix(out_fn), MODE_RW)); if(in_f.get()==NULL) { diff --git a/urbackupcommon/fileclient/FileClient.cpp b/urbackupcommon/fileclient/FileClient.cpp index 8b4a20b2..24160960 100644 --- a/urbackupcommon/fileclient/FileClient.cpp +++ b/urbackupcommon/fileclient/FileClient.cpp @@ -1077,7 +1077,7 @@ bool FileClient::Reconnect(void) _u32 hash_r; MD5 hash_func; IFile* file = backing_file; - std::auto_ptr sparse_file; + std::unique_ptr sparse_file; char* buf = dl_buf; diff --git a/urbackupcommon/fileclient/FileClientChunked.cpp b/urbackupcommon/fileclient/FileClientChunked.cpp index e35c758d..ba221abf 100644 --- a/urbackupcommon/fileclient/FileClientChunked.cpp +++ b/urbackupcommon/fileclient/FileClientChunked.cpp @@ -156,7 +156,7 @@ _u32 FileClientChunked::GetFile(std::string remotefn, _i64& filesize_out, int64 if(!queued_fcs.empty()) { - std::auto_ptr next(queued_fcs.front()); + std::unique_ptr next(queued_fcs.front()); queued_fcs.pop_front(); diff --git a/urbackupcommon/fileclient/FileClientChunked.h b/urbackupcommon/fileclient/FileClientChunked.h index b22372ac..70d83791 100644 --- a/urbackupcommon/fileclient/FileClientChunked.h +++ b/urbackupcommon/fileclient/FileClientChunked.h @@ -279,7 +279,7 @@ private: bool curr_is_script; - std::auto_ptr extent_iterator; + std::unique_ptr extent_iterator; IFsFile::SSparseExtent curr_sparse_extent; int reconnect_tries; diff --git a/urbackupcommon/mbrdata.h b/urbackupcommon/mbrdata.h index 0ea2b551..9e1b2913 100644 --- a/urbackupcommon/mbrdata.h +++ b/urbackupcommon/mbrdata.h @@ -191,7 +191,7 @@ namespace { bool is_disk_mbr(const std::string& mbrfn) { - std::auto_ptr mbrf(Server->openFile(os_file_prefix(mbrfn), MODE_READ)); + std::unique_ptr mbrf(Server->openFile(os_file_prefix(mbrfn), MODE_READ)); if (mbrf.get() != NULL) { std::string mbr_header = mbrf->Read(2); diff --git a/urbackupserver/Backup.h b/urbackupserver/Backup.h index 4fc3bd50..3c6d6f82 100644 --- a/urbackupserver/Backup.h +++ b/urbackupserver/Backup.h @@ -114,7 +114,7 @@ protected: LogAction log_action; IDatabase* db; - std::auto_ptr server_settings; + std::unique_ptr server_settings; ServerBackupDao* backup_dao; bool log_backup; diff --git a/urbackupserver/ClientMain.cpp b/urbackupserver/ClientMain.cpp index 4bad34d9..5a8c68fc 100644 --- a/urbackupserver/ClientMain.cpp +++ b/urbackupserver/ClientMain.cpp @@ -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 local_server_backup_dao(new ServerBackupDao(db)); + std::unique_ptr 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 cc; + std::unique_ptr 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 cc; + std::unique_ptr cc; if (conn != NULL && conn->conn.get() != NULL && conn->internet_connection == internet_connection) @@ -1928,7 +1928,7 @@ void ClientMain::sendSettings(void) std::vector settings_names=getSettingsList(); std::vector global_settings_names=getGlobalizedSettingsList(); - std::auto_ptr settings_client, settings_default, settings_global; + std::unique_ptr 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 sr(Server->createFileSettingsReader(tmp_fn)); + std::unique_ptr sr(Server->createFileSettingsReader(tmp_fn)); std::vector setting_names=getSettingsList(); @@ -2322,13 +2322,13 @@ void ClientMain::checkClientVersion(void) } - std::auto_ptr sigfile(Server->openFile(signature_file, MODE_READ)); + std::unique_ptr sigfile(Server->openFile(signature_file, MODE_READ)); if(sigfile.get()==NULL) { ServerLogger::Log(logid, "Error opening sigfile", LL_ERROR); return; } - std::auto_ptr updatefile(Server->openFile(installer_file, MODE_READ)); + std::unique_ptr 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 cc(getClientCommandConnection(server_settings.get(), 10000)); + std::unique_ptr 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& fc_chunked, +bool ClientMain::getClientChunkedFilesrvConnection(std::unique_ptr& fc_chunked, ServerSettings* server_settings, FileClientChunked::NoFreeSpaceCallback* no_free_space_callback, int timeoutms) { if (no_free_space_callback == NULL) diff --git a/urbackupserver/ClientMain.h b/urbackupserver/ClientMain.h index 2f8dc006..5ecaa978 100644 --- a/urbackupserver/ClientMain.h +++ b/urbackupserver/ClientMain.h @@ -166,7 +166,7 @@ public: internet_connection(false) {} - std::auto_ptr conn; + std::unique_ptr conn; bool internet_connection; }; @@ -210,7 +210,7 @@ public: _u32 getClientFilesrvConnection(FileClient *fc, ServerSettings* server_settings, int timeoutms=10000); - bool getClientChunkedFilesrvConnection(std::auto_ptr& fc_chunked, + bool getClientChunkedFilesrvConnection(std::unique_ptr& 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 server_settings; + std::unique_ptr 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 restore_mutex; + std::unique_ptr restore_mutex; std::vector running_restores; std::mutex local_backup_mutex; diff --git a/urbackupserver/DataplanDb.h b/urbackupserver/DataplanDb.h index 5719a6cd..ed99c828 100644 --- a/urbackupserver/DataplanDb.h +++ b/urbackupserver/DataplanDb.h @@ -26,7 +26,7 @@ public: private: static DataplanDb* instance; - std::auto_ptr mutex; + std::unique_ptr mutex; std::vector items; common::lrucache cache; diff --git a/urbackupserver/FileBackup.cpp b/urbackupserver/FileBackup.cpp index 7385dcd1..4d215f05 100644 --- a/urbackupserver/FileBackup.cpp +++ b/urbackupserver/FileBackup.cpp @@ -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 cc; + std::unique_ptr 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 urbackup_tokens( + std::unique_ptr 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 f(Server->openFile(os_file_prefix(fn), MODE_READ)); + std::unique_ptr 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 touch_f(Server->openFile(backuppath, MODE_WRITE)); + std::unique_ptr 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 urbackup_tokens( + std::unique_ptr 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& id void FileBackup::saveUsersOnClient() { - std::auto_ptr urbackup_tokens( + std::unique_ptr 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 fc_metadata_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version, + std::unique_ptr 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 fc_metadata_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version, + std::unique_ptr 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 component_config_xml(Server->openFile(os_file_prefix(component_config_dir+os_file_sep()+"backupcom.xml"), MODE_WRITE)); + std::unique_ptr 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 fc_phash_stream(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version, + std::unique_ptr 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 fc_phash_stream_end(new FileClient(false, identity, client_main->getProtocolVersions().filesrv_protocol_version, + std::unique_ptr 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 tmpfile(Server->openTemporaryFile()); + std::unique_ptr tmpfile(Server->openTemporaryFile()); std::string tmpdirname = tmpfile->getFilename(); tmpfile.reset(); Server->deleteFile(tmpdirname); os_create_dir(tmpdirname); - std::auto_ptr output_file(Server->openFile(tmpdirname+os_file_sep()+"verify_failed.file", MODE_WRITE)); + std::unique_ptr 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) diff --git a/urbackupserver/FileBackup.h b/urbackupserver/FileBackup.h index af3dde7e..58072a52 100644 --- a/urbackupserver/FileBackup.h +++ b/urbackupserver/FileBackup.h @@ -65,7 +65,7 @@ public: return false; } private: - std::auto_ptr mutex; + std::unique_ptr mutex; std::map filepath_corrections; }; @@ -163,7 +163,7 @@ public: } private: - std::auto_ptr mutex; + std::unique_ptr mutex; size_t max_downloaded; size_t max_preprocessed; size_t min_downloaded; @@ -274,8 +274,8 @@ protected: std::vector bsh_ticket; std::vector bsh_prepare; std::vector bsh_prepare_ticket; - std::auto_ptr local_hash; - std::auto_ptr local_hash2; + std::unique_ptr local_hash; + std::unique_ptr local_hash2; std::string filelist_async_id; @@ -284,15 +284,15 @@ protected: std::map continuous_sequences; - std::auto_ptr fileindex; + std::unique_ptr fileindex; bool disk_error; int backupid; - std::auto_ptr metadata_download_thread; + std::unique_ptr metadata_download_thread; THREADPOOL_TICKET metadata_download_thread_ticket; - std::auto_ptr metadata_apply_thread; + std::unique_ptr 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 phash_load; + std::unique_ptr phash_load; THREADPOOL_TICKET phash_load_ticket; MaxFileId max_file_id; diff --git a/urbackupserver/FileMetadataDownloadThread.cpp b/urbackupserver/FileMetadataDownloadThread.cpp index 6e0df8a7..c6561801 100644 --- a/urbackupserver/FileMetadataDownloadThread.cpp +++ b/urbackupserver/FileMetadataDownloadThread.cpp @@ -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 tmp_f(ClientMain::getTemporaryFileRetry(use_tmpfiles, tmpfile_path, logid)); + std::unique_ptr 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 metadata_f(Server->openFile(metadata_tmp_fn, mode)); + std::unique_ptr 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 output_f; + std::unique_ptr 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 output_f(Server->openFile(os_file_prefix(os_path), MODE_WRITE)); + std::unique_ptr 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 tmp(Server->openTemporaryFile()); + std::unique_ptr 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 tmp(Server->openTemporaryFile()); + std::unique_ptr tmp(Server->openTemporaryFile()); if (copy_file(metadata_f, tmp.get())) { diff --git a/urbackupserver/FileMetadataDownloadThread.h b/urbackupserver/FileMetadataDownloadThread.h index 9d85bd5d..aa5c282b 100644 --- a/urbackupserver/FileMetadataDownloadThread.h +++ b/urbackupserver/FileMetadataDownloadThread.h @@ -115,7 +115,7 @@ private: std::vector saved_folder_items; - std::auto_ptr fc; + std::unique_ptr 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 mutex; - std::auto_ptr cond; + std::unique_ptr mutex; + std::unique_ptr cond; }; int check_metadata(); diff --git a/urbackupserver/FullFileBackup.cpp b/urbackupserver/FullFileBackup.cpp index ce2461b7..3f5e40e0 100644 --- a/urbackupserver/FullFileBackup.cpp +++ b/urbackupserver/FullFileBackup.cpp @@ -224,7 +224,7 @@ bool FullFileBackup::doFileBackup() std::string last_backuppath; std::string last_backuppath_complete; - std::auto_ptr server_download(new ServerDownloadThreadGroup(fc, NULL, backuppath, + std::unique_ptr 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 touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE)); + std::unique_ptr 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 sync_f; + std::unique_ptr sync_f; if (!c_has_error) { sync_f.reset(Server->openFile(os_file_prefix(backuppath_hashes + os_file_sep() + sync_fn), MODE_WRITE)); diff --git a/urbackupserver/ImageBackup.cpp b/urbackupserver/ImageBackup.cpp index c9fb1211..a575862d 100644 --- a/urbackupserver/ImageBackup.cpp +++ b/urbackupserver/ImageBackup.cpp @@ -387,7 +387,7 @@ bool ImageBackup::doImage(const std::string &pLetter, const std::string &pParent return false; } - std::auto_ptr mbr_file(Server->openFile(os_file_prefix(imagefn + ".mbr"), MODE_WRITE)); + std::unique_ptr 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 hashfile(Server->openFile(os_file_prefix(pParentvhd + ".hash"))); + std::unique_ptr 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 prevbitmap; + std::unique_ptr 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 bitmap_file; + std::unique_ptr 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 prevbitmap; + std::unique_ptr 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 sync_f; + std::unique_ptr 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 touch_f(Server->openFile(image_folder, MODE_WRITE)); + std::unique_ptr 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 touch_f(Server->openFile(image_folder, MODE_WRITE)); + std::unique_ptr 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); diff --git a/urbackupserver/ImageBackup.h b/urbackupserver/ImageBackup.h index 99ae4c13..2d23e327 100644 --- a/urbackupserver/ImageBackup.h +++ b/urbackupserver/ImageBackup.h @@ -85,7 +85,7 @@ protected: int64 snapshot_id; - std::auto_ptr mutex; + std::unique_ptr mutex; std::string snapshot_group_loginfo; diff --git a/urbackupserver/ImageMount.cpp b/urbackupserver/ImageMount.cpp index 32526e58..a146ee8c 100644 --- a/urbackupserver/ImageMount.cpp +++ b/urbackupserver/ImageMount.cpp @@ -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 vhdfile; + std::unique_ptr vhdfile; if (ext == "raw") { vhdfile.reset(image_fak->createVHDFile(image_inf.path, true, 0, 2 * 1024 * 1024, false, IFSImageFactory::ImageFormat_RawCowFile)); diff --git a/urbackupserver/IncrFileBackup.cpp b/urbackupserver/IncrFileBackup.cpp index a18881b8..f37df159 100644 --- a/urbackupserver/IncrFileBackup.cpp +++ b/urbackupserver/IncrFileBackup.cpp @@ -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 fc_chunked; + std::unique_ptr 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 touch_f(Server->openFile(backuppath, MODE_WRITE)); + std::unique_ptr 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 server_download(new ServerDownloadThreadGroup(fc, fc_chunked.get(), backuppath, + std::unique_ptr 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 link_dao_synchronous; + std::unique_ptr 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 touch_file(Server->openFile(os_file_prefix(touch_path), MODE_WRITE)); + std::unique_ptr 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 sync_f; + std::unique_ptr 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 sync_f; + std::unique_ptr 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 tf(Server->openTemporaryFile()); + std::unique_ptr 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 tmp(Server->openFile(clientlist_fn, MODE_READ)); + std::unique_ptr 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 tf(Server->openFile(os_file_prefix(curr_fn), MODE_READ)); + std::unique_ptr 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 last_file(Server->openFile(os_file_prefix(backuppath+local_curr_os_path), MODE_READ)); + std::unique_ptr 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); diff --git a/urbackupserver/LMDBFileIndex.cpp b/urbackupserver/LMDBFileIndex.cpp index f068e181..4cb55551 100644 --- a/urbackupserver/LMDBFileIndex.cpp +++ b/urbackupserver/LMDBFileIndex.cpp @@ -501,7 +501,7 @@ bool LMDBFileIndex::create_env() } { - std::auto_ptr lmdb_f(Server->openFile("urbackup/fileindex/backup_server_files_index.lmdb", MODE_READ)); + std::unique_ptr 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)) diff --git a/urbackupserver/LMDBFileIndex.h b/urbackupserver/LMDBFileIndex.h index 15f9b6c5..51c744af 100644 --- a/urbackupserver/LMDBFileIndex.h +++ b/urbackupserver/LMDBFileIndex.h @@ -62,7 +62,7 @@ private: static MDB_dbi dbi; size_t map_size; - std::auto_ptr read_transaction_lock; + std::unique_ptr read_transaction_lock; void put_internal(const SIndexKey& key, int64 value, int flags, bool log, bool handle_enosp); diff --git a/urbackupserver/LocalBackup.cpp b/urbackupserver/LocalBackup.cpp index 5ff3235f..3f2cab2e 100644 --- a/urbackupserver/LocalBackup.cpp +++ b/urbackupserver/LocalBackup.cpp @@ -224,7 +224,7 @@ bool LocalBackup::queryBackupFinished(int64 timeout_time, bool& finished) finished = false; int64 starttime = Server->getTimeMS(); - std::auto_ptr cc; + std::unique_ptr cc; CTCPStack tcpstack(client_main->isOnInternetConnection()); while (Server->getTimeMS() - starttime <= timeout_time) @@ -446,7 +446,7 @@ bool LocalBackup::finishLocalBackup(std::vector& del_files) const int64 timeout_time = 60000; int64 starttime = Server->getTimeMS(); - std::auto_ptr cc; + std::unique_ptr cc; CTCPStack tcpstack(client_main->isOnInternetConnection()); while (Server->getTimeMS() - starttime <= timeout_time) diff --git a/urbackupserver/PhashLoad.cpp b/urbackupserver/PhashLoad.cpp index cf01003c..e9a04cd0 100644 --- a/urbackupserver/PhashLoad.cpp +++ b/urbackupserver/PhashLoad.cpp @@ -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 phash_file_dl(Server->openTemporaryFile()); + std::unique_ptr phash_file_dl(Server->openTemporaryFile()); if (phash_file_dl.get() == NULL) { diff --git a/urbackupserver/ServerDownloadThread.cpp b/urbackupserver/ServerDownloadThread.cpp index 4e3ef88c..20d27807 100644 --- a/urbackupserver/ServerDownloadThread.cpp +++ b/urbackupserver/ServerDownloadThread.cpp @@ -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 file_old(Server->openFile(os_file_prefix(filepath_old), MODE_READ)); + std::unique_ptr 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 hashfile_old(Server->openFile(os_file_prefix(hashpath_old), MODE_READ)); + std::unique_ptr 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 touch_file(Server->openFile(os_file_prefix(backuppath + os_path), MODE_WRITE)); + std::unique_ptr 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); diff --git a/urbackupserver/ServerDownloadThread.h b/urbackupserver/ServerDownloadThread.h index 918bf67c..451a4131 100644 --- a/urbackupserver/ServerDownloadThread.h +++ b/urbackupserver/ServerDownloadThread.h @@ -142,7 +142,7 @@ class ServerDownloadThread : public IThread, public FileClient::QueueCallback, p public: class ActiveDlIds { - std::auto_ptr mutex; + std::unique_ptr mutex; std::set ids; public: ActiveDlIds() diff --git a/urbackupserver/ServerDownloadThreadGroup.cpp b/urbackupserver/ServerDownloadThreadGroup.cpp index aeae2ba7..8578de37 100644 --- a/urbackupserver/ServerDownloadThreadGroup.cpp +++ b/urbackupserver/ServerDownloadThreadGroup.cpp @@ -41,7 +41,7 @@ ServerDownloadThreadGroup::ServerDownloadThreadGroup(FileClient& fc, FileClientC if (incremental_num > 0 && intra_file_diffs) { - std::auto_ptr new_fc; + std::unique_ptr new_fc; if (client_main->getClientChunkedFilesrvConnection(new_fc, server_settings, client_main, 60000)) { new_fc->setProgressLogCallback(client_main); diff --git a/urbackupserver/apps/check_files_index.cpp b/urbackupserver/apps/check_files_index.cpp index 52380eae..f8dea635 100644 --- a/urbackupserver/apps/check_files_index.cpp +++ b/urbackupserver/apps/check_files_index.cpp @@ -60,7 +60,7 @@ int check_files_index() IDatabaseCursor* cursor = q_iterate->Cursor(); - std::auto_ptr fileindex(create_lmdb_files_index()); + std::unique_ptr fileindex(create_lmdb_files_index()); if(!fileindex.get()) { diff --git a/urbackupserver/apps/md5sum_check.cpp b/urbackupserver/apps/md5sum_check.cpp index 567e0c71..0dc6fa12 100644 --- a/urbackupserver/apps/md5sum_check.cpp +++ b/urbackupserver/apps/md5sum_check.cpp @@ -45,7 +45,7 @@ int md5sum_check() #endif fn = check_workingdir + fn; - std::auto_ptr f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP)); + std::unique_ptr f(Server->openFile(os_file_prefix(fn), MODE_READ_SEQUENTIAL_BACKUP)); if (f.get() == NULL) { diff --git a/urbackupserver/apps/patch.cpp b/urbackupserver/apps/patch.cpp index fd7b2fb0..3bb0323b 100644 --- a/urbackupserver/apps/patch.cpp +++ b/urbackupserver/apps/patch.cpp @@ -66,7 +66,7 @@ int patch_hash() return 2; } - std::auto_ptr f(Server->openFile(source_file, MODE_READ)); + std::unique_ptr 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 patch_file(Server->openFile(patch_file_fn, MODE_READ)); + std::unique_ptr 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 extent_iterator; + std::unique_ptr extent_iterator; if (!sparse_extents_file.empty()) { diff --git a/urbackupserver/apps/skiphash_copy.cpp b/urbackupserver/apps/skiphash_copy.cpp index 419234c4..b3582761 100644 --- a/urbackupserver/apps/skiphash_copy.cpp +++ b/urbackupserver/apps/skiphash_copy.cpp @@ -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 src(Server->openFile(os_file_prefix(src_path), MODE_READ_SEQUENTIAL)); + std::unique_ptr 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 hashoutput(Server->openFile(os_file_prefix(dst_path+".hash"), MODE_WRITE)); + std::unique_ptr 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 dst(Server->openFile(os_file_prefix(dst_path), MODE_RW)); + std::unique_ptr 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 hashinput; + std::unique_ptr hashinput; if(!hashinput_path.empty()) { diff --git a/urbackupserver/cmdline_preprocessor.cpp b/urbackupserver/cmdline_preprocessor.cpp index 79a7248b..d6a42a2b 100644 --- a/urbackupserver/cmdline_preprocessor.cpp +++ b/urbackupserver/cmdline_preprocessor.cpp @@ -141,7 +141,7 @@ void read_config_file(std::string fn, std::vector& real_args) } { - std::auto_ptr settings(Server->createFileSettingsReader(fn)); + std::unique_ptr settings(Server->createFileSettingsReader(fn)); std::string val; if(settings->getValue("FASTCGI_PORT", &val)) { diff --git a/urbackupserver/create_files_index.cpp b/urbackupserver/create_files_index.cpp index 608ea94b..9f0e23c0 100644 --- a/urbackupserver/create_files_index.cpp +++ b/urbackupserver/create_files_index.cpp @@ -190,7 +190,7 @@ bool create_files_index_common(FileIndex& fileindex, SStartupStatus& status) Server->destroyAllDatabases(); - std::auto_ptr db_file(Server->openFile("urbackup/backup_server_files_new.db", MODE_RW)); + std::unique_ptr db_file(Server->openFile("urbackup/backup_server_files_new.db", MODE_RW)); if (db_file.get() == NULL) { diff --git a/urbackupserver/dllmain.cpp b/urbackupserver/dllmain.cpp index 05f8c2f4..5eb4bfd5 100644 --- a/urbackupserver/dllmain.cpp +++ b/urbackupserver/dllmain.cpp @@ -514,7 +514,7 @@ DLLEXPORT void LoadActions(IServer* pServer) } else if (app == "hash") { - std::auto_ptr f(Server->openFile(Server->getServerParameter("hash_file"), MODE_READ_SEQUENTIAL)); + std::unique_ptr 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 settings_db(Server->createDBSettingsReader(db, "settings_db.settings", + std::unique_ptr 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 db_file(Server->openFile("urbackup/backup_server.db", MODE_READ)); + std::unique_ptr db_file(Server->openFile("urbackup/backup_server.db", MODE_READ)); if(db_file.get() && Server->getServerParameter("override_freespace_check")==std::string()) { diff --git a/urbackupserver/filedownload.h b/urbackupserver/filedownload.h index d7941b15..85de200a 100644 --- a/urbackupserver/filedownload.h +++ b/urbackupserver/filedownload.h @@ -62,8 +62,8 @@ private: int64 curr_chunk_patch_pos; CTCPStack tcpstack; - std::auto_ptr fc_chunked; - std::auto_ptr fc; + std::unique_ptr fc_chunked; + std::unique_ptr fc; std::vector dlqueueChunked; std::vector dlqueueFull; diff --git a/urbackupserver/restore_client.cpp b/urbackupserver/restore_client.cpp index 45d507ae..9711589e 100644 --- a/urbackupserver/restore_client.cpp +++ b/urbackupserver/restore_client.cpp @@ -108,7 +108,7 @@ namespace } } - std::auto_ptr metadata_file(Server->openFile(os_file_prefix(metadata_path), MODE_READ)); + std::unique_ptr metadata_file(Server->openFile(os_file_prefix(metadata_path), MODE_READ)); if(metadata_file.get()==NULL) { diff --git a/urbackupserver/server.cpp b/urbackupserver/server.cpp index abbf6528..6a3bd05a 100644 --- a/urbackupserver/server.cpp +++ b/urbackupserver/server.cpp @@ -1167,7 +1167,7 @@ void BackupServer::runServerRecovery(IDatabase * db) db_single_result res; while (cur.next(res)) { - std::auto_ptr f(Server->openFile(os_file_prefix(res["path"]))); + std::unique_ptr f(Server->openFile(os_file_prefix(res["path"]))); if (f.get()!=NULL) { delete_missing = true; @@ -1234,7 +1234,7 @@ void BackupServer::runServerRecovery(IDatabase * db) } else { - std::auto_ptr sync_f(Server->openFile(os_file_prefix(backuppath + os_file_sep() + ".hashes" + os_file_sep() + sync_fn), MODE_READ)); + std::unique_ptr sync_f(Server->openFile(os_file_prefix(backuppath + os_file_sep() + ".hashes" + os_file_sep() + sync_fn), MODE_READ)); if (sync_f.get() == NULL) { @@ -1259,7 +1259,7 @@ void BackupServer::runServerRecovery(IDatabase * db) } IQuery* q_set_done = db->Prepare("UPDATE backups SET done=0, complete=0 WHERE id=?"); - std::auto_ptr file_cleanups(new FileCleanups); + std::unique_ptr file_cleanups(new FileCleanups); for (size_t i = 0; i < to_delete.size(); ++i) { has_delete = true; @@ -1310,7 +1310,7 @@ void BackupServer::runServerRecovery(IDatabase * db) std::string path = res["path"]; std::string backupinfo = "[id=" + res["backupid"] + ", path=" + path + ", backuptime=" + res["backuptime"] + ", clientid=" + res["clientid"] + ", client=" + res["name"] + "]"; - std::auto_ptr image_f(Server->openFile(os_file_prefix(path), MODE_READ)); + std::unique_ptr image_f(Server->openFile(os_file_prefix(path), MODE_READ)); if (image_f.get() == NULL) { @@ -1346,7 +1346,7 @@ void BackupServer::runServerRecovery(IDatabase * db) } else { - std::auto_ptr sync_f(Server->openFile(os_file_prefix(res["path"] + ".sync"), MODE_READ)); + std::unique_ptr sync_f(Server->openFile(os_file_prefix(res["path"] + ".sync"), MODE_READ)); if (sync_f.get() == NULL) { diff --git a/urbackupserver/server_channel.cpp b/urbackupserver/server_channel.cpp index 05ccafec..47b9256d 100644 --- a/urbackupserver/server_channel.cpp +++ b/urbackupserver/server_channel.cpp @@ -1132,7 +1132,7 @@ void ServerChannelThread::DOWNLOAD_IMAGE(str_map& params) int img_version=watoi(res[0]["version"]); if(params["mbr"]=="true") { - std::auto_ptr f(Server->openFile(os_file_prefix(res[0]["path"]+".mbr"), MODE_READ)); + std::unique_ptr f(Server->openFile(os_file_prefix(res[0]["path"]+".mbr"), MODE_READ)); if(f.get()==NULL) { _i64 r=little_endian(-1); diff --git a/urbackupserver/server_cleanup.cpp b/urbackupserver/server_cleanup.cpp index a6b5923d..15186980 100644 --- a/urbackupserver/server_cleanup.cpp +++ b/urbackupserver/server_cleanup.cpp @@ -84,7 +84,7 @@ void ServerCleanupThread::destroyMutex(void) } ServerCleanupThread::ServerCleanupThread(CleanupAction cleanup_action) - : cleanup_action(cleanup_action), cleanupdao(NULL), backupdao(NULL) + : cleanup_action(cleanup_action) { logid = ServerLogger::getLogId(LOG_CATEGORY_CLEANUP); } @@ -1814,7 +1814,7 @@ namespace src_file_destroy.reset(src_file); } - std::auto_ptr dst_file(Server->openFile(os_file_prefix(dst), MODE_WRITE)); + std::unique_ptr dst_file(Server->openFile(os_file_prefix(dst), MODE_WRITE)); bool copy_ok = true; if (src_file != NULL diff --git a/urbackupserver/server_cleanup.h b/urbackupserver/server_cleanup.h index e5e43d50..073023c8 100644 --- a/urbackupserver/server_cleanup.h +++ b/urbackupserver/server_cleanup.h @@ -216,10 +216,10 @@ private: CleanupAction cleanup_action; - std::auto_ptr cleanupdao; - std::auto_ptr backupdao; - std::auto_ptr filesdao; - std::auto_ptr fileindex; + std::unique_ptr cleanupdao; + std::unique_ptr backupdao; + std::unique_ptr filesdao; + std::unique_ptr fileindex; logid_t logid; diff --git a/urbackupserver/server_continuous.h b/urbackupserver/server_continuous.h index 39c579a2..f029686b 100644 --- a/urbackupserver/server_continuous.h +++ b/urbackupserver/server_continuous.h @@ -649,7 +649,7 @@ private: bool execAddFile(SChange& change) { - std::auto_ptr f(Server->openFile(getFullpath(change.fn1), MODE_WRITE)); + std::unique_ptr f(Server->openFile(getFullpath(change.fn1), MODE_WRITE)); if(!f.get()) { @@ -699,7 +699,7 @@ private: } } - bool constructFileClient(std::auto_ptr& new_fc) + bool constructFileClient(std::unique_ptr& new_fc) { new_fc.reset(new FileClient(false, server_identity, client_main->getProtocolVersions().file_protocol_version, client_main->isOnInternetConnection(), client_main, client_main)); _u32 rc = client_main->getClientFilesrvConnection(new_fc.get(), server_settings.get()); @@ -724,7 +724,7 @@ private: bool execMod(SChange& change) { - std::auto_ptr f(Server->openFile(getFullpath(change.fn1))); + std::unique_ptr f(Server->openFile(getFullpath(change.fn1))); if(!fileclient.get()) { @@ -930,15 +930,15 @@ private: int backupid; IPipe* hashpipe_prepare; - std::auto_ptr local_hash; + std::unique_ptr local_hash; - std::auto_ptr fileclient_chunked; - std::auto_ptr fileclient; - std::auto_ptr fileclient_metadata; + std::unique_ptr fileclient_chunked; + std::unique_ptr fileclient; + std::unique_ptr fileclient_metadata; - std::auto_ptr server_settings; + std::unique_ptr server_settings; - std::auto_ptr server_download; + std::unique_ptr server_download; std::deque dl_queue; @@ -947,9 +947,9 @@ private: bool transfer_incr_blockdiff; bool has_fullpath_entryid_mapping_table; - std::auto_ptr backupdao; - std::auto_ptr filesdao; - std::auto_ptr fileindex; + std::unique_ptr backupdao; + std::unique_ptr filesdao; + std::unique_ptr fileindex; FilePathCorrections filepath_corrections; diff --git a/urbackupserver/server_dir_links.cpp b/urbackupserver/server_dir_links.cpp index f5309b4c..505bcf6a 100644 --- a/urbackupserver/server_dir_links.cpp +++ b/urbackupserver/server_dir_links.cpp @@ -358,7 +358,7 @@ bool replay_directory_link_journal( ) } bool remove_directory_link(const std::string & path, ServerLinkDao & link_dao, int clientid, - std::auto_ptr& synchronous_link_dao, bool with_transaction) + std::unique_ptr& synchronous_link_dao, bool with_transaction) { std::string pool_path; if (!os_get_symlink_target(path, pool_path)) @@ -441,7 +441,7 @@ bool remove_directory_link(const std::string & path, ServerLinkDao & link_dao, i #else int mode = MODE_READ; #endif - std::auto_ptr dir_f(Server->openFile(os_file_prefix(ExtractFilePath(path, os_file_sep())), mode)); + std::unique_ptr dir_f(Server->openFile(os_file_prefix(ExtractFilePath(path, os_file_sep())), mode)); if (dir_f.get() != NULL) { dir_f->Sync(); @@ -470,7 +470,7 @@ namespace } ServerLinkDao* link_dao; - std::auto_ptr synchronous_link_dao; + std::unique_ptr synchronous_link_dao; int clientid; bool with_transaction; }; diff --git a/urbackupserver/server_dir_links.h b/urbackupserver/server_dir_links.h index a08e6409..230f9f33 100644 --- a/urbackupserver/server_dir_links.h +++ b/urbackupserver/server_dir_links.h @@ -20,7 +20,7 @@ bool link_directory_pool(int clientid, const std::string& target_dir, const std: bool replay_directory_link_journal(); bool remove_directory_link(const std::string &path, ServerLinkDao& link_dao, int clientid, - std::auto_ptr& synchronous_link_dao, bool with_transaction=true); + std::unique_ptr& synchronous_link_dao, bool with_transaction=true); bool remove_directory_link_dir(const std::string &path, ServerLinkDao& link_dao, int clientid, bool delete_root=true, bool with_transaction=true); diff --git a/urbackupserver/server_hash.cpp b/urbackupserver/server_hash.cpp index 4731a9a9..f02f3447 100644 --- a/urbackupserver/server_hash.cpp +++ b/urbackupserver/server_hash.cpp @@ -191,7 +191,7 @@ void BackupServerHash::operator()(void) } else { - std::auto_ptr extent_iterator; + std::unique_ptr extent_iterator; if (!sparse_extents_fn.empty()) { IFile* sparse_extents_f = Server->openFile(sparse_extents_fn, MODE_READ); @@ -245,7 +245,7 @@ void BackupServerHash::operator()(void) metadata.set_shahash(src_metadata.shahash); } - std::auto_ptr tf(Server->openFile(os_file_prefix(source), MODE_READ_SEQUENTIAL)); + std::unique_ptr tf(Server->openFile(os_file_prefix(source), MODE_READ_SEQUENTIAL)); if(!tf.get()) { @@ -262,7 +262,7 @@ void BackupServerHash::operator()(void) if(!hash_src.empty()) { - std::auto_ptr hashf(Server->openFile(os_file_prefix(hash_src), MODE_READ_SEQUENTIAL)); + std::unique_ptr hashf(Server->openFile(os_file_prefix(hash_src), MODE_READ_SEQUENTIAL)); if(hashf.get()) { copyFile(hashf.get(), hash_dest, NULL); @@ -700,7 +700,7 @@ bool BackupServerHash::findFileAndLink(const std::string &tfn, IFile *tf, std::s if(!existing_file.hashpath.empty()) { - std::auto_ptr ctf_hash(Server->openFile(os_file_prefix(existing_file.hashpath), MODE_READ)); + std::unique_ptr ctf_hash(Server->openFile(os_file_prefix(existing_file.hashpath), MODE_READ)); bool write_metadata = true; @@ -769,7 +769,7 @@ bool BackupServerHash::findFileAndLink(const std::string &tfn, IFile *tf, std::s if(!hashoutput_fn.empty()) { - std::auto_ptr src(Server->openFile(os_file_prefix(hashoutput_fn), MODE_READ)); + std::unique_ptr src(Server->openFile(os_file_prefix(hashoutput_fn), MODE_READ)); if(src.get()!=NULL) { if(!copyFile(src.get(), hash_fn, NULL)) @@ -797,7 +797,7 @@ bool BackupServerHash::findFileAndLink(const std::string &tfn, IFile *tf, std::s } else if(!existing_file.hashpath.empty()) { - std::auto_ptr ctf(Server->openFile(os_file_prefix(existing_file.hashpath), MODE_READ)); + std::unique_ptr ctf(Server->openFile(os_file_prefix(existing_file.hashpath), MODE_READ)); if(ctf.get()!=NULL) { int64 hashfilesize = read_hashdata_size(ctf.get()); @@ -1256,7 +1256,7 @@ bool BackupServerHash::copyFile(IFile *tf, const std::string &dest, ExtentIterat ServerLogger::Log(logid, "HT: Copying file to \""+dest+"\"", LL_DEBUG); std::string errstr; - std::auto_ptr dst(openFileRetry(dest, MODE_WRITE, errstr)); + std::unique_ptr dst(openFileRetry(dest, MODE_WRITE, errstr)); if (dst.get() == NULL) { ServerLogger::Log(logid, "Error opening dest file \"" + dest + "\". " + errstr, LL_ERROR); @@ -1623,7 +1623,7 @@ bool BackupServerHash::replaceFile(IFile *tf, const std::string &dest, const std ServerLogger::Log(logid, "HT: Copying with reflink data from \""+orig_fn+"\"", LL_DEBUG); std::string errstr; - std::auto_ptr dst(openFileRetry(dest, MODE_RW, errstr)); + std::unique_ptr dst(openFileRetry(dest, MODE_RW, errstr)); if (dst.get() == NULL) { ServerLogger::Log(logid, "Error opening destination file at \"" + dest + "\". " + errstr, LL_ERROR); diff --git a/urbackupserver/server_prepare_hash.cpp b/urbackupserver/server_prepare_hash.cpp index e0f0506d..06d4217d 100644 --- a/urbackupserver/server_prepare_hash.cpp +++ b/urbackupserver/server_prepare_hash.cpp @@ -166,7 +166,7 @@ void BackupServerPrepareHash::operator()(void) } else { - std::auto_ptr extent_iterator; + std::unique_ptr extent_iterator; if (!sparse_extents_fn.empty()) { IFile* sparse_extents_f = Server->openFile(sparse_extents_fn, MODE_READ); @@ -216,7 +216,7 @@ void BackupServerPrepareHash::operator()(void) } else { - std::auto_ptr l_hashoutput_f(Server->openFile(os_file_prefix(hashoutput_fn), MODE_READ)); + std::unique_ptr l_hashoutput_f(Server->openFile(os_file_prefix(hashoutput_fn), MODE_READ)); hashoutput_f = l_hashoutput_f.get(); TreeHash treehash(NULL); hashf = &treehash; diff --git a/urbackupserver/server_settings.cpp b/urbackupserver/server_settings.cpp index 4ceab7f7..82177c3b 100644 --- a/urbackupserver/server_settings.cpp +++ b/urbackupserver/server_settings.cpp @@ -111,8 +111,8 @@ ServerSettings::ServerSettings(IDatabase *db, int pClientid) } } -void ServerSettings::createSettingsReaders(IDatabase* db, int clientid, std::auto_ptr& settings_default, - std::auto_ptr& settings_client, std::auto_ptr& settings_global, +void ServerSettings::createSettingsReaders(IDatabase* db, int clientid, std::unique_ptr& settings_default, + std::unique_ptr& settings_client, std::unique_ptr& settings_global, int& settings_default_id) { settings_client.reset(Server->createDBMemSettingsReader(db, "settings", "SELECT key,value FROM settings_db.settings WHERE clientid=" + convert(clientid))); @@ -1051,7 +1051,7 @@ std::string ServerSettings::getImageFileFormatInt( const std::string& image_file void ServerSettings::readStringClientSetting(IDatabase * db, int clientid, const std::string & name, const std::string & merge_sep, std::string * output, bool allow_client_value) { - std::auto_ptr settings_client, settings_default, settings_global; + std::unique_ptr settings_client, settings_default, settings_global; int setting_default_id; createSettingsReaders(db, clientid, settings_default, settings_client, settings_global, setting_default_id); @@ -1243,7 +1243,7 @@ void ServerSettings::readSettings() local_settings = new SSettings(); local_settings->refcount = 1; local_settings->clientid = clientid; - std::auto_ptr settings_client, settings_default, settings_global; + std::unique_ptr settings_client, settings_default, settings_global; int settings_default_id; IQuery* q_get_client_setting = db->Prepare("SELECT value, value_client, use FROM settings_db.settings WHERE clientid=? AND key=?", false); @@ -1317,7 +1317,7 @@ bool ServerSettings::isInTimeSpan(std::vector bw) SLDAPSettings ServerSettings::getLDAPSettings() { - std::auto_ptr settings_client, settings_default, settings_global; + std::unique_ptr settings_client, settings_default, settings_global; int setting_default_id; createSettingsReaders(db, clientid, settings_default, settings_client, settings_global, setting_default_id); SLDAPSettings ldap_settings; diff --git a/urbackupserver/server_settings.h b/urbackupserver/server_settings.h index 9d78c9c1..a64c3893 100644 --- a/urbackupserver/server_settings.h +++ b/urbackupserver/server_settings.h @@ -255,8 +255,8 @@ public: std::string ldapMapToString(const std::map& ldap_map); - static void createSettingsReaders(IDatabase* db, int clientid, std::auto_ptr& settings_default, - std::auto_ptr& settings_client, std::auto_ptr& settings_global, int& settings_default_id); + static void createSettingsReaders(IDatabase* db, int clientid, std::unique_ptr& settings_default, + std::unique_ptr& settings_client, std::unique_ptr& settings_global, int& settings_default_id); std::string getImageFileFormatInt(const std::string& image_file_format); diff --git a/urbackupserver/server_update.cpp b/urbackupserver/server_update.cpp index 447dc3f9..656c9933 100644 --- a/urbackupserver/server_update.cpp +++ b/urbackupserver/server_update.cpp @@ -100,7 +100,7 @@ void ServerUpdate::update_client() bool dl_ok = true; - std::auto_ptr sig_file(Server->openFile("urbackup/" + curr.basename + ".sig2.new", MODE_WRITE)); + std::unique_ptr sig_file(Server->openFile("urbackup/" + curr.basename + ".sig2.new", MODE_WRITE)); if (sig_file.get() == NULL) { Server->Log("Error opening signature output file urbackup/" + curr.basename + ".sig2.new", LL_ERROR); @@ -119,7 +119,7 @@ void ServerUpdate::update_client() { Server->Log("Downloading old signature...", LL_INFO); - std::auto_ptr old_sig_file(Server->openFile("urbackup/" + curr.basename + ".sig.new", MODE_WRITE)); + std::unique_ptr old_sig_file(Server->openFile("urbackup/" + curr.basename + ".sig.new", MODE_WRITE)); if (old_sig_file.get() == NULL) { Server->Log("Error opening signature output file urbackup/" + curr.basename + ".sig.new", LL_ERROR); @@ -141,7 +141,7 @@ void ServerUpdate::update_client() Server->Log("Getting update file URL...", LL_INFO); std::string update_url = url_fak->downloadString(curr_update_url + curr.basename + ".url", http_proxy, &errmsg); - std::auto_ptr update_file; + std::unique_ptr update_file; if (update_url.empty()) { @@ -225,7 +225,7 @@ void ServerUpdate::update_server_version_info() std::string errmsg; Server->Log("Downloading server version info...", LL_INFO); - std::auto_ptr server_version_info(Server->openFile("urbackup/server_version_info.properties.new", MODE_WRITE)); + std::unique_ptr server_version_info(Server->openFile("urbackup/server_version_info.properties.new", MODE_WRITE)); if(!server_version_info.get()) { @@ -265,7 +265,7 @@ void ServerUpdate::update_dataplan_db() std::string errmsg; Server->Log("Downloading dataplan database...", LL_INFO); - std::auto_ptr dataplan_db(Server->openFile("urbackup/dataplan_db.txt.new", MODE_WRITE)); + std::unique_ptr dataplan_db(Server->openFile("urbackup/dataplan_db.txt.new", MODE_WRITE)); if (!dataplan_db.get()) { Server->Log("Error opening urbackup/dataplan_db.txt.new for writing", LL_ERROR); diff --git a/urbackupserver/server_update_stats.h b/urbackupserver/server_update_stats.h index 16d1caf3..a9feb96c 100644 --- a/urbackupserver/server_update_stats.h +++ b/urbackupserver/server_update_stats.h @@ -65,6 +65,6 @@ private: size_t num_updated_files; - std::auto_ptr backupdao; - std::auto_ptr fileindex; + std::unique_ptr backupdao; + std::unique_ptr fileindex; }; \ No newline at end of file diff --git a/urbackupserver/serverinterface/backups.cpp b/urbackupserver/serverinterface/backups.cpp index 37c365fd..407713fc 100644 --- a/urbackupserver/serverinterface/backups.cpp +++ b/urbackupserver/serverinterface/backups.cpp @@ -384,7 +384,7 @@ namespace backupaccess return STokens(); } - std::auto_ptr backup_tokens(Server->createFileSettingsReader(backupfolder+os_file_sep()+clientname+os_file_sep()+path+os_file_sep()+".hashes"+os_file_sep()+".urbackup_tokens.properties")); + std::unique_ptr backup_tokens(Server->createFileSettingsReader(backupfolder+os_file_sep()+clientname+os_file_sep()+path+os_file_sep()+".hashes"+os_file_sep()+".urbackup_tokens.properties")); if(!backup_tokens.get()) { @@ -829,7 +829,7 @@ namespace backupaccess } else { - std::auto_ptr f; + std::unique_ptr f; if(path_info.is_file) { @@ -960,7 +960,7 @@ namespace backupaccess std::string extension = findextension(filename); bool disk_image = false; - std::auto_ptr mbrfile(Server->openFile(os_file_prefix(path + ".mbr"), MODE_READ)); + std::unique_ptr mbrfile(Server->openFile(os_file_prefix(path + ".mbr"), MODE_READ)); if (mbrfile.get() && mbrfile->Size()<10*1024*1024) { std::string mbrdata_header = mbrfile->Read(0LL, 2); @@ -997,7 +997,7 @@ namespace backupaccess } } - std::auto_ptr vhdfile; + std::unique_ptr vhdfile; if (extension == "vhd" || extension == "vhdz") { diff --git a/urbackupserver/serverinterface/create_zip.cpp b/urbackupserver/serverinterface/create_zip.cpp index 79351c9e..95e679f1 100644 --- a/urbackupserver/serverinterface/create_zip.cpp +++ b/urbackupserver/serverinterface/create_zip.cpp @@ -279,7 +279,7 @@ bool add_dir(mz_zip_archive& zip_archive, const std::string& archivefoldername, } else { - std::auto_ptr add_file(Server->openFile(os_file_prefix(filename), MODE_READ_SEQUENTIAL)); + std::unique_ptr add_file(Server->openFile(os_file_prefix(filename), MODE_READ_SEQUENTIAL)); if (add_file.get() == NULL) { Server->Log("Error opening file \"" + filename + "\" for ZIP file download. " + os_last_error_str(), LL_ERROR); diff --git a/urbackupserver/serverinterface/settings.cpp b/urbackupserver/serverinterface/settings.cpp index 6f2e1b51..2ab6080a 100644 --- a/urbackupserver/serverinterface/settings.cpp +++ b/urbackupserver/serverinterface/settings.cpp @@ -151,7 +151,7 @@ JSON::Object getJSONClientSettings(IDatabase *db, int t_clientid) } ServerSettings settings_group(db, group_id); - std::auto_ptr settings_def; + std::unique_ptr settings_def; if (t_clientid == 0) { @@ -322,7 +322,7 @@ void addNextArchival(IDatabase* db, int clientid, JSON::Object& obj) void getGeneralSettings(JSON::Object& obj, IDatabase *db, ServerSettings &settings) { - std::auto_ptr settings_db(Server->createDBSettingsReader(db, "settings_db.settings", + std::unique_ptr settings_db(Server->createDBSettingsReader(db, "settings_db.settings", "SELECT value FROM settings_db.settings WHERE key=? AND clientid=0")); #define SET_SETTING(x) obj.set(#x, settings.getSettings()->x); #define SET_SETTING_DB(x, def) obj.set(#x, settings_db->getValue(#x, (def))) diff --git a/urbackupserver/serverinterface/status.cpp b/urbackupserver/serverinterface/status.cpp index 0384ffcb..42216402 100644 --- a/urbackupserver/serverinterface/status.cpp +++ b/urbackupserver/serverinterface/status.cpp @@ -90,7 +90,7 @@ std::string get_stop_show_version(IDatabase *db) void set_server_version_info(IDatabase* db, JSON::Object& ret) { - std::auto_ptr infoProperties(Server->createFileSettingsReader("urbackup/server_version_info.properties")); + std::unique_ptr infoProperties(Server->createFileSettingsReader("urbackup/server_version_info.properties")); if(infoProperties.get()) { diff --git a/urbackupserver/serverinterface/status_check.cpp b/urbackupserver/serverinterface/status_check.cpp index a097ddc4..cbdea3cc 100644 --- a/urbackupserver/serverinterface/status_check.cpp +++ b/urbackupserver/serverinterface/status_check.cpp @@ -284,7 +284,7 @@ namespace std::string test3_path = testfolderpath + os_file_sep() + "CON"; - std::auto_ptr test_file(Server->openFile(test3_path, MODE_WRITE)); + std::unique_ptr test_file(Server->openFile(test3_path, MODE_WRITE)); if (test_file.get() == NULL) { @@ -339,7 +339,7 @@ namespace tmpfile_path = server_settings->backupfolder + os_file_sep() + "urbackup_tmp_files"; } - std::auto_ptr tmp_f(ClientMain::getTemporaryFileRetry(use_tmpfiles, tmpfile_path, logid_t())); + std::unique_ptr tmp_f(ClientMain::getTemporaryFileRetry(use_tmpfiles, tmpfile_path, logid_t())); if (tmp_f.get() == NULL) { diff --git a/urbackupserver/serverinterface/usage.cpp b/urbackupserver/serverinterface/usage.cpp index a019eb84..6b03c4ad 100644 --- a/urbackupserver/serverinterface/usage.cpp +++ b/urbackupserver/serverinterface/usage.cpp @@ -61,7 +61,7 @@ namespace IDatabase* files_db = Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER_FILES); ServerFilesDao filesdao(files_db); - std::auto_ptr fileindex(create_lmdb_files_index()); + std::unique_ptr fileindex(create_lmdb_files_index()); fileindex->start_transaction(); fileindex->start_iteration(); diff --git a/urbackupserver/verify_hashes.cpp b/urbackupserver/verify_hashes.cpp index 19d9beb8..3e8eede6 100644 --- a/urbackupserver/verify_hashes.cpp +++ b/urbackupserver/verify_hashes.cpp @@ -126,7 +126,7 @@ private: bool verify_file(db_single_result &res, _i64 &curr_verified, _i64 verify_size, bool& missing, const std::string& backuppath) { std::string fp=res["fullpath"]; - std::auto_ptr f(Server->openFile(os_file_prefix(fp), MODE_READ)); + std::unique_ptr f(Server->openFile(os_file_prefix(fp), MODE_READ)); if( f.get()==NULL ) { std::cout << std::endl; @@ -477,7 +477,7 @@ bool verify_hashes(std::string arg) { files_db = Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER_FILES); ServerFilesDao backupdao(files_db); - std::auto_ptr fileindex(create_lmdb_files_index()); + std::unique_ptr fileindex(create_lmdb_files_index()); if(fileindex.get()==NULL) {