diff options
-rw-r--r-- | cocoa/ScintillaCocoa.h | 1 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 2 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 1 | ||||
-rw-r--r-- | gtk/ScintillaGTKAccessible.cxx | 1 | ||||
-rw-r--r-- | lexlib/CharacterSet.h | 8 | ||||
-rw-r--r-- | qt/ScintillaEdit/ScintillaDocument.cpp | 1 | ||||
-rw-r--r-- | qt/ScintillaEditBase/ScintillaQt.h | 1 | ||||
-rw-r--r-- | src/Document.cxx | 6 | ||||
-rw-r--r-- | src/Document.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 33 | ||||
-rw-r--r-- | src/Editor.h | 4 | ||||
-rw-r--r-- | src/PositionCache.cxx | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 1 | ||||
-rw-r--r-- | src/XPM.h | 6 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 1 |
15 files changed, 41 insertions, 28 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 60400cc77..128ddb9f6 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -22,6 +22,7 @@ #include <string> #include <vector> #include <map> +#include <memory> #include "ILexer.h" diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 1400796be..1caed47da 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1897,7 +1897,7 @@ void ScintillaCocoa::WillDraw(NSRect rect) pdoc->StyleToAdjustingLineDuration(posAfterMax); StartIdleStyling(posAfterMax < posAfterArea); NotifyUpdateUI(); - if (WrapLines(wsVisible)) { + if (WrapLines(WrapScope::wsVisible)) { // Wrap may have reduced number of lines so more lines may need to be styled const int posAfterAreaWrapped = PositionAfterArea(rcWillDraw); pdoc->EnsureStyledTo(posAfterAreaWrapped); diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index a9335e14e..35622bc02 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -17,6 +17,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #include <glib.h> #include <gmodule.h> diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx index 1c2ed88ff..4fcfcda99 100644 --- a/gtk/ScintillaGTKAccessible.cxx +++ b/gtk/ScintillaGTKAccessible.cxx @@ -60,6 +60,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #include <glib.h> #include <gtk/gtk.h> diff --git a/lexlib/CharacterSet.h b/lexlib/CharacterSet.h index 183fbe421..cdea26836 100644 --- a/lexlib/CharacterSet.h +++ b/lexlib/CharacterSet.h @@ -48,6 +48,14 @@ public: bset[i] = other.bset[i]; } } + CharacterSet &operator=(CharacterSet &&other) { + size = other.size; + valueAfter = other.valueAfter; + bset = other.bset; + other.size = 0; + other.bset = nullptr; + return *this; + } ~CharacterSet() { delete []bset; bset = 0; diff --git a/qt/ScintillaEdit/ScintillaDocument.cpp b/qt/ScintillaEdit/ScintillaDocument.cpp index fd9f3e995..86f50db9d 100644 --- a/qt/ScintillaEdit/ScintillaDocument.cpp +++ b/qt/ScintillaEdit/ScintillaDocument.cpp @@ -5,6 +5,7 @@ #include <stdexcept> #include <vector> #include <map> +#include <memory> #include "ScintillaDocument.h" diff --git a/qt/ScintillaEditBase/ScintillaQt.h b/qt/ScintillaEditBase/ScintillaQt.h index 6db30bdec..0f8da8b1f 100644 --- a/qt/ScintillaEditBase/ScintillaQt.h +++ b/qt/ScintillaEditBase/ScintillaQt.h @@ -23,6 +23,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #include "Scintilla.h" #include "Platform.h" diff --git a/src/Document.cxx b/src/Document.cxx index 74c152e85..e7bb9c009 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -15,6 +15,7 @@ #include <string> #include <vector> #include <algorithm> +#include <memory> #define NOEXCEPT @@ -140,8 +141,7 @@ Document::~Document() { delete perLineData[j]; perLineData[j] = 0; } - delete regex; - regex = 0; + regex.release(); delete pli; pli = 0; delete pcf; @@ -1848,7 +1848,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, const bool regExp = (flags & SCFIND_REGEXP) != 0; if (regExp) { if (!regex) - regex = CreateRegexSearch(&charClass); + regex = std::unique_ptr<RegexSearchBase>(CreateRegexSearch(&charClass)); return regex->FindText(this, minPos, maxPos, search, caseSensitive, word, wordStart, flags, length); } else { diff --git a/src/Document.h b/src/Document.h index 2f6531e9f..a76c97141 100644 --- a/src/Document.h +++ b/src/Document.h @@ -234,7 +234,7 @@ private: PerLine *perLineData[ldSize]; bool matchesValid; - RegexSearchBase *regex; + std::unique_ptr<RegexSearchBase> regex; public: diff --git a/src/Editor.cxx b/src/Editor.cxx index cee9cebd7..e5fbc69be 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -816,7 +816,7 @@ void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, if (ensureVisible) { // In case in need of wrapping to ensure DisplayFromDoc works. if (currentLine >= wrapPending.start) - WrapLines(wsAll); + WrapLines(WrapScope::wsAll); XYScrollPosition newXY = XYScrollToMakeVisible( SelectionRange(posDrag.IsValid() ? posDrag : newPos), xysDefault); if (previousPos.IsValid() && (newXY.xOffset == xOffset)) { @@ -1476,7 +1476,7 @@ bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { // wsVisible: wrap currently visible lines // wsIdle: wrap one page + 100 lines // Return true if wrapping occurred. -bool Editor::WrapLines(enum wrapScope ws) { +bool Editor::WrapLines(WrapScope ws) { int goodTopLine = topLine; bool wrapOccurred = false; if (!Wrapping()) { @@ -1494,14 +1494,14 @@ bool Editor::WrapLines(enum wrapScope ws) { wrapPending.start = std::min(wrapPending.start, pdoc->LinesTotal()); if (!SetIdle(true)) { // Idle processing not supported so full wrap required. - ws = wsAll; + ws = WrapScope::wsAll; } // Decide where to start wrapping int lineToWrap = wrapPending.start; int lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); const int lineDocTop = cs.DocFromDisplay(topLine); const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); - if (ws == wsVisible) { + if (ws == WrapScope::wsVisible) { lineToWrap = Platform::Clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); // Priority wrap to just after visible area. // Since wrapping could reduce display lines, treat each @@ -1518,7 +1518,7 @@ bool Editor::WrapLines(enum wrapScope ws) { // Currently visible text does not need wrapping return false; } - } else if (ws == wsIdle) { + } else if (ws == WrapScope::wsIdle) { lineToWrapEnd = lineToWrap + LinesOnScreen() + 100; } const int lineEndNeedWrap = std::min(wrapPending.end, pdoc->LinesTotal()); @@ -1711,7 +1711,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { } // Wrap the visible lines if needed. - if (WrapLines(wsVisible)) { + if (WrapLines(WrapScope::wsVisible)) { // The wrapping process has changed the height of some lines so // abandon this paint for a complete repaint. if (AbandonPaint()) { @@ -1872,10 +1872,6 @@ void Editor::FilterSelections() { } } -static bool cmpSelPtrs(const SelectionRange *a, const SelectionRange *b) { - return *a < *b; -} - // AddCharUTF inserts an array of bytes which may or may not be in UTF-8. void Editor::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { FilterSelections(); @@ -1888,7 +1884,8 @@ void Editor::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { selPtrs.push_back(&sel.Range(r)); } // Order selections by position in document. - std::sort(selPtrs.begin(), selPtrs.end(), cmpSelPtrs); + std::sort(selPtrs.begin(), selPtrs.end(), + [](const SelectionRange *a, const SelectionRange *b) {return *a < *b;}); // Loop in reverse to avoid disturbing positions of selections yet to be processed. for (std::vector<SelectionRange *>::reverse_iterator rit = selPtrs.rbegin(); @@ -4029,15 +4026,15 @@ long Editor::SearchText( std::string Editor::CaseMapString(const std::string &s, int caseMapping) { std::string ret(s); - for (size_t i=0; i<ret.size(); i++) { + for (char &ch : ret) { switch (caseMapping) { case cmUpper: - if (ret[i] >= 'a' && ret[i] <= 'z') - ret[i] = static_cast<char>(ret[i] - 'a' + 'A'); + if (ch >= 'a' && ch <= 'z') + ch = static_cast<char>(ch - 'a' + 'A'); break; case cmLower: - if (ret[i] >= 'A' && ret[i] <= 'Z') - ret[i] = static_cast<char>(ret[i] - 'A' + 'a'); + if (ch >= 'A' && ch <= 'Z') + ch = static_cast<char>(ch - 'A' + 'a'); break; } } @@ -4934,7 +4931,7 @@ bool Editor::Idle() { if (needWrap) { // Wrap lines during idle. - WrapLines(wsIdle); + WrapLines(WrapScope::wsIdle); // No more wrapping needWrap = wrapPending.NeedsWrap(); } else if (needIdleStyling) { @@ -5373,7 +5370,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { // In case in need of wrapping to ensure DisplayFromDoc works. if (lineDoc >= wrapPending.start) - WrapLines(wsAll); + WrapLines(WrapScope::wsAll); if (!cs.GetVisible(lineDoc)) { // Back up to find a non-blank line diff --git a/src/Editor.h b/src/Editor.h index c29985c78..985f64bae 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -372,8 +372,8 @@ protected: // ScintillaBase subclass needs access to much of Editor bool Wrapping() const; void NeedWrapping(int docLineStart=0, int docLineEnd=WrapPending::lineLarge); bool WrapOneLine(Surface *surface, int lineToWrap); - enum wrapScope {wsAll, wsVisible, wsIdle}; - bool WrapLines(enum wrapScope ws); + enum class WrapScope {wsAll, wsVisible, wsIdle}; + bool WrapLines(WrapScope ws); void LinesJoin(); void LinesSplit(int pixelWidth); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 45731601a..a46c13004 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -15,6 +15,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #include "Platform.h" diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 678dd1487..27ed95135 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -16,6 +16,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #include "Platform.h" @@ -43,9 +43,9 @@ private: * A translucent image stored as a sequence of RGBA bytes. */ class RGBAImage { - // Private so RGBAImage objects can not be copied - RGBAImage(const RGBAImage &); - RGBAImage &operator=(const RGBAImage &); + // Deleted so RGBAImage objects can not be copied + RGBAImage(const RGBAImage &) = delete; + RGBAImage &operator=(const RGBAImage &) = delete; int height; int width; float scale; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index ae20ac2e9..0907d7a14 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -19,6 +19,7 @@ #include <vector> #include <map> #include <algorithm> +#include <memory> #undef _WIN32_WINNT #define _WIN32_WINNT 0x0500 |