From patchwork Mon Jul 25 13:56:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 3076 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3E8B523E54 for ; Mon, 25 Jul 2011 13:57:00 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id F21E0A18492 for ; Mon, 25 Jul 2011 13:56:59 +0000 (UTC) Received: by qyk30 with SMTP id 30so2963572qyk.11 for ; Mon, 25 Jul 2011 06:56:59 -0700 (PDT) Received: by 10.229.1.217 with SMTP id 25mr1000731qcg.38.1311602219396; Mon, 25 Jul 2011 06:56:59 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs77861qcb; Mon, 25 Jul 2011 06:56:58 -0700 (PDT) Received: by 10.213.4.196 with SMTP id 4mr205967ebs.88.1311602217791; Mon, 25 Jul 2011 06:56:57 -0700 (PDT) Received: from mail-ew0-f50.google.com (mail-ew0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id x10si5020209eef.199.2011.07.25.06.56.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:56:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) client-ip=209.85.215.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of alexandros.frantzis@linaro.org) smtp.mail=alexandros.frantzis@linaro.org Received: by ewy10 with SMTP id 10so2880217ewy.37 for ; Mon, 25 Jul 2011 06:56:57 -0700 (PDT) Received: by 10.204.145.19 with SMTP id b19mr733800bkv.192.1311602216940; Mon, 25 Jul 2011 06:56:56 -0700 (PDT) Received: from localhost (77.49.93.204.dsl.dyn.forthnet.gr [77.49.93.204]) by mx.google.com with ESMTPS id q1sm1323364faa.3.2011.07.25.06.56.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:56:56 -0700 (PDT) From: alexandros.frantzis@linaro.org To: patches@linaro.org Subject: [PATCH 01/21] gl: Correctly extract GL version from OpenGL ES version strings Date: Mon, 25 Jul 2011 16:56:28 +0300 Message-Id: <1311602208-5973-1-git-send-email-alexandros.frantzis@linaro.org> X-Mailer: git-send-email 1.7.5.4 From: Alexandros Frantzis The GL version string returned by glGetString() for GLES doesn't have the version number at the beginning of the string. Signed-off-by: Chris Wilson --- src/cairo-gl-info.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/cairo-gl-info.c b/src/cairo-gl-info.c index 5b4190e..168d194 100644 --- a/src/cairo-gl-info.c +++ b/src/cairo-gl-info.c @@ -38,13 +38,17 @@ _cairo_gl_get_version (void) int major, minor; const char *version = (const char *) glGetString (GL_VERSION); const char *dot = version == NULL ? NULL : strchr (version, '.'); + const char *major_start = dot; /* Sanity check */ if (dot == NULL || dot == version || *(dot + 1) == '\0') { major = 0; minor = 0; } else { - major = strtol (version, NULL, 10); + /* Find the start of the major version in the string */ + while (major_start > version && *major_start != ' ') + --major_start; + major = strtol (major_start, NULL, 10); minor = strtol (dot + 1, NULL, 10); }