From 684ed1b997f9e8a2fe2219524c1dea04b20a7e25 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 17 Oct 2022 16:45:38 -0700 Subject: XRRGetProviderInfo: Remove unneeded ProviderInfoExtra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was always 0, hence caused gcc warnings: XrrProvider.c: In function ‘XRRGetProviderInfo’: XrrProvider.c:133:49: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (rep.length > INT_MAX >> 2 || rep.length < ProviderInfoExtra >> 2) ^ XrrProvider.c:135:17: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (rep.length < ProviderInfoExtra >> 2) ^ XrrProvider.c:135:5: warning: this condition has identical branches [-Wduplicated-branches] if (rep.length < ProviderInfoExtra >> 2) ^ Signed-off-by: Alan Coopersmith --- src/XrrProvider.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/XrrProvider.c b/src/XrrProvider.c index d796cd0..1c7c43b 100644 --- a/src/XrrProvider.c +++ b/src/XrrProvider.c @@ -104,7 +104,6 @@ XRRFreeProviderResources(XRRProviderResources *provider_resources) free(provider_resources); } -#define ProviderInfoExtra (SIZEOF(xRRGetProviderInfoReply) - 32) XRRProviderInfo * XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provider) { @@ -123,25 +122,22 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi req->provider = provider; req->configTimestamp = resources->configTimestamp; - if (!_XReply (dpy, (xReply *) &rep, ProviderInfoExtra >> 2, xFalse)) + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); SyncHandle (); return NULL; } - if (rep.length > INT_MAX >> 2 || rep.length < ProviderInfoExtra >> 2) + if (rep.length > INT_MAX >> 2) { - if (rep.length < ProviderInfoExtra >> 2) - _XEatDataWords (dpy, rep.length); - else - _XEatDataWords (dpy, rep.length - (ProviderInfoExtra >> 2)); + _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); SyncHandle (); return NULL; } - nbytes = ((long) rep.length << 2) - ProviderInfoExtra; + nbytes = ((long) rep.length << 2); nbytesRead = (long)(rep.nCrtcs * 4 + rep.nOutputs * 4 + @@ -156,7 +152,7 @@ XRRGetProviderInfo(Display *dpy, XRRScreenResources *resources, RRProvider provi xpi = (XRRProviderInfo *)Xmalloc(rbytes); if (xpi == NULL) { - _XEatDataWords (dpy, rep.length - (ProviderInfoExtra >> 2)); + _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); SyncHandle (); return NULL; -- cgit v1.2.3