VirtualBox

Changeset 82476 in vbox for trunk


Ignore:
Timestamp:
Dec 6, 2019 11:52:16 PM (5 years ago)
Author:
vboxsync
Message:

GuestHost/SharedClipboard.h: Fixed some broken macros: VBOX_SHCL_MAX_EVENTS, VBOX_SHCL_MAX_TRANSFERS, VBOX_SHCL_MAX_SESSIONS and VBOX_SHCL_CONTEXTID_MAKE_SESSION. Some cleanups. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard.h

    r82462 r82476  
    122122    /** Payload ID; currently unused. */
    123123    uint32_t uID;
     124    /** Size (in bytes) of actual payload data. */
     125    uint32_t cbData;
    124126    /** Pointer to actual payload data. */
    125127    void    *pvData;
    126     /** Size (in bytes) of actual payload data. */
    127     uint32_t cbData;
    128128} SHCLEVENTPAYLOAD, *PSHCLEVENTPAYLOAD;
    129129
     
    155155
    156156/** Maximum number of concurrent Shared Clipboard client sessions a VM can have. */
    157 #define VBOX_SHCL_MAX_SESSIONS                   UINT16_MAX - 1
     157#define VBOX_SHCL_MAX_SESSIONS                   (UINT16_MAX - 1)
    158158/** Maximum number of concurrent Shared Clipboard transfers a single
    159159 *  client can have. */
    160 #define VBOX_SHCL_MAX_TRANSFERS                  UINT16_MAX - 1
     160#define VBOX_SHCL_MAX_TRANSFERS                  (UINT16_MAX - 1)
    161161/** Maximum number of events a single Shared Clipboard transfer can have. */
    162 #define VBOX_SHCL_MAX_EVENTS                     UINT32_MAX - 1
     162#define VBOX_SHCL_MAX_EVENTS                     (UINT32_MAX - 1)
    163163
    164164/**
    165165 * Creates a context ID out of a client ID, a transfer ID and a count (can be an event ID).
    166166 */
    167 #define VBOX_SHCL_CONTEXTID_MAKE(uSessionID, uTransferID, uEventID) \
    168     (  (uint64_t)((uSessionID)  & 0xffff) << 48 \
    169      | (uint64_t)((uTransferID) & 0xffff) << 32 \
    170      | (uint32_t)((uEventID)    & 0xffffffff) \
     167#define VBOX_SHCL_CONTEXTID_MAKE(a_idSession, a_idTransfer, a_idEvent) \
     168    (  ((uint64_t)((a_idSession)  & 0xffff) << 48) \
     169     | ((uint64_t)((a_idTransfer) & 0xffff) << 32) \
     170     | ((uint32_t) (a_idEvent)) \
    171171    )
    172172/** Creates a context ID out of a session ID. */
    173 #define VBOX_SHCL_CONTEXTID_MAKE_SESSION(uSessionID) \
    174     ((uint32_t)((uSessionID) & 0xffff) << 48)
     173#define VBOX_SHCL_CONTEXTID_MAKE_SESSION(a_idSession)    VBOX_SHCL_CONTEXTID_MAKE(a_idSession, 0, 0)
    175174/** Gets the session ID out of a context ID. */
    176 #define VBOX_SHCL_CONTEXTID_GET_SESSION(uContextID) \
    177     (((uContextID) >> 48) & 0xffff)
     175#define VBOX_SHCL_CONTEXTID_GET_SESSION(a_idContext)     ( (uint16_t)(((a_idContext) >> 48) & UINT16_MAX) )
    178176/** Gets the transfer ID out of a context ID. */
    179 #define VBOX_SHCL_CONTEXTID_GET_TRANSFER(uContextID) \
    180     (((uContextID) >> 32) & 0xffff)
     177#define VBOX_SHCL_CONTEXTID_GET_TRANSFER(a_idContext)    ( (uint16_t)(((a_idContext) >> 32) & UINT16_MAX) )
    181178/** Gets the transfer event out of a context ID. */
    182 #define VBOX_SHCL_CONTEXTID_GET_EVENT(uContextID) \
    183     ((uContextID) & 0xffffffff)
    184 
    185 /**
    186  * Structure for maintaining a Shared Clipboard event.
     179#define VBOX_SHCL_CONTEXTID_GET_EVENT(a_idContext)       ( (uint32_t)( (a_idContext)        & UINT32_MAX) )
     180
     181/**
     182 * Shared Clipboard event.
    187183 */
    188184typedef struct _SHCLEVENT
     
    199195
    200196/**
    201  * Structure for maintaining a Shared Clipboard event source.
    202  *
    203  * Each event source maintains an own counter for events, so that
    204  * it can be used in different contexts.
    205  */
    206 typedef struct _SHCLEVENTSOURCE
    207 {
    208     /** The event source' ID. */
     197 * Shared Clipboard event source.
     198 *
     199 * Each event source maintains an own counter for events, so that it can be used
     200 * in different contexts.
     201 */
     202typedef struct SHCLEVENTSOURCE
     203{
     204    /** The event source ID. */
    209205    SHCLEVENTSOURCEID uID;
    210206    /** Next upcoming event ID. */
     
    224220 *  @{
    225221 */
    226 int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID uID);
     222int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID idEvtSrc);
    227223void ShClEventSourceDestroy(PSHCLEVENTSOURCE pSource);
    228224void ShClEventSourceReset(PSHCLEVENTSOURCE pSource);
     
    234230SHCLEVENTID ShClEventIDGenerate(PSHCLEVENTSOURCE pSource);
    235231SHCLEVENTID ShClEventGetLast(PSHCLEVENTSOURCE pSource);
    236 int ShClEventRegister(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID);
    237 int ShClEventUnregister(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID);
    238 int ShClEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD* ppPayload);
    239 int ShClEventSignal(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID, PSHCLEVENTPAYLOAD pPayload);
    240 void ShClEventPayloadDetach(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID);
     232int ShClEventRegister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
     233int ShClEventUnregister(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
     234int ShClEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload);
     235int ShClEventSignal(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent, PSHCLEVENTPAYLOAD pPayload);
     236void ShClEventPayloadDetach(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
    241237/** @} */
    242238
    243239/**
    244  * Enumeration to specify the Shared Clipboard transfer source type.
     240 * Shared Clipboard transfer source type.
    245241 */
    246242typedef enum SHCLSOURCE
     
    253249    SHCLSOURCE_REMOTE,
    254250    /** The usual 32-bit hack. */
    255     SHCLSOURCE_32Bit_Hack = 0x7fffffff
     251    SHCLSOURCE_32BIT_HACK = 0x7fffffff
    256252} SHCLSOURCE;
    257253
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