Changeset 95956 in vbox
- Timestamp:
- Jul 29, 2022 8:54:43 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/string.cpp
r93115 r95956 43 43 HRESULT hrc = printfVNoThrow(pszFormat, va); 44 44 va_end(va); 45 #ifdef RT_EXCEPTIONS_ENABLED 45 46 if (hrc == S_OK) 46 47 { /* likely */ } 47 48 else 48 49 throw std::bad_alloc(); 50 #else 51 Assert(hrc == S_OK); RT_NOREF(hrc); 52 #endif 49 53 return *this; 50 54 } … … 63 67 { 64 68 HRESULT hrc = printfVNoThrow(pszFormat, va); 69 #ifdef RT_EXCEPTIONS_ENABLED 65 70 if (hrc == S_OK) 66 71 { /* likely */ } 67 72 else 68 73 throw std::bad_alloc(); 74 #else 75 Assert(hrc == S_OK); RT_NOREF(hrc); 76 #endif 69 77 return *this; 70 78 } … … 183 191 else /* ASSUME: input is valid Utf-8. Fake out of memory error. */ 184 192 AssertLogRelMsgFailed(("%Rrc %.*Rhxs\n", vrc, RTStrNLen(a_pszSrc, a_cchMax), a_pszSrc)); 193 #ifdef RT_EXCEPTIONS_ENABLED 185 194 throw std::bad_alloc(); 195 #endif 186 196 } 187 197 … … 324 334 { 325 335 HRESULT hrc = joltNoThrow(cwcNew); 336 # ifdef RT_EXCEPTIONS_ENABLED 326 337 if (hrc != S_OK) 327 338 throw std::bad_alloc(); 339 # else 340 Assert(hrc == S_OK); RT_NOREF(hrc); 341 # endif 328 342 } 329 343 … … 360 374 { 361 375 HRESULT hrc = reserveNoThrow(cwcMin, fForce); 376 #ifdef RT_EXCEPTIONS_ENABLED 362 377 if (hrc != S_OK) 363 378 throw std::bad_alloc(); 379 #else 380 Assert(hrc == S_OK); RT_NOREF(hrc); 381 #endif 364 382 } 365 383 … … 550 568 size_t cwcSrc; 551 569 int rc = RTStrCalcUtf16LenEx(pszSrc, cchSrc, &cwcSrc); 570 #ifdef RT_EXCEPTIONS_ENABLED 552 571 AssertRCStmt(rc, throw std::bad_alloc()); 572 #else 573 AssertRCReturn(rc, *this); 574 #endif 553 575 554 576 size_t cwcOld = length(); … … 559 581 PRTUTF16 pwszDst = &m_bstr[cwcOld]; 560 582 rc = RTStrToUtf16Ex(pszSrc, cchSrc, &pwszDst, cwcSrc + 1, NULL); 583 #ifdef RT_EXCEPTIONS_ENABLED 561 584 AssertRCStmt(rc, throw std::bad_alloc()); 585 #else 586 AssertRC(rc); 587 #endif 562 588 } 563 589 m_bstr[cwcTotal] = '\0'; … … 593 619 HRESULT hrc = appendPrintfVNoThrow(pszFormat, va); 594 620 va_end(va); 621 #ifdef RT_EXCEPTIONS_ENABLED 595 622 if (hrc != S_OK) 596 623 throw std::bad_alloc(); 624 #else 625 Assert(hrc == S_OK); RT_NOREF(hrc); 626 #endif 597 627 return *this; 598 628 } … … 612 642 { 613 643 HRESULT hrc = appendPrintfVNoThrow(pszFormat, va); 644 #ifdef RT_EXCEPTIONS_ENABLED 614 645 if (hrc != S_OK) 615 646 throw std::bad_alloc(); 647 #else 648 Assert(hrc == S_OK); RT_NOREF(hrc); 649 #endif 616 650 return *this; 617 651 } … … 682 716 { 683 717 m_bstr = ::SysAllocString(a_bstrSrc); 718 #ifdef RT_EXCEPTIONS_ENABLED 684 719 if (RT_LIKELY(m_bstr)) 685 720 { /* likely */ } 686 721 else 687 722 throw std::bad_alloc(); 723 #else 724 Assert(m_bstr); 725 #endif 688 726 } 689 727 else … … 733 771 memcpy(*pstr, c_str(), cb); 734 772 else 773 #ifdef RT_EXCEPTIONS_ENABLED 735 774 throw std::bad_alloc(); 775 #else 776 AssertFailed(); 777 #endif 736 778 } 737 779 … … 882 924 m_psz = NULL; 883 925 926 #ifdef RT_EXCEPTIONS_ENABLED 884 927 throw std::bad_alloc(); 928 #else 929 AssertFailed(); 930 #endif 885 931 } 886 932 }
Note:
See TracChangeset
for help on using the changeset viewer.