VirtualBox

Changeset 23675 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 10, 2009 9:59:29 PM (15 years ago)
Author:
vboxsync
Message:

stringify Session state

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Global.cpp

    r23648 r23675  
    210210}
    211211
     212/*static*/ const char *
     213Global::stringifySessionState(SessionState_T aState)
     214{
     215    switch (aState)
     216    {
     217        case SessionState_Null:         return "Null";
     218        case SessionState_Closed:       return "Closed";
     219        case SessionState_Open:         return "Open";
     220        case SessionState_Spawning:     return "Spawning";
     221        case SessionState_Closing:      return "Closing";
     222        default:
     223        {
     224            AssertMsgFailed(("%d (%#x)\n", aState, aState));
     225            static char s_szMsg[48];
     226            RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
     227            return s_szMsg;
     228        }
     229
     230    }
     231}
     232
    212233/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/MachineImpl.cpp

    r23674 r23675  
    30343034        if (mData->mSession.mState != SessionState_Open)
    30353035            return setError(VBOX_E_INVALID_VM_STATE,
    3036                             tr("Machine session is not open (session state: %d)"),
    3037                             mData->mSession.mState);
     3036                            tr("Machine session is not open (session state: %s)"),
     3037                            Global::stringifySessionState(mData->mSession.mState));
    30383038
    30393039        directControl = mData->mSession.mDirectControl;
     
    30613061        if (mData->mSession.mState != SessionState_Open)
    30623062            return setError(E_FAIL,
    3063                             tr("Machine session is not open (session state: %d)"),
    3064                             mData->mSession.mState);
     3063                            tr("Machine session is not open (session state: %s)"),
     3064                            Global::stringifySessionState(mData->mSession.mState));
    30653065
    30663066        directControl = mData->mSession.mDirectControl;
     
    36723672                        mUserData->mName.raw());
    36733673
    3674     LogFlowThisFunc(("mSession.mState=%d\n", mData->mSession.mState));
     3674    LogFlowThisFunc(("mSession.mState=%s\n", Global::stringifySessionState(mData->mSession.mState)));
    36753675
    36763676    if (mData->mSession.mState == SessionState_Open ||
     
    38893889                        mUserData->mName.raw());
    38903890
    3891     LogFlowThisFunc(("mSession.mState=%d\n", mData->mSession.mState));
     3891    LogFlowThisFunc(("mSession.mState=%s\n", Global::stringifySessionState(mData->mSession.mState)));
    38923892
    38933893    if (mData->mSession.mState == SessionState_Open ||
     
    41264126            tr ("The machine '%ls' is not registered"), mUserData->mName.raw());
    41274127
    4128     LogFlowThisFunc(("mSession.state=%d\n", mData->mSession.mState));
     4128    LogFlowThisFunc(("mSession.state=%s\n", Global::stringifySessionState(mData->mSession.mState)));
    41294129
    41304130    if (mData->mSession.mState != SessionState_Open)
  • trunk/src/VBox/Main/SessionImpl.cpp

    r23223 r23675  
    3030#include "SessionImpl.h"
    3131#include "ConsoleImpl.h"
     32#include "Global.h"
    3233
    3334#include "Logging.h"
     
    5051        if (mState != SessionState_Open) \
    5152            return setError (E_UNEXPECTED, \
    52                 tr ("The session is not open")); \
     53                tr ("The session is not open (session state: %s)"), \
     54                Global::stringifySessionState(mState)); \
    5355    } while (0)
    5456
     
    466468        AutoWriteLock alock(this);
    467469
    468         LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType));
     470        LogFlowThisFunc(("mState=%s, mType=%d\n", Global::stringifySessionState(mState), mType));
    469471
    470472        if (mState == SessionState_Closing)
     
    675677    if (mState != SessionState_Open)
    676678        return setError (VBOX_E_INVALID_VM_STATE,
    677             tr ("Machine session is not open (session state: %d)."),
    678             mState);
     679            tr ("Machine session is not open (session state: %s)."),
     680            Global::stringifySessionState(mState));
    679681    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    680682    CheckComArgNotNull(aName);
     
    712714    if (mState != SessionState_Open)
    713715        return setError (VBOX_E_INVALID_VM_STATE,
    714             tr ("Machine session is not open (session state: %d)."),
    715             mState);
     716            tr ("Machine session is not open (session state: %s)."),
     717            Global::stringifySessionState(mState));
    716718    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    717719    if (!VALID_PTR (aPatterns) && (aPatterns != NULL))
     
    758760    AutoWriteLock alock(this);
    759761
    760     LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType));
     762    LogFlowThisFunc(("mState=%s, mType=%d\n", Global::stringifySessionState(mState), mType));
    761763
    762764    if (mState != SessionState_Open)
  • trunk/src/VBox/Main/include/Global.h

    r23648 r23675  
    122122     */
    123123    static const char *stringifyMachineState(MachineState_T aState);
     124
     125    /**
     126     * Stringify a session state.
     127     *
     128     * @returns Pointer to a read only string.
     129     * @param   aState      Valid session state.
     130     */
     131    static const char *stringifySessionState(MachineState_T aState);
    124132};
    125133
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