diff options
-rw-r--r-- | include/Accessor.h | 6 | ||||
-rw-r--r-- | include/KeyWords.h | 4 | ||||
-rw-r--r-- | src/Document.cxx | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 48 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | src/KeyWords.cxx | 2 | ||||
-rw-r--r-- | src/LexCPP.cxx | 4 | ||||
-rw-r--r-- | src/LexHTML.cxx | 30 | ||||
-rw-r--r-- | src/LexOthers.cxx | 16 | ||||
-rw-r--r-- | src/LexPerl.cxx | 6 | ||||
-rw-r--r-- | src/LexPython.cxx | 18 | ||||
-rw-r--r-- | src/LexSQL.cxx | 6 | ||||
-rw-r--r-- | src/LexVB.cxx | 6 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 4 | ||||
-rw-r--r-- | src/ScintillaBase.h | 2 | ||||
-rw-r--r-- | vcbuild/SciLexer.dsp | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 10 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 13 |
18 files changed, 99 insertions, 86 deletions
diff --git a/include/Accessor.h b/include/Accessor.h index fc67f07c0..b420397e2 100644 --- a/include/Accessor.h +++ b/include/Accessor.h @@ -5,12 +5,12 @@ enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; -class BufferAccess; +class Accessor; -typedef bool (*PFNIsCommentLeader)(BufferAccess &styler, int pos, int len); +typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); // Interface to data in a Scintilla -class BufferAccess { +class Accessor { public: virtual void SetCodePage(int codePage_)=0; virtual char operator[](int position)=0; diff --git a/include/KeyWords.h b/include/KeyWords.h index 65c54379b..3159dcc1b 100644 --- a/include/KeyWords.h +++ b/include/KeyWords.h @@ -4,7 +4,7 @@ // The License.txt file describes the conditions under which this software may be distributed. typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], BufferAccess &styler); + WordList *keywordlists[], Accessor &styler); class LexerModule { static LexerModule *base; @@ -14,7 +14,7 @@ class LexerModule { public: LexerModule(int language_, LexerFunction fn_); static void Colourise(unsigned int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], BufferAccess &styler); + int language, WordList *keywordlists[], Accessor &styler); }; inline bool iswordchar(char ch) { diff --git a/src/Document.cxx b/src/Document.cxx index fb2650425..7a30d7fd1 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -604,7 +604,7 @@ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitiv //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); char firstChar = s[0]; if (!caseSensitive) - firstChar = toupper(firstChar); + firstChar = static_cast<char>(toupper(firstChar)); int pos = startPos; while (forward ? (pos < endSearch) : (pos >= endSearch)) { char ch = CharAt(pos); @@ -657,11 +657,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) { } else { if (makeUpperCase) { if (islower(ch)) { - ChangeChar(pos, toupper(ch)); + ChangeChar(pos, static_cast<char>(toupper(ch))); } } else { if (isupper(ch)) { - ChangeChar(pos, tolower(ch)); + ChangeChar(pos, static_cast<char>(tolower(ch))); } } } diff --git a/src/Editor.cxx b/src/Editor.cxx index 983568ec2..1566ffa6e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -719,8 +719,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou styleByte = pdoc->StyleAt(charInDoc); if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) { ll.chars[numCharsInLine] = chDoc; - ll.styles[numCharsInLine] = styleByte & styleMask; - ll.indicators[numCharsInLine] = styleByte & ~styleMask; + ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask); + ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask); numCharsInLine++; } } @@ -1059,9 +1059,11 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // Highlight the current braces if any if ((braces[0] >= posLineStart) && (braces[0] < posLineEnd)) - ll.styles[braces[0] - posLineStart] = bracesMatchStyle; + ll.styles[braces[0] - posLineStart] = + static_cast<char>(bracesMatchStyle); if ((braces[1] >= posLineStart) && (braces[1] < posLineEnd)) - ll.styles[braces[1] - posLineStart] = bracesMatchStyle; + ll.styles[braces[1] - posLineStart] = + static_cast<char>(bracesMatchStyle); // Draw the line if (cs.GetVisible(line)) @@ -1428,7 +1430,7 @@ void Editor::DelCharBack() { void Editor::NotifyFocus(bool) { } -void Editor::NotifyStyleNeeded(int endStyleNeeded) { +void Editor::NotifyStyleToNeeded(int endStyleNeeded) { SCNotification scn; scn.nmhdr.code = SCN_STYLENEEDED; scn.position = endStyleNeeded; @@ -1436,7 +1438,7 @@ void Editor::NotifyStyleNeeded(int endStyleNeeded) { } void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { - NotifyStyleNeeded(endStyleNeeded); + NotifyStyleToNeeded(endStyleNeeded); } void Editor::NotifyChar(char ch) { @@ -1641,7 +1643,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { } } -void Editor::NotifyDeleted(Document *document, void *userData) { +void Editor::NotifyDeleted(Document *, void *) { /* Do nothing */ } @@ -2629,12 +2631,13 @@ char BraceOpposite(char ch) { // TODO: should be able to extend styled region to find matching brace // TODO: may need to make DBCS safe // so should be moved into Document -int Editor::BraceMatch(int position, int maxReStyle) { +int Editor::BraceMatch(int position, int /*maxReStyle*/) { char chBrace = pdoc->CharAt(position); char chSeek = BraceOpposite(chBrace); - if (!chSeek) + if (chSeek != '\0') return - 1; - char styBrace = pdoc->StyleAt(position) & pdoc->stylingBitsMask; + char styBrace = static_cast<char>( + pdoc->StyleAt(position) & pdoc->stylingBitsMask); int direction = -1; if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') direction = 1; @@ -2751,6 +2754,11 @@ void Editor::EnsureLineVisible(int line) { } } +static bool ValidMargin(WPARAM wParam) { + return (wParam >= 0 && wParam < ViewStyle::margins); +} + + LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -3314,11 +3322,11 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { break; case SCI_STARTSTYLING: - pdoc->StartStyling(wParam, lParam); + pdoc->StartStyling(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLING: - pdoc->SetStyleFor(wParam, lParam); + pdoc->SetStyleFor(wParam, static_cast<char>(lParam)); break; case SCI_SETSTYLINGEX: // Specify a complete styling buffer @@ -3417,53 +3425,53 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { return -1; case SCI_SETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL); InvalidateStyleRedraw(); } break; case SCI_GETMARGINTYPEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER; else return 0; case SCI_SETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].width = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINWIDTHN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].width; else return 0; case SCI_SETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].mask = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINMASKN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].mask; else return 0; case SCI_SETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) { + if (ValidMargin(wParam)) { vs.ms[wParam].sensitive = lParam; InvalidateStyleRedraw(); } break; case SCI_GETMARGINSENSITIVEN: - if (wParam >= 0 && wParam < ViewStyle::margins) + if (ValidMargin(wParam)) return vs.ms[wParam].sensitive ? 1 : 0; else return 0; diff --git a/src/Editor.h b/src/Editor.h index 205baa880..0c04b41cd 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -207,7 +207,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void NotifyParent(SCNotification scn) = 0; - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(char ch); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx index 7cc69bd28..113ba222d 100644 --- a/src/KeyWords.cxx +++ b/src/KeyWords.cxx @@ -26,7 +26,7 @@ LexerModule::LexerModule(int language_, LexerFunction fn_) : } void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle, - int language, WordList *keywordlists[], BufferAccess &styler) { + int language, WordList *keywordlists[], Accessor &styler) { LexerModule *lm = base; while (lm) { if (lm->language == language) { diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index d3c00164f..144648e35 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); bool wordIsUUID = false; @@ -39,7 +39,7 @@ static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keyw } static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - BufferAccess &styler) { + Accessor &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 490bed6ee..87bb29335 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -18,11 +18,11 @@ #include "SciLexer.h" enum { eScriptNone, eScriptJS, eScriptVBS, eScriptPython }; -static int segIsScriptingIndicator(BufferAccess &styler, unsigned int start, unsigned int end, int prevValue) { +static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) { char s[100]; s[0] = '\0'; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); + s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } //Platform::DebugPrintf("Scripting indicator [%s]\n", s); @@ -38,7 +38,7 @@ static int segIsScriptingIndicator(BufferAccess &styler, unsigned int start, uns return prevValue; } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; @@ -48,7 +48,7 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k char s[100]; s[0] = '\0'; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); + s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } if (keywords.InList(s)) @@ -58,14 +58,14 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k } static int classifyTagHTML(unsigned int start, unsigned int end, - WordList &keywords, BufferAccess &styler) { + WordList &keywords, Accessor &styler) { char s[100]; // Copy after the '<' unsigned int i = 0; for (unsigned int cPos=start; cPos <= end && i < 30; cPos++) { char ch = styler[cPos]; if (ch != '<') - s[i++] = tolower(ch); + s[i++] = static_cast<char>(tolower(ch)); } s[i] = '\0'; char chAttr = SCE_H_TAGUNKNOWN; @@ -86,7 +86,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, } static void classifyWordHTJS(unsigned int start, unsigned int end, - WordList &keywords, BufferAccess &styler) { + WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -104,7 +104,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, } static void classifyWordHTJSA(unsigned int start, unsigned int end, - WordList &keywords, BufferAccess &styler) { + WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -121,11 +121,11 @@ static void classifyWordHTJSA(unsigned int start, unsigned int end, styler.ColourTo(end, chAttr); } -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); + s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } char chAttr = SCE_HB_IDENTIFIER; @@ -145,11 +145,11 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT; } -static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); + s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } char chAttr = SCE_HBA_IDENTIFIER; @@ -169,7 +169,7 @@ static int classifyWordHTVBA(unsigned int start, unsigned int end, WordList &key return SCE_HBA_DEFAULT; } -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { +static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -189,7 +189,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key strcpy(prevWord, s); } -static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { +static void classifyWordHTPyA(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -226,7 +226,7 @@ static bool isLineEnd(char ch) { } static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - BufferAccess &styler) { + Accessor &styler) { WordList &keywords=*keywordlists[0]; WordList &keywords2=*keywordlists[1]; diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index abaf3ce75..a36e9a933 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static void ColouriseBatchLine(char *lineBuffer, int endLine, BufferAccess &styler) { +static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) { if (0 == strncmp(lineBuffer, "REM", 3)) { styler.ColourTo(endLine, 1); } else if (0 == strncmp(lineBuffer, "rem", 3)) { @@ -33,7 +33,7 @@ static void ColouriseBatchLine(char *lineBuffer, int endLine, BufferAccess &styl } } -static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { +static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -49,7 +49,7 @@ static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList * ColouriseBatchLine(lineBuffer, startPos + length, styler); } -static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, BufferAccess &styler) { +static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) { int i = 0; while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces i++; @@ -75,7 +75,7 @@ static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, } } -static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { +static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -96,7 +96,7 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList * ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler); } -static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, BufferAccess &styler) { +static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { int i = 0; while (isspace(lineBuffer[i]) && (i < lengthLine)) i++; @@ -107,7 +107,7 @@ static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Buff } } -static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { +static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); @@ -123,7 +123,7 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[ ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler); } -static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, BufferAccess &styler) { +static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) { if (lineBuffer[0] == '>') { // Command or return status styler.ColourTo(endPos, 4); @@ -178,7 +178,7 @@ static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, } } -static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], BufferAccess &styler) { +static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index c52aa8c4f..8fef7225e 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -31,7 +31,7 @@ inline bool isPerlOperator(char ch) { return false; } -static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -54,7 +54,7 @@ static bool isEndVar(char ch) { ch != '_' && ch != '\''; } -static bool isMatch(BufferAccess &styler, int lengthDoc, int pos, const char *val) { +static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { return false; } @@ -90,7 +90,7 @@ static char opposite(char ch) { } static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], BufferAccess &styler) { + WordList *keywordlists[], Accessor &styler) { // Lexer for perl often has to backtrack to start of current style to determine // which characters are being used as quotes, how deeply nested is the diff --git a/src/LexPython.cxx b/src/LexPython.cxx index fcaa541ac..51d9791d9 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -17,7 +17,7 @@ #include "Scintilla.h" #include "SciLexer.h" -static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler, char *prevWord) { +static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { @@ -37,12 +37,12 @@ static void classifyWordPy(unsigned int start, unsigned int end, WordList &keywo strcpy(prevWord, s); } -static bool IsPyComment(BufferAccess &styler, int pos, int len) { +static bool IsPyComment(Accessor &styler, int pos, int len) { return len>0 && styler[pos]=='#'; } static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], BufferAccess &styler) { + WordList *keywordlists[], Accessor &styler) { // Python uses a different mask because bad indentation is marked by oring with 32 styler.StartAt(startPos, 127); @@ -71,15 +71,19 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, for (int i = startPos; i <= lengthDoc; i++) { if (atStartLine) { + char chFlags; + char chBad = static_cast<char>(64); + char chGood = static_cast<char>(0); if (whingeLevel == 1) { - styler.SetFlags((spaceFlags & wsInconsistent) ? 64 : 0, state); + chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood; } else if (whingeLevel == 2) { - styler.SetFlags((spaceFlags & wsSpaceTab) ? 64 : 0, state); + chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood; } else if (whingeLevel == 3) { - styler.SetFlags((spaceFlags & wsSpace) ? 64 : 0, state); + chFlags = (spaceFlags & wsSpace) ? chBad : chGood; } else if (whingeLevel == 4) { - styler.SetFlags((spaceFlags & wsTab) ? 64 : 0, state); + chFlags = (spaceFlags & wsTab) ? chBad : chGood; } + styler.SetFlags(chFlags, static_cast<char>(state)); atStartLine = false; } diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx index 6433776ca..eb8464a56 100644 --- a/src/LexSQL.cxx +++ b/src/LexSQL.cxx @@ -17,11 +17,11 @@ #include "Scintilla.h" #include "SciLexer.h" -static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = toupper(styler[start + i]); + s[i] = static_cast<char>(toupper(styler[start + i])); s[i + 1] = '\0'; } char chAttr = SCE_C_IDENTIFIER; @@ -35,7 +35,7 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw } static void ColouriseSQLDoc(unsigned int startPos, int length, - int initStyle, WordList *keywordlists[], BufferAccess &styler) { + int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/LexVB.cxx b/src/LexVB.cxx index 2b2154f21..9f372c59f 100644 --- a/src/LexVB.cxx +++ b/src/LexVB.cxx @@ -17,12 +17,12 @@ #include "Scintilla.h" #include "SciLexer.h" -static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, BufferAccess &styler) { +static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = tolower(styler[start + i]); + s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } char chAttr = SCE_C_DEFAULT; @@ -43,7 +43,7 @@ static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywor } static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], BufferAccess &styler) { + WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 76177f242..ce8883bc3 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -291,7 +291,7 @@ void ScintillaBase::Colourise(int start, int end) { } #endif -void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { +void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { #ifdef SCI_LEXER if (lexLanguage != SCLEX_CONTAINER) { int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0); @@ -301,7 +301,7 @@ void ScintillaBase::NotifyStyleNeeded(int endStyleNeeded) { return; } #endif - Editor::NotifyStyleNeeded(endStyleNeeded); + Editor::NotifyStyleToNeeded(endStyleNeeded); } LRESULT ScintillaBase::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index e9f8f28d0..ec1b0665b 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -59,7 +59,7 @@ protected: virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - virtual void NotifyStyleNeeded(int endStyleNeeded); + virtual void NotifyStyleToNeeded(int endStyleNeeded); public: // Public so scintilla_send_message can use it virtual LRESULT WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam); diff --git a/vcbuild/SciLexer.dsp b/vcbuild/SciLexer.dsp index b0a7e20d3..ceaedf345 100644 --- a/vcbuild/SciLexer.dsp +++ b/vcbuild/SciLexer.dsp @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SciLexer_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MD /W3 /Gm /ZI /Od /I "..\include" /I "..\src" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /FD /GZ /c +# ADD CPP /nologo /MD /W3 /Gm /ZI /Od /I "..\include" /I "..\src" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SCI_LEXER" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 17ca7cc03..63dd56648 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -101,12 +101,12 @@ void Palette::Allocate(Window &) { char *pal = new char[sizeof(LOGPALETTE) + (used-1) * sizeof(PALETTEENTRY)]; LOGPALETTE *logpal = reinterpret_cast<LOGPALETTE *>(pal); logpal->palVersion = 0x300; - logpal->palNumEntries = used; + logpal->palNumEntries = static_cast<WORD>(used); for (int iPal=0;iPal<used;iPal++) { Colour desired = entries[iPal].desired; - logpal->palPalEntry[iPal].peRed = desired.GetRed(); - logpal->palPalEntry[iPal].peGreen = desired.GetGreen(); - logpal->palPalEntry[iPal].peBlue = desired.GetBlue(); + logpal->palPalEntry[iPal].peRed = static_cast<BYTE>(desired.GetRed()); + logpal->palPalEntry[iPal].peGreen = static_cast<BYTE>(desired.GetGreen()); + logpal->palPalEntry[iPal].peBlue = static_cast<BYTE>(desired.GetBlue()); entries[iPal].allocated = PALETTERGB(desired.GetRed(), desired.GetGreen(), desired.GetBlue()); // PC_NOCOLLAPSE means exact colours allocated even when in background this means other windows @@ -135,7 +135,7 @@ void Font::Create(const char *faceName, int size, bool bold, bool italic) { // The negative is to allow for leading lf.lfHeight = -(abs(size)); lf.lfWeight = bold ? FW_BOLD : FW_NORMAL; - lf.lfItalic = italic ? 1 : 0; + lf.lfItalic = static_cast<BYTE>(italic ? 1 : 0); lf.lfCharSet = DEFAULT_CHARSET; strcpy(lf.lfFaceName, faceName); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2e3143054..9334ae215 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -93,7 +93,7 @@ class ScintillaWin : bool capturedMouse; - UINT cfColumnSelect; + CLIPFORMAT cfColumnSelect; DropSource ds; DataObject dob; @@ -164,7 +164,7 @@ public: friend class DropSource; friend class DataObject; friend class DropTarget; - bool DragIsRectangularOK(UINT fmt) { + bool DragIsRectangularOK(CLIPFORMAT fmt) { return dragIsRectangle && (fmt == cfColumnSelect); } }; @@ -177,7 +177,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) { // There does not seem to be a real standard for indicating that the clipboard contains a rectangular // selection, so copy Developer Studio. - cfColumnSelect = ::RegisterClipboardFormat("MSDEVColumnSelect"); + cfColumnSelect = static_cast<CLIPFORMAT>( + ::RegisterClipboardFormat("MSDEVColumnSelect")); wMain = hwnd; wDraw = hwnd; @@ -527,7 +528,7 @@ bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { sizeof(sci) }; sci.fMask = SIF_PAGE | SIF_RANGE; - BOOL bz = ::GetScrollInfo(wMain.GetID(), SB_VERT, &sci); + ::GetScrollInfo(wMain.GetID(), SB_VERT, &sci); if ((sci.nMin != 0) || (sci.nMax != pdoc->LinesTotal()) || (sci.nPage != static_cast<unsigned int>(pdoc->LinesTotal() - MaxScrollPos() + 1)) || (sci.nPos != 0)) { @@ -940,7 +941,7 @@ void ScintillaWin::ImeStartComposition() { // The negative is to allow for leading lf.lfHeight = -(abs(deviceHeight)); lf.lfWeight = vs.styles[styleHere].bold ? FW_BOLD : FW_NORMAL; - lf.lfItalic = vs.styles[styleHere].italic ? 1 : 0; + lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0); lf.lfCharSet = DEFAULT_CHARSET; strcpy(lf.lfFaceName, vs.styles[styleHere].fontName); @@ -992,7 +993,7 @@ void ScintillaWin::ScrollMessage(WPARAM wParam) { sci.cbSize = sizeof(sci); sci.fMask = SIF_ALL; - BOOL b = ::GetScrollInfo(wMain.GetID(), SB_VERT, &sci); + ::GetScrollInfo(wMain.GetID(), SB_VERT, &sci); //Platform::DebugPrintf("ScrollInfo %d mask=%x min=%d max=%d page=%d pos=%d track=%d\n", b,sci.fMask, //sci.nMin, sci.nMax, sci.nPage, sci.nPos, sci.nTrackPos); |