VirtualBox

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


Ignore:
Timestamp:
Feb 24, 2010 4:24:33 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
58004
Message:

Main: Bstr makeover (third attempt) -- make Bstr(NULL) and Bstr() behave the same; resulting cleanup; make some more internal methods use Utf8Str instead of Bstr; fix a lot of CheckComArgNotNull??() usage

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

Legend:

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

    r26603 r26753  
    15691569                                                    mhda.lDevice,
    15701570                                                    DeviceType_Floppy,
    1571                                                     Bstr(""));
     1571                                                    NULL);
    15721572                        if (FAILED(rc)) throw rc;
    15731573
     
    16181618                                                    mhda.lDevice,
    16191619                                                    DeviceType_DVD,
    1620                                                     Bstr(""));
     1620                                                    NULL);
    16211621                        if (FAILED(rc)) throw rc;
    16221622
     
    17441744                            rc = mVirtualBox->OpenHardDisk(Bstr(strSrcFilePath),
    17451745                                                           AccessMode_ReadOnly,
    1746                                                            false, Bstr(""), false, Bstr(""),
     1746                                                           false,
     1747                                                           NULL,
     1748                                                           false,
     1749                                                           NULL,
    17471750                                                           srcHdVBox.asOutParam());
    17481751                            if (FAILED(rc)) throw rc;
     
    42814284                                                      IN_BSTR aExtraConfigValue)
    42824285{
    4283     CheckComArgNotNull(aVboxValue);
    4284     CheckComArgNotNull(aExtraConfigValue);
    4285 
    42864286    AutoCaller autoCaller(this);
    42874287    if (FAILED(autoCaller.rc())) return autoCaller.rc();
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r26615 r26753  
    574574{
    575575    if (!enabledGuestPropertiesVRDP())
    576     {
    577576        return;
    578     }
     577
     578    Bstr bstrReadOnlyGuest(L"RDONLYGUEST");
    579579
    580580    int rc;
     
    584584    if (RT_SUCCESS(rc))
    585585    {
    586         mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
     586        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest);
    587587        RTStrFree(pszPropertyName);
    588588    }
     
    591591    if (RT_SUCCESS(rc))
    592592    {
    593         mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
     593        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest);
    594594        RTStrFree(pszPropertyName);
    595595    }
     
    598598    if (RT_SUCCESS(rc))
    599599    {
    600         mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));
     600        mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest);
    601601        RTStrFree(pszPropertyName);
    602602    }
     
    606606    if (RT_SUCCESS(rc))
    607607    {
    608         mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId), Bstr("RDONLYGUEST"));
     608        mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId), bstrReadOnlyGuest);
    609609        RTStrFree(pszClientId);
    610610    }
     
    11901190
    11911191// static
    1192 DECLCALLBACK(int)
    1193 Console::doGuestPropNotification(void *pvExtension, uint32_t u32Function,
    1194                                  void *pvParms, uint32_t cbParms)
     1192DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
     1193                                                   uint32_t u32Function,
     1194                                                   void *pvParms,
     1195                                                   uint32_t cbParms)
    11951196{
    11961197    using namespace guestProp;
     
    12121213    Bstr value(pCBData->pcszValue);
    12131214    Bstr flags(pCBData->pcszFlags);
    1214     if (   !name.isNull()
    1215         && (!value.isNull() || pCBData->pcszValue == NULL)
    1216         && (!flags.isNull() || pCBData->pcszFlags == NULL)
    1217        )
    1218     {
    1219         ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension);
    1220         HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name,
    1221                                                               value,
    1222                                                               pCBData->u64Timestamp,
    1223                                                               flags);
    1224         if (SUCCEEDED(hrc))
    1225             rc = VINF_SUCCESS;
    1226         else
    1227         {
    1228             LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
    1229                      pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
    1230             rc = Global::vboxStatusCodeFromCOM(hrc);
    1231         }
    1232     }
     1215    ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension);
     1216    HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name,
     1217                                                          value,
     1218                                                          pCBData->u64Timestamp,
     1219                                                          flags);
     1220    if (SUCCEEDED(hrc))
     1221        rc = VINF_SUCCESS;
    12331222    else
    1234         rc = VERR_NO_MEMORY;
     1223    {
     1224        LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
     1225                 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
     1226        rc = Global::vboxStatusCodeFromCOM(hrc);
     1227    }
    12351228    return rc;
    12361229}
     
    12481241    Utf8Str utf8Patterns(aPatterns);
    12491242    parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
     1243    // mutableRaw() returns NULL for an empty string
     1244//     if ((parm[0].u.pointer.addr = utf8Patterns.mutableRaw()))
     1245//         parm[0].u.pointer.size = (uint32_t)utf8Patterns.length() + 1;
     1246//     else
     1247//     {
     1248//         parm[0].u.pointer.addr = (void*)"";
     1249//         parm[0].u.pointer.size = 1;
     1250//     }
    12501251    parm[0].u.pointer.addr = utf8Patterns.mutableRaw();
    12511252    parm[0].u.pointer.size = (uint32_t)utf8Patterns.length() + 1;
     
    13641365    try
    13651366    {
    1366         Bstr                pattern("");
    1367         hrc = doEnumerateGuestProperties(pattern, ComSafeArrayAsOutParam(namesOut),
     1367        Bstr pattern;
     1368        hrc = doEnumerateGuestProperties(pattern,
     1369                                         ComSafeArrayAsOutParam(namesOut),
    13681370                                         ComSafeArrayAsOutParam(valuesOut),
    13691371                                         ComSafeArrayAsOutParam(timestampsOut),
     
    13711373        if (SUCCEEDED(hrc))
    13721374        {
    1373             std::vector <BSTR>      names;
    1374             std::vector <BSTR>      values;
    1375             std::vector <ULONG64>   timestamps;
    1376             std::vector <BSTR>      flags;
     1375            std::vector<BSTR>      names;
     1376            std::vector<BSTR>      values;
     1377            std::vector<ULONG64>   timestamps;
     1378            std::vector<BSTR>      flags;
    13771379            for (size_t i = 0; i < namesOut.size(); ++i)
    13781380            {
     
    13921394            com::SafeArray<ULONG64> timestampsIn(timestamps);
    13931395            com::SafeArray<BSTR>    flagsIn(flags);
    1394             if (   namesIn.isNull()
    1395                 || valuesIn.isNull()
    1396                 || timestampsIn.isNull()
    1397                 || flagsIn.isNull()
    1398                )
    1399                 throw std::bad_alloc();
    14001396            /* PushGuestProperties() calls DiscardSettings(), which calls us back */
    14011397            mControl->PushGuestProperties(ComSafeArrayAsInParam(namesIn),
     
    25942590{
    25952591#ifdef VBOX_WITH_USB
    2596     CheckComArgNotNull(aAddress);
     2592    CheckComArgStrNotEmptyOrNull(aAddress);
    25972593    CheckComArgOutPointerValid(aDevice);
    25982594
     
    26642660Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
    26652661{
    2666     CheckComArgNotNull(aName);
    2667     CheckComArgNotNull(aHostPath);
     2662    CheckComArgStrNotEmptyOrNull(aName);
     2663    CheckComArgStrNotEmptyOrNull(aHostPath);
    26682664
    26692665    AutoCaller autoCaller(this);
     
    27322728STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName)
    27332729{
    2734     CheckComArgNotNull(aName);
     2730    CheckComArgStrNotEmptyOrNull(aName);
    27352731
    27362732    AutoCaller autoCaller(this);
     
    27982794    LogFlowThisFunc(("aName='%ls' mMachineState=%08X\n", aName, mMachineState));
    27992795
    2800     CheckComArgNotNull(aName);
     2796    CheckComArgStrNotEmptyOrNull(aName);
    28012797    CheckComArgOutPointerValid(aProgress);
    28022798
     
    77257721         * (i.e. creating a snapshot online)
    77267722         */
    7727         ComAssertThrow(    (!pTask->bstrSavedStateFile.isNull() && pTask->fTakingSnapshotOnline)
    7728                         || (pTask->bstrSavedStateFile.isNull() && !pTask->fTakingSnapshotOnline),
     7723        ComAssertThrow(    (!pTask->bstrSavedStateFile.isEmpty() && pTask->fTakingSnapshotOnline)
     7724                        || ( pTask->bstrSavedStateFile.isEmpty() && !pTask->fTakingSnapshotOnline),
    77297725                       rc = E_FAIL);
    77307726
     
    80408036            task->mProgress->notifyComplete(rc,
    80418037                                            COM_IIDOF(IConsole),
    8042                                             Console::getComponentName(),
     8038                                            (CBSTR)Console::getComponentName(),
    80438039                                            errMsg.c_str());
    80448040        else
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r26681 r26753  
    31803180                }
    31813181
    3182                 if (!networkName.isNull())
     3182                if (!networkName.isEmpty())
    31833183                {
    31843184                    /*
     
    31873187                     */
    31883188                    ComPtr<IDHCPServer> dhcpServer;
    3189                     hrc = virtualBox->FindDHCPServerByNetworkName(networkName.mutableRaw(), dhcpServer.asOutParam());
     3189                    hrc = virtualBox->FindDHCPServerByNetworkName(networkName, dhcpServer.asOutParam());
    31903190                    if (SUCCEEDED(hrc))
    31913191                    {
  • trunk/src/VBox/Main/ConsoleImplTeleporter.cpp

    r26603 r26753  
    903903    CheckComArgOutPointerValid(aProgress);
    904904    CheckComArgStrNotEmptyOrNull(aHostname);
    905     CheckComArgNotNull(aHostname);
     905    CheckComArgStrNotEmptyOrNull(aHostname);
    906906    CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort));
    907907    CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime));
  • trunk/src/VBox/Main/GuestImpl.cpp

    r26603 r26753  
    127127
    128128    // redirect the call to IMachine if no additions are installed
    129     if (mData.mAdditionsVersion.isNull())
    130         return mParent->machine()->COMGETTER(OSTypeId) (aOSTypeId);
     129    if (mData.mAdditionsVersion.isEmpty())
     130        return mParent->machine()->COMGETTER(OSTypeId)(aOSTypeId);
    131131
    132132    mData.mOSTypeId.cloneTo(aOSTypeId);
     
    262262                                   IN_BSTR aDomain, BOOL aAllowInteractiveLogon)
    263263{
    264     CheckComArgNotNull(aUserName);
    265     CheckComArgNotNull(aPassword);
    266     CheckComArgNotNull(aDomain);
    267 
    268264    AutoCaller autoCaller(this);
    269265    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     
    315311/////////////////////////////////////////////////////////////////////////////
    316312
    317 void Guest::setAdditionsVersion (Bstr aVersion, VBOXOSTYPE aOsType)
    318 {
    319     Assert(aVersion.isNull() || !aVersion.isEmpty());
    320 
     313void Guest::setAdditionsVersion(Bstr aVersion, VBOXOSTYPE aOsType)
     314{
    321315    AutoCaller autoCaller(this);
    322316    AssertComRCReturnVoid (autoCaller.rc());
     
    325319
    326320    mData.mAdditionsVersion = aVersion;
    327     mData.mAdditionsActive = !aVersion.isNull();
     321    mData.mAdditionsActive = !aVersion.isEmpty();
    328322
    329323    mData.mOSTypeId = Global::OSTypeId (aOsType);
  • trunk/src/VBox/Main/HostImpl.cpp

    r26603 r26753  
    451451    if(hr == S_OK)
    452452    {
    453         size_t cUnicodeName = wcslen(lpszName) + 1;
    454         size_t uniLen = (cUnicodeName * 2 + sizeof (OLECHAR) - 1) / sizeof (OLECHAR);
    455         Bstr name (uniLen + 1 /* extra zero */);
    456         wcscpy((wchar_t *) name.mutableRaw(), lpszName);
     453        Bstr name((CBSTR)lpszName);
    457454
    458455        hr = pncc->GetInstanceGuid(&IfGuid);
     
    12901287STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive)
    12911288{
    1292     CheckComArgNotNull(aName);
     1289    CheckComArgStrNotEmptyOrNull(aName);
    12931290    CheckComArgOutPointerValid(aDrive);
    12941291
     
    13171314STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive)
    13181315{
    1319     CheckComArgNotNull(aName);
     1316    CheckComArgStrNotEmptyOrNull(aName);
    13201317    CheckComArgOutPointerValid(aDrive);
    13211318
     
    14511448{
    14521449#ifdef VBOX_WITH_USB
    1453     CheckComArgNotNull(aAddress);
     1450    CheckComArgStrNotEmptyOrNull(aAddress);
    14541451    CheckComArgOutPointerValid(aDevice);
    14551452
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r26603 r26753  
    423423            {
    424424                m.realIPAddress = 0;
    425                 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw())), Bstr(""))))
     425                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()), NULL)))
    426426                    return E_FAIL;
    427                 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw())), Bstr(""))))
     427                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()), NULL)))
    428428                    return E_FAIL;
    429429                return S_OK;
  • trunk/src/VBox/Main/MachineImpl.cpp

    r26738 r26753  
    697697STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
    698698{
    699     CheckComArgNotNull(aName);
    700 
    701     if (!*aName)
    702         return setError(E_INVALIDARG,
    703                         tr("Machine name cannot be empty"));
     699    CheckComArgStrNotEmptyOrNull(aName);
    704700
    705701    AutoCaller autoCaller(this);
     
    779775STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
    780776{
    781     CheckComArgNotNull(aOSTypeId);
     777    CheckComArgStrNotEmptyOrNull(aOSTypeId);
    782778
    783779    AutoCaller autoCaller(this);
     
    19301926    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    19311927
    1932     if (mData->mSession.mType.isNull())
    1933         Bstr("").cloneTo(aSessionType);
    1934     else
    1935         mData->mSession.mType.cloneTo(aSessionType);
     1928    mData->mSession.mType.cloneTo(aSessionType);
    19361929
    19371930    return S_OK;
     
    19901983    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    19911984
    1992     if (mSSData->mStateFilePath.isEmpty())
    1993         Bstr("").cloneTo(aStateFilePath);
    1994     else
    1995         mSSData->mStateFilePath.cloneTo(aStateFilePath);
     1985    mSSData->mStateFilePath.cloneTo(aStateFilePath);
    19961986
    19971987    return S_OK;
     
    21372127Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns)
    21382128{
    2139     CheckComArgNotNull(aPatterns);
    21402129    AutoCaller autoCaller(this);
    21412130    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     
    24032392                     aControllerName, aControllerPort, aDevice, aType, aId));
    24042393
    2405     CheckComArgNotNull(aControllerName);
    2406     CheckComArgNotNull(aId);
     2394    CheckComArgStrNotEmptyOrNull(aControllerName);
    24072395
    24082396    AutoCaller autoCaller(this);
     
    28292817                                   LONG aDevice)
    28302818{
    2831     CheckComArgNotNull(aControllerName);
     2819    CheckComArgStrNotEmptyOrNull(aControllerName);
    28322820
    28332821    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n",
     
    29142902                                        LONG aDevice, BOOL aPassthrough)
    29152903{
    2916     CheckComArgNotNull(aControllerName);
     2904    CheckComArgStrNotEmptyOrNull(aControllerName);
    29172905
    29182906    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aPassthrough=%d\n",
     
    29682956                     aControllerName, aControllerPort, aDevice, aForce));
    29692957
    2970     CheckComArgNotNull(aControllerName);
    2971     CheckComArgNotNull(aId);
     2958    CheckComArgStrNotEmptyOrNull(aControllerName);
     2959    CheckComArgStrNotEmptyOrNull(aId);
    29722960
    29732961    AutoCaller autoCaller(this);
     
    31093097                     aControllerName, aControllerPort, aDevice));
    31103098
    3111     CheckComArgNotNull(aControllerName);
     3099    CheckComArgStrNotEmptyOrNull(aControllerName);
    31123100    CheckComArgOutPointerValid(aMedium);
    31133101
     
    32083196                                   BSTR *aValue)
    32093197{
    3210     CheckComArgNotNull(aKey);
     3198    CheckComArgStrNotEmptyOrNull(aKey);
    32113199    CheckComArgOutPointerValid(aValue);
    32123200
     
    32353223STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue)
    32363224{
    3237     CheckComArgNotNull(aKey);
     3225    CheckComArgStrNotEmptyOrNull(aKey);
    32383226
    32393227    AutoCaller autoCaller(this);
     
    32663254        // lock to copy the list of callbacks to invoke
    32673255        Bstr error;
    3268         Bstr bstrValue;
    3269         if (aValue)
    3270             bstrValue = aValue;
    3271         else
    3272             bstrValue = (const char *)"";
     3256        Bstr bstrValue(aValue);
    32733257
    32743258        if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue, error))
    32753259        {
    32763260            const char *sep = error.isEmpty() ? "" : ": ";
    3277             CBSTR err = error.isNull() ? (CBSTR) L"" : error.raw();
     3261            CBSTR err = error.raw();
    32783262            LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
    32793263                            sep, err));
     
    34593443STDMETHODIMP Machine::FindSnapshot(IN_BSTR aName, ISnapshot **aSnapshot)
    34603444{
    3461     CheckComArgNotNull(aName);
     3445    CheckComArgStrNotEmptyOrNull(aName);
    34623446    CheckComArgOutPointerValid(aSnapshot);
    34633447
     
    34853469STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
    34863470{
    3487     CheckComArgNotNull(aName);
    3488     CheckComArgNotNull(aHostPath);
     3471    CheckComArgStrNotEmptyOrNull(aName);
     3472    CheckComArgStrNotEmptyOrNull(aHostPath);
    34893473
    34903474    AutoCaller autoCaller(this);
     
    35203504STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName)
    35213505{
    3522     CheckComArgNotNull(aName);
     3506    CheckComArgStrNotEmptyOrNull(aName);
    35233507
    35243508    AutoCaller autoCaller(this);
     
    36103594    ReturnComNotImplemented();
    36113595#else // VBOX_WITH_GUEST_PROPS
    3612     CheckComArgNotNull(aName);
     3596    CheckComArgStrNotEmptyOrNull(aName);
    36133597    CheckComArgOutPointerValid(aValue);
    36143598    CheckComArgOutPointerValid(aTimestamp);
     
    36893673    using namespace guestProp;
    36903674
    3691     CheckComArgNotNull(aName);
    3692     CheckComArgNotNull(aValue);
     3675    CheckComArgStrNotEmptyOrNull(aName);
    36933676    if ((aFlags != NULL) && !VALID_PTR(aFlags))
    36943677        return E_INVALIDARG;
     
    39343917                     aControllerName, aControllerPort, aDevice));
    39353918
    3936     CheckComArgNotNull(aControllerName);
     3919    CheckComArgStrNotEmptyOrNull(aControllerName);
    39373920    CheckComArgOutPointerValid(aAttachment);
    39383921
     
    89508933#endif /* VBOX_WITH_USB */
    89518934
    8952     if (!mData->mSession.mType.isNull())
     8935    if (!mData->mSession.mType.isEmpty())
    89538936    {
    89548937        /* mType is not null when this machine's process has been started by
     
    96589641    using namespace guestProp;
    96599642
    9660     CheckComArgNotNull(aName);
     9643    CheckComArgStrNotEmptyOrNull(aName);
    96619644    if (aValue != NULL && (!VALID_PTR(aValue) || !VALID_PTR(aFlags)))
    96629645        return E_POINTER;  /* aValue can be NULL to indicate deletion */
  • trunk/src/VBox/Main/Matching.cpp

    r26603 r26753  
    196196
    197197    // empty or null mSimple matches any match
    198     return
    199         mSimple.isEmpty() ||
    200         (mIgnoreCase && mSimple.compareIgnoreCase (aValue) == 0) ||
    201         (!mIgnoreCase && mSimple.compare (aValue) == 0);
     198    return     mSimple.isEmpty()
     199            || (mIgnoreCase && mSimple.compare(aValue, Bstr::CaseInsensitive) == 0)
     200            || (!mIgnoreCase && mSimple.compare(aValue) == 0);
    202201}
    203202
  • trunk/src/VBox/Main/MediumImpl.cpp

    r26603 r26753  
    13611361    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    13621362
    1363     if (m->strDescription.isEmpty())
    1364         Bstr("").cloneTo(aDescription);
    1365     else
    1366         m->strDescription.cloneTo(aDescription);
     1363    m->strDescription.cloneTo(aDescription);
    13671364
    13681365    return S_OK;
     
    13711368STDMETHODIMP Medium::COMSETTER(Description)(IN_BSTR aDescription)
    13721369{
    1373     CheckComArgNotNull(aDescription);
    1374 
    13751370    AutoCaller autoCaller(this);
    13761371    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     
    14151410STDMETHODIMP Medium::COMSETTER(Location)(IN_BSTR aLocation)
    14161411{
    1417     CheckComArgNotNull(aLocation);
     1412    CheckComArgStrNotEmptyOrNull(aLocation);
    14181413
    14191414    AutoCaller autoCaller(this);
     
    17251720    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    17261721
    1727     if (m->strLastAccessError.isEmpty())
    1728         Bstr("").cloneTo(aLastAccessError);
    1729     else
    1730         m->strLastAccessError.cloneTo(aLastAccessError);
     1722    m->strLastAccessError.cloneTo(aLastAccessError);
    17311723
    17321724    return S_OK;
     
    21022094                        tr("Property '%ls' does not exist"), aName);
    21032095
    2104     if (it->second.isEmpty())
    2105         Bstr("").cloneTo(aValue);
    2106     else
    2107         it->second.cloneTo(aValue);
     2096    it->second.cloneTo(aValue);
    21082097
    21092098    return S_OK;
     
    21692158    {
    21702159        it->first.cloneTo(&names[i]);
    2171         if (it->second.isEmpty())
    2172             Bstr("").cloneTo(&values[i]);
    2173         else
    2174             it->second.cloneTo(&values[i]);
    2175         ++ i;
     2160        it->second.cloneTo(&values[i]);
     2161        ++i;
    21762162    }
    21772163
     
    23622348
    23632349STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
    2364                               MediumVariant_T aVariant,
    2365                               IMedium *aParent,
    2366                               IProgress **aProgress)
     2350                             MediumVariant_T aVariant,
     2351                             IMedium *aParent,
     2352                             IProgress **aProgress)
    23672353{
    23682354    CheckComArgNotNull(aTarget);
     
    30903076    {
    30913077        /* only save properties that have non-default values */
    3092         if (!it->second.isNull())
     3078        if (!it->second.isEmpty())
    30933079        {
    30943080            Utf8Str name = it->first;
     
    48584844
    48594845    /* we interpret null values as "no value" in Medium */
    4860     if (it->second.isNull())
     4846    if (it->second.isEmpty())
    48614847        return VERR_CFGM_VALUE_NOT_FOUND;
    48624848
     
    48854871
    48864872    /* we interpret null values as "no value" in Medium */
    4887     if (it->second.isNull())
     4873    if (it->second.isEmpty())
    48884874        return VERR_CFGM_VALUE_NOT_FOUND;
    48894875
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r26603 r26753  
    10261026        case NetworkAttachmentType_NAT:
    10271027            mData->mNATNetwork = data.strName;
    1028             if (mData->mNATNetwork.isNull())
    1029                 mData->mNATNetwork = "";
    10301028            rc = AttachToNAT();
    10311029            if (FAILED(rc)) return rc;
     
    10411039        case NetworkAttachmentType_Internal:
    10421040            mData->mInternalNetwork = data.strName;
    1043             Assert(!mData->mInternalNetwork.isNull());
     1041            Assert(!mData->mInternalNetwork.isEmpty());
    10441042
    10451043            rc = AttachToInternalNetwork();
  • trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp

    r26603 r26753  
    142142
    143143    /* this is const, no need to lock */
    144     Bstr(mData.id).cloneTo(aId);
     144    mData.id.toUtf16().detachTo(aId);
    145145
    146146    return S_OK;
  • trunk/src/VBox/Main/SessionImpl.cpp

    r26603 r26753  
    694694                        Global::stringifySessionState(mState));
    695695    AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    696     CheckComArgNotNull(aName);
     696    CheckComArgStrNotEmptyOrNull(aName);
    697697    if (!aIsSetter && !VALID_PTR(aRetValue))
    698698        return E_POINTER;
  • trunk/src/VBox/Main/SharedFolderImpl.cpp

    r26603 r26753  
    333333    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    334334
    335     if (m.lastAccessError.isEmpty())
    336         Bstr("").cloneTo(aLastAccessError);
    337     else
    338         m.lastAccessError.cloneTo(aLastAccessError);
     335    m.lastAccessError.cloneTo(aLastAccessError);
    339336
    340337    return S_OK;
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r26603 r26753  
    342342STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName)
    343343{
    344     CheckComArgNotNull(aName);
     344    CheckComArgStrNotEmptyOrNull(aName);
    345345
    346346    AutoCaller autoCaller(this);
     
    378378STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription)
    379379{
    380     CheckComArgNotNull(aDescription);
    381 
    382380    AutoCaller autoCaller(this);
    383381    if (FAILED(autoCaller.rc())) return autoCaller.rc();
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r26603 r26753  
    828828        /* MediumFormat is all const, no need to lock */
    829829
    830         if ((*it)->id().compareIgnoreCase (aFormat) == 0)
     830        if ((*it)->id().compare(aFormat, Bstr::CaseInsensitive) == 0)
    831831        {
    832832            format = *it;
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r26603 r26753  
    11101110    rc = aUSBDevice->COMGETTER(Manufacturer) (manufacturer.asOutParam());
    11111111    ComAssertComRCRet(rc, false);
    1112     if (!manufacturer.isNull())
     1112    if (!manufacturer.isEmpty())
    11131113        USBFilterSetStringExact (&dev, USBFILTERIDX_MANUFACTURER_STR, Utf8Str(manufacturer).c_str(), true);
    11141114
     
    11161116    rc = aUSBDevice->COMGETTER(Product) (product.asOutParam());
    11171117    ComAssertComRCRet(rc, false);
    1118     if (!product.isNull())
     1118    if (!product.isEmpty())
    11191119        USBFilterSetStringExact (&dev, USBFILTERIDX_PRODUCT_STR, Utf8Str(product).c_str(), true);
    11201120
     
    11221122    rc = aUSBDevice->COMGETTER(SerialNumber) (serialNumber.asOutParam());
    11231123    ComAssertComRCRet(rc, false);
    1124     if (!serialNumber.isNull())
     1124    if (!serialNumber.isEmpty())
    11251125        USBFilterSetStringExact (&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber).c_str(), true);
    11261126
  • trunk/src/VBox/Main/USBDeviceImpl.cpp

    r26603 r26753  
    155155
    156156    /* this is const, no need to lock */
    157     Guid(mData.id).toString().cloneTo(aId);
     157    Guid(mData.id).toUtf16().detachTo(aId);
    158158
    159159    return S_OK;
  • trunk/src/VBox/Main/VFSExplorerImpl.cpp

    r25860 r26753  
    561561STDMETHODIMP VFSExplorer::Cd(IN_BSTR aDir, IProgress **aProgress)
    562562{
    563     CheckComArgNotNull(aDir);
     563    CheckComArgStrNotEmptyOrNull(aDir);
    564564    CheckComArgOutPointerValid(aProgress);
    565565
  • trunk/src/VBox/Main/VirtualBoxBase.cpp

    r26603 r26753  
    810810 */
    811811/* static */
    812 HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal (
    813     HRESULT aResultCode, const GUID &aIID,
    814     const Bstr &aComponent, const Bstr &aText,
    815     bool aWarning, bool aLogIt)
     812HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal(HRESULT aResultCode,
     813                                                             const GUID &aIID,
     814                                                             const wchar_t *aComponent,
     815                                                             const Bstr &aText,
     816                                                             bool aWarning,
     817                                                             bool aLogIt)
    816818{
    817819    /* whether multi-error mode is turned on */
    818     bool preserve = ((uintptr_t) RTTlsGet (MultiResult::sCounter)) > 0;
     820    bool preserve = ((uintptr_t)RTTlsGet(MultiResult::sCounter)) > 0;
     821
     822    Bstr bstrComponent((CBSTR)aComponent);
    819823
    820824    if (aLogIt)
    821         LogRel (("ERROR [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%ls} aText={%ls} "
    822                  "aWarning=%RTbool, preserve=%RTbool\n",
    823                  aResultCode, aResultCode, &aIID, aComponent.raw(), aText.raw(), aWarning,
    824                  preserve));
     825        LogRel(("ERROR [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%ls} aText={%ls} "
     826                "aWarning=%RTbool, preserve=%RTbool\n",
     827                aResultCode, aResultCode, &aIID, bstrComponent.raw(), aText.raw(), aWarning,
     828                preserve));
    825829
    826830    /* these are mandatory, others -- not */
     
    870874
    871875        /* set the current error info and preserve the previous one if any */
    872         rc = info->init (aResultCode, aIID, aComponent, aText, curInfo);
     876        rc = info->init(aResultCode, aIID, bstrComponent, aText, curInfo);
    873877        if (FAILED(rc)) break;
    874878
     
    914918
    915919            /* set the current error info and preserve the previous one if any */
    916             rc = info->init (aResultCode, aIID, aComponent, aText, curInfo);
     920            rc = info->init(aResultCode, aIID, bstrComponent, aText, curInfo);
    917921            if (FAILED(rc)) break;
    918922
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r26603 r26753  
    302302    LogFlowThisFuncEnter();
    303303
    304     if (sVersion.isNull())
     304    if (sVersion.isEmpty())
    305305        sVersion = VBOX_VERSION_STRING;
    306306    sRevision = RTBldCfgRevision();
    307     if (sPackageType.isNull())
     307    if (sPackageType.isEmpty())
    308308        sPackageType = VBOX_PACKAGE_STRING;
    309309    LogFlowThisFunc(("Version: %ls, Package: %ls\n", sVersion.raw(), sPackageType.raw()));
     
    12251225    LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aName, aMachine));
    12261226
    1227     CheckComArgNotNull(aName);
     1227    CheckComArgStrNotEmptyOrNull(aName);
    12281228    CheckComArgOutSafeArrayPointerValid(aMachine);
    12291229
     
    13421342STDMETHODIMP VirtualBox::OpenHardDisk(IN_BSTR aLocation,
    13431343                                      AccessMode_T accessMode,
    1344                                       BOOL aSetImageId, IN_BSTR aImageId,
    1345                                       BOOL aSetParentId, IN_BSTR aParentId,
     1344                                      BOOL aSetImageId,
     1345                                      IN_BSTR aImageId,
     1346                                      BOOL aSetParentId,
     1347                                      IN_BSTR aParentId,
    13461348                                      IMedium **aHardDisk)
    13471349{
    1348     CheckComArgNotNull(aLocation);
    1349     CheckComArgNotNull(aImageId);
    1350     CheckComArgNotNull(aParentId);
     1350    CheckComArgStrNotEmptyOrNull(aLocation);
    13511351    CheckComArgOutSafeArrayPointerValid(aHardDisk);
    13521352
     
    14231423                                      IMedium **aHardDisk)
    14241424{
    1425     CheckComArgNotNull(aLocation);
     1425    CheckComArgStrNotEmptyOrNull(aLocation);
    14261426    CheckComArgOutSafeArrayPointerValid(aHardDisk);
    14271427
     
    14991499STDMETHODIMP VirtualBox::FindDVDImage (IN_BSTR aLocation, IMedium **aDVDImage)
    15001500{
    1501     CheckComArgNotNull(aLocation);
     1501    CheckComArgStrNotEmptyOrNull(aLocation);
    15021502    CheckComArgOutSafeArrayPointerValid(aDVDImage);
    15031503
     
    15781578                                          IMedium **aFloppyImage)
    15791579{
    1580     CheckComArgNotNull(aLocation);
     1580    CheckComArgStrNotEmptyOrNull(aLocation);
    15811581    CheckComArgOutSafeArrayPointerValid(aFloppyImage);
    15821582
     
    16151615    };
    16161616
    1617     CheckComArgNotNull (aType);
     1617    CheckComArgNotNull(aType);
    16181618
    16191619    AutoCaller autoCaller(this);
     
    16391639    {
    16401640        const Bstr &typeId = (*it)->id();
    1641         AssertMsg (!!typeId, ("ID must not be NULL"));
    1642         if (typeId.compareIgnoreCase (id) == 0)
     1641        AssertMsg(!typeId.isEmpty(), ("ID must not be NULL"));
     1642        if (typeId.compare(id, Bstr::CaseInsensitive) == 0)
    16431643        {
    16441644            (*it).queryInterfaceTo(aType);
     
    16551655STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL /* aWritable */)
    16561656{
    1657     CheckComArgNotNull(aName);
    1658     CheckComArgNotNull(aHostPath);
     1657    CheckComArgStrNotEmptyOrNull(aName);
     1658    CheckComArgStrNotEmptyOrNull(aHostPath);
    16591659
    16601660    AutoCaller autoCaller(this);
     
    16661666STDMETHODIMP VirtualBox::RemoveSharedFolder(IN_BSTR aName)
    16671667{
    1668     CheckComArgNotNull(aName);
     1668    CheckComArgStrNotEmptyOrNull(aName);
    16691669
    16701670    AutoCaller autoCaller(this);
     
    17091709                                      BSTR *aValue)
    17101710{
    1711     CheckComArgNotNull(aKey);
     1711    CheckComArgStrNotEmptyOrNull(aKey);
    17121712    CheckComArgNotNull(aValue);
    17131713
     
    17161716
    17171717    /* start with nothing found */
    1718     Bstr bstrResult("");
    1719 
    1720     settings::ExtraDataItemsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(Utf8Str(aKey));
     1718    Utf8Str strKey(aKey);
     1719    Bstr bstrResult;
     1720
     1721    settings::ExtraDataItemsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(strKey);
    17211722    if (it != m->pMainConfigFile->mapExtraDataItems.end())
    17221723        // found:
     
    17351736                                      IN_BSTR aValue)
    17361737{
    1737     CheckComArgNotNull(aKey);
     1738    CheckComArgStrNotEmptyOrNull(aKey);
    17381739
    17391740    AutoCaller autoCaller(this);
     
    17661767        // lock to copy the list of callbacks to invoke
    17671768        Bstr error;
    1768         Bstr bstrValue;
    1769         if (aValue)
    1770             bstrValue = aValue;
    1771         else
    1772             bstrValue = (const char *)"";
     1769        Bstr bstrValue(aValue);
    17731770
    17741771        if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue, error))
    17751772        {
    17761773            const char *sep = error.isEmpty() ? "" : ": ";
    1777             CBSTR err = error.isNull() ? (CBSTR) L"" : error.raw();
     1774            CBSTR err = error.raw();
    17781775            LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
    17791776                            sep, err));
     
    18661863    LogRel(("remotesession=%s\n", Utf8Str(aMachineId).c_str()));
    18671864
    1868     CheckComArgNotNull(aMachineId);
     1865    CheckComArgStrNotEmptyOrNull(aMachineId);
    18691866    CheckComArgNotNull(aSession);
    1870     CheckComArgNotNull(aType);
     1867    CheckComArgStrNotEmptyOrNull(aType);
    18711868    CheckComArgOutSafeArrayPointerValid(aProgress);
    18721869
     
    43594356STDMETHODIMP VirtualBox::CreateDHCPServer (IN_BSTR aName, IDHCPServer ** aServer)
    43604357{
    4361     CheckComArgNotNull(aName);
     4358    CheckComArgStrNotEmptyOrNull(aName);
    43624359    CheckComArgNotNull(aServer);
    43634360
     
    43804377STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer ** aServer)
    43814378{
    4382     CheckComArgNotNull(aName);
     4379    CheckComArgStrNotEmptyOrNull(aName);
    43834380    CheckComArgNotNull(aServer);
    43844381
     
    44564453
    44574454    ComPtr<IDHCPServer> existing;
    4458     rc = FindDHCPServerByNetworkName(name.mutableRaw(), existing.asOutParam());
     4455    rc = FindDHCPServerByNetworkName(name, existing.asOutParam());
    44594456    if (SUCCEEDED(rc))
    44604457    {
  • trunk/src/VBox/Main/generic/NetIf-generic.cpp

    r26603 r26753  
    234234            return VERR_INVALID_PARAMETER;
    235235        iface->COMGETTER(Name) (ifname.asOutParam());
    236         if (ifname.isNull())
     236        if (ifname.isEmpty())
    237237            return VERR_INTERNAL_ERROR;
    238238
  • trunk/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp

    r25149 r26753  
    202202        return NS_ERROR_INVALID_POINTER;
    203203
    204     Utf8Str (mText).cloneTo(aMessage);
     204    Utf8Str(mText).cloneTo(aMessage);
    205205    return S_OK;
    206206}
  • trunk/src/VBox/Main/glue/string.cpp

    r26186 r26753  
    44 *
    55 * MS COM / XPCOM Abstraction Layer:
    6  * Smart string classes definition
     6 * UTF-8 and UTF-16 string classes
    77 */
    88
     
    3131{
    3232
     33// BSTR representing a null wide char with 32 bits of length prefix (0);
     34// this will work on Windows as well as other platforms where BSTR does
     35// not use length prefixes
     36const OLECHAR g_achEmptyBstr[3] = { 0, 0, 0 };
     37const BSTR g_bstrEmpty = (BSTR)(&g_achEmptyBstr[2]);
     38
    3339/* static */
    3440const Bstr Bstr::Null; /* default ctor is OK */
     
    3642/* static */
    3743const Utf8Str Utf8Str::Null; /* default ctor is OK */
     44
     45#if defined (VBOX_WITH_XPCOM)
     46void Utf8Str::cloneTo(char **pstr) const
     47{
     48    size_t cb = length() + 1;
     49    *pstr = (char*)nsMemory::Alloc(cb);
     50    if (!*pstr)
     51        throw std::bad_alloc();
     52    memcpy(*pstr, c_str(), cb);
     53}
     54#endif
    3855
    3956Utf8Str& Utf8Str::toLower()
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r26238 r26753  
    781781class VirtualBoxSupportErrorInfoImplBase
    782782{
    783     static HRESULT setErrorInternal(HRESULT aResultCode, const GUID &aIID,
    784                                     const Bstr &aComponent, const Bstr &aText,
    785                                     bool aWarning, bool aLogIt);
     783    static HRESULT setErrorInternal(HRESULT aResultCode,
     784                                    const GUID &aIID,
     785                                    const wchar_t *aComponent,
     786                                    const Bstr &aText,
     787                                    bool aWarning,
     788                                    bool aLogIt);
    786789
    787790protected:
     
    910913    };
    911914
    912     static HRESULT setError(HRESULT aResultCode, const GUID &aIID,
    913                             const Bstr &aComponent,
     915    static HRESULT setError(HRESULT aResultCode,
     916                            const GUID &aIID,
     917                            const wchar_t *aComponent,
    914918                            const Bstr &aText,
    915919                            bool aLogIt = true)
     
    919923    }
    920924
    921     static HRESULT setWarning(HRESULT aResultCode, const GUID &aIID,
    922                               const Bstr &aComponent,
     925    static HRESULT setWarning(HRESULT aResultCode,
     926                              const GUID &aIID,
     927                              const wchar_t *aComponent,
    923928                              const Bstr &aText)
    924929    {
     
    927932    }
    928933
    929     static HRESULT setError(HRESULT aResultCode, const GUID &aIID,
    930                             const Bstr &aComponent,
     934    static HRESULT setError(HRESULT aResultCode,
     935                            const GUID &aIID,
     936                            const wchar_t *aComponent,
    931937                            const char *aText, va_list aArgs, bool aLogIt = true)
    932938    {
     
    936942    }
    937943
    938     static HRESULT setWarning(HRESULT aResultCode, const GUID &aIID,
    939                               const Bstr &aComponent,
     944    static HRESULT setWarning(HRESULT aResultCode,
     945                              const GUID &aIID,
     946                              const wchar_t *aComponent,
    940947                              const char *aText, va_list aArgs)
    941948    {
     
    10611068        va_list args;
    10621069        va_start(args, aText);
    1063         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(
    1064             aResultCode, aIID, aComponent, aText, args, true /* aLogIt */);
     1070        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(aResultCode,
     1071                                                                  aIID,
     1072                                                                  aComponent,
     1073                                                                  aText,
     1074                                                                  args,
     1075                                                                  true /* aLogIt */);
    10651076        va_end(args);
    10661077        return rc;
     
    11151126        va_list args;
    11161127        va_start(args, aText);
    1117         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(
    1118             aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args, true /* aLogIt */);
     1128        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(aResultCode,
     1129                                                                  COM_IIDOF(I),
     1130                                                                  C::getComponentName(),
     1131                                                                  aText,
     1132                                                                  args,
     1133                                                                  true /* aLogIt */);
    11191134        va_end(args);
    11201135        return rc;
     
    11341149        va_list args;
    11351150        va_start(args, aText);
    1136         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(
    1137             aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args);
     1151        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(aResultCode,
     1152                                                                    COM_IIDOF(I),
     1153                                                                    C::getComponentName(),
     1154                                                                    aText,
     1155                                                                    args);
    11381156        va_end(args);
    11391157        return rc;
     
    11521170                             va_list aArgs)
    11531171    {
    1154         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(
    1155             aResultCode, COM_IIDOF(I), C::getComponentName(), aText, aArgs, true /* aLogIt */);
     1172        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(aResultCode,
     1173                                                                  COM_IIDOF(I),
     1174                                                                  C::getComponentName(),
     1175                                                                  aText,
     1176                                                                  aArgs,
     1177                                                                  true /* aLogIt */);
    11561178        return rc;
    11571179    }
     
    11691191                               va_list aArgs)
    11701192    {
    1171         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(
    1172             aResultCode, COM_IIDOF(I), C::getComponentName(), aText, aArgs);
     1193        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(aResultCode,
     1194                                                                    COM_IIDOF(I),
     1195                                                                    C::getComponentName(),
     1196                                                                    aText,
     1197                                                                    aArgs);
    11731198        return rc;
    11741199    }
     
    11881213        va_list args;
    11891214        va_start(args, aText);
    1190         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(
    1191             aResultCode, aIID, C::getComponentName(), aText, args, true /* aLogIt */);
     1215        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(aResultCode,
     1216                                                                  aIID,
     1217                                                                  C::getComponentName(),
     1218                                                                  aText,
     1219                                                                  args,
     1220                                                                  true /* aLogIt */);
    11921221        va_end(args);
    11931222        return rc;
     
    12081237        va_list args;
    12091238        va_start(args, aText);
    1210         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(
    1211             aResultCode, aIID, C::getComponentName(), aText, args);
     1239        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning(aResultCode,
     1240                                                                    aIID,
     1241                                                                    C::getComponentName(),
     1242                                                                    aText,
     1243                                                                    args);
    12121244        va_end(args);
    12131245        return rc;
     
    12251257        va_list args;
    12261258        va_start(args, aText);
    1227         HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(
    1228             aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args, false /* aLogIt */);
     1259        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError(aResultCode,
     1260                                                                  COM_IIDOF(I),
     1261                                                                  C::getComponentName(),
     1262                                                                  aText,
     1263                                                                  args,
     1264                                                                  false /* aLogIt */);
    12291265        va_end(args);
    12301266        return rc;
  • trunk/src/VBox/Main/win/NetIf-win.cpp

    r26603 r26753  
    908908    if(hr == S_OK)
    909909    {
    910         size_t cUnicodeName = wcslen(lpszName) + 1;
    911         size_t uniLen = (cUnicodeName * 2 + sizeof (OLECHAR) - 1) / sizeof (OLECHAR);
    912         Bstr name (uniLen + 1 /* extra zero */);
    913         wcscpy((wchar_t *) name.mutableRaw(), lpszName);
     910        Bstr name(lpszName);
    914911
    915912        hr = pncc->GetInstanceGuid(&IfGuid);
  • trunk/src/VBox/Main/win/svcmain.cpp

    r26603 r26753  
    231231
    232232                if (*lpszToken != NULL)
    233                 {
    234                     Bstr str (lpszToken);
    235                     LPCTSTR lpszToken2 = FindOneOf(lpszToken, szTokens);
    236                     if (lpszToken2)
    237                         str.mutableRaw()[lpszToken2 - lpszToken] = '\0';
    238233                    pipeName = Utf8Str(lpszToken);
    239                 }
    240234            }
    241235
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