aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/ScintillaCocoa.mm8
-rw-r--r--cocoa/ScintillaView.mm26
-rw-r--r--src/EditView.cxx6
-rw-r--r--src/Editor.cxx29
-rw-r--r--src/ScintillaBase.cxx22
5 files changed, 48 insertions, 43 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index 5f5d68b73..d2d9c0f5a 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1023,7 +1023,7 @@ void ScintillaCocoa::Paste(bool forceRectangular)
pdoc->BeginUndoAction();
ClearSelection(false);
- InsertPasteShape(selectedText.Data(), selectedText.Length(),
+ InsertPasteShape(selectedText.Data(), static_cast<int>(selectedText.Length()),
selectedText.rectangular ? pasteRectangular : pasteStream);
pdoc->EndUndoAction();
@@ -2241,7 +2241,7 @@ void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining
CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(),
vs.styles[STYLE_DEFAULT].characterSet);
std::vector<char> buffer(charRange.length);
- pdoc->GetCharRange(&buffer[0], charRange.location, charRange.length);
+ pdoc->GetCharRange(&buffer[0], static_cast<int>(charRange.location), static_cast<int>(charRange.length));
CFStringRef cfsFind = CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(&buffer[0]),
@@ -2250,8 +2250,8 @@ void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining
if (cfsFind)
CFRelease(cfsFind);
layerFindIndicator.retaining = retaining;
- layerFindIndicator.positionFind = charRange.location;
- int style = WndProc(SCI_GETSTYLEAT, charRange.location, 0);
+ layerFindIndicator.positionFind = static_cast<int>(charRange.location);
+ long style = WndProc(SCI_GETSTYLEAT, charRange.location, 0);
std::vector<char> bufferFontName(WndProc(SCI_STYLEGETFONT, style, 0) + 1);
WndProc(SCI_STYLEGETFONT, style, (sptr_t)&bufferFontName[0]);
layerFindIndicator.sFont = [NSString stringWithUTF8String: &bufferFontName[0]];
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index dbb87a82b..87a17cebe 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -62,7 +62,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
owner = nil;
marginWidth = 20;
currentCursors = [[NSMutableArray arrayWithCapacity:0] retain];
- for (size_t i=0; i<5; i++)
+ for (size_t i=0; i<=SC_MAX_MARGIN; i++)
{
[currentCursors addObject: [reverseArrowCursor retain]];
}
@@ -137,8 +137,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
size_t co = [currentCursors count];
for (size_t i=0; i<co; i++)
{
- int cursType = owner.backend->WndProc(SCI_GETMARGINCURSORN, i, 0);
- int width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0);
+ long cursType = owner.backend->WndProc(SCI_GETMARGINCURSORN, i, 0);
+ long width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0);
NSCursor *cc = cursorFromEnum(static_cast<Window::Cursor>(cursType));
[currentCursors replaceObjectAtIndex:i withObject: cc];
marginRect.origin.x = x;
@@ -378,7 +378,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
message: SCI_POINTYFROMPOSITION
wParam: 0
lParam: aRange.location];
- int rangeEnd = aRange.location + aRange.length;
+ NSUInteger rangeEnd = aRange.location + aRange.length;
rect.size.width = [ScintillaView directCall: mOwner
message: SCI_POINTXFROMPOSITION
wParam: 0
@@ -520,10 +520,10 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
if (range.length > 0)
{
// range is in characters so convert to bytes for selection.
- int rangeStart = currentPosition;
+ long rangeStart = currentPosition;
for (size_t characterInComposition=0; characterInComposition<range.location; characterInComposition++)
rangeStart = [mOwner getGeneralProperty: SCI_POSITIONAFTER parameter: rangeStart];
- int rangeEnd = rangeStart;
+ long rangeEnd = rangeStart;
for (size_t characterInRange=0; characterInRange<range.length; characterInRange++)
rangeEnd = [mOwner getGeneralProperty: SCI_POSITIONAFTER parameter: rangeEnd];
[mOwner setGeneralProperty: SCI_SETSELECTION parameter: rangeEnd value: rangeStart];
@@ -666,7 +666,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
if ((rc.origin.y > 0) && (NSMaxY(rc) < contentRect.size.height)) {
// Only snap for positions inside the document - allow outside
// for overshoot.
- int lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0);
+ long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0);
rc.origin.y = roundf(rc.origin.y / lineHeight) * lineHeight;
}
return rc;
@@ -1711,8 +1711,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
if (wholeWord)
searchFlags |= SCFIND_WHOLEWORD;
- int selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0];
- int selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0];
+ long selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0];
+ long selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0];
// Sets the start point for the coming search to the beginning of the current selection.
// For forward searches we have therefore to set the selection start to the current selection end
@@ -1791,13 +1791,13 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
{
// The current position is where we start searching for single occurrences. Otherwise we start at
// the beginning of the document.
- int startPosition;
+ long startPosition;
if (doAll)
startPosition = 0; // Start at the beginning of the text if we replace all occurrences.
else
// For a single replacement we start at the current caret position.
startPosition = [self getGeneralProperty: SCI_GETCURRENTPOS];
- int endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH];
+ long endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH];
int searchFlags= 0;
if (matchCase)
@@ -1809,9 +1809,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
[self setGeneralProperty: SCI_SETTARGETEND value: endPosition];
const char* textToSearch = [searchText UTF8String];
- int sourceLength = strlen(textToSearch); // Length in bytes.
+ long sourceLength = strlen(textToSearch); // Length in bytes.
const char* replacement = [newText UTF8String];
- int targetLength = strlen(replacement); // Length in bytes.
+ long targetLength = strlen(replacement); // Length in bytes.
sptr_t result;
int replaceCount = 0;
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: