Changeset 2696
- Timestamp:
- 06/06/2010 16:12:20 (2 years ago)
- Location:
- box/trunk
- Files:
-
- 6 edited
-
bin/bbackupd/BackupClientContext.cpp (modified) (1 diff)
-
bin/bbackupd/BackupClientContext.h (modified) (2 diffs)
-
bin/bbackupd/BackupDaemon.cpp (modified) (1 diff)
-
lib/backupclient/BackupDaemonConfigVerify.cpp (modified) (1 diff)
-
lib/common/Configuration.cpp (modified) (2 diffs)
-
lib/common/Configuration.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientContext.cpp
r2300 r2696 46 46 const std::string &rHostname, 47 47 int Port, 48 int32_t AccountNumber,48 uint32_t AccountNumber, 49 49 bool ExtendedLogging, 50 50 bool ExtendedLogToFile, -
box/trunk/bin/bbackupd/BackupClientContext.h
r2414 r2696 46 46 const std::string &rHostname, 47 47 int32_t Port, 48 int32_t AccountNumber,48 uint32_t AccountNumber, 49 49 bool ExtendedLogging, 50 50 bool ExtendedLogToFile, … … 214 214 std::string mHostname; 215 215 int mPort; 216 int32_t mAccountNumber;216 uint32_t mAccountNumber; 217 217 SocketStreamTLS *mpSocket; 218 218 BackupProtocolClient *mpConnection; -
box/trunk/bin/bbackupd/BackupDaemon.cpp
r2632 r2696 744 744 conf.GetKeyValue("StoreHostname"), 745 745 conf.GetKeyValueInt("StorePort"), 746 conf.GetKeyValue Int("AccountNumber"),746 conf.GetKeyValueUint32("AccountNumber"), 747 747 conf.GetKeyValueBool("ExtendedLogging"), 748 748 conf.KeyExists("ExtendedLogFile"), -
box/trunk/lib/backupclient/BackupDaemonConfigVerify.cpp
r2302 r2696 66 66 { 67 67 ConfigurationVerifyKey("AccountNumber", 68 ConfigTest_Exists | ConfigTest_Is Int),68 ConfigTest_Exists | ConfigTest_IsUint32), 69 69 ConfigurationVerifyKey("UpdateStoreInterval", 70 70 ConfigTest_Exists | ConfigTest_IsInt), -
box/trunk/lib/common/Configuration.cpp
r2493 r2696 454 454 else 455 455 { 456 long value = ::strtol((i->second).c_str(), NULL, 0 /* C style handling */); 456 long value = ::strtol((i->second).c_str(), NULL, 457 0 /* C style handling */); 457 458 if(value == LONG_MAX || value == LONG_MIN) 459 { 460 THROW_EXCEPTION(CommonException, ConfigBadIntValue) 461 } 462 return (int)value; 463 } 464 } 465 466 467 // -------------------------------------------------------------------------- 468 // 469 // Function 470 // Name: Configuration::GetKeyValueUint32(const std::string& rKeyName) 471 // Purpose: Gets a key value as a 32-bit unsigned integer 472 // Created: 2003/07/23 473 // 474 // -------------------------------------------------------------------------- 475 uint32_t Configuration::GetKeyValueUint32(const std::string& rKeyName) const 476 { 477 std::map<std::string, std::string>::const_iterator i(mKeys.find(rKeyName)); 478 479 if(i == mKeys.end()) 480 { 481 THROW_EXCEPTION(CommonException, ConfigNoKey) 482 } 483 else 484 { 485 errno = 0; 486 long value = ::strtoul((i->second).c_str(), NULL, 487 0 /* C style handling */); 488 if(errno != 0) 458 489 { 459 490 THROW_EXCEPTION(CommonException, ConfigBadIntValue) … … 681 712 } 682 713 } 714 715 // Check it's a number? 716 if(pvkey->Flags() & ConfigTest_IsUint32) 717 { 718 // Test it... 719 char *end; 720 errno = 0; 721 uint32_t r = ::strtoul(val, &end, 0); 722 if(errno != 0 || end != (val + rval.size())) 723 { 724 // not a good value 725 ok = false; 726 rErrorMsg += rLevel + mName + "." + pvkey->Name() + " (key) is not a valid unsigned 32-bit integer.\n"; 727 } 728 } 683 729 684 730 // Check it's a bool? -
box/trunk/lib/common/Configuration.h
r2251 r2696 23 23 ConfigTest_Exists = 2, 24 24 ConfigTest_IsInt = 4, 25 ConfigTest_MultiValueAllowed = 8, 26 ConfigTest_IsBool = 16 25 ConfigTest_IsUint32 = 8, 26 ConfigTest_MultiValueAllowed = 16, 27 ConfigTest_IsBool = 32 27 28 }; 28 29 … … 113 114 const std::string &GetKeyValue(const std::string& rKeyName) const; 114 115 int GetKeyValueInt(const std::string& rKeyName) const; 116 uint32_t GetKeyValueUint32(const std::string& rKeyName) const; 115 117 bool GetKeyValueBool(const std::string& rKeyName) const; 116 118 std::vector<std::string> GetKeyNames() const;
Note: See TracChangeset
for help on using the changeset viewer.
