From ffd4874798ba54f86acac75779a15b4babeaa5f3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 11 May 2011 12:20:50 +1000 Subject: include: add version_compare helper function Compare two version numbers in the major.minor form. Switch the few users of manual version switching over to the new function. Signed-off-by: Peter Hutterer Reviewed-by: Jamey Sharp --- xfixes/xfixes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xfixes') diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index e8c7bf161..54f0df341 100644 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -72,17 +72,17 @@ ProcXFixesQueryVersion(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) { + + if (version_compare(stuff->majorVersion, stuff->minorVersion, + SERVER_XFIXES_MAJOR_VERSION, SERVER_XFIXES_MAJOR_VERSION) < 0) + { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION; - if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION && - stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION) - rep.minorVersion = stuff->minorVersion; - else - rep.minorVersion = SERVER_XFIXES_MINOR_VERSION; + rep.minorVersion = SERVER_XFIXES_MINOR_VERSION; } + pXFixesClient->major_version = rep.majorVersion; pXFixesClient->minor_version = rep.minorVersion; if (client->swapped) { -- cgit v1.2.3