mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-28 21:33:09 +00:00
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 <peter.hutterer@who-t.net> Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
parent
c4f9c3a07d
commit
ffd4874798
6 changed files with 94 additions and 16 deletions
|
|
@ -28,8 +28,8 @@ RRClientKnowsRates (ClientPtr pClient)
|
|||
{
|
||||
rrClientPriv(pClient);
|
||||
|
||||
return (pRRClient->major_version > 1 ||
|
||||
(pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
|
||||
return version_compare(pRRClient->major_version, pRRClient->minor_version,
|
||||
1, 1) >= 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -47,8 +47,8 @@ ProcRRQueryVersion (ClientPtr client)
|
|||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
|
||||
(SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
|
||||
if (version_compare(stuff->majorVersion, stuff->minorVersion,
|
||||
SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0)
|
||||
{
|
||||
rep.majorVersion = stuff->majorVersion;
|
||||
rep.minorVersion = stuff->minorVersion;
|
||||
|
|
|
|||
Loading…
Reference in a new issue