From c8af9906b692de24dbf1b03c563d85fa85d3a4dc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 22 Aug 2013 00:17:34 +0000 Subject: Pass std::auto_ptr objects to Protocol for upload. Passing raw pointers is bad C++ style, and dangerous, because Protocol will free the passed-in pointers after uploading them, so we should not keep using them. Reduce code duplication in BackupClientDirectoryRecord patch/normal upload. Return a std::auto_ptr instead of a std::auto_ptr from BackupStoreFile::EncodeFile* functions. --- lib/backupstore/BackupStoreFile.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/backupstore/BackupStoreFile.h') diff --git a/lib/backupstore/BackupStoreFile.h b/lib/backupstore/BackupStoreFile.h index e24ff8cb..7c72e010 100644 --- a/lib/backupstore/BackupStoreFile.h +++ b/lib/backupstore/BackupStoreFile.h @@ -60,6 +60,8 @@ public: virtual bool IsManaged() = 0; }; +class BackupStoreFileEncodeStream; + // -------------------------------------------------------------------------- // // Class @@ -119,7 +121,7 @@ public: // Main interface - static std::auto_ptr EncodeFile + static std::auto_ptr EncodeFile ( const std::string& Filename, int64_t ContainerID, const BackupStoreFilename &rStoreFilename, @@ -127,7 +129,7 @@ public: ReadLoggingStream::Logger* pLogger = NULL, RunStatusProvider* pRunStatusProvider = NULL ); - static std::auto_ptr EncodeFileDiff + static std::auto_ptr EncodeFileDiff ( const std::string& Filename, int64_t ContainerID, const BackupStoreFilename &rStoreFilename, -- cgit v1.2.3