Changeset 2604
- Timestamp:
- 10/02/2010 19:01:12 (2 years ago)
- Location:
- box/trunk
- Files:
-
- 4 edited
-
bin/bbackupquery/bbackupquery.cpp (modified) (5 diffs)
-
lib/backupclient/BackupClientFileAttributes.cpp (modified) (5 diffs)
-
lib/common/Logging.cpp (modified) (1 diff)
-
lib/common/Logging.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupquery/bbackupquery.cpp
r2493 r2604 61 61 void PrintUsageAndExit() 62 62 { 63 printf("Usage: bbackupquery [-q ] [-w] "63 printf("Usage: bbackupquery [-q*|v*|V|W<level>] [-w] " 64 64 #ifdef WIN32 65 65 "[-u] " … … 124 124 125 125 #ifdef WIN32 126 const char* validOpts = "qv wuc:l:o:O:W:";126 const char* validOpts = "qvVwuc:l:o:O:W:"; 127 127 bool unicodeConsole = false; 128 128 #else 129 const char* validOpts = "qv wc:l:o:O:W:";129 const char* validOpts = "qvVwc:l:o:O:W:"; 130 130 #endif 131 131 … … 139 139 switch(c) 140 140 { 141 case 'q':141 case 'q': 142 142 { 143 143 if(masterLevel == Log::NOTHING) … … 152 152 break; 153 153 154 case 'v':154 case 'v': 155 155 { 156 156 if(masterLevel == Log::EVERYTHING) … … 162 162 } 163 163 masterLevel++; 164 } 165 break; 166 167 case 'V': 168 { 169 masterLevel = Log::EVERYTHING; 164 170 } 165 171 break; -
box/trunk/lib/backupclient/BackupClientFileAttributes.cpp
r2493 r2604 235 235 if(mpClearAttributes->GetSize() != rAttr.mpClearAttributes->GetSize()) 236 236 { 237 BOX_TRACE("Attribute Compare: Attributes objects are " 238 "different sizes, cannot compare them: local " << 239 mpClearAttributes->GetSize() << " bytes, remote " << 240 rAttr.mpClearAttributes->GetSize() << " bytes"); 237 241 return false; 238 242 } … … 242 246 attr_StreamFormat *a1 = (attr_StreamFormat*)mpClearAttributes->GetBuffer(); 243 247 attr_StreamFormat *a2 = (attr_StreamFormat*)rAttr.mpClearAttributes->GetBuffer(); 244 245 if(a1->AttributeType != a2->AttributeType 246 || a1->UID != a2->UID 247 || a1->GID != a2->GID 248 || a1->UserDefinedFlags != a2->UserDefinedFlags 249 || a1->Mode != a2->Mode) 250 { 251 return false; 252 } 248 249 #define COMPARE(attribute, message) \ 250 if (a1->attribute != a2->attribute) \ 251 { \ 252 BOX_TRACE("Attribute Compare: " << message << " differ: " \ 253 "local " << a1->attribute << ", " \ 254 "remote " << a2->attribute); \ 255 return false; \ 256 } 257 COMPARE(AttributeType, "Attribute types"); 258 COMPARE(UID, "UIDs"); 259 COMPARE(GID, "GIDs"); 260 COMPARE(UserDefinedFlags, "User-defined flags"); 261 COMPARE(Mode, "Modes"); 253 262 254 263 if(!IgnoreModTime) … … 258 267 if(t1 != t2) 259 268 { 269 BOX_TRACE("Attribute Compare: File modification " 270 "times differ: local " << t1 << ", " 271 "remote " << t2); 260 272 return false; 261 273 } … … 268 280 if(t1 != t2) 269 281 { 282 BOX_TRACE("Attribute Compare: Attribute modification " 283 "times differ: local " << t1 << ", " 284 "remote " << t2); 270 285 return false; 271 286 } … … 277 292 { 278 293 // Symlink strings don't match. This also compares xattrs 279 if(::memcmp(a1 + 1, a2 + 1, size - sizeof(attr_StreamFormat)) != 0) 280 { 294 int datalen = size - sizeof(attr_StreamFormat); 295 296 if(::memcmp(a1 + 1, a2 + 1, datalen) != 0) 297 { 298 std::string s1((char *)(a1 + 1), datalen); 299 std::string s2((char *)(a2 + 1), datalen); 300 BOX_TRACE("Attribute Compare: Symbolic link target " 301 "or extended attributes differ: " 302 "local " << PrintEscapedBinaryData(s1) << ", " 303 "remote " << PrintEscapedBinaryData(s2)); 281 304 return false; 282 305 } -
box/trunk/lib/common/Logging.cpp
r2546 r2604 496 496 return true; 497 497 } 498 499 std::string PrintEscapedBinaryData(const std::string& rInput) 500 { 501 std::ostringstream output; 502 503 for (size_t i = 0; i < rInput.length(); i++) 504 { 505 if (isprint(rInput[i])) 506 { 507 output << rInput[i]; 508 } 509 else 510 { 511 output << "\\x" << std::hex << std::setw(2) << 512 std::setfill('0') << (int) rInput[i] << 513 std::dec; 514 } 515 } 516 517 return output.str(); 518 } -
box/trunk/lib/common/Logging.h
r2544 r2604 18 18 19 19 #include "FileStream.h" 20 21 /*22 #define BOX_LOG(level, stuff) \23 { \24 if(Log::sMaxLoggingLevelForAnyOutput >= level) \25 std::ostringstream line; \26 line << stuff; \27 Log::Write(level, __FILE__, __LINE__, line.str()); \28 } \29 }30 */31 20 32 21 #define BOX_LOG(level, stuff) \ … … 53 42 { BOX_LOG(Log::TRACE, stuff) } 54 43 44 #define BOX_SYS_ERROR(stuff) \ 45 stuff << ": " << std::strerror(errno) << " (" << errno << ")" 46 55 47 #define BOX_LOG_SYS_WARNING(stuff) \ 56 BOX_WARNING( stuff << ": " << std::strerror(errno) << " (" << errno << ")")48 BOX_WARNING(BOX_SYS_ERROR(stuff)) 57 49 #define BOX_LOG_SYS_ERROR(stuff) \ 58 BOX_ERROR( stuff << ": " << std::strerror(errno) << " (" << errno << ")")50 BOX_ERROR(BOX_SYS_ERROR(stuff)) 59 51 #define BOX_LOG_SYS_FATAL(stuff) \ 60 BOX_FATAL(stuff << ": " << std::strerror(errno) << " (" << errno << ")") 52 BOX_FATAL(BOX_SYS_ERROR(stuff)) 53 54 #define LOG_AND_THROW_ERROR(message, filename, exception, subtype) \ 55 BOX_LOG_SYS_ERROR(message << ": " << filename); \ 56 THROW_EXCEPTION_MESSAGE(exception, subtype, \ 57 BOX_SYS_ERROR(message << ": " << filename)); 61 58 62 59 inline std::string GetNativeErrorMessage() … … 340 337 }; 341 338 339 std::string PrintEscapedBinaryData(const std::string& rInput); 340 342 341 #endif // LOGGING__H
Note: See TracChangeset
for help on using the changeset viewer.
