Fixed 64-bit integer truncation issues in shader translator.
This is an incompatible API change, but one which is necessary in
order to improve correctness of the code. The API version in
ShaderLang.h is updated and, unfortunately, the define renamed to
something less ambiguous due to conflicts on some Android buildbots.
Temporary patches in Chromium and WebKit will be landed separately to
support this upgrade.
BUG=403,404,405,406,407,408,409
Review URL: https://codereview.appspot.com/7300058
Conflicts:
include/GLSLANG/ShaderLang.h
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1960 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
index 689ae64..3fc8bb6 100644
--- a/src/compiler/preprocessor/Tokenizer.l
+++ b/src/compiler/preprocessor/Tokenizer.l
@@ -239,13 +239,14 @@
// Set the location for EOF token manually.
pp::Input* input = &yyextra->input;
pp::Input::Location* scanLoc = &yyextra->scanLoc;
- int sIndexMax = std::max(0, input->count() - 1);
+ yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
if (scanLoc->sIndex != sIndexMax)
{
// We can only reach here if there are empty strings at the
// end of the input.
scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
- yyfileno = sIndexMax; yylineno = 1;
+ // FIXME: this is not 64-bit clean.
+ yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
}
yylloc->file = yyfileno;
yylloc->line = yylineno;