VirtualBox

Changeset 41554 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jun 3, 2012 10:33:25 PM (13 years ago)
Author:
vboxsync
Message:

RTErrGet: Don't immediately return values ending with _FIRST, _LAST, _LOWEST or _HIGHEST.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/err/errmsg.cpp

    r28800 r41554  
    8686             * one of those start/end #defines before we return.
    8787             */
    88             if (    !strstr(g_aStatusMsgs[i].pszDefine, "FIRST")
    89                 &&  !strstr(g_aStatusMsgs[i].pszDefine, "LAST"))
     88#define STR_ENDS_WITH(a_psz, a_cch, a_sz) \
     89    ( (a_cch) >= sizeof(a_sz) && !strncmp((a_psz) + (a_cch) - sizeof(a_sz) + 1, RT_STR_TUPLE(a_sz)) )
     90            size_t const cchDefine = strlen(g_aStatusMsgs[i].pszDefine);
     91            if (   !STR_ENDS_WITH(g_aStatusMsgs[i].pszDefine, cchDefine, "_FIRST")
     92                && !STR_ENDS_WITH(g_aStatusMsgs[i].pszDefine, cchDefine, "_LAST")
     93                && !STR_ENDS_WITH(g_aStatusMsgs[i].pszDefine, cchDefine, "_LOWEST")
     94                && !STR_ENDS_WITH(g_aStatusMsgs[i].pszDefine, cchDefine, "_HIGHEST")
     95               )
    9096                return &g_aStatusMsgs[i];
    9197            iFound = i;
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