Mesa (glsl2): glsl2: Fix lexing of octal values, including "0".

Eric Anholt anholt at kemper.freedesktop.org
Mon Jul 19 18:59:24 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 5304493c40c5f450568fb518cb09940a72c1bc1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5304493c40c5f450568fb518cb09940a72c1bc1d

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jul 19 11:52:54 2010 -0700

glsl2: Fix lexing of octal values, including "0".

When faced with a constructor like 'ivec4(0, 2, 0, 0)', we would
manage to get a value of 2 instead of 0 for the first "0".  Usually 2
characters past "0" would point at some junk and lex as 0 anyway.

Fixes glsl-octal and glsl-unused-varyings.

---

 src/glsl/glsl_lexer.lpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp
index 6c10008..b0afc44 100644
--- a/src/glsl/glsl_lexer.lpp
+++ b/src/glsl/glsl_lexer.lpp
@@ -231,7 +231,7 @@ void		return VOID;
 			    return INTCONSTANT;
 			}
 0[0-7]*			{
-			    yylval->n = strtol(yytext + 2, NULL, 8);
+			    yylval->n = strtol(yytext, NULL, 8);
 			    return INTCONSTANT;
 			}
 




More information about the mesa-commit mailing list