VirtualBox

Ignore:
Timestamp:
Jul 8, 2020 7:33:26 PM (5 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

Location:
trunk/src/VBox/Additions/x11/VBoxClient
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp

    r83135 r85121  
    430430RTVEC_DECL(RectList, RTRECT)
    431431
    432 DECLCALLBACK(int) getRectsCallback(VBoxGuestWinInfo *pInfo,
    433                                    struct RectList *pRects)
     432static DECLCALLBACK(int) getRectsCallback(VBoxGuestWinInfo *pInfo, struct RectList *pRects)
    434433{
    435434    if (pInfo->mhasShape)
     
    485484            return rc;
    486485    }
    487     mGuestWindows.doWithAll((PVBOXGUESTWINCALLBACK)getRectsCallback,
    488                             &rects);
     486    mGuestWindows.doWithAll((PFNVBOXGUESTWINCALLBACK)getRectsCallback, &rects);
    489487    if (mpRects)
    490488        RTMemFree(mpRects);
  • trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h

    r83135 r85121  
    4949/** Structure containing information about a guest window's position and visible area.
    5050    Used inside of VBoxGuestWindowList. */
    51 struct VBoxGuestWinInfo {
     51struct VBoxGuestWinInfo
     52{
    5253public:
    5354    /** Header structure for insertion into an AVL tree */
     
    6667    XRectangle *mpRects;
    6768    /** Constructor. */
    68     VBoxGuestWinInfo(bool hasShape, int x, int y, int w, int h, int cRects,
    69                      XRectangle *pRects)
    70             : mhasShape(hasShape), mX(x), mY(y), mWidth(w), mHeight(h),
    71               mcRects(cRects), mpRects(pRects) {}
     69    VBoxGuestWinInfo(bool hasShape, int x, int y, int w, int h, int cRects, XRectangle *pRects)
     70        : mhasShape(hasShape), mX(x), mY(y), mWidth(w), mHeight(h)
     71        , mcRects(cRects), mpRects(pRects)
     72    {}
    7273
    7374    /** Destructor */
     
    8384private:
    8485    // We don't want a copy constructor or assignment operator
    85     VBoxGuestWinInfo(const VBoxGuestWinInfo&);
    86     VBoxGuestWinInfo& operator=(const VBoxGuestWinInfo&);
     86    VBoxGuestWinInfo(const VBoxGuestWinInfo &);
     87    VBoxGuestWinInfo &operator=(const VBoxGuestWinInfo &);
    8788};
    8889
    8990/** Callback type used for "DoWithAll" calls */
    90 typedef DECLCALLBACK(int) VBOXGUESTWINCALLBACK(VBoxGuestWinInfo *, void *);
     91typedef DECLCALLBACKTYPE(int, FNVBOXGUESTWINCALLBACK,(VBoxGuestWinInfo *, void *));
    9192/** Pointer to VBOXGUESTWINCALLBACK */
    92 typedef VBOXGUESTWINCALLBACK *PVBOXGUESTWINCALLBACK;
    93 
    94 DECLCALLBACK(int) inline VBoxGuestWinCleanup(VBoxGuestWinInfo *pInfo, void *)
     93typedef FNVBOXGUESTWINCALLBACK *PFNVBOXGUESTWINCALLBACK;
     94
     95static inline DECLCALLBACK(int) VBoxGuestWinCleanup(VBoxGuestWinInfo *pInfo, void *)
    9596{
    9697    delete pInfo;
     
    136137    }
    137138
    138     void detachAll(PVBOXGUESTWINCALLBACK pCallback, void *pvParam)
    139     {
    140         RTAvlU32Destroy(&mWindows, (PAVLU32CALLBACK)pCallback, pvParam);
    141     }
    142 
    143     int doWithAll(PVBOXGUESTWINCALLBACK pCallback, void *pvParam)
    144     {
    145         return RTAvlU32DoWithAll(&mWindows, 1, (PAVLU32CALLBACK)pCallback,
    146                                  pvParam);
     139    void detachAll(PFNVBOXGUESTWINCALLBACK pfnCallback, void *pvParam)
     140    {
     141        RTAvlU32Destroy(&mWindows, (PAVLU32CALLBACK)pfnCallback, pvParam);
     142    }
     143
     144    int doWithAll(PFNVBOXGUESTWINCALLBACK pfnCallback, void *pvParam)
     145    {
     146        return RTAvlU32DoWithAll(&mWindows, 1, (PAVLU32CALLBACK)pfnCallback, pvParam);
    147147    }
    148148
     
    152152        LogRelFlowFunc(("hWin=%lu, isMapped=%RTbool, x=%d, y=%d, w=%d, h=%d, cRects=%d\n",
    153153                        (unsigned long) hWin, isMapped, x, y, w, h, cRects));
    154         VBoxGuestWinInfo *pInfo = new VBoxGuestWinInfo(isMapped, x, y, w, h, cRects,
    155                                                        pRects);
     154        VBoxGuestWinInfo *pInfo = new VBoxGuestWinInfo(isMapped, x, y, w, h, cRects, pRects);
    156155        pInfo->Core.Key = hWin;
    157156        LogRelFlowFuncLeave();
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