aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-19 17:09:27 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-19 17:09:27 +1000
commit1edfa1eaef9301aeffe31253cfc06709d4d8aae0 (patch)
tree1f3d496d6b70578797b056e5bcbf5694cb65f407 /src/CellBuffer.cxx
parentd7c16df6b0cafa6d5dffbcfad31afe7d468b85be (diff)
downloadscintilla-mirror-1edfa1eaef9301aeffe31253cfc06709d4d8aae0.tar.gz
Backport: 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. Backport of changeset 6705:5c0a80740b8c.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r--src/CellBuffer.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 0bf437e7b..c7fb6b650 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -381,6 +381,10 @@ char CellBuffer::CharAt(Sci::Position position) const {
return substance.ValueAt(position);
}
+unsigned char CellBuffer::UCharAt(Sci::Position position) const {
+ return static_cast<unsigned char>(substance.ValueAt(position));
+}
+
void CellBuffer::GetCharRange(char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
if (lengthRetrieve <= 0)
return;
@@ -424,7 +428,7 @@ const char *CellBuffer::RangePointer(Sci::Position position, Sci::Position range
}
Sci::Position CellBuffer::GapPosition() const {
- return static_cast<Sci::Position>(substance.GapPosition());
+ return substance.GapPosition();
}
// The char* returned is to an allocation owned by the undo history
@@ -493,7 +497,7 @@ const char *CellBuffer::DeleteChars(Sci::Position position, Sci::Position delete
}
Sci::Position CellBuffer::Length() const {
- return static_cast<Sci::Position>(substance.Length());
+ return substance.Length();
}
void CellBuffer::Allocate(Sci::Position newSize) {