diff options
-rw-r--r-- | lexlib/LexAccessor.h | 2 | ||||
-rw-r--r-- | lexlib/StyleContext.cxx | 6 | ||||
-rw-r--r-- | lexlib/WordList.cxx | 8 | ||||
-rw-r--r-- | src/CellBuffer.cxx | 2 | ||||
-rw-r--r-- | src/DBCS.cxx | 2 | ||||
-rw-r--r-- | src/Document.cxx | 14 | ||||
-rw-r--r-- | src/UniConversion.cxx | 3 | ||||
-rw-r--r-- | src/XPM.cxx | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 8 |
9 files changed, 23 insertions, 24 deletions
diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h index 30dadcabe..48097e279 100644 --- a/lexlib/LexAccessor.h +++ b/lexlib/LexAccessor.h @@ -109,7 +109,7 @@ public: return true; } char StyleAt(Sci_Position position) const { - return static_cast<char>(pAccess->StyleAt(position)); + return pAccess->StyleAt(position); } Sci_Position GetLine(Sci_Position position) const { return pAccess->LineFromPosition(position); diff --git a/lexlib/StyleContext.cxx b/lexlib/StyleContext.cxx index ba73fbf8f..683e21453 100644 --- a/lexlib/StyleContext.cxx +++ b/lexlib/StyleContext.cxx @@ -26,8 +26,8 @@ bool StyleContext::MatchIgnoreCase(const char *s) { return false; s++; for (int n = 2; *s; n++) { - if (static_cast<unsigned char>(*s) != - MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n, 0)))) + if (*s != + MakeLowerCase(styler.SafeGetCharAt(currentPos + n, 0))) return false; s++; } @@ -58,7 +58,7 @@ static void getRangeLowered(Sci_PositionU start, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { - s[i] = static_cast<char>(tolower(styler[start + i])); + s[i] = MakeLowerCase(styler[start + i]); i++; } s[i] = '\0'; diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx index 425bcc01a..954689ef7 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -113,7 +113,7 @@ static int cmpWords(const void *a, const void *b) { } static void SortWordList(char **words, unsigned int len) { - qsort(static_cast<void *>(words), len, sizeof(*words), cmpWords); + qsort(words, len, sizeof(*words), cmpWords); } #endif @@ -147,7 +147,7 @@ bool WordList::InList(const char *s) const { const unsigned char firstChar = s[0]; int j = starts[firstChar]; if (j >= 0) { - while (static_cast<unsigned char>(words[j][0]) == firstChar) { + while (words[j][0] == firstChar) { if (s[1] == words[j][1]) { const char *a = words[j] + 1; const char *b = s + 1; @@ -189,7 +189,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const { const unsigned char firstChar = s[0]; int j = starts[firstChar]; if (j >= 0) { - while (static_cast<unsigned char>(words[j][0]) == firstChar) { + while (words[j][0] == firstChar) { bool isSubword = false; int start = 1; if (words[j][1] == marker) { @@ -243,7 +243,7 @@ bool WordList::InListAbridged(const char *s, const char marker) const { const unsigned char firstChar = s[0]; int j = starts[firstChar]; if (j >= 0) { - while (static_cast<unsigned char>(words[j][0]) == firstChar) { + while (words[j][0] == firstChar) { const char *a = words[j]; const char *b = s; while (*a && *a == *b) { diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 2928edcb4..a0873c986 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -382,7 +382,7 @@ char CellBuffer::CharAt(Sci::Position position) const noexcept { } unsigned char CellBuffer::UCharAt(Sci::Position position) const noexcept { - return static_cast<unsigned char>(substance.ValueAt(position)); + return substance.ValueAt(position); } void CellBuffer::GetCharRange(char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const { diff --git a/src/DBCS.cxx b/src/DBCS.cxx index 644cad04d..148c9818e 100644 --- a/src/DBCS.cxx +++ b/src/DBCS.cxx @@ -13,7 +13,7 @@ namespace Scintilla { bool DBCSIsLeadByte(int codePage, char ch) noexcept { // Byte ranges found in Wikipedia articles with relevant search strings in each case - const unsigned char uch = static_cast<unsigned char>(ch); + const unsigned char uch = ch; switch (codePage) { case 932: // Shift_jis diff --git a/src/Document.cxx b/src/Document.cxx index 107c94b3c..ca3c6ea17 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -608,10 +608,10 @@ bool Document::InGoodUTF8(Sci::Position pos, Sci::Position &start, Sci::Position if (len > trailBytes) // pos too far from lead return false; - char charBytes[UTF8MaxBytes] = {static_cast<char>(leadByte),0,0,0}; + unsigned char charBytes[UTF8MaxBytes] = {leadByte,0,0,0}; for (Sci::Position b=1; b<widthCharBytes && ((start+b) < Length()); b++) charBytes[b] = cb.CharAt(start+b); - const int utf8status = UTF8Classify(reinterpret_cast<const unsigned char *>(charBytes), widthCharBytes); + const int utf8status = UTF8Classify(charBytes, widthCharBytes); if (utf8status & UTF8MaskInvalid) return false; end = start + widthCharBytes; @@ -709,10 +709,10 @@ Sci::Position Document::NextPosition(Sci::Position pos, int moveDir) const noexc pos++; } else { const int widthCharBytes = UTF8BytesOfLead[leadByte]; - char charBytes[UTF8MaxBytes] = {static_cast<char>(leadByte),0,0,0}; + unsigned char charBytes[UTF8MaxBytes] = {leadByte,0,0,0}; for (int b=1; b<widthCharBytes; b++) charBytes[b] = cb.CharAt(pos+b); - const int utf8status = UTF8Classify(reinterpret_cast<const unsigned char *>(charBytes), widthCharBytes); + const int utf8status = UTF8Classify(charBytes, widthCharBytes); if (utf8status & UTF8MaskInvalid) pos++; else @@ -944,7 +944,7 @@ bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const { bool Document::IsDBCSLeadByteNoExcept(char ch) const noexcept { // Used inside core Scintilla // Byte ranges found in Wikipedia articles with relevant search strings in each case - const unsigned char uch = static_cast<unsigned char>(ch); + const unsigned char uch = ch; switch (dbcsCodePage) { case 932: // Shift_jis @@ -992,7 +992,7 @@ int Document::SafeSegment(const char *text, int length, int lengthSegment) const int lastPunctuationBreak = -1; int lastEncodingAllowedBreak = 0; for (int j=0; j < lengthSegment;) { - const unsigned char ch = static_cast<unsigned char>(text[j]); + const unsigned char ch = text[j]; if (j > 0) { if (IsSpaceOrTab(text[j - 1]) && !IsSpaceOrTab(text[j])) { lastSpaceBreak = j; @@ -2613,7 +2613,7 @@ public: const Document *doc; Sci::Position position; - ByteIterator(const Document *doc_=nullptr, Sci::Position position_=0) noexcept : + ByteIterator(const Document *doc_=nullptr, Sci::Position position_=0) noexcept : doc(doc_), position(position_) { } ByteIterator(const ByteIterator &other) noexcept { diff --git a/src/UniConversion.cxx b/src/UniConversion.cxx index 04b8891cb..64599afaf 100644 --- a/src/UniConversion.cxx +++ b/src/UniConversion.cxx @@ -87,9 +87,8 @@ void UTF8FromUTF32Character(int uch, char *putf) { size_t UTF16Length(const char *s, size_t len) { size_t ulen = 0; - const unsigned char *us = reinterpret_cast<const unsigned char *>(s); for (size_t i = 0; i < len;) { - const unsigned char ch = us[i]; + const unsigned char ch = s[i]; const unsigned int byteCount = UTF8BytesOfLead[ch]; const unsigned int utf16Len = UTF16LengthFromUTF8ByteCount(byteCount); i += byteCount; diff --git a/src/XPM.cxx b/src/XPM.cxx index 04dc530bf..0d57873ac 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -120,7 +120,7 @@ void XPM::Init(const char *const *linesForm) { const char *lform = linesForm[y+nColours+1]; const size_t len = MeasureLength(lform); for (size_t x = 0; x<len; x++) - pixels[y * width + x] = static_cast<unsigned char>(lform[x]); + pixels[y * width + x] = lform[x]; } } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index bd6e292f0..2393554a8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2799,7 +2799,7 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) { GlobalMemory ansiText; ansiText.Allocate(selectedText.LengthWithTerminator()); if (ansiText) { - memcpy(static_cast<char *>(ansiText.ptr), selectedText.Data(), selectedText.LengthWithTerminator()); + memcpy(ansiText.ptr, selectedText.Data(), selectedText.LengthWithTerminator()); ansiText.SetClip(CF_TEXT); } } @@ -3156,7 +3156,7 @@ STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { } else { text.Allocate(drag.LengthWithTerminator()); if (text) { - memcpy(static_cast<char *>(text.ptr), drag.Data(), drag.LengthWithTerminator()); + memcpy(text.ptr, drag.Data(), drag.LengthWithTerminator()); } } pSTM->hGlobal = text ? text.Unlock() : 0; @@ -3245,9 +3245,9 @@ BOOL ScintillaWin::CreateSystemCaret() { sysCaretHeight = vs.lineHeight; int bitmapSize = (((sysCaretWidth + 15) & ~15) >> 3) * sysCaretHeight; - std::vector<char> bits(bitmapSize); + std::vector<BYTE> bits(bitmapSize); sysCaretBitmap = ::CreateBitmap(sysCaretWidth, sysCaretHeight, 1, - 1, reinterpret_cast<BYTE *>(&bits[0])); + 1, &bits[0]); BOOL retval = ::CreateCaret( MainHWND(), sysCaretBitmap, sysCaretWidth, sysCaretHeight); |