diff options
author | Neil <nyamatongwe@gmail.com> | 2018-05-24 09:24:44 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-05-24 09:24:44 +1000 |
commit | 9b2941ea45ed3de51c660008f75b8d15ce18cca5 (patch) | |
tree | 16df3f0e9077887d0294c909d6fe60d72a9213a2 /src/PositionCache.cxx | |
parent | 083e04becbb7676dc1f699e81cff61490799e21b (diff) | |
download | scintilla-mirror-9b2941ea45ed3de51c660008f75b8d15ce18cca5.tar.gz |
Backport: Fix warnings. Add const, constexpr, and noexcept. Initialize. Standard methods.
Replace 0 and NULL with nullptr for COM, DirectWrite and least ambiguous cases.
Backport of changeset 6974:e99161ef7bdd.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index df58aa9a7..4d8752e95 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -57,12 +57,11 @@ LineLayout::LineLayout(int maxLineLength_) : highlightColumn(false), containsCaret(false), edgeColumn(0), + bracePreviousStyles{}, hotspot(0,0), widthLine(wrapWidthInfinite), lines(1), wrapIndent(0) { - bracePreviousStyles[0] = 0; - bracePreviousStyles[1] = 0; Resize(maxLineLength_); } @@ -318,7 +317,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, } allInvalidated = false; Sci::Position pos = -1; - LineLayout *ret = 0; + LineLayout *ret = nullptr; if (level == llcCaret) { pos = 0; } else if (level == llcPage) { @@ -408,12 +407,12 @@ const Representation *SpecialRepresentations::RepresentationFromCharacter(const PLATFORM_ASSERT(len <= 4); const unsigned char ucStart = charBytes[0]; if (!startByteHasReprs[ucStart]) - return 0; + return nullptr; MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len)); if (it != mapReprs.end()) { return &(it->second); } - return 0; + return nullptr; } bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const { @@ -432,7 +431,7 @@ void SpecialRepresentations::Clear() { } void BreakFinder::Insert(Sci::Position val) { - int posInLine = static_cast<int>(val); + const int posInLine = static_cast<int>(val); if (posInLine > nextBreak) { const std::vector<int>::iterator it = std::lower_bound(selAndEdge.begin(), selAndEdge.end(), posInLine); if (it == selAndEdge.end()) { @@ -522,7 +521,7 @@ TextSegment BreakFinder::Next() { if (nextBreak == prev) { nextBreak += charWidth; } else { - repr = 0; // Optimize -> should remember repr + repr = nullptr; // Optimize -> should remember repr } if ((nextBreak - prev) < lengthStartSubdivision) { return TextSegment(prev, nextBreak - prev, repr); |