aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2016-09-14 15:06:13 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2016-09-14 15:06:13 +1000
commit427f3dabfedb6f9b66c15d93a013b9beaf089e37 (patch)
treeeda7a1c73570b20202a46081707d1fe9949a475a
parent5ca7dd65bb30f05ad8aa6bfd269d812e766930da (diff)
downloadscintilla-mirror-427f3dabfedb6f9b66c15d93a013b9beaf089e37.tar.gz
Casts for 64 to 32-bit conversions on OS X.
-rw-r--r--cocoa/ScintillaCocoa.mm14
-rw-r--r--lexers/LexErrorList.cxx4
-rw-r--r--lexers/LexYAML.cxx2
-rw-r--r--src/Editor.cxx4
4 files changed, 12 insertions, 12 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index ec9844bb0..9fe70e3a8 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1676,7 +1676,7 @@ int ScintillaCocoa::TargetAsUTF8(char *text)
if (text)
memcpy(text, tmputf.c_str(), tmputf.length());
CFRelease(cfsVal);
- return tmputf.length();
+ return static_cast<int>(tmputf.length());
}
return targetLength;
}
@@ -1687,7 +1687,7 @@ int ScintillaCocoa::TargetAsUTF8(char *text)
// Return the length of the result in bytes.
int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const
{
- const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8);
+ const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<int>(strlen(utf8));
if (IsUnicodeMode())
{
if (encoded)
@@ -1707,7 +1707,7 @@ int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const
if (encoded)
memcpy(encoded, sEncoded.c_str(), sEncoded.length());
CFRelease(cfsVal);
- return sEncoded.length();
+ return static_cast<int>(sEncoded.length());
}
}
@@ -2196,10 +2196,10 @@ int ScintillaCocoa::InsertText(NSString* input)
*/
NSRange ScintillaCocoa::PositionsFromCharacters(NSRange range) const
{
- long start = pdoc->GetRelativePositionUTF16(0, range.location);
+ long start = pdoc->GetRelativePositionUTF16(0, static_cast<int>(range.location));
if (start == INVALID_POSITION)
start = pdoc->Length();
- long end = pdoc->GetRelativePositionUTF16(start, range.length);
+ long end = pdoc->GetRelativePositionUTF16(static_cast<int>(start), static_cast<int>(range.length));
if (end == INVALID_POSITION)
end = pdoc->Length();
return NSMakeRange(start, end - start);
@@ -2212,8 +2212,8 @@ NSRange ScintillaCocoa::PositionsFromCharacters(NSRange range) const
*/
NSRange ScintillaCocoa::CharactersFromPositions(NSRange range) const
{
- const long start = pdoc->CountUTF16(0, range.location);
- const long len = pdoc->CountUTF16(range.location, NSMaxRange(range));
+ const long start = pdoc->CountUTF16(0, static_cast<int>(range.location));
+ const long len = pdoc->CountUTF16(static_cast<int>(range.location), static_cast<int>(NSMaxRange(range)));
return NSMakeRange(start, len);
}
diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx
index 142b7b5a5..6dc6b025e 100644
--- a/lexers/LexErrorList.cxx
+++ b/lexers/LexErrorList.cxx
@@ -320,12 +320,12 @@ static void ColouriseErrorListLine(
int portionStyle = style;
while (const char *startSeq = strstr(linePortion, CSI)) {
if (startSeq > linePortion) {
- styler.ColourTo(startPortion + (startSeq - linePortion), portionStyle);
+ styler.ColourTo(startPortion + static_cast<int>(startSeq - linePortion), portionStyle);
}
const char *endSeq = startSeq + 2;
while (!SequenceEnd(*endSeq))
endSeq++;
- const int endSeqPosition = startPortion + (endSeq - linePortion) + 1;
+ const int endSeqPosition = startPortion + static_cast<int>(endSeq - linePortion) + 1;
switch (*endSeq) {
case 0:
styler.ColourTo(endPos, SCE_ERR_ESCSEQ_UNKNOWN);
diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx
index 5cd348f46..5f94215d1 100644
--- a/lexers/LexYAML.cxx
+++ b/lexers/LexYAML.cxx
@@ -46,7 +46,7 @@ static unsigned int SpaceCount(char* lineBuffer) {
while (*headBuffer == ' ')
headBuffer++;
- return headBuffer - lineBuffer;
+ return static_cast<unsigned int>(headBuffer - lineBuffer);
}
#define YAML_STATE_BITSIZE 16
diff --git a/src/Editor.cxx b/src/Editor.cxx
index f9ac97b45..bb608d08c 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -739,8 +739,8 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) {
const int searchEnd = it->end;
for (;;) {
int lengthFound = static_cast<int>(selectedText.length());
- int pos = pdoc->FindText(searchStart, searchEnd, selectedText.c_str(),
- searchFlags, &lengthFound);
+ int pos = static_cast<int>(pdoc->FindText(searchStart, searchEnd,
+ selectedText.c_str(), searchFlags, &lengthFound));
if (pos >= 0) {
sel.AddSelection(SelectionRange(pos + lengthFound, pos));
ScrollRange(sel.RangeMain());