diff options
author | Sven Gothel <[email protected]> | 2013-05-31 06:52:32 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-31 06:52:32 +0200 |
commit | ef8949d4bdfb21bbe423acc661affaf59369f859 (patch) | |
tree | 45e9135c340be9fa01965850d7abb2227e1feed7 /src/jogl/classes/jogamp/opengl/GLVersionNumber.java | |
parent | 81afec4e963ac4372dc2b604d6f91237b81ee6f2 (diff) |
Complete/Fix GLVersionNumber (81afec4e963ac4372dc2b604d6f91237b81ee6f2): Set 'valid' flag, always set major/minor and strEnd.
Also: Add negative tests to unit test.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLVersionNumber.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index a32fdfa77..0ce34a60d 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -60,6 +60,7 @@ public class GLVersionNumber extends VersionNumberString { int[] val = new int[] { 0, 0, 0 }; int strEnd = 0; short state = 0; + boolean valid = false; if (versionString != null && versionString.length() > 0) { try { final java.util.regex.Pattern versionPattern; @@ -69,13 +70,12 @@ public class GLVersionNumber extends VersionNumberString { versionPattern = VersionNumberString.getDefaultVersionNumberPattern(); } final VersionNumberString version = new VersionNumberString(versionString, versionPattern); - if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! - val[0] = version.getMajor(); - val[1] = version.getMinor(); - strEnd = version.endOfStringMatch(); - state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | - ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); - } + strEnd = version.endOfStringMatch(); + val[0] = version.getMajor(); + val[1] = version.getMinor(); + state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | + ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); + valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component! } catch (Exception e) { e.printStackTrace(); System.err.println("Info: ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: " + e); @@ -83,7 +83,7 @@ public class GLVersionNumber extends VersionNumberString { val[1] = 0; } } - return new GLVersionNumber(val, strEnd, state, versionString, false); + return new GLVersionNumber(val, strEnd, state, versionString, valid); } public final boolean isValid() { |