summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsFortranParser.y
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-02-17 16:53:57 (GMT)
committerBrad King <brad.king@kitware.com>2009-02-17 16:53:57 (GMT)
commitab629e28f334071784b6009a046b3be441f39349 (patch)
treec87d42c4e6b29d931d6cc3c9caa1a0ded317d885 /Source/cmDependsFortranParser.y
parent57a1d0093e68d766641ec2824c2dcf7f27a8c296 (diff)
downloadCMake-ab629e28f334071784b6009a046b3be441f39349.zip
CMake-ab629e28f334071784b6009a046b3be441f39349.tar.gz
CMake-ab629e28f334071784b6009a046b3be441f39349.tar.bz2
BUG: Do not use 'char' type as array subscript
This converts uses of 'char' as an array subscript to 'unsigned char' to heed the warning from gcc. The subscript must be an unsigned type to avoid indexing before the beginning of the array. This change avoids a potential crash if input text contains a byte value beyond 0x7f.
Diffstat (limited to 'Source/cmDependsFortranParser.y')
-rw-r--r--Source/cmDependsFortranParser.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y
index 7a8d3d9..9aa9445 100644
--- a/Source/cmDependsFortranParser.y
+++ b/Source/cmDependsFortranParser.y
@@ -101,8 +101,8 @@ static char charmap[] = {
inline int strcasecmpCM(const char *s1, const char *s2)
{
const char *cm = charmap;
- const char* us1 = s1;
- const char* us2 = s2;
+ unsigned char const* us1 = reinterpret_cast<unsigned char const*>(s1);
+ unsigned char const* us2 = reinterpret_cast<unsigned char const*>(s2);
while(cm[*us1] == cm[*us2++])
if(*us1++ == '\0')