diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 14:26:55 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-19 14:32:42 -0700 |
commit | 76c83199fce3a54f78a2a167037db7460c7161f4 (patch) | |
tree | 2c5e627af84429cbd2a312fe5210f854670b445e | |
parent | 5e66fb64762b6d442a55d0506b07be18aeee7643 (diff) |
Handle implicit conversion warnings from clang
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/XvMC.c | 76 | ||||
-rw-r--r-- | wrapper/XvMCWrapper.c | 11 |
2 files changed, 43 insertions, 44 deletions
@@ -82,8 +82,8 @@ XvMCQueryVersion(Display *dpy, int *major, int *minor) SyncHandle(); return BadImplementation; } - *major = rep.major; - *minor = rep.minor; + *major = (int) rep.major; + *minor = (int) rep.minor; UnlockDisplay(dpy); SyncHandle(); return Success; @@ -103,7 +103,7 @@ XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) LockDisplay(dpy); XvMCGetReq(ListSurfaceTypes, req); - req->port = port; + req->port = (CARD32) port; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); @@ -115,13 +115,13 @@ XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) surface_info = Xmalloc(rep.num * sizeof(XvMCSurfaceInfo)); if (surface_info) { - *num = rep.num; + *num = (int) rep.num; for (CARD32 i = 0; i < rep.num; i++) { xvmcSurfaceInfo sinfo; _XRead(dpy, (char *) &sinfo, sizeof(xvmcSurfaceInfo)); - surface_info[i].surface_type_id = sinfo.surface_type_id; + surface_info[i].surface_type_id = (int) sinfo.surface_type_id; surface_info[i].chroma_format = sinfo.chroma_format; surface_info[i].max_width = sinfo.max_width; surface_info[i].max_height = sinfo.max_height; @@ -129,8 +129,8 @@ XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) sinfo.subpicture_max_width; surface_info[i].subpicture_max_height = sinfo.subpicture_max_height; - surface_info[i].mc_type = sinfo.mc_type; - surface_info[i].flags = sinfo.flags; + surface_info[i].mc_type = (int) sinfo.mc_type; + surface_info[i].flags = (int) sinfo.flags; } } else @@ -159,8 +159,8 @@ XvMCListSubpictureTypes(Display *dpy, LockDisplay(dpy); XvMCGetReq(ListSubpictureTypes, req); - req->port = port; - req->surface_type_id = surface_type_id; + req->port = (CARD32) port; + req->surface_type_id = (CARD32) surface_type_id; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); @@ -172,13 +172,13 @@ XvMCListSubpictureTypes(Display *dpy, ret = Xmalloc(rep.num * sizeof(XvImageFormatValues)); if (ret) { - *count_return = rep.num; + *count_return = (int) rep.num; for (CARD32 i = 0; i < rep.num; i++) { xvImageFormatInfo Info; _XRead(dpy, (char *) (&Info), sz_xvImageFormatInfo); - ret[i].id = Info.id; + ret[i].id = (int) Info.id; ret[i].type = Info.type; ret[i].byte_order = Info.byte_order; memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); @@ -250,12 +250,12 @@ _xvmc_create_context(Display *dpy, LockDisplay(dpy); XvMCGetReq(CreateContext, req); context->context_id = XAllocID(dpy); - req->context_id = context->context_id; - req->port = context->port; - req->surface_type_id = context->surface_type_id; + req->context_id = (CARD32) context->context_id; + req->port = (CARD32) context->port; + req->surface_type_id = (CARD32) context->surface_type_id; req->width = context->width; req->height = context->height; - req->flags = context->flags; + req->flags = (CARD32) context->flags; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); @@ -263,14 +263,14 @@ _xvmc_create_context(Display *dpy, } context->width = rep.width_actual; context->height = rep.height_actual; - context->flags = rep.flags_return; + context->flags = (int) rep.flags_return; if (rep.length) { if (rep.length < (INT_MAX >> 2)) *priv_data = Xmalloc(rep.length << 2); if (*priv_data) { _XRead(dpy, (char *) (*priv_data), rep.length << 2); - *priv_count = rep.length; + *priv_count = (int) rep.length; } else _XEatDataWords(dpy, rep.length); @@ -291,7 +291,7 @@ _xvmc_destroy_context(Display *dpy, XvMCContext *context) LockDisplay(dpy); XvMCGetReq(DestroyContext, req); - req->context_id = context->context_id; + req->context_id = (CARD32) context->context_id; UnlockDisplay(dpy); SyncHandle(); return Success; @@ -336,8 +336,8 @@ _xvmc_create_surface(Display *dpy, surface->width = context->width; surface->height = context->height; - req->surface_id = surface->surface_id; - req->context_id = surface->context_id; + req->surface_id = (CARD32) surface->surface_id; + req->context_id = (CARD32) surface->context_id; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); @@ -349,7 +349,7 @@ _xvmc_create_surface(Display *dpy, *priv_data = Xmalloc(rep.length << 2); if (*priv_data) { _XRead(dpy, (char *) (*priv_data), rep.length << 2); - *priv_count = rep.length; + *priv_count = (int) rep.length; } else _XEatDataWords(dpy, rep.length); @@ -370,7 +370,7 @@ _xvmc_destroy_surface(Display *dpy, XvMCSurface *surface) LockDisplay(dpy); XvMCGetReq(DestroySurface, req); - req->surface_id = surface->surface_id; + req->surface_id = (CARD32) surface->surface_id; UnlockDisplay(dpy); SyncHandle(); return Success; @@ -413,9 +413,9 @@ _xvmc_create_subpicture(Display *dpy, subpicture->subpicture_id = XAllocID(dpy); subpicture->context_id = context->context_id; - req->subpicture_id = subpicture->subpicture_id; - req->context_id = subpicture->context_id; - req->xvimage_id = subpicture->xvimage_id; + req->subpicture_id = (CARD32) subpicture->subpicture_id; + req->context_id = (CARD32) subpicture->context_id; + req->xvimage_id = (CARD32) subpicture->xvimage_id; req->width = subpicture->width; req->height = subpicture->height; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { @@ -428,17 +428,17 @@ _xvmc_create_subpicture(Display *dpy, subpicture->height = rep.height_actual; subpicture->num_palette_entries = rep.num_palette_entries; subpicture->entry_bytes = rep.entry_bytes; - subpicture->component_order[0] = rep.component_order[0]; - subpicture->component_order[1] = rep.component_order[1]; - subpicture->component_order[2] = rep.component_order[2]; - subpicture->component_order[3] = rep.component_order[3]; + subpicture->component_order[0] = (char) rep.component_order[0]; + subpicture->component_order[1] = (char) rep.component_order[1]; + subpicture->component_order[2] = (char) rep.component_order[2]; + subpicture->component_order[3] = (char) rep.component_order[3]; if (rep.length) { if (rep.length < (INT_MAX >> 2)) *priv_data = Xmalloc(rep.length << 2); if (*priv_data) { _XRead(dpy, (char *) (*priv_data), rep.length << 2); - *priv_count = rep.length; + *priv_count = (int) rep.length; } else _XEatDataWords(dpy, rep.length); @@ -459,7 +459,7 @@ _xvmc_destroy_subpicture(Display *dpy, XvMCSubpicture *subpicture) LockDisplay(dpy); XvMCGetReq(DestroySubpicture, req); - req->subpicture_id = subpicture->subpicture_id; + req->subpicture_id = (CARD32) subpicture->subpicture_id; UnlockDisplay(dpy); SyncHandle(); return Success; @@ -489,7 +489,7 @@ XvMCGetDRInfo(Display *dpy, XvPortID port, LockDisplay(dpy); XvMCGetReq(GetDRInfo, req); - req->port = port; + req->port = (CARD32) port; req->magic = 0; #ifdef HAVE_SHMAT shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600); @@ -525,7 +525,7 @@ XvMCGetDRInfo(Display *dpy, XvPortID port, } } else { - req->shmKey = -1; + req->shmKey = (CARD32) -1; shmKey = -1; } } @@ -564,7 +564,7 @@ XvMCGetDRInfo(Display *dpy, XvPortID port, } if (*name && *busID && tmpBuf) { - _XRead(dpy, tmpBuf, realSize); + _XRead(dpy, tmpBuf, (long) realSize); strncpy(*name, tmpBuf, rep.nameLen); (*name)[rep.nameLen == 0 ? 0 : rep.nameLen - 1] = '\0'; strncpy(*busID, tmpBuf + rep.nameLen, rep.busIDLen); @@ -588,12 +588,12 @@ XvMCGetDRInfo(Display *dpy, XvPortID port, UnlockDisplay(dpy); SyncHandle(); - *major = rep.major; - *minor = rep.minor; - *patchLevel = rep.patchLevel; + *major = (int) rep.major; + *minor = (int) rep.minor; + *patchLevel = (int) rep.patchLevel; #ifdef HAVE_SHMAT if (shmKey >= 0) - *isLocal = rep.isLocal; + *isLocal = (int) rep.isLocal; else #endif *isLocal = 1; diff --git a/wrapper/XvMCWrapper.c b/wrapper/XvMCWrapper.c index 35c74ee..a3004dd 100644 --- a/wrapper/XvMCWrapper.c +++ b/wrapper/XvMCWrapper.c @@ -121,8 +121,7 @@ typedef Status (*XvMCBeginSurfaceP) (Display *, XvMCContext *, XvMCSurface *, typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *, const XvMCQMatrix *); typedef Status (*XvMCPutSliceP) (Display *, XvMCContext *, char *, int); -typedef Status (*XvMCPutSlice2P) (Display *, XvMCContext *, char *, int, - unsigned); +typedef Status (*XvMCPutSlice2P) (Display *, XvMCContext *, char *, int, int); typedef Status (*XvMCGetDRInfoP) (Display *, XvPortID, char **, char **, int *, int *, int *, int *); @@ -220,7 +219,7 @@ static void * dlopenversion(const char *lib, const char *version, int flag) { void *ret; - int curLen, verLen; + size_t curLen, verLen; char *curName; curLen = strlen(lib) + (verLen = strlen(version)) + 1; @@ -230,7 +229,7 @@ dlopenversion(const char *lib, const char *version, int flag) const char *tail = strstr(version + 1, "."); if (NULL != tail) { - strncat(curName, version, tail - version); + strncat(curName, version, (size_t) (tail - version)); } else { strncat(curName, version, verLen); @@ -282,7 +281,7 @@ initW(Display *dpy, XvPortID port) void *handle; char *clientName = NULL; char *err; - int nameLen = 0; + size_t nameLen = 0; wrapperInit = 1; xW.initialised = 0; @@ -332,7 +331,7 @@ initW(Display *dpy, XvPortID port) * No. Try to obtain it from the config file. */ - int tmp; + size_t tmp; FILE *configFile; if (clientName) |