From a39afdd633ac9b7dc855a861b50b5f339bb720b6 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Tue, 11 Nov 2003 20:38:20 +0000 Subject: [PATCH] Fix parsing of GL version string in X.Y cases. --- dlls/ddraw/d3ddevice/mesa.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index dd8211fb022..f10e9cd2891 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -4091,7 +4091,7 @@ d3ddevice_init_at_startup(void *gl_handle) const char *glVersion; const char *glXExtensions = NULL; const void *(*pglXGetProcAddressARB)(const GLubyte *) = NULL; - int major, minor, patch; + int major, minor, patch, num_parsed; TRACE("Initializing GL...\n"); @@ -4136,7 +4136,13 @@ d3ddevice_init_at_startup(void *gl_handle) } /* Parse the GL version string */ - sscanf(glVersion, "%d.%d.%d", &major, &minor, &patch); + num_parsed = sscanf(glVersion, "%d.%d.%d", &major, &minor, &patch); + if (num_parsed == 1) { + minor = 0; + patch = 0; + } else if (num_parsed == 2) { + patch = 0; + } TRACE("GL version %d.%d.%d\n", major, minor, patch); /* And starts to fill the extension context properly */ -- 2.11.4.GIT