VirtualBox

Changeset 83994 in vbox


Ignore:
Timestamp:
Apr 27, 2020 11:01:30 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137561
Message:

IPRT/string.h: Document status code formatting in IN_RT_STATIC builds and adjusted the formatter to make the best of it.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/string.h

    r83886 r83994  
    15401540 *      - \%Rrf             - Takes an integer iprt status code as argument. Will insert the
    15411541 *                            full description of the specified status code.
     1542 *                            Note! Works like \%Rrs when IN_RT_STATIC is defined (so please avoid).
    15421543 *      - \%Rra             - Takes an integer iprt status code as argument. Will insert the
    15431544 *                            status code define + full description.
     1545 *                            Note! Reduced output when IN_RT_STATIC is defined (so please avoid).
    15441546 *      - \%Rwc             - Takes a long Windows error code as argument. Will insert the status
    15451547 *                            code define corresponding to the Windows error code.
    15461548 *      - \%Rwf             - Takes a long Windows error code as argument. Will insert the
    15471549 *                            full description of the specified status code.
     1550 *                            Note! Works like \%Rwc when IN_RT_STATIC is defined.
    15481551 *      - \%Rwa             - Takes a long Windows error code as argument. Will insert the
    15491552 *                            error code define + full description.
     1553 *                            Note! Reduced output when IN_RT_STATIC is defined (so please avoid).
    15501554 *
    15511555 *      - \%Rhrc            - Takes a COM/XPCOM status code as argument. Will insert the status
     
    15531557 *      - \%Rhrf            - Takes a COM/XPCOM status code as argument. Will insert the
    15541558 *                            full description of the specified status code.
     1559 *                            Note! Works like \%Rhrc when IN_RT_STATIC is
     1560 *                                  defined on Windows (so please avoid).
    15551561 *      - \%Rhra            - Takes a COM/XPCOM error code as argument. Will insert the
    15561562 *                            error code define + full description.
     1563 *                            Note! Reduced output when IN_RT_STATIC is defined on Windows (so please avoid).
    15571564 *
    15581565 *      - \%Rfn             - Pretty printing of a function or method. It drops the
  • trunk/src/VBox/Runtime/common/string/strformatrt.cpp

    r83166 r83994  
    10311031                                return pfnOutput(pvArgOutput, pMsg->pszDefine, strlen(pMsg->pszDefine));
    10321032                            case 'f':
    1033                                 return pfnOutput(pvArgOutput, pMsg->pszMsgFull,strlen(pMsg->pszMsgFull));
     1033# if !defined(RT_OS_WINDOWS) || (!defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY))
     1034                                return pfnOutput(pvArgOutput, pMsg->pszMsgFull, strlen(pMsg->pszMsgFull));
     1035# else
     1036                                AssertFailed();
     1037                                return pfnOutput(pvArgOutput, pMsg->pszDefine, strlen(pMsg->pszDefine));
     1038# endif
    10341039                            case 'a':
     1040# if !defined(RT_OS_WINDOWS) || (!defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY))
    10351041                                return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, hrc, pMsg->pszMsgFull);
     1042# else
     1043                                AssertFailed();
     1044                                return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X)", pMsg->pszDefine, hrc);
     1045# endif
    10361046                            default:
    10371047                                AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg));
     
    11841194                        return pfnOutput(pvArgOutput, pMsg->pszDefine,    strlen(pMsg->pszDefine));
    11851195                    case 's':
     1196# if !defined(IPRT_ERRMSG_DEFINES_ONLY)
    11861197                        return pfnOutput(pvArgOutput, pMsg->pszMsgShort,  strlen(pMsg->pszMsgShort));
     1198# else
     1199                        return pfnOutput(pvArgOutput, pMsg->pszDefine,    strlen(pMsg->pszDefine));
     1200# endif
    11871201                    case 'f':
     1202# if !defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY)
    11881203                        return pfnOutput(pvArgOutput, pMsg->pszMsgFull,   strlen(pMsg->pszMsgFull));
     1204# else
     1205                        return pfnOutput(pvArgOutput, pMsg->pszDefine,    strlen(pMsg->pszDefine));
     1206# endif
    11891207                    case 'a':
     1208# if !defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY)
    11901209                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (%d) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull);
     1210# elif !defined(IPRT_ERRMSG_DEFINES_ONLY)
     1211                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (%d) - %s", pMsg->pszDefine, rc, pMsg->pszMsgShort);
     1212# else
     1213                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (%d)", pMsg->pszDefine, rc);
     1214# endif
     1215
    11911216                    default:
    11921217                        AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg));
     
    12251250                        return pfnOutput(pvArgOutput, pMsg->pszDefine, strlen(pMsg->pszDefine));
    12261251                    case 'f':
    1227                         return pfnOutput(pvArgOutput, pMsg->pszMsgFull,strlen(pMsg->pszMsgFull));
     1252#  if !defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY)
     1253                        return pfnOutput(pvArgOutput, pMsg->pszMsgFull, strlen(pMsg->pszMsgFull));
     1254#  else
     1255                        AssertFailed();
     1256                        return pfnOutput(pvArgOutput, pMsg->pszDefine, strlen(pMsg->pszDefine));
     1257#  endif
    12281258                    case 'a':
     1259#  if !defined(RT_IN_STATIC) && !defined(IPRT_ERRMSG_DEFINES_ONLY)
    12291260                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull);
    1230 # else
     1261#  else
     1262                        AssertFailed();
     1263                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X)", pMsg->pszDefine, rc);
     1264#  endif
     1265# else  /* !RT_OS_WINDOWS */
    12311266                    case 'c':
    12321267                    case 'f':
    12331268                    case 'a':
    12341269                        return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "0x%08X", rc);
    1235 # endif
     1270# endif /* !RT_OS_WINDOWS */
    12361271                    default:
    12371272                        AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg));
Note: See TracChangeset for help on using the changeset viewer.

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