Changeset 2182


Ignore:
Timestamp:
28/05/2008 16:25:59 (4 years ago)
Author:
chris
Message:

Use symbolic names instead of #defines for return codes.

Location:
box/trunk/bin/bbackupquery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupquery/BackupQueries.cpp

    r2158 r2182  
    123123                        BOX_WARNING("System command returned error code " << 
    124124                                result); 
    125                         SetReturnCode(COMMAND_RETURN_ERROR); 
     125                        SetReturnCode(ReturnCode::Command_Error); 
    126126                } 
    127127                return; 
     
    296296        { 
    297297                // If not a quit command, set the return code to zero 
    298                 SetReturnCode(0); 
     298                SetReturnCode(ReturnCode::Command_OK); 
    299299        } 
    300300 
     
    411411                        BOX_ERROR("Directory '" << args[0] << "' not found " 
    412412                                "on store."); 
    413                         SetReturnCode(COMMAND_RETURN_ERROR); 
     413                        SetReturnCode(ReturnCode::Command_Error); 
    414414                        return; 
    415415                } 
     
    449449        { 
    450450                BOX_ERROR("Failed to list directory: " << e.what()); 
    451                 SetReturnCode(COMMAND_RETURN_ERROR); 
     451                SetReturnCode(ReturnCode::Command_Error); 
    452452                return; 
    453453        } 
     
    455455        { 
    456456                BOX_ERROR("Failed to list directory: unknown error"); 
    457                 SetReturnCode(COMMAND_RETURN_ERROR); 
     457                SetReturnCode(ReturnCode::Command_Error); 
    458458                return; 
    459459        } 
     
    774774        { 
    775775                BOX_ERROR("Incorrect usage. cd [-o] [-d] <directory>"); 
    776                 SetReturnCode(COMMAND_RETURN_ERROR); 
     776                SetReturnCode(ReturnCode::Command_Error); 
    777777                return; 
    778778        } 
     
    792792        { 
    793793                BOX_ERROR("Directory '" << args[0] << "' not found."); 
    794                 SetReturnCode(COMMAND_RETURN_ERROR); 
     794                SetReturnCode(ReturnCode::Command_Error); 
    795795                return; 
    796796        } 
     
    814814        { 
    815815                BOX_ERROR("Incorrect usage. lcd <local-directory>"); 
    816                 SetReturnCode(COMMAND_RETURN_ERROR); 
     816                SetReturnCode(ReturnCode::Command_Error); 
    817817                return; 
    818818        } 
     
    824824        { 
    825825                BOX_ERROR("Failed to convert path from console encoding."); 
    826                 SetReturnCode(COMMAND_RETURN_ERROR); 
     826                SetReturnCode(ReturnCode::Command_Error); 
    827827                return; 
    828828        } 
     
    843843                } 
    844844 
    845                 SetReturnCode(COMMAND_RETURN_ERROR); 
     845                SetReturnCode(ReturnCode::Command_Error); 
    846846                return; 
    847847        } 
     
    852852        { 
    853853                BOX_LOG_SYS_ERROR("Error getting current directory"); 
    854                 SetReturnCode(COMMAND_RETURN_ERROR); 
     854                SetReturnCode(ReturnCode::Command_Error); 
    855855                return; 
    856856        } 
     
    860860        { 
    861861                BOX_ERROR("Failed to convert new path from console encoding."); 
    862                 SetReturnCode(COMMAND_RETURN_ERROR); 
     862                SetReturnCode(ReturnCode::Command_Error); 
    863863                return; 
    864864        } 
     
    10701070                BOX_ERROR("The local file " << localName << " already exists, " 
    10711071                        "will not overwrite it."); 
    1072                 SetReturnCode(COMMAND_RETURN_ERROR); 
     1072                SetReturnCode(ReturnCode::Command_Error); 
    10731073                return; 
    10741074        } 
     
    12691269                if (params.mUncheckedFiles != 0) 
    12701270                { 
    1271                         SetReturnCode(COMPARE_RETURN_ERROR); 
     1271                        SetReturnCode(ReturnCode::Compare_Error); 
    12721272                }  
    12731273                else if (params.mDifferences != 0) 
    12741274                { 
    1275                         SetReturnCode(COMPARE_RETURN_DIFFERENT); 
     1275                        SetReturnCode(ReturnCode::Compare_Different); 
    12761276                } 
    12771277                else 
    12781278                { 
    1279                         SetReturnCode(COMPARE_RETURN_SAME); 
     1279                        SetReturnCode(ReturnCode::Compare_Same); 
    12801280                } 
    12811281        } 
     
    20562056        { 
    20572057                BOX_ERROR("Failed to restore: " << e.what()); 
    2058                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2058                SetReturnCode(ReturnCode::Command_Error); 
    20592059                return; 
    20602060        } 
     
    20622062        { 
    20632063                BOX_ERROR("Failed to restore: unknown exception"); 
    2064                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2064                SetReturnCode(ReturnCode::Command_Error); 
    20652065                return; 
    20662066        } 
     
    20802080                BOX_ERROR("Resume possible -- repeat command with -r flag " 
    20812081                        "to resume."); 
    2082                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2082                SetReturnCode(ReturnCode::Command_Error); 
    20832083                break; 
    20842084         
     
    20862086                BOX_ERROR("The target directory exists. You cannot restore " 
    20872087                        "over an existing directory."); 
    2088                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2088                SetReturnCode(ReturnCode::Command_Error); 
    20892089                break; 
    20902090                 
     
    20932093                        "To restore to a directory whose parent " 
    20942094                        "does not exist, create the parent first."); 
    2095                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2095                SetReturnCode(ReturnCode::Command_Error); 
    20962096                break; 
    20972097 
    20982098        case Restore_UnknownError: 
    20992099                BOX_ERROR("Unknown error during restore."); 
    2100                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2100                SetReturnCode(ReturnCode::Command_Error); 
    21012101                break; 
    21022102 
    21032103        default: 
    21042104                BOX_ERROR("Unknown restore result " << result << "."); 
    2105                 SetReturnCode(COMMAND_RETURN_ERROR); 
     2105                SetReturnCode(ReturnCode::Command_Error); 
    21062106                break; 
    21072107        } 
  • box/trunk/bin/bbackupquery/BackupQueries.h

    r1487 r2182  
    8080                box_time_t mLatestFileUploadTime; 
    8181        }; 
    82         void CompareLocation(const std::string &rLocation, CompareParams &rParams); 
    83         void Compare(const std::string &rStoreDir, const std::string &rLocalDir, CompareParams &rParams); 
    84         void Compare(int64_t DirID, const std::string &rStoreDir, const std::string &rLocalDir, CompareParams &rParams); 
     82        void CompareLocation(const std::string &rLocation, 
     83                CompareParams &rParams); 
     84        void Compare(const std::string &rStoreDir, 
     85                const std::string &rLocalDir, CompareParams &rParams); 
     86        void Compare(int64_t DirID, const std::string &rStoreDir, 
     87                const std::string &rLocalDir, CompareParams &rParams); 
     88 
     89public: 
     90 
     91        class ReturnCode 
     92        { 
     93                public: 
     94                enum { 
     95                        Command_OK = 0, 
     96                        Compare_Same = 1, 
     97                        Compare_Different, 
     98                        Compare_Error, 
     99                        Command_Error, 
     100                } Type; 
     101        }; 
     102 
     103private: 
    85104 
    86105        // Utility functions 
Note: See TracChangeset for help on using the changeset viewer.