VirtualBox

Changeset 96164 in vbox for trunk/src/VBox/Runtime/win


Ignore:
Timestamp:
Aug 12, 2022 11:40:11 AM (2 years ago)
Author:
vboxsync
Message:

IPRT/errmsgwin.cpp: Made IPRT_ERRMSG_DEFINES_ONLY only option next to IPRT_NO_ERROR_DATA.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/win/errmsgwin.cpp

    r95547 r96164  
    4141*   Defined Constants And Macros                                                                                                 *
    4242*********************************************************************************************************************************/
    43 #if !defined(IPRT_ERRMSG_DEFINES_ONLY) && defined(IN_RT_STATIC) /* No message text in static builds to save space. */
    44 # define IPRT_ERRMSG_DEFINES_ONLY
    45 #endif
    46 
    47 #ifdef IPRT_ERRMSG_DEFINES_ONLY
    48 # define ENTRY(a_pszMsg, a_pszDefine, a_iCode) \
     43#define ENTRY(a_pszMsg, a_pszDefine, a_iCode) \
    4944    { a_pszDefine, a_pszDefine, a_iCode }
    50 #else
    51 # define ENTRY(a_pszMsg, a_pszDefine, a_iCode) \
    52     { a_pszMsg, a_pszDefine, a_iCode }
    53 #endif
    5445
    5546
     
    7263    { 0, 0, 13, 0, 13, },
    7364};
    74 #elif defined(IPRT_ERRMSG_DEFINES_ONLY)
     65#else
    7566# include "errmsgwindata-only-defines.h"
    76 #else
    77 # include "errmsgwindata-all.h"
    7867#endif
    7968
     
    201190RTDECL(size_t)  RTErrWinFormatMsg(long rc, PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, char *pszTmp, size_t cbTmp)
    202191{
    203 #ifdef IPRT_ERRMSG_DEFINES_ONLY
    204192    return RTErrWinFormatDefine(rc, pfnOutput, pvArgOutput, pszTmp, cbTmp);
    205 #else
    206     size_t idx = rtErrWinLookup(rc);
    207     if (idx != ~(size_t)0)
    208         return RTBldProgStrTabQueryOutput(&g_WinMsgStrTab,
    209                                           g_aWinMsgs[idx].offMsgFull, g_aWinMsgs[idx].cchMsgFull,
    210                                           pfnOutput, pvArgOutput);
    211 
    212     /*
    213      * If FACILITY_WIN32 kind of status, look up the win32 code.
    214      */
    215     const char *pszTail = NULL;
    216     size_t cchRet;
    217     if (   SCODE_FACILITY(rc) == FACILITY_WIN32
    218         && (idx = rtErrWinLookup(HRESULT_CODE(rc))) != ~(size_t)0)
    219     {
    220         /* Append the incoming rc, so we know it's not a regular WIN32 status: */
    221         cchRet  = RTBldProgStrTabQueryOutput(&g_WinMsgStrTab,
    222                                              g_aWinMsgs[idx].offMsgFull, g_aWinMsgs[idx].cchMsgFull,
    223                                              pfnOutput, pvArgOutput);
    224         cchRet += pfnOutput(pvArgOutput, RT_STR_TUPLE(" ("));
    225         pszTail = ")";
    226     }
    227     else
    228         cchRet  = pfnOutput(pvArgOutput, RT_STR_TUPLE("Unknown Status "));
    229 
    230     ssize_t cchValue = RTStrFormatU32(pszTmp, cbTmp, rc, 16, 0, 0, RTSTR_F_SPECIAL);
    231     Assert(cchValue > 0);
    232     cchRet += pfnOutput(pvArgOutput, pszTmp, cchValue);
    233 
    234     if (pszTail)
    235         cchRet += pfnOutput(pvArgOutput, pszTail, 1);
    236     return cchRet;
    237 #endif
    238193}
    239194
     
    260215    cchRet += pfnOutput(pvArgOutput, pszTmp, cchValue);
    261216
    262 #ifndef IPRT_ERRMSG_DEFINES_ONLY
    263     if (idx != ~(size_t)0)
    264     {
    265         cchRet += pfnOutput(pvArgOutput, RT_STR_TUPLE(") - "));
    266         cchRet += RTBldProgStrTabQueryOutput(&g_WinMsgStrTab,
    267                                              g_aWinMsgs[idx].offMsgFull, g_aWinMsgs[idx].cchMsgFull,
    268                                              pfnOutput, pvArgOutput);
    269     }
    270 #endif
    271217    return cchRet;
    272218}
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