aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx42
-rw-r--r--src/ScintillaBase.cxx6
2 files changed, 27 insertions, 21 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index cc53f5aac..2581748ed 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1414,7 +1414,7 @@ void Editor::LinesSplit(int pixelWidth) {
for (int subLine = 1; subLine < ll->lines; subLine++) {
pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) +
ll->LineStart(subLine), eol);
- targetEnd += strlen(eol);
+ targetEnd += static_cast<int>(strlen(eol));
}
}
}
@@ -1428,6 +1428,12 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) {
return markerCheck;
}
+// Avoid 64 bit compiler warnings.
+// Scintilla does not support text buffers larger than 2**31
+static int istrlen(const char *s) {
+ return static_cast<int>(strlen(s));
+}
+
void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (vs.fixedColumnWidth == 0)
return;
@@ -1589,11 +1595,11 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
}
PRectangle rcNumber = rcMarker;
// Right justify
- int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number));
+ int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
int xpos = rcNumber.right - width - 3;
rcNumber.left = xpos;
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
- rcNumber.top + vs.maxAscent, number, strlen(number),
+ rcNumber.top + vs.maxAscent, number, istrlen(number),
vs.styles[STYLE_LINENUMBER].fore.allocated,
vs.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -1770,7 +1776,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
} else if (controlCharSymbol < 32) {
const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]);
// +3 For a blank on front and rounded edge each side:
- ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3;
+ ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3;
} else {
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
surface->MeasureWidths(ctrlCharsFont, cc, 1,
@@ -2135,7 +2141,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcChar.left++;
rcChar.right--;
surface->DrawTextClipped(rcChar, ctrlCharsFont,
- rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar),
+ rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar),
textBack, textFore);
} else {
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
@@ -2680,7 +2686,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
int lineNumberWidth = 0;
if (lineNumberIndex >= 0) {
lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font,
- "99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace));
+ "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace));
vsPrint.ms[lineNumberIndex].width = lineNumberWidth;
}
@@ -2760,10 +2766,10 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
rcNumber.right = rcNumber.left + lineNumberWidth;
// Right justify
rcNumber.left -= surfaceMeasure->WidthText(
- vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number));
+ vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number));
surface->FlushCachedState();
surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font,
- ypos + vsPrint.maxAscent, number, strlen(number),
+ ypos + vsPrint.maxAscent, number, istrlen(number),
vsPrint.styles[STYLE_LINENUMBER].fore.allocated,
vsPrint.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -2799,7 +2805,7 @@ int Editor::TextWidth(int style, const char *text) {
RefreshStyleData();
AutoSurface surface(this);
if (surface) {
- return surface->WidthText(vs.styles[style].font, text, strlen(text));
+ return surface->WidthText(vs.styles[style].font, text, istrlen(text));
} else {
return 1;
}
@@ -3553,7 +3559,7 @@ void Editor::LineDuplicate() {
char *thisLine = CopyRange(start, end);
const char *eol = StringFromEOLMode(pdoc->eolMode);
pdoc->InsertString(end, eol);
- pdoc->InsertString(end + strlen(eol), thisLine, end - start);
+ pdoc->InsertString(end + istrlen(eol), thisLine, end - start);
delete []thisLine;
}
@@ -3568,7 +3574,7 @@ void Editor::NewLine() {
eol = "\r";
} // else SC_EOL_LF -> "\n" already set
if (pdoc->InsertString(currentPos, eol)) {
- SetEmptySelection(currentPos + strlen(eol));
+ SetEmptySelection(currentPos + istrlen(eol));
while (*eol) {
NotifyChar(*eol);
eol++;
@@ -4069,7 +4075,7 @@ long Editor::FindText(
sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
- int lengthFound = strlen(ft->lpstrText);
+ int lengthFound = istrlen(ft->lpstrText);
int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
(wParam & SCFIND_MATCHCASE) != 0,
(wParam & SCFIND_WHOLEWORD) != 0,
@@ -4112,7 +4118,7 @@ long Editor::SearchText(
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
- int lengthFound = strlen(txt);
+ int lengthFound = istrlen(txt);
if (iMessage == SCI_SEARCHNEXT) {
pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
(wParam & SCFIND_MATCHCASE) != 0,
@@ -4315,14 +4321,14 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul
position = positionAfterDeletion;
if (rectangular) {
- PasteRectangular(position, value, strlen(value));
+ PasteRectangular(position, value, istrlen(value));
pdoc->EndUndoAction();
// Should try to select new rectangle but it may not be a rectangle now so just select the drop position
SetSelection(position, position);
} else {
position = MovePositionOutsideChar(position, currentPos - position);
if (pdoc->InsertString(position, value)) {
- SetSelection(position + strlen(value), position);
+ SetSelection(position + istrlen(value), position);
}
pdoc->EndUndoAction();
}
@@ -4990,7 +4996,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
pdoc->BeginUndoAction();
if (length == -1)
- length = strlen(text);
+ length = istrlen(text);
if (replacePatterns) {
text = pdoc->SubstituteByPosition(text, &length);
if (!text)
@@ -5186,7 +5192,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
char *replacement = CharPtrFromSPtr(lParam);
pdoc->InsertString(currentPos, replacement);
pdoc->EndUndoAction();
- SetEmptySelection(currentPos + strlen(replacement));
+ SetEmptySelection(currentPos + istrlen(replacement));
EnsureCaretVisible();
}
break;
@@ -5357,7 +5363,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
char *sz = CharPtrFromSPtr(lParam);
pdoc->InsertString(insertPos, sz);
if (newCurrent > insertPos)
- newCurrent += strlen(sz);
+ newCurrent += istrlen(sz);
SetEmptySelection(newCurrent);
return 0;
}
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index d2927fa9d..039539ad3 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -203,11 +203,11 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
pdoc->DeleteChars(currentPos, lenEntered);
SetEmptySelection(currentPos);
pdoc->InsertString(currentPos, list);
- SetEmptySelection(currentPos + strlen(list));
+ SetEmptySelection(currentPos + static_cast<int>(strlen(list)));
} else {
SetEmptySelection(currentPos);
pdoc->InsertString(currentPos, list + lenEntered);
- SetEmptySelection(currentPos + strlen(list + lenEntered));
+ SetEmptySelection(currentPos + static_cast<int>(strlen(list + lenEntered)));
}
return;
}
@@ -340,7 +340,7 @@ void ScintillaBase::AutoCompleteCompleted() {
if (item != -1) {
SString piece = selected;
pdoc->InsertString(firstPos, piece.c_str());
- SetEmptySelection(firstPos + piece.length());
+ SetEmptySelection(firstPos + static_cast<int>(piece.length()));
}
pdoc->EndUndoAction();
}