aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.h
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/Document.h
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/Document.h')
-rw-r--r--src/Document.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Document.h b/src/Document.h
index ecb57195d..397c7a233 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -290,6 +290,7 @@ public:
void SCI_METHOD SetErrorStatus(int status) override;
Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const override;
+ Sci::Line SciLineFromPosition(Sci::Position pos) const; // Avoids casting LineFromPosition
Sci::Position ClampPositionIntoDocument(Sci::Position pos) const;
bool ContainsLineEnd(const char *s, Sci::Position length) const { return cb.ContainsLineEnd(s, length); }
bool IsCrLf(Sci::Position pos) const;
@@ -360,10 +361,10 @@ public:
char CharAt(Sci::Position position) const { return cb.CharAt(position); }
void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override {
- cb.GetCharRange(buffer, static_cast<Sci::Position>(position), static_cast<Sci::Position>(lengthRetrieve));
+ cb.GetCharRange(buffer, position, lengthRetrieve);
}
- char SCI_METHOD StyleAt(Sci_Position position) const override { return cb.StyleAt(static_cast<Sci::Position>(position)); }
- int StyleIndexAt(Sci_Position position) const { return static_cast<unsigned char>(cb.StyleAt(static_cast<Sci::Position>(position))); }
+ char SCI_METHOD StyleAt(Sci_Position position) const override { return cb.StyleAt(position); }
+ int StyleIndexAt(Sci_Position position) const { return static_cast<unsigned char>(cb.StyleAt(position)); }
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const {
cb.GetStyleRange(buffer, position, lengthRetrieve);
}