diff options
author | Zufu Liu <unknown> | 2019-01-06 12:06:48 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2019-01-06 12:06:48 +1100 |
commit | 24b2acfddea20bbcdb6c714dcdc96389ab4f54b5 (patch) | |
tree | 1a438cf0677801a264f5d6047118b001286b0d89 | |
parent | b7937365db8e0a049155fda1b31d2c3ff5321547 (diff) | |
download | scintilla-mirror-24b2acfddea20bbcdb6c714dcdc96389ab4f54b5.tar.gz |
Backport: Bug [#2068]. Fix some clang-tidy warnings.
Backport of changeset 7195:ce4394f12c76.
-rw-r--r-- | lexlib/PropSetSimple.cxx | 2 | ||||
-rw-r--r-- | src/CaseConvert.cxx | 2 | ||||
-rw-r--r-- | src/ContractionState.cxx | 2 | ||||
-rw-r--r-- | src/Document.cxx | 2 | ||||
-rw-r--r-- | src/EditView.cxx | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 4 | ||||
-rw-r--r-- | src/PositionCache.cxx | 2 | ||||
-rw-r--r-- | src/PositionCache.h | 2 | ||||
-rw-r--r-- | src/RunStyles.cxx | 4 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 8 |
11 files changed, 16 insertions, 16 deletions
diff --git a/lexlib/PropSetSimple.cxx b/lexlib/PropSetSimple.cxx index ba76019be..5ce353c71 100644 --- a/lexlib/PropSetSimple.cxx +++ b/lexlib/PropSetSimple.cxx @@ -117,7 +117,7 @@ static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, i innerVarStart = withVars.find("$(", varStart+2); } - std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2); + std::string var(withVars, varStart + 2, varEnd - varStart - 2); std::string val = props.Get(var.c_str()); if (blankVars.contains(var.c_str())) { diff --git a/src/CaseConvert.cxx b/src/CaseConvert.cxx index cecea427c..d57875996 100644 --- a/src/CaseConvert.cxx +++ b/src/CaseConvert.cxx @@ -595,7 +595,7 @@ public: } virtual ~CaseConverter() = default; bool Initialised() const { - return characters.size() > 0; + return !characters.empty(); } void Add(int character, const char *conversion) { characterToConversion.emplace_back(character, conversion); diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index 5937be6fc..c5e352180 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -210,7 +210,7 @@ Sci::Line ContractionState<LINE>::DocFromDisplay(Sci::Line lineDisplay) const { template <typename LINE> void ContractionState<LINE>::InsertLines(Sci::Line lineDoc, Sci::Line lineCount) { - for (int l = 0; l < lineCount; l++) { + for (Sci::Line l = 0; l < lineCount; l++) { InsertLine(lineDoc + l); } Check(); diff --git a/src/Document.cxx b/src/Document.cxx index ad0ec80e7..53c5280db 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -3193,7 +3193,7 @@ const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, substituted.clear(); const DocumentIndexer di(doc, doc->Length()); search.GrabMatches(di); - for (int j = 0; j < *length; j++) { + for (Sci::Position j = 0; j < *length; j++) { if (text[j] == '\\') { if (text[j + 1] >= '0' && text[j + 1] <= '9') { const unsigned int patNum = text[j + 1] - '0'; diff --git a/src/EditView.cxx b/src/EditView.cxx index 57567b13b..29ff92501 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -911,7 +911,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle int alpha = SC_ALPHA_NOALPHA; if (!hideSelection) { const Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1); - eolInSelection = (lastSubLine == true) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; + eolInSelection = lastSubLine ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; } diff --git a/src/Editor.cxx b/src/Editor.cxx index b176c0465..045266604 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5775,7 +5775,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (wParam == 0) return 0; char *ptr = CharPtrFromSPtr(lParam); - unsigned int iChar = 0; + size_t iChar = 0; for (; iChar < wParam - 1; iChar++) ptr[iChar] = pdoc->CharAt(iChar); ptr[iChar] = '\0'; @@ -5909,7 +5909,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return selectedText.LengthWithTerminator(); } else { char *ptr = CharPtrFromSPtr(lParam); - unsigned int iChar = 0; + size_t iChar = 0; if (selectedText.Length()) { for (; iChar < selectedText.LengthWithTerminator(); iChar++) ptr[iChar] = selectedText.Data()[iChar]; diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index e27699bfe..3b3014ab5 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -575,7 +575,7 @@ PositionCacheEntry::PositionCacheEntry(const PositionCacheEntry &other) : } void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, - unsigned int len_, XYPOSITION *positions_, unsigned int clock_) { + unsigned int len_, const XYPOSITION *positions_, unsigned int clock_) { Clear(); styleNumber = styleNumber_; len = len_; diff --git a/src/PositionCache.h b/src/PositionCache.h index 8aaead094..c3973eba9 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -150,7 +150,7 @@ public: void operator=(const PositionCacheEntry &) = delete; void operator=(PositionCacheEntry &&) = delete; ~PositionCacheEntry(); - void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); + void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, const XYPOSITION *positions_, unsigned int clock_); void Clear(); bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len_); diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index ad3084a01..115f51a9a 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -249,7 +249,7 @@ DISTANCE RunStyles<DISTANCE, STYLE>::Runs() const noexcept { template <typename DISTANCE, typename STYLE> bool RunStyles<DISTANCE, STYLE>::AllSame() const noexcept { - for (int run = 1; run < starts->Partitions(); run++) { + for (DISTANCE run = 1; run < starts->Partitions(); run++) { if (styles->ValueAt(run) != styles->ValueAt(run - 1)) return false; } @@ -299,7 +299,7 @@ void RunStyles<DISTANCE, STYLE>::Check() const { if (styles->ValueAt(styles->Length()-1) != 0) { throw std::runtime_error("RunStyles: Unused style at end changed."); } - for (int j=1; j<styles->Length()-1; j++) { + for (ptrdiff_t j=1; j<styles->Length()-1; j++) { if (styles->ValueAt(j) == styles->ValueAt(j-1)) { throw std::runtime_error("RunStyles: Style of a partition same as previous."); } diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 065fae988..016855615 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -403,7 +403,7 @@ void ViewStyle::ResetDefaultStyle() { void ViewStyle::ClearStyles() { // Reset all styles to be like the default style - for (unsigned int i=0; i<styles.size(); i++) { + for (size_t i=0; i<styles.size(); i++) { if (i != STYLE_DEFAULT) { styles[i].ClearTo(styles[STYLE_DEFAULT]); } diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 0dc420d19..e5cff0042 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1094,7 +1094,7 @@ public: SurfaceD2D(SurfaceD2D &&) = delete; SurfaceD2D &operator=(const SurfaceD2D &) = delete; SurfaceD2D &operator=(SurfaceD2D &&) = delete; - virtual ~SurfaceD2D() override; + ~SurfaceD2D() override; void SetScale(); void Init(WindowID wid) override; @@ -1250,9 +1250,9 @@ void SurfaceD2D::PenColour(ColourDesired fore) { void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) { if (pRenderTarget) { D2D_COLOR_F col; - col.r = (fore.AsInteger() & 0xff) / 255.0f; - col.g = ((fore.AsInteger() & 0xff00) >> 8) / 255.0f; - col.b = (fore.AsInteger() >> 16) / 255.0f; + col.r = fore.GetRedComponent(); + col.g = fore.GetGreenComponent(); + col.b = fore.GetBlueComponent(); col.a = alpha / 255.0f; if (pBrush) { pBrush->SetColor(col); |