Mesa (master): glx: Avoid atof() when computing the server's GLX version

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 20 01:05:24 UTC 2019


Module: Mesa
Branch: master
Commit: b4fe0b3ffd825284aa57072c67a019fbc1bf4a1b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4fe0b3ffd825284aa57072c67a019fbc1bf4a1b

Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 19 13:50:12 2019 -0400

glx: Avoid atof() when computing the server's GLX version

atof() is locale-dependent (sigh), which means 1.3 becomes 1.0 if the
locale's decimal separator isn't a full-stop. Just use the protocol
major/minor instead. This would be slightly broken if the server
generically implements 1.3+ but a particular screen is only capable of
less, but in practice no such servers exist.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/74
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>

---

 src/glx/glxext.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 6e6525aeeae..59434431006 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -714,7 +714,8 @@ static GLboolean
    LockDisplay(dpy);
 
    psc->configs = NULL;
-   if (atof(priv->serverGLXversion) >= 1.3) {
+   if (priv->majorVersion > 1 ||
+       (priv->majorVersion == 1 && priv->minorVersion >= 3)) {
       GetReq(GLXGetFBConfigs, fb_req);
       fb_req->reqType = priv->majorOpcode;
       fb_req->glxCode = X_GLXGetFBConfigs;




More information about the mesa-commit mailing list