From a29a92c614ae03f4058f0e63899350d83c43d670 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 19 Apr 2018 17:09:27 +1000 Subject: Casting changed in many places, due to change to 64-bit variables for 64-bit builds. Some of the changes ensure no truncation while others remove casts that are no longer needed because the externally visible Sci_Position is now identical to Sci::Position. Some extra methods (CellBuffer::UCharAt and Document::SciLineFromPosition) added to avoid casting in client code. Sci::Line is currently identical to Sci::Position but it could be made smaller so lines have Sci::Line types and are cast. Some arguments widened. --- src/ScintillaBase.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/ScintillaBase.cxx') diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index febc4f11f..4df4c2a13 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -247,7 +247,7 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list if (list && !strchr(list, ac.GetSeparator())) { const char *typeSep = strchr(list, ac.GetTypesep()); const Sci::Position lenInsert = typeSep ? - static_cast(typeSep-list) : static_cast(strlen(list)); + (typeSep-list) : strlen(list); if (ac.ignoreCase) { // May need to convert the case before invocation, so remove lenEntered characters AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert); @@ -423,7 +423,7 @@ void ScintillaBase::AutoCompleteCompleted(char ch, unsigned int completionMethod endPos = pdoc->ExtendWordSelect(endPos, 1, true); if (endPos < firstPos) return; - AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast(selected.length())); + AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), selected.length()); SetLastXChosen(); scn.nmhdr.code = SCN_AUTOCCOMPLETED; @@ -656,7 +656,7 @@ void LexState::SetWordList(int n, const char *wl) { if (instance) { const Sci_Position firstModification = instance->WordListSet(n, wl); if (firstModification >= 0) { - pdoc->ModifiedAt(static_cast(firstModification)); + pdoc->ModifiedAt(firstModification); } } } @@ -702,7 +702,7 @@ void LexState::PropSet(const char *key, const char *val) { if (instance) { const Sci_Position firstModification = instance->PropertySet(key, val); if (firstModification >= 0) { - pdoc->ModifiedAt(static_cast(firstModification)); + pdoc->ModifiedAt(firstModification); } } } @@ -825,10 +825,10 @@ const char *LexState::DescriptionOfStyle(int style) { void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { #ifdef SCI_LEXER if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { - const Sci::Line lineEndStyled = static_cast( - pdoc->LineFromPosition(pdoc->GetEndStyled())); - const Sci::Position endStyled = static_cast( - pdoc->LineStart(lineEndStyled)); + const Sci::Line lineEndStyled = + pdoc->SciLineFromPosition(pdoc->GetEndStyled()); + const Sci::Position endStyled = + pdoc->LineStart(lineEndStyled); DocumentLexState()->Colourise(endStyled, endStyleNeeded); return; } @@ -984,7 +984,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return ac.GetTypesep(); case SCI_CALLTIPSHOW: - CallTipShow(LocationFromPosition(static_cast(wParam)), + CallTipShow(LocationFromPosition(static_cast(wParam)), reinterpret_cast(lParam)); break; @@ -999,7 +999,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return ct.posStartCallTip; case SCI_CALLTIPSETPOSSTART: - ct.posStartCallTip = static_cast(wParam); + ct.posStartCallTip = static_cast(wParam); break; case SCI_CALLTIPSETHLT: @@ -1048,7 +1048,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_COLOURISE: if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) { pdoc->ModifiedAt(static_cast(wParam)); - NotifyStyleToNeeded((lParam == -1) ? static_cast(pdoc->Length()) : + NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast(lParam)); } else { DocumentLexState()->Colourise(static_cast(wParam), static_cast(lParam)); -- cgit v1.2.3