VirtualBox

Changeset 45686 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 23, 2013 6:15:40 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85223
Message:

Console::setGuestProperty: some cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r45679 r45686  
    54995499    ReturnComNotImplemented();
    55005500#else /* VBOX_WITH_GUEST_PROPS */
    5501     if (!VALID_PTR(aName))
     5501    if (!RT_VALID_PTR(aName))
    55025502        return setError(E_INVALIDARG, tr("Name cannot be NULL or an invalid pointer"));
    5503     if ((aValue != NULL) && !VALID_PTR(aValue))
     5503    if (aValue != NULL && !RT_VALID_PTR(aValue))
    55045504        return setError(E_INVALIDARG, tr("Invalid value pointer"));
    5505     if ((aFlags != NULL) && !VALID_PTR(aFlags))
     5505    if (aFlags != NULL && !RT_VALID_PTR(aFlags))
    55065506        return setError(E_INVALIDARG, tr("Invalid flags pointer"));
    55075507
     
    55175517     * ptrVM, so there is no need to hold a lock of this */
    55185518
    5519     HRESULT rc = E_UNEXPECTED;
    55205519    using namespace guestProp;
    55215520
    55225521    VBOXHGCMSVCPARM parm[3];
     5522
    55235523    Utf8Str Utf8Name = aName;
    5524     int vrc = VINF_SUCCESS;
    5525 
    55265524    parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
    55275525    parm[0].u.pointer.addr = (void*)Utf8Name.c_str();
    55285526    /* The + 1 is the null terminator */
    55295527    parm[0].u.pointer.size = (uint32_t)Utf8Name.length() + 1;
    5530     Utf8Str Utf8Value = aValue;
     5528
    55315529    if (aValue != NULL)
    55325530    {
     5531        Utf8Str Utf8Value = aValue;
    55335532        parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
    5534         parm[1].u.pointer.addr = (void*)Utf8Value.c_str();
     5533        parm[1].u.pointer.addr = (void *)Utf8Value.c_str();
    55355534        /* The + 1 is the null terminator */
    55365535        parm[1].u.pointer.size = (uint32_t)Utf8Value.length() + 1;
    55375536    }
    5538     Utf8Str Utf8Flags = aFlags;
     5537
    55395538    if (aFlags != NULL)
    55405539    {
     5540        Utf8Str Utf8Flags = aFlags;
    55415541        parm[2].type = VBOX_HGCM_SVC_PARM_PTR;
    55425542        parm[2].u.pointer.addr = (void*)Utf8Flags.c_str();
     
    55445544        parm[2].u.pointer.size = (uint32_t)Utf8Flags.length() + 1;
    55455545    }
    5546     if ((aValue != NULL) && (aFlags != NULL))
     5546
     5547    int vrc;
     5548    if (aValue != NULL && aFlags != NULL)
    55475549        vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", SET_PROP_HOST,
    55485550                                      3, &parm[0]);
     
    55535555        vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", DEL_PROP_HOST,
    55545556                                    1, &parm[0]);
     5557    HRESULT hrc;
    55555558    if (RT_SUCCESS(vrc))
    5556         rc = S_OK;
     5559        hrc = S_OK;
    55575560    else
    5558         rc = setError(E_UNEXPECTED,
    5559             tr("The service call failed with the error %Rrc"),
    5560             vrc);
    5561     return rc;
     5561        hrc = setError(E_UNEXPECTED, tr("The service call failed with the error %Rrc"), vrc);
     5562    return hrc;
    55625563#endif /* VBOX_WITH_GUEST_PROPS */
    55635564}
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