VirtualBox

Changeset 84030 in vbox


Ignore:
Timestamp:
Apr 28, 2020 9:35:19 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137601
Message:

VBoxBugReport: %Rrf instead of RTErrGetFull + %d. Use for com failures. Use appendPrintf rather than a 2nd RTCStringFmt combining the formatted caller message with the status code. Use the RTCError(RTCString &) constructor rather than the less efficient C-string variant. bugref:9726

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBugReport/VBoxBugReport.h

    r82968 r84030  
    4848/* Base */
    4949
    50 inline void handleRtError(int rc, const char *pszMsgFmt, ...)
     50DECLINLINE(void) handleRtError(int rc, const char *pszMsgFmt, ...)
    5151{
    5252    if (RT_FAILURE(rc))
     
    5454        va_list va;
    5555        va_start(va, pszMsgFmt);
    56         RTCString msgArgs(pszMsgFmt, va);
     56        RTCString strMsg(pszMsgFmt, va);
    5757        va_end(va);
    58         RTCStringFmt msg("%s. %s (%d)\n", msgArgs.c_str(), RTErrGetFull(rc), rc);
    59         throw RTCError(msg.c_str());
     58        strMsg.appendPrintfNoThrow(". %Rrf\n", rc);
     59        throw RTCError(strMsg);
    6060    }
    6161}
    6262
    63 inline void handleComError(HRESULT hr, const char *pszMsgFmt, ...)
     63DECLINLINE(void) handleComError(HRESULT hr, const char *pszMsgFmt, ...)
    6464{
    6565    if (FAILED(hr))
     
    6767        va_list va;
    6868        va_start(va, pszMsgFmt);
    69         RTCString msgArgs(pszMsgFmt, va);
     69        RTCString strMsg(pszMsgFmt, va);
    7070        va_end(va);
    71         RTCStringFmt msg("%s (hr=0x%x)\n", msgArgs.c_str(), hr);
    72         throw RTCError(msg.c_str());
     71        strMsg.appendPrintfNoThrow(". (hr=0x%x %Rhrc)\n", hr, hr);
     72        throw RTCError(strMsg);
    7373    }
    7474}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette