From 1753bcc2b72e72a58faff5cc0ffb546aebf44deb Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 3 Aug 2011 11:46:43 +1000 Subject: Fixed 64-bit warnings. --- lexers/LexHTML.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lexers') diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index b54401805..a20796387 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -57,7 +57,7 @@ inline bool IsOperator(int ch) { } static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { - size_t i = 0; + unsigned int i = 0; for (; (i < end - start + 1) && (i < len-1); i++) { s[i] = static_cast(MakeLowerCase(styler[start + i])); } @@ -66,7 +66,7 @@ static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int en static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) { - size_t i = 0; + unsigned int i = 0; for (; i < sLen-1; i++) { char ch = static_cast(styler.SafeGetCharAt(start + i)); if ((i == 0) && !IsAWordStart(ch)) @@ -960,8 +960,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, SCE_H_ASP); if (ch != '%' && ch != '$' && ch != '/') { - i += strlen(makoBlockType); - visibleChars += strlen(makoBlockType); + i += static_cast(strlen(makoBlockType)); + visibleChars += static_cast(strlen(makoBlockType)); if (keywords4.InList(makoBlockType)) styler.ColourTo(i, SCE_HP_WORD); else @@ -1983,7 +1983,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; } else if (isLineEnd(chPrev)) { - const int psdLength = strlen(phpStringDelimiter); + const int psdLength = static_cast(strlen(phpStringDelimiter)); const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); if (isLineEnd(chAfterPsd) || @@ -2006,7 +2006,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_HPHP_DEFAULT; } } else if (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter)) { - const int psdLength = strlen(phpStringDelimiter); + const int psdLength = static_cast(strlen(phpStringDelimiter)); const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); if (isLineEnd(chAfterPsd) || -- cgit v1.2.3 From f13c4e804a0e2a832466d42fb3cf0a5852bf67f6 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 3 Aug 2011 21:20:34 +1000 Subject: Patch from Kein-Hong Man: - bkend adjust - removal of isMatch() No changes to behaviour or highlighting, _except_ for CRLF line endings, highlighting will stop at the end of the HEREDOC delimiter instead of eating up the CR as well. --- lexers/LexPerl.cxx | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'lexers') diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index 7f0cbcf62..8a4456273 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -246,14 +246,6 @@ static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) { return true; } -static bool isMatch(const char *sref, char *s) { - // match per-line delimiter - must kill trailing CR if CRLF - int i = strlen(s); - if (i != 0 && s[i - 1] == '\r') - s[i - 1] = '\0'; - return (strcmp(sref, s) == 0); -} - static int actualNumStyle(int numberStyle) { if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) { return SCE_PL_STRING; @@ -773,15 +765,16 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, case SCE_PL_HERE_QX: { // also implies HereDoc.State == 2 sc.Complete(); - while (!sc.atLineEnd) - sc.Forward(); - char s[HERE_DELIM_MAX]; - sc.GetCurrent(s, sizeof(s)); - if (isMatch(HereDoc.Delimiter, s)) { + if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) { + sc.Forward(HereDoc.DelimiterLength); + if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n'))) { sc.SetState(SCE_PL_DEFAULT); backFlag = BACK_NONE; HereDoc.State = 0; } + } + while (!sc.atLineEnd) + sc.Forward(); } break; case SCE_PL_POD: @@ -910,12 +903,13 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, break; case SCE_PL_FORMAT: { sc.Complete(); - while (!sc.atLineEnd) + if (sc.Match('.')) { sc.Forward(); - char s[10]; - sc.GetCurrent(s, sizeof(s)); - if (isMatch(".", s)) + if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n'))) sc.SetState(SCE_PL_DEFAULT); + } + while (!sc.atLineEnd) + sc.Forward(); } break; case SCE_PL_ERROR: @@ -1127,7 +1121,6 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, bool isHereDoc = sc.Match('<', '<'); bool hereDocSpace = false; // for: SCALAR [whitespace] '<<' unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0; - unsigned int bkend; sc.Complete(); styler.Flush(); if (styler.StyleAt(bk) == SCE_PL_DEFAULT) @@ -1196,7 +1189,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, // keywords always forced as /PATTERN/: split, if, elsif, while // everything else /PATTERN/ unless digit/space immediately after '/' // for '//', defined-or favoured unless special keywords - bkend = bk + 1; + unsigned int bkend = bk + 1; while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) { bk--; } -- cgit v1.2.3 From c9c71dec593d8a8f52818ead276d91aeb4d191df Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 5 Aug 2011 08:49:58 +1000 Subject: Use casts to squash 64-bit warnings from strlen return value. --- lexers/LexAU3.cxx | 2 +- lexers/LexMagik.cxx | 2 +- lexers/LexModula.cxx | 4 ++-- lexers/LexPowerPro.cxx | 2 +- lexers/LexTeX.cxx | 2 +- lexers/LexVHDL.cxx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lexers') diff --git a/lexers/LexAU3.cxx b/lexers/LexAU3.cxx index 72c918f07..e9ab75772 100644 --- a/lexers/LexAU3.cxx +++ b/lexers/LexAU3.cxx @@ -241,7 +241,7 @@ static void ColouriseAU3Doc(unsigned int startPos, if (IsAWordChar(sc.ch) || sc.ch == '}') { strcpy(s_save,s); - int tp = strlen(s_save); + int tp = static_cast(strlen(s_save)); if (tp < 99) { s_save[tp] = static_cast(tolower(sc.ch)); s_save[tp+1] = '\0'; diff --git a/lexers/LexMagik.cxx b/lexers/LexMagik.cxx index 45390d45d..992080dd8 100644 --- a/lexers/LexMagik.cxx +++ b/lexers/LexMagik.cxx @@ -233,7 +233,7 @@ static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle, } if(characters.InList(keyword)) { - sc.Forward(strlen(keyword)); + sc.Forward(static_cast(strlen(keyword))); } else { sc.Forward(); } diff --git a/lexers/LexModula.cxx b/lexers/LexModula.cxx index 1d0361165..cc5847fd6 100644 --- a/lexers/LexModula.cxx +++ b/lexers/LexModula.cxx @@ -92,7 +92,7 @@ static inline bool checkStatement( Accessor &styler, int &curPos, const char *stt, bool spaceAfter = true ) { - int len = strlen( stt ); + int len = static_cast(strlen( stt )); int i; for( i = 0; i < len; i++ ) { if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) { @@ -113,7 +113,7 @@ static inline bool checkEndSemicolon( int &curPos, int endPos ) { const char *stt = "END"; - int len = strlen( stt ); + int len = static_cast(strlen( stt )); int i; for( i = 0; i < len; i++ ) { if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) { diff --git a/lexers/LexPowerPro.cxx b/lexers/LexPowerPro.cxx index 89bce5800..e8a7a6689 100644 --- a/lexers/LexPowerPro.cxx +++ b/lexers/LexPowerPro.cxx @@ -155,7 +155,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl if ((sc.ch > 0) && setWord.Contains(sc.ch)) { strcpy(s_save,s); - int tp = strlen(s_save); + int tp = static_cast(strlen(s_save)); if (tp < 99) { s_save[tp] = static_cast(tolower(sc.ch)); s_save[tp+1] = '\0'; diff --git a/lexers/LexTeX.cxx b/lexers/LexTeX.cxx index 7b79670a9..062c7abb9 100644 --- a/lexers/LexTeX.cxx +++ b/lexers/LexTeX.cxx @@ -222,7 +222,7 @@ static void ColouriseTeXDoc( sc.ForwardSetState(SCE_TEX_TEXT) ; } else { sc.GetCurrent(key, sizeof(key)-1) ; - k = strlen(key) ; + k = static_cast(strlen(key)) ; memmove(key,key+1,k) ; // shift left over escape token key[k] = '\0' ; k-- ; diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index 58bcd1a5a..5580b3c5e 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -235,7 +235,7 @@ static void FoldNoBoxVHDLDoc( } } } - for(j=j+strlen(prevWord); j(strlen(prevWord)); j Date: Fri, 5 Aug 2011 08:56:36 +1000 Subject: Updated email contact. --- lexers/LexConf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lexers') diff --git a/lexers/LexConf.cxx b/lexers/LexConf.cxx index 5e1bd199e..23ed5a6c8 100644 --- a/lexers/LexConf.cxx +++ b/lexers/LexConf.cxx @@ -2,7 +2,7 @@ /** @file LexConf.cxx ** Lexer for Apache Configuration Files. ** - ** First working version contributed by Ahmad Zawawi on October 28, 2000. + ** First working version contributed by Ahmad Zawawi on October 28, 2000. ** i created this lexer because i needed something pretty when dealing ** when Apache Configuration files... **/ -- cgit v1.2.3 From 0f6df3f52a8b10105b209936151fe30f6c03628b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 5 Aug 2011 11:14:43 +1000 Subject: Lua lexer update for Lua 5.2 beta. Feature #3386330. (a) \* escapes in strings changed to \z (b) goto