diff options
Diffstat (limited to 'src/scintilla_backports/6442_3e3bfe29a819.patch')
-rw-r--r-- | src/scintilla_backports/6442_3e3bfe29a819.patch | 319 |
1 files changed, 319 insertions, 0 deletions
diff --git a/src/scintilla_backports/6442_3e3bfe29a819.patch b/src/scintilla_backports/6442_3e3bfe29a819.patch new file mode 100644 index 00000000..acc6dbae --- /dev/null +++ b/src/scintilla_backports/6442_3e3bfe29a819.patch @@ -0,0 +1,319 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1516950278 -39600 +# Node ID 3e3bfe29a819c1f7a1761096ec54e9b6ee446a68 +# Parent 92c8f0f1b3e64900cbb868a56936898693b9cfcc +Extend SplitVector to allow more than 2 billion elements on 64-bit systems. + +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/CellBuffer.cxx Fri Jan 26 18:04:38 2018 +1100 +@@ -394,7 +394,7 @@ + } + + Sci::Position CellBuffer::GapPosition() const { +- return substance.GapPosition(); ++ return static_cast<Sci::Position>(substance.GapPosition()); + } + + // The char* returned is to an allocation owned by the undo history +@@ -457,7 +457,7 @@ + } + + Sci::Position CellBuffer::Length() const { +- return substance.Length(); ++ return static_cast<Sci::Position>(substance.Length()); + } + + void CellBuffer::Allocate(Sci::Position newSize) { +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/Partitioning.h +--- a/src/Partitioning.h Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/Partitioning.h Fri Jan 26 18:04:38 2018 +1100 +@@ -16,7 +16,7 @@ + + class SplitVectorWithRangeAdd : public SplitVector<int> { + public: +- explicit SplitVectorWithRangeAdd(int growSize_) { ++ explicit SplitVectorWithRangeAdd(ptrdiff_t growSize_) { + SetGrowSize(growSize_); + ReAllocate(growSize_); + } +@@ -25,12 +25,12 @@ + void operator=(const SplitVectorWithRangeAdd &) = delete; + ~SplitVectorWithRangeAdd() { + } +- void RangeAddDelta(int start, int end, int delta) { ++ void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, int delta) { + // end is 1 past end, so end-start is number of elements to change +- int i = 0; +- const int rangeLength = end - start; +- int range1Length = rangeLength; +- const int part1Left = part1Length - start; ++ ptrdiff_t i = 0; ++ const ptrdiff_t rangeLength = end - start; ++ ptrdiff_t range1Length = rangeLength; ++ const ptrdiff_t part1Left = part1Length - start; + if (range1Length > part1Left) + range1Length = part1Left; + while (i < range1Length) { +@@ -67,7 +67,7 @@ + } + stepPartition = partitionUpTo; + if (stepPartition >= body->Length()-1) { +- stepPartition = body->Length()-1; ++ stepPartition = Partitions(); + stepLength = 0; + } + } +@@ -80,7 +80,7 @@ + stepPartition = partitionDownTo; + } + +- void Allocate(int growSize) { ++ void Allocate(ptrdiff_t growSize) { + body = new SplitVectorWithRangeAdd(growSize); + stepPartition = 0; + stepLength = 0; +@@ -101,7 +101,7 @@ + } + + int Partitions() const { +- return body->Length()-1; ++ return static_cast<int>(body->Length()-1); + } + + void InsertPartition(int partition, int pos) { +@@ -132,7 +132,7 @@ + BackStep(partitionInsert); + stepLength += delta; + } else { +- ApplyStep(body->Length()-1); ++ ApplyStep(Partitions()); + stepPartition = partitionInsert; + stepLength = delta; + } +@@ -168,10 +168,10 @@ + int PartitionFromPosition(int pos) const { + if (body->Length() <= 1) + return 0; +- if (pos >= (PositionFromPartition(body->Length()-1))) +- return body->Length() - 1 - 1; ++ if (pos >= (PositionFromPartition(Partitions()))) ++ return Partitions() - 1; + int lower = 0; +- int upper = body->Length()-1; ++ int upper = Partitions(); + do { + const int middle = (upper + lower + 1) / 2; // Round high + int posMiddle = body->ValueAt(middle); +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/PerLine.cxx +--- a/src/PerLine.cxx Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/PerLine.cxx Fri Jan 26 18:04:38 2018 +1100 +@@ -135,7 +135,7 @@ + Sci::Line LineMarkers::MarkerNext(Sci::Line lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; +- const Sci::Line length = markers.Length(); ++ const Sci::Line length = static_cast<Sci::Line>(markers.Length()); + for (Sci::Line iLine = lineStart; iLine < length; iLine++) { + const MarkerHandleSet *onLine = markers[iLine].get(); + if (onLine && ((onLine->MarkValue() & mask) != 0)) +@@ -281,7 +281,7 @@ + } + + Sci::Line LineState::GetMaxLineState() const { +- return lineStates.Length(); ++ return static_cast<Sci::Line>(lineStates.Length()); + } + + static int NumberLines(const char *text) { +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/SplitVector.h +--- a/src/SplitVector.h Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/SplitVector.h Fri Jan 26 18:04:38 2018 +1100 +@@ -16,15 +16,15 @@ + protected: + T *body; +- int size; +- int lengthBody; +- int part1Length; +- int gapLength; /// invariant: gapLength == size - lengthBody +- int growSize; ++ ptrdiff_t size; ++ ptrdiff_t lengthBody; ++ ptrdiff_t part1Length; ++ ptrdiff_t gapLength; /// invariant: gapLength == size - lengthBody ++ ptrdiff_t growSize; + + /// Move the gap to a particular position so that insertion and + /// deletion at that point will not require much copying and + /// hence be fast. +- void GapTo(int position) { ++ void GapTo(ptrdiff_t position) { + if (position != part1Length) { + if (position < part1Length) { + // Moving the gap towards start so moving elements towards end +@@ -45,11 +45,11 @@ + + /// Check that there is room in the buffer for an insertion, + /// reallocating if more space needed. +- void RoomFor(int insertionLength) { ++ void RoomFor(ptrdiff_t insertionLength) { + if (gapLength <= insertionLength) { + while (growSize < size / 6) + growSize *= 2; + ReAllocate(size + insertionLength + growSize); + } + } + +@@ -75,18 +75,18 @@ + ~SplitVector() { + } + +- int GetGrowSize() const { ++ ptrdiff_t GetGrowSize() const { + return growSize; + } +- +- void SetGrowSize(int growSize_) { ++ ++ void SetGrowSize(ptrdiff_t growSize_) { + growSize = growSize_; + } + + /// Reallocate the storage for the buffer to be newSize and + /// copy exisiting contents to the new buffer. + /// Must not be used to decrease the size of the buffer. +- void ReAllocate(int newSize) { ++ void ReAllocate(ptrdiff_t newSize) { + if (newSize < 0) + throw std::runtime_error("SplitVector::ReAllocate: negative size."); + +@@ -104,9 +104,9 @@ + + /// Retrieve the character at a particular position. + /// Retrieving positions outside the range of the buffer returns 0. + /// The assertions here are disabled since calling code can be + /// simpler if out of range access works and returns 0. +- T ValueAt(int position) const { ++ T ValueAt(ptrdiff_t position) const { + if (position < part1Length) { + //PLATFORM_ASSERT(position >= 0); + if (position < 0) { +@@ -124,7 +124,7 @@ + } + } + +- void SetValueAt(int position, T v) { ++ void SetValueAt(ptrdiff_t position, T v) { + if (position < part1Length) { + PLATFORM_ASSERT(position >= 0); + if (position < 0) { +@@ -144,7 +144,7 @@ + } + } + +- T &operator[](int position) const { ++ T &operator[](ptrdiff_t position) const { + PLATFORM_ASSERT(position >= 0 && position < lengthBody); + if (position < part1Length) { + return body[position]; +@@ -166,13 +166,13 @@ + } + + /// Retrieve the length of the buffer. +- int Length() const { ++ ptrdiff_t Length() const { + return lengthBody; + } + + /// Insert a single value into the buffer. + /// Inserting at positions outside the current range fails. +- void Insert(int position, T v) { ++ void Insert(ptrdiff_t position, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if ((position < 0) || (position > lengthBody)) { + return; +@@ -187,7 +187,7 @@ + + /// Insert a number of elements into the buffer setting their value. + /// Inserting at positions outside the current range fails. +- void InsertValue(int position, int insertLength, T v) { ++ void InsertValue(ptrdiff_t position, ptrdiff_t insertLength, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if (insertLength > 0) { + if ((position < 0) || (position > lengthBody)) { +@@ -225,14 +225,14 @@ + + /// Ensure at least length elements allocated, + /// appending zero valued elements if needed. +- void EnsureLength(int wantedLength) { ++ void EnsureLength(ptrdiff_t wantedLength) { + if (Length() < wantedLength) { + InsertValue(Length(), wantedLength - Length(), 0); + } + } + + /// Insert text into the buffer from an array. +- void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { ++ void InsertFromArray(ptrdiff_t positionToInsert, const T s[], ptrdiff_t positionFrom, ptrdiff_t insertLength) { + PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); + if (insertLength > 0) { + if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { +@@ -248,7 +248,7 @@ + } + + /// Delete one element from the buffer. +- void Delete(int position) { ++ void Delete(ptrdiff_t position) { + PLATFORM_ASSERT((position >= 0) && (position < lengthBody)); + if ((position < 0) || (position >= lengthBody)) { + return; +@@ -258,7 +258,7 @@ + + /// Delete a range from the buffer. + /// Deleting positions outside the current range fails. +- void DeleteRange(int position, int deleteLength) { ++ void DeleteRange(ptrdiff_t position, ptrdiff_t deleteLength) { + PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody)); + if ((position < 0) || ((position + deleteLength) > lengthBody)) { + return; +@@ -277,17 +277,17 @@ + // Retrieve a range of elements into an array +- void GetRange(T *buffer, int position, int retrieveLength) const { ++ void GetRange(T *buffer, ptrdiff_t position, ptrdiff_t retrieveLength) const { + // Split into up to 2 ranges, before and after the split then use memcpy on each. +- int range1Length = 0; ++ ptrdiff_t range1Length = 0; + if (position < part1Length) { +- const int part1AfterPosition = part1Length - position; ++ const ptrdiff_t part1AfterPosition = part1Length - position; + range1Length = retrieveLength; + if (range1Length > part1AfterPosition) + range1Length = part1AfterPosition; + } + std::copy(body + position, body + position + range1Length, buffer); + buffer += range1Length; + position = position + range1Length + gapLength; +- int range2Length = retrieveLength - range1Length; ++ ptrdiff_t range2Length = retrieveLength - range1Length; + std::copy(body + position, body + position + range2Length, buffer); + } + +@@ -308,7 +308,7 @@ + return body; + } + +- T *RangePointer(int position, int rangeLength) { ++ T *RangePointer(ptrdiff_t position, ptrdiff_t rangeLength) { + if (position < part1Length) { + if ((position + rangeLength) > part1Length) { + // Range overlaps gap, so move gap to start of range. +@@ -323,7 +323,7 @@ + } + } + +- int GapPosition() const { ++ ptrdiff_t GapPosition() const { + return part1Length; + } + }; |