diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 13:51:24 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 14:32:19 -0700 |
commit | 5e66fb64762b6d442a55d0506b07be18aeee7643 (patch) | |
tree | f8a5a74455665f63962c978b1f657a6e0f82b153 | |
parent | 58073bc12d17341cb9459f36caf161256fc8be19 (diff) |
Replace custom copy of GetReq macro with call to Xlib 1.5's _XGetRequest
XvMCproto.h names don't match those required by the Xlibint.h GetReq*
macros, but at least we can rely on the _XGetRequest function for the
bulk of the work now, instead of duplicating it.
Continues to use sizeof() instead of SIZEOF() due to stray ; on the
end of many sz_* definitions in XvMCproto.h, but I've verified the
sizes are the same with both methods.
Also clears clang warnings that were repeated for every call:
XvMC.c:79:5: warning: cast from 'char *' to 'xvmcQueryVersionReq *'
increases required alignment from 1 to 2 [-Wcast-align]
XvMCGetReq(QueryVersion, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./XvMClibint.h:16:8: note: expanded from macro 'XvMCGetReq'
req = (xvmc##name##Req *)(dpy->last_req = dpy->bufptr);\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XvMC.c:79:5: warning: implicit conversion loses integer precision:
'int' to 'CARD8' (aka 'unsigned char') [-Wconversion]
XvMCGetReq(QueryVersion, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./XvMClibint.h:17:30: note: expanded from macro 'XvMCGetReq'
req->reqType = info->codes->major_opcode;\
~ ~~~~~~~~~~~~~^~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/XvMClibint.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/XvMClibint.h b/src/XvMClibint.h index b21b966..a6ac5f2 100644 --- a/src/XvMClibint.h +++ b/src/XvMClibint.h @@ -9,16 +9,12 @@ #define XvMCCheckExtension(dpy, i, val) \ XextCheckExtension(dpy, i, xvmc_extension_name, val) +/* names in XvMCproto.h don't match the expectation of Xlib's GetReq* macros, + so we have to provide our own implementation */ #define XvMCGetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + sizeof(xvmc##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xvmc##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = info->codes->major_opcode;\ - req->xvmcReqType = xvmc_##name; \ - req->length = sizeof(xvmc##name##Req)>>2;\ - dpy->bufptr += sizeof(xvmc##name##Req);\ - dpy->request++ + req = (xvmc##name##Req *) _XGetRequest( \ + dpy, (CARD8) info->codes->major_opcode, sizeof(xvmc##name##Req)); \ + req->xvmcReqType = xvmc_##name _XFUNCPROTOBEGIN |