diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/EditView.cxx | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 29 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 22 |
3 files changed, 31 insertions, 26 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index c33f62d7b..a4c06f25d 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1978,11 +1978,11 @@ long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); // Recalculate fixedColumnWidth } - int linePrintStart = model.pdoc->LineFromPosition(pfr->chrg.cpMin); + int linePrintStart = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMin)); int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; if (linePrintLast < linePrintStart) linePrintLast = linePrintStart; - int linePrintMax = model.pdoc->LineFromPosition(pfr->chrg.cpMax); + int linePrintMax = model.pdoc->LineFromPosition(static_cast<int>(pfr->chrg.cpMax)); if (linePrintLast > linePrintMax) linePrintLast = linePrintMax; //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", @@ -2000,7 +2000,7 @@ long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, int lineDoc = linePrintStart; - int nPrintPos = pfr->chrg.cpMin; + int nPrintPos = static_cast<int>(pfr->chrg.cpMin); int visibleLine = 0; int widthPrint = pfr->rc.right - pfr->rc.left - vsPrint.fixedColumnWidth; if (printParameters.wrapState == eWrapNone) diff --git a/src/Editor.cxx b/src/Editor.cxx index 3919b7c17..85fab6e70 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3657,7 +3657,10 @@ long Editor::FindText( if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); try { - int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, + long pos = pdoc->FindText( + static_cast<int>(ft->chrg.cpMin), + static_cast<int>(ft->chrg.cpMax), + ft->lpstrText, (wParam & SCFIND_MATCHCASE) != 0, (wParam & SCFIND_WHOLEWORD) != 0, (wParam & SCFIND_WORDSTART) != 0, @@ -3668,7 +3671,7 @@ long Editor::FindText( ft->chrgText.cpMin = pos; ft->chrgText.cpMax = pos + lengthFound; } - return pos; + return static_cast<int>(pos); } catch (RegexError &) { errorStatus = SC_STATUS_WARN_REGEX; return -1; @@ -3702,7 +3705,7 @@ long Editor::SearchText( sptr_t lParam) { ///< The text to search for. const char *txt = reinterpret_cast<char *>(lParam); - int pos; + long pos; int lengthFound = istrlen(txt); if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); @@ -3729,7 +3732,7 @@ long Editor::SearchText( return -1; } if (pos != -1) { - SetSelection(pos, pos + lengthFound); + SetSelection(static_cast<int>(pos), static_cast<int>(pos + lengthFound)); } return pos; @@ -3762,7 +3765,7 @@ long Editor::SearchInTarget(const char *text, int length) { if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); try { - int pos = pdoc->FindText(targetStart, targetEnd, text, + long pos = pdoc->FindText(targetStart, targetEnd, text, (searchFlags & SCFIND_MATCHCASE) != 0, (searchFlags & SCFIND_WHOLEWORD) != 0, (searchFlags & SCFIND_WORDSTART) != 0, @@ -3770,8 +3773,8 @@ long Editor::SearchInTarget(const char *text, int length) { searchFlags, &lengthFound); if (pos != -1) { - targetStart = pos; - targetEnd = pos + lengthFound; + targetStart = static_cast<int>(pos); + targetEnd = static_cast<int>(pos + lengthFound); } return pos; } catch (RegexError &) { @@ -5656,12 +5659,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (lParam == 0) return 0; Sci_TextRange *tr = reinterpret_cast<Sci_TextRange *>(lParam); - int cpMax = tr->chrg.cpMax; + int cpMax = static_cast<int>(tr->chrg.cpMax); if (cpMax == -1) cpMax = pdoc->Length(); PLATFORM_ASSERT(cpMax <= pdoc->Length()); - int len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions - pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len); + int len = static_cast<int>(cpMax - tr->chrg.cpMin); // No -1 as cpMin and cpMax are referring to inter character positions + pdoc->GetCharRange(tr->lpstrText, static_cast<int>(tr->chrg.cpMin), len); // Spec says copied text is terminated with a NUL tr->lpstrText[len] = '\0'; return len; // Not including NUL @@ -5899,9 +5902,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return 0; Sci_TextRange *tr = reinterpret_cast<Sci_TextRange *>(lParam); int iPlace = 0; - for (int iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { - tr->lpstrText[iPlace++] = pdoc->CharAt(iChar); - tr->lpstrText[iPlace++] = pdoc->StyleAt(iChar); + for (long iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { + tr->lpstrText[iPlace++] = pdoc->CharAt(static_cast<int>(iChar)); + tr->lpstrText[iPlace++] = pdoc->StyleAt(static_cast<int>(iChar)); } tr->lpstrText[iPlace] = '\0'; tr->lpstrText[iPlace + 1] = '\0'; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 43284f177..b52fb9a04 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -587,7 +587,7 @@ void LexState::SetLexerModule(const LexerModule *lex) { } void LexState::SetLexer(uptr_t wParam) { - lexLanguage = wParam; + lexLanguage = static_cast<int>(wParam); if (lexLanguage == SCLEX_CONTAINER) { SetLexerModule(0); } else { @@ -999,7 +999,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), static_cast<int>(lParam)); case SCI_SETKEYWORDS: - DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam)); + DocumentLexState()->SetWordList(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam)); break; case SCI_SETLEXERLANGUAGE: @@ -1011,7 +1011,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_PRIVATELEXERCALL: return reinterpret_cast<sptr_t>( - DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam))); + DocumentLexState()->PrivateCall(static_cast<int>(wParam), reinterpret_cast<void *>(lParam))); case SCI_GETSTYLEBITSNEEDED: return 8; @@ -1023,7 +1023,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam)); case SCI_DESCRIBEPROPERTY: - return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam))); + return StringResult(lParam, + DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam))); case SCI_DESCRIBEKEYWORDSETS: return StringResult(lParam, DocumentLexState()->DescribeWordListSets()); @@ -1032,26 +1033,27 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return DocumentLexState()->LineEndTypesSupported(); case SCI_ALLOCATESUBSTYLES: - return DocumentLexState()->AllocateSubStyles(wParam, lParam); + return DocumentLexState()->AllocateSubStyles(static_cast<int>(wParam), static_cast<int>(lParam)); case SCI_GETSUBSTYLESSTART: - return DocumentLexState()->SubStylesStart(wParam); + return DocumentLexState()->SubStylesStart(static_cast<int>(wParam)); case SCI_GETSUBSTYLESLENGTH: - return DocumentLexState()->SubStylesLength(wParam); + return DocumentLexState()->SubStylesLength(static_cast<int>(wParam)); case SCI_GETSTYLEFROMSUBSTYLE: - return DocumentLexState()->StyleFromSubStyle(wParam); + return DocumentLexState()->StyleFromSubStyle(static_cast<int>(wParam)); case SCI_GETPRIMARYSTYLEFROMSTYLE: - return DocumentLexState()->PrimaryStyleFromStyle(wParam); + return DocumentLexState()->PrimaryStyleFromStyle(static_cast<int>(wParam)); case SCI_FREESUBSTYLES: DocumentLexState()->FreeSubStyles(); break; case SCI_SETIDENTIFIERS: - DocumentLexState()->SetIdentifiers(wParam, reinterpret_cast<const char *>(lParam)); + DocumentLexState()->SetIdentifiers(static_cast<int>(wParam), + reinterpret_cast<const char *>(lParam)); break; case SCI_DISTANCETOSECONDARYSTYLES: |