VirtualBox

Changeset 24292 in vbox for trunk/src/VBox/VMM/SSM.cpp


Ignore:
Timestamp:
Nov 3, 2009 3:19:17 PM (15 years ago)
Author:
vboxsync
Message:

SSMSetLoadErrorV: Don't use %N as the VMSetError message may be formatted several time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/SSM.cpp

    r24268 r24292  
    68826882
    68836883    /*
     6884     * Format the incoming error.
     6885     */
     6886    char *pszMsg;
     6887    RTStrAPrintfV(&pszMsg, pszFormat, va);
     6888    if (!pszMsg)
     6889    {
     6890        VMSetError(pSSM->pVM, VERR_NO_MEMORY, RT_SRC_POS,
     6891                   N_("SSMR3SetLoadErrorV ran out of memory formatting: %s\n"), pszFormat);
     6892        return rc;
     6893    }
     6894
     6895    /*
    68846896     * Forward to VMSetError with the additional info.
    68856897     */
     
    68876899    const char *pszName     = pUnit ? pUnit->szName      : "unknown";
    68886900    uint32_t    uInstance   = pUnit ? pUnit->u32Instance : 0;
    6889     va_list     vaCopy;
    6890     va_copy(vaCopy, va);
    68916901    if (   pSSM->enmOp == SSMSTATE_LOAD_EXEC
    68926902        && pSSM->u.Read.uCurUnitPass == SSM_PASS_FINAL)
    6893         rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#u: %N [ver=%u pass=final]"),
    6894                         pszName, uInstance,
    6895                         pszFormat, &vaCopy,
    6896                         pSSM->u.Read.uCurUnitVer);
     6903        rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#%u: %s [ver=%u pass=final]"),
     6904                        pszName, uInstance, pszMsg, pSSM->u.Read.uCurUnitVer);
    68976905    else if (pSSM->enmOp == SSMSTATE_LOAD_EXEC)
    6898         rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#u: %N [ver=%u pass=#%u]"),
    6899                         pszName, uInstance,
    6900                         pszFormat, &vaCopy,
    6901                         pSSM->u.Read.uCurUnitVer, pSSM->u.Read.uCurUnitPass);
     6906        rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#%u: %s [ver=%u pass=#%u]"),
     6907                        pszName, uInstance, pszMsg, pSSM->u.Read.uCurUnitVer, pSSM->u.Read.uCurUnitPass);
    69026908    else if (pSSM->enmOp == SSMSTATE_LOAD_PREP)
    6903         rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#u: %N [prep]"),
    6904                         pszName, uInstance,
    6905                         pszFormat, &vaCopy);
     6909        rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#%u: %s [prep]"),
     6910                        pszName, uInstance, pszMsg);
    69066911    else if (pSSM->enmOp == SSMSTATE_LOAD_DONE)
    6907         rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#u: %N [done]"),
    6908                         pszName, uInstance,
    6909                         pszFormat, &vaCopy);
     6912        rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#%u: %s [done]"),
     6913                        pszName, uInstance, pszMsg);
    69106914    else if (pSSM->enmOp == SSMSTATE_OPEN_READ)
    6911         rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#u: %N [read]"),
    6912                         pszName, uInstance,
    6913                         pszFormat, &vaCopy);
     6915        rc = VMSetError(pSSM->pVM, rc, RT_SRC_POS_ARGS, N_("%s#%u: %s [read]"),
     6916                        pszName, uInstance, pszMsg);
    69146917    else
    69156918        AssertFailed();
    6916     va_end(vaCopy);
    69176919    pSSM->u.Read.fHaveSetError = true;
     6920    RTStrFree(pszMsg);
    69186921    return rc;
    69196922}
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