Re: [AD] SF.net SVN: alleg:[13158] allegro/branches/4.9/src/opengl/extensions.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
On 30 Mar 2010, at 14:46 , mmimica@xxxxxxxxxx wrote:
+   for (major = 9; major > 0; major--) {
+      for (minor1 = 9; minor1 >= 0; minor1--) {
+         for (minor2 = 9; minor2 >= 0; minor2--) {
+            sprintf(ver, "%i.%i.%i", major, minor1, minor2);
+            if (strncmp(str, ver, 5) == 0) {

Yuck.
What's wrong with sscanf()?
Say,
major = minor1 = minor2 = 0;
sscanf(ver, "%d.%d.%d", &major, &minor1, &minor2);
?

The docs say:
       The GL_VERSION string begins with a version number.  The version number
       uses one of these forms:

       major_number.minor_number
       major_number.minor_number.release_number

       Vendor-specific  information  may follow the version number. Its format
       depends on the implementation, but a space always separates the version
       number and the vendor-specific information.

So there may be garbage after the first two or three digits.

And the space is not always there apparently. Hm, actually, I find it hard to believe. Maybe the space got trimmed in my debug output. I'll doublecheck when I boot Windows again.



--
Milan Mimica
http://sparklet.sf.net




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/