Changeset 85285 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Jul 12, 2020 3:20:03 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r84626 r85285 352 352 if (strVersion.length() > 3) 353 353 { 354 uint32_t ulMajor = 0;355 uint32_t ulMinor = 0;356 357 354 const char *pcsz = strVersion.c_str(); 358 char c; 359 360 while ( (c = *pcsz)361 && RT_C_IS_DIGIT(c)362 )363 { 364 u lMajor *= 10;365 u lMajor += c - '0';355 356 uint32_t uMajor = 0; 357 char ch; 358 while ( (ch = *pcsz) 359 && RT_C_IS_DIGIT(ch) ) 360 { 361 uMajor *= 10; 362 uMajor += (uint32_t)(ch - '0'); 366 363 ++pcsz; 367 364 } 368 365 369 if (*pcsz++ == '.') 370 { 371 while ( (c = *pcsz) 372 && RT_C_IS_DIGIT(c) 373 ) 374 { 375 ulMinor *= 10; 376 ulMinor += c - '0'; 366 uint32_t uMinor = 0; 367 if (ch == '.') 368 { 369 pcsz++; 370 while ( (ch = *pcsz) 371 && RT_C_IS_DIGIT(ch)) 372 { 373 uMinor *= 10; 374 uMinor += (ULONG)(ch - '0'); 377 375 ++pcsz; 378 376 } 379 377 } 380 378 381 if (u lMajor == 1)382 { 383 if (u lMinor == 3)379 if (uMajor == 1) 380 { 381 if (uMinor == 3) 384 382 sv = SettingsVersion_v1_3; 385 else if (u lMinor == 4)383 else if (uMinor == 4) 386 384 sv = SettingsVersion_v1_4; 387 else if (u lMinor == 5)385 else if (uMinor == 5) 388 386 sv = SettingsVersion_v1_5; 389 else if (u lMinor == 6)387 else if (uMinor == 6) 390 388 sv = SettingsVersion_v1_6; 391 else if (u lMinor == 7)389 else if (uMinor == 7) 392 390 sv = SettingsVersion_v1_7; 393 else if (u lMinor == 8)391 else if (uMinor == 8) 394 392 sv = SettingsVersion_v1_8; 395 else if (u lMinor == 9)393 else if (uMinor == 9) 396 394 sv = SettingsVersion_v1_9; 397 else if (u lMinor == 10)395 else if (uMinor == 10) 398 396 sv = SettingsVersion_v1_10; 399 else if (u lMinor == 11)397 else if (uMinor == 11) 400 398 sv = SettingsVersion_v1_11; 401 else if (u lMinor == 12)399 else if (uMinor == 12) 402 400 sv = SettingsVersion_v1_12; 403 else if (u lMinor == 13)401 else if (uMinor == 13) 404 402 sv = SettingsVersion_v1_13; 405 else if (u lMinor == 14)403 else if (uMinor == 14) 406 404 sv = SettingsVersion_v1_14; 407 else if (u lMinor == 15)405 else if (uMinor == 15) 408 406 sv = SettingsVersion_v1_15; 409 else if (u lMinor == 16)407 else if (uMinor == 16) 410 408 sv = SettingsVersion_v1_16; 411 else if (u lMinor == 17)409 else if (uMinor == 17) 412 410 sv = SettingsVersion_v1_17; 413 else if (u lMinor == 18)411 else if (uMinor == 18) 414 412 sv = SettingsVersion_v1_18; 415 else if (u lMinor > 18)413 else if (uMinor > 18) 416 414 sv = SettingsVersion_Future; 417 415 } 418 else if (u lMajor > 1)416 else if (uMajor > 1) 419 417 sv = SettingsVersion_Future; 420 418 421 Log(("Parsed settings version %d.%d to enum value %d\n", u lMajor, ulMinor, sv));419 Log(("Parsed settings version %d.%d to enum value %d\n", uMajor, uMinor, sv)); 422 420 } 423 421 … … 534 532 else if (cbOut < 0) 535 533 throw ConfigFileError(this, pElm, N_("Base64 encoded data '%s' invalid"), psz); 536 binary.resize( cbOut);534 binary.resize((size_t)cbOut); 537 535 int vrc = VINF_SUCCESS; 538 536 if (cbOut) 539 vrc = RTBase64Decode(psz, &binary.front(), cbOut, NULL, NULL);537 vrc = RTBase64Decode(psz, &binary.front(), (size_t)cbOut, NULL, NULL); 540 538 if (RT_FAILURE(vrc)) 541 539 { … … 565 563 * @param str 566 564 * @param binary 565 * @throws std::bad_alloc and ConfigFileError 567 566 */ 568 567 void ConfigFileBase::toBase64(com::Utf8Str &str, const IconBlob &binary) const 569 568 { 570 s size_t cb = binary.size();569 size_t cb = binary.size(); 571 570 if (cb > 0) 572 571 { 573 ssize_t cchOut = RTBase64EncodedLength(cb); 574 str.reserve(cchOut+1); 575 int vrc = RTBase64Encode(&binary.front(), cb, 576 str.mutableRaw(), str.capacity(), 577 NULL); 572 size_t cchOut = RTBase64EncodedLength(cb); 573 str.reserve(cchOut + 1); 574 int vrc = RTBase64Encode(&binary.front(), cb, str.mutableRaw(), str.capacity(), NULL); 578 575 if (RT_FAILURE(vrc)) 579 576 throw ConfigFileError(this, NULL, N_("Failed to convert binary data to base64 format (%Rrc)"), vrc); … … 2156 2153 { 2157 2154 const char *pszEnd = strchr(psz, ','); 2158 size_t cchHost = pszEnd ? pszEnd - psz: strlen(psz);2155 size_t cchHost = pszEnd ? (size_t)(pszEnd - psz) : strlen(psz); 2159 2156 while (cchHost > 0 && RT_C_IS_SPACE(psz[cchHost - 1])) 2160 2157 cchHost--;
Note:
See TracChangeset
for help on using the changeset viewer.