VirtualBox

Ignore:
Timestamp:
Feb 1, 2013 6:28:53 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83539
Message:

Main: change API. Interface IMediumFormat was touched. Attribute capabilities got the type MediumFormatCapabilities and option safeArray. PR5434.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MediumFormatImpl.cpp

    r37587 r44503  
    218218}
    219219
    220 STDMETHODIMP MediumFormat::COMGETTER(Capabilities)(ULONG *aCaps)
    221 {
    222     CheckComArgOutPointerValid(aCaps);
    223 
    224     AutoCaller autoCaller(this);
    225     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    226 
    227     /* m.capabilities is const, no need to lock */
    228 
    229     /// @todo add COMGETTER(ExtendedCapabilities) when we reach the 32 bit
    230     /// limit (or make the argument ULONG64 after checking that COM is capable
    231     /// of defining enums (used to represent bit flags) that contain 64-bit
    232     /// values). Or go away from the enum/ulong hack for bit sets and use
    233     /// a safearray like elsewhere.
    234     ComAssertRet((uint64_t)m.capabilities == ((ULONG)m.capabilities), E_FAIL);
    235 
    236     *aCaps = (ULONG)m.capabilities;
     220STDMETHODIMP MediumFormat::COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCaps))
     221{
     222    CheckComArgOutSafeArrayPointerValid(aCaps);
     223
     224    AutoCaller autoCaller(this);
     225    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     226
     227    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     228
     229    SafeArray<MediumFormatCapabilities_T> capabilities(sizeof(MediumFormatCapabilities_T)*8);
     230
     231    for (ULONG i = 0; i < capabilities.size(); ++i)
     232    {
     233        ULONG temp = m.capabilities;
     234        temp &= 1<<i;
     235        capabilities [i] = (MediumFormatCapabilities_T)temp;
     236    }
     237
     238    capabilities.detachTo(ComSafeArrayOutArg(aCaps));
    237239
    238240    return S_OK;
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