summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-06-22 11:20:13 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-05 21:14:56 -0700
commit4ced44196d6636006c9724a373c0d2ca0c12dc1e (patch)
tree861de73a4d0a462bf73f72aaf94ff5e90ed20b76 /src
parent89dc3ff457644271b1c633efa9682ae45e55d9d8 (diff)
Fix sign conversion & comparison warnings from clang
Clears up: Xv.c:196:21: warning: implicit conversion changes signedness: 'CARD32' (aka 'unsigned int') to 'int' [-Wsign-conversion] size = rep.length << 2; ~ ~~~~~~~~~~~^~~~ Xv.c:212:41: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) { ~~~~~~~~^~~~~ Xv.c:236:43: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] pa->num_adaptors = rep.num_adaptors - ii; ~ ~~~~~~~~~~~~~~~~~^~~~ Xv.c:243:40: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ( (name = (char *)Xmalloc(size+1)) == NULL) ~~~~~~~~~~~~^~~ Xv.c:251:37: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] (void)strncpy(name, u.string, size); ~~~~~~~ ^~~~ Xv.c:260:36: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ((pfs=(XvFormat *)Xmalloc(size))==NULL) { ~~~~~~~~^~~~~ Xv.c:269:20: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] for (jj=0; jj<pa->num_formats; jj++) { ~~^~~~~~~~~~~~~~~~ Xv.c:259:29: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] size = pa->num_formats*sizeof(XvFormat); ~ ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ Xv.c:305:16: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++) ~~^~~~~~~~~~~~~~~~~~~~~~~~ Xv.c:356:21: warning: implicit conversion changes signedness: 'CARD32' (aka 'unsigned int') to 'int' [-Wsign-conversion] size = rep.length << 2; ~ ~~~~~~~~~~~^~~~ Xv.c:369:41: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) { ~~~~~~~~^~~~~ Xv.c:392:45: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] pe->num_encodings = rep.num_encodings - jj; ~ ~~~~~~~~~~~~~~~~~~^~~~ Xv.c:397:40: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ( (name = (char *)Xmalloc(size+1)) == NULL) { ~~~~~~~~~~~~^~~ Xv.c:404:31: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] strncpy(name, u.string, size); ~~~~~~~ ^~~~ Xv.c:433:16: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] for (ii=0; ii<pEncodings->num_encodings; ii++, pe++) { ~~^~~~~~~~~~~~~~~~~~~~~~~~~~ Xv.c:886:27: warning: comparison of integers of different signs: 'int' and 'CAR D32' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < rep.num_attributes; i++) { ~ ^ ~~~~~~~~~~~~~~~~~~ Xv.c:946:27: warning: comparison of integers of different signs: 'int' and 'CAR D32' (aka 'unsigned int') [-Wsign-compare] for (i = 0; i < rep.num_formats; i++) { ~ ^ ~~~~~~~~~~~~~~~ Xv.c:1100:5: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] SetReqLen(req, len, len); ^~~~~~~~~~~~~~~~~~~~~~~~ X11/Xlibint.h:530:27: note: expanded from macro 'SetReqLen' if ((req->length + n) > (unsigned)65535) { \ ^ ~~~~~~~~~~~~~~~ Xv.c:1100:20: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion] SetReqLen(req, len, len); ~~~~~~~~~~~~~~~^~~~~~~~~ X11/Xlibint.h:532:21: note: expanded from macro 'SetReqLen' MakeBigReq(req,n) \ ^ X11/Xlibint.h:505:35: note: expanded from macro 'MakeBigReq' ((CARD32 *)req)[1] = _BRlen + n + 2; \ ~ ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/Xv.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Xv.c b/src/Xv.c
index 5df5464..c87c6cd 100644
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -162,7 +162,8 @@ XvQueryAdaptors(
XExtDisplayInfo *info = xv_find_display(dpy);
xvQueryAdaptorsReq *req;
xvQueryAdaptorsReply rep;
- int size, ii, jj;
+ size_t size;
+ unsigned int ii, jj;
char *name;
XvAdaptorInfo *pas, *pa;
XvFormat *pfs, *pf;
@@ -195,7 +196,7 @@ XvQueryAdaptors(
SyncHandle();
return (XvBadAlloc);
}
- _XRead(dpy, buffer, size);
+ _XRead(dpy, buffer, (long) size);
u.buffer = buffer;
@@ -291,7 +292,7 @@ void
XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors)
{
XvAdaptorInfo *pa;
- int ii;
+ unsigned int ii;
if (!pAdaptors)
return;
@@ -320,7 +321,8 @@ XvQueryEncodings(
XExtDisplayInfo *info = xv_find_display(dpy);
xvQueryEncodingsReq *req;
xvQueryEncodingsReply rep;
- int size, jj;
+ size_t size;
+ unsigned int jj;
char *name;
XvEncodingInfo *pes, *pe;
char *buffer;
@@ -351,7 +353,7 @@ XvQueryEncodings(
SyncHandle();
return (XvBadAlloc);
}
- _XRead(dpy, buffer, size);
+ _XRead(dpy, buffer, (long) size);
u.buffer = buffer;
@@ -415,7 +417,7 @@ void
XvFreeEncodingInfo(XvEncodingInfo *pEncodings)
{
XvEncodingInfo *pe;
- int ii;
+ unsigned long ii;
if (!pEncodings)
return;
@@ -842,7 +844,7 @@ XvQueryPortAttributes(Display *dpy, XvPortID port, int *num)
if (ret != NULL) {
char *marker = (char *) (&ret[rep.num_attributes]);
xvAttributeInfo Info;
- int i;
+ unsigned int i;
/* keep track of remaining room for text strings */
size = rep.text_size;
@@ -906,7 +908,7 @@ XvListImageFormats(Display *dpy, XvPortID port, int *num)
if (ret != NULL) {
xvImageFormatInfo Info;
- int i;
+ unsigned int i;
for (i = 0; i < rep.num_formats; i++) {
_XRead(dpy, (char *) (&Info), sz_xvImageFormatInfo);
@@ -1036,7 +1038,7 @@ XvPutImage(
{
XExtDisplayInfo *info = xv_find_display(dpy);
xvPutImageReq *req;
- int len;
+ unsigned int len;
XvCheckExtension(dpy, info, XvBadExtension);
@@ -1061,7 +1063,7 @@ XvPutImage(
req->width = image->width;
req->height = image->height;
- len = (image->data_size + 3) >> 2;
+ len = ((unsigned int) image->data_size + 3) >> 2;
SetReqLen(req, len, len);
/* Yes it's kindof lame that we are sending the whole thing,