Module Name:    xsrc
Committed By:   christos
Date:           Mon Oct 10 02:52:02 UTC 2016

Modified Files:
        xsrc/external/mit/libXrandr/dist/src: XrrProvider.c

Log Message:
avoid unsigned < 0 comparisons


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/libXrandr/dist/src/XrrProvider.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXrandr/dist/src/XrrProvider.c
diff -u xsrc/external/mit/libXrandr/dist/src/XrrProvider.c:1.8 xsrc/external/mit/libXrandr/dist/src/XrrProvider.c:1.9
--- xsrc/external/mit/libXrandr/dist/src/XrrProvider.c:1.8	Fri Oct  7 11:52:35 2016
+++ xsrc/external/mit/libXrandr/dist/src/XrrProvider.c	Sun Oct  9 22:52:02 2016
@@ -104,7 +104,8 @@ XRRFreeProviderResources(XRRProviderReso
     free(provider_resources);
 }
 
-#define ProviderInfoExtra	(SIZEOF(xRRGetProviderInfoReply) - 32)  
+#define ProviderInfoExtra	(SIZEOF(xRRGetProviderInfoReply) - 32)
+#define ProviderInfoExtraWords	(ProviderInfoExtra >> 2)
 XRRProviderInfo *
 XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider)
 {
@@ -123,19 +124,25 @@ XRRGetProviderInfo(Display *dpy, XRRScre
     req->provider = provider;
     req->configTimestamp = resources->configTimestamp;
 
-    if (!_XReply (dpy, (xReply *) &rep, ProviderInfoExtra >> 2, xFalse))
+    if (!_XReply (dpy, (xReply *) &rep, ProviderInfoExtraWords, xFalse))
     {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return NULL;
     }
 
-    if (rep.length > (INT_MAX >> 2) || rep.length < (ProviderInfoExtra >> 2))
+    if (rep.length > (INT_MAX >> 2)
+#if ProviderInfoExtraWords > 0
+	|| rep.length < ProviderInfoExtraWords
+#endif
+    )
     {
-	if (rep.length < (ProviderInfoExtra >> 2))
+#if ProviderInfoExtraWords > 0
+	if (rep.length < ProviderInfoExtraWords)
 	    _XEatDataWords (dpy, rep.length);
 	else
-	    _XEatDataWords (dpy, rep.length - (ProviderInfoExtra >> 2));
+#endif
+	    _XEatDataWords (dpy, rep.length - ProviderInfoExtraWords);
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return NULL;

Reply via email to