diff options
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r-- | src/EditView.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index addcaf1f3..8522ba419 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -19,6 +19,7 @@ #include <map> #include <forward_list> #include <algorithm> +#include <iterator> #include <memory> #include "Platform.h" @@ -86,9 +87,9 @@ static int WidthStyledText(Surface *surface, const ViewStyle &vs, int styleOffse int width = 0; size_t start = 0; while (start < len) { - const size_t style = styles[start]; + const unsigned char style = styles[start]; size_t endSegment = start; - while ((endSegment + 1 < len) && (static_cast<size_t>(styles[endSegment + 1]) == style)) + while ((endSegment + 1 < len) && (styles[endSegment + 1] == style)) endSegment++; FontAlias fontText = vs.styles[style + styleOffset].font; width += static_cast<int>(surface->WidthText(fontText, text + start, @@ -280,13 +281,13 @@ void EditView::AllocateGraphics(const ViewStyle &vsDraw) { } static const char *ControlCharacterString(unsigned char ch) { - const char *reps[] = { + const char * const reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" }; - if (ch < ELEMENTS(reps)) { + if (ch < std::size(reps)) { return reps[ch]; } else { return "BAD"; @@ -913,7 +914,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle rcSegment.left = xStart + ll->positions[eolPos] - static_cast<XYPOSITION>(subLineStart)+virtualSpace; rcSegment.right = xStart + ll->positions[eolPos + 1] - static_cast<XYPOSITION>(subLineStart)+virtualSpace; blobsWidth += rcSegment.Width(); - char hexits[4]; + char hexits[4] = ""; const char *ctrlChar; const unsigned char chEOL = ll->chars[eolPos]; const int styleMain = ll->styles[eolPos]; |