Changeset 2144


Ignore:
Timestamp:
09/04/2008 22:04:14 (4 years ago)
Author:
chris
Message:

Reformat long lines in BackupClientRestore?.cpp for readability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupClientRestore.cpp

    r2127 r2144  
    203203// 
    204204// Function 
    205 //              Name:    BackupClientRestoreDir(BackupProtocolClient &, int64_t, const char *, bool) 
     205//              Name:    BackupClientRestoreDir(BackupProtocolClient &, 
     206//                       int64_t, const char *, bool) 
    206207//              Purpose: Restore a directory 
    207208//              Created: 23/11/03 
    208209// 
    209210// -------------------------------------------------------------------------- 
    210 static int BackupClientRestoreDir(BackupProtocolClient &rConnection, int64_t DirectoryID, std::string &rLocalDirectoryName, 
     211static int BackupClientRestoreDir(BackupProtocolClient &rConnection, 
     212        int64_t DirectoryID, std::string &rLocalDirectoryName, 
    211213        RestoreParams &Params, RestoreResumeInfo &rLevel) 
    212214{ 
    213         // If we're resuming... check that we haven't got a next level to look at 
     215        // If we're resuming... check that we haven't got a next level to 
     216        // look at 
    214217        if(rLevel.mpNextLevel != 0) 
    215218        { 
    216219                // Recurse immediately 
    217                 std::string localDirname(rLocalDirectoryName + DIRECTORY_SEPARATOR_ASCHAR + rLevel.mNextLevelLocalName); 
    218                 BackupClientRestoreDir(rConnection, rLevel.mNextLevelID, localDirname, Params, *rLevel.mpNextLevel); 
     220                std::string localDirname(rLocalDirectoryName +  
     221                        DIRECTORY_SEPARATOR_ASCHAR +  
     222                        rLevel.mNextLevelLocalName); 
     223                BackupClientRestoreDir(rConnection, rLevel.mNextLevelID, 
     224                        localDirname, Params, *rLevel.mpNextLevel); 
    219225                 
    220226                // Add it to the list of done itmes 
     
    260266                case ObjectExists_File: 
    261267                        { 
    262                                 // File exists with this name, which is fun. Get rid of it. 
     268                                // File exists with this name, which is fun. 
     269                                // Get rid of it. 
    263270                                BOX_WARNING("File present with name '" << 
    264                                         rLocalDirectoryName << "', removing " << 
     271                                        rLocalDirectoryName << "', removing " 
    265272                                        "out of the way of restored directory. " 
    266273                                        "Use specific restore with ID to " 
     
    407414        // list of files which is appropriate to the restore type 
    408415        rConnection.QueryListDirectory( 
    409                         DirectoryID, 
    410                         Params.RestoreDeleted?(BackupProtocolClientListDirectory::Flags_Deleted):(BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING), 
    411                         BackupProtocolClientListDirectory::Flags_OldVersion | (Params.RestoreDeleted?(0):(BackupProtocolClientListDirectory::Flags_Deleted)), 
    412                         true /* want attributes */); 
     416                DirectoryID, 
     417                Params.RestoreDeleted?(BackupProtocolClientListDirectory::Flags_Deleted):(BackupProtocolClientListDirectory::Flags_INCLUDE_EVERYTHING), 
     418                BackupProtocolClientListDirectory::Flags_OldVersion | (Params.RestoreDeleted?(0):(BackupProtocolClientListDirectory::Flags_Deleted)), 
     419                true /* want attributes */); 
    413420 
    414421        // Retrieve the directory from the stream following 
     
    444451                BackupStoreDirectory::Iterator i(dir); 
    445452                BackupStoreDirectory::Entry *en = 0; 
    446                 while((en = i.Next(BackupStoreDirectory::Entry::Flags_File)) != 0) 
     453                while((en = i.Next(BackupStoreDirectory::Entry::Flags_File)) 
     454                        != 0) 
    447455                { 
    448456                        // Check ID hasn't already been done 
    449                         if(rLevel.mRestoredObjects.find(en->GetObjectID()) == rLevel.mRestoredObjects.end()) 
     457                        if(rLevel.mRestoredObjects.find(en->GetObjectID()) 
     458                                == rLevel.mRestoredObjects.end()) 
    450459                        { 
    451460                                // Local name 
     
    458467                                // For resuming restores, we can't overwrite 
    459468                                // files already there. 
    460                                 if(ObjectExists(localFilename) != ObjectExists_NoObject && 
     469                                if(ObjectExists(localFilename) 
     470                                        != ObjectExists_NoObject && 
    461471                                        ::unlink(localFilename.c_str()) != 0) 
    462472                                { 
     
    550560                                { 
    551561                                        // File exists... 
    552                                         bytesWrittenSinceLastRestoreInfoSave += fileSize; 
     562                                        bytesWrittenSinceLastRestoreInfoSave 
     563                                                += fileSize; 
    553564                                         
    554565                                        if(bytesWrittenSinceLastRestoreInfoSave > MAX_BYTES_WRITTEN_BETWEEN_RESTORE_INFO_SAVES) 
    555566                                        { 
    556                                                 // Save the restore info, in case it's needed later 
     567                                                // Save the restore info, in 
     568                                                // case it's needed later 
    557569                                                try 
    558570                                                { 
     
    613625                BackupStoreDirectory::Iterator i(dir); 
    614626                BackupStoreDirectory::Entry *en = 0; 
    615                 while((en = i.Next(BackupStoreDirectory::Entry::Flags_Dir)) != 0) 
     627                while((en = i.Next(BackupStoreDirectory::Entry::Flags_Dir)) 
     628                        != 0) 
    616629                { 
    617630                        // Check ID hasn't already been done 
    618                         if(rLevel.mRestoredObjects.find(en->GetObjectID()) == rLevel.mRestoredObjects.end()) 
     631                        if(rLevel.mRestoredObjects.find(en->GetObjectID()) 
     632                                == rLevel.mRestoredObjects.end()) 
    619633                        { 
    620634                                // Local name 
    621635                                BackupStoreFilenameClear nm(en->GetName()); 
    622                                 std::string localDirname(rLocalDirectoryName + DIRECTORY_SEPARATOR_ASCHAR + nm.GetClearFilename()); 
     636                                std::string localDirname(rLocalDirectoryName 
     637                                        + DIRECTORY_SEPARATOR_ASCHAR 
     638                                        + nm.GetClearFilename()); 
    623639                                 
    624640                                // Add the level for the next entry 
    625                                 RestoreResumeInfo &rnextLevel(rLevel.AddLevel(en->GetObjectID(), nm.GetClearFilename())); 
     641                                RestoreResumeInfo &rnextLevel( 
     642                                        rLevel.AddLevel(en->GetObjectID(), 
     643                                                nm.GetClearFilename())); 
    626644                                 
    627645                                // Recurse 
     
    669687// 
    670688// Function 
    671 //              Name:    BackupClientRestore(BackupProtocolClient &, int64_t, const char *, bool, bool) 
    672 //              Purpose: Restore a directory on the server to a local directory on the disc. 
    673 // 
    674 //                               The local directory must not already exist. 
    675 // 
    676 //                               If a restore is aborted for any reason, then it may be resumed if 
    677 //                               Resume == true. If Resume == false and resumption is possible, then 
    678 //                               Restore_ResumePossible is returned. 
    679 // 
    680 //                               Set RestoreDeleted to restore a deleted directory. This may not give the 
    681 //                               directory structure when it was deleted, because files may have been deleted 
    682 //                               within it before it was deleted. 
    683 // 
    684 //                               Returns Restore_TargetExists if the target directory exists, but 
    685 //                               there is no restore possible. (Won't attempt to overwrite things.) 
    686 // 
    687 //                               Returns Restore_Complete on success. (Exceptions on error.) 
     689//              Name:    BackupClientRestore(BackupProtocolClient &, int64_t, 
     690//                       const char *, bool, bool) 
     691//              Purpose: Restore a directory on the server to a local 
     692//                       directory on the disc. The local directory must not 
     693//                       already exist. 
     694// 
     695//                       If a restore is aborted for any reason, then it may 
     696//                       be resumed if Resume == true. If Resume == false 
     697//                       and resumption is possible, then 
     698//                       Restore_ResumePossible is returned. 
     699// 
     700//                       Set RestoreDeleted to restore a deleted directory. 
     701//                       This may not give the directory structure when it 
     702//                       was deleted, because files may have been deleted 
     703//                       within it before it was deleted. 
     704// 
     705//                       Returns Restore_TargetExists if the target 
     706//                       directory exists, but there is no restore possible. 
     707//                       (Won't attempt to overwrite things.) 
     708// 
     709//                       Returns Restore_Complete on success. (Exceptions 
     710//                       on error.) 
    688711//              Created: 23/11/03 
    689712// 
    690713// -------------------------------------------------------------------------- 
    691 int BackupClientRestore(BackupProtocolClient &rConnection, int64_t DirectoryID, const char *LocalDirectoryName, 
    692         bool PrintDots, bool RestoreDeleted, bool UndeleteAfterRestoreDeleted, bool Resume) 
     714int BackupClientRestore(BackupProtocolClient &rConnection, 
     715        int64_t DirectoryID, const char *LocalDirectoryName, 
     716        bool PrintDots, bool RestoreDeleted, 
     717        bool UndeleteAfterRestoreDeleted, bool Resume) 
    693718{ 
    694719        // Parameter block 
     
    704729        // Does any resumption information exist? 
    705730        bool doingResume = false; 
    706         if(FileExists(params.mRestoreResumeInfoFilename.c_str()) && targetExistance == ObjectExists_Dir) 
     731        if(FileExists(params.mRestoreResumeInfoFilename.c_str()) && 
     732                targetExistance == ObjectExists_Dir) 
    707733        { 
    708734                if(!Resume) 
    709735                { 
    710                         // Caller didn't specify that resume should be done, so refuse to do it 
    711                         // but say why. 
     736                        // Caller didn't specify that resume should be done, 
     737                        // so refuse to do it but say why. 
    712738                        return Restore_ResumePossible; 
    713739                } 
     
    760786} 
    761787 
    762  
    763  
    764  
Note: See TracChangeset for help on using the changeset viewer.