Fix build warnings and errors in Scintilla code

Conversion from 'size_t' to 'int' (MSVC).
-Wdefaulted-function-deleted (macOS Clang).
Redeclare 'enum class' as 'enum' (VS2015).
'std::string': type not allowed for 'constexpr' (VS2015).
This commit is contained in:
Maarten Bent 2022-10-16 14:48:19 +02:00
parent 289cd2e58e
commit fb6d8168c7
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
6 changed files with 9 additions and 9 deletions

View file

@ -319,7 +319,7 @@ public:
Font() noexcept;
// Deleted so Font objects can not be copied
Font(const Font &) = delete;
Font(Font &&) = delete;
Font(Font &&) = default;
Font &operator=(const Font &) = delete;
Font &operator=(Font &&) = delete;
virtual ~Font();

View file

@ -25,7 +25,7 @@ private:
Sci_Position startPos;
Sci_Position endPos;
int codePage;
enum EncodingType encodingType;
EncodingType encodingType;
Sci_Position lenDoc;
char styleBuf[bufferSize];
Sci_Position validLen;

View file

@ -17,7 +17,7 @@ class SparseState {
struct State {
Sci_Position position;
T value;
constexpr State(Sci_Position position_, T value_) noexcept : position(position_), value(value_) {
State(Sci_Position position_, T value_) noexcept : position(position_), value(value_) {
}
inline bool operator<(const State &other) const noexcept {
return position < other.position;

View file

@ -165,12 +165,12 @@ int CallTip::DrawChunk(Surface *surface, int x, const char *s, size_t len,
xEnd = NextTabPos(x);
} else {
const char *segText = s + startSeg;
xEnd = x + static_cast<int>(Sci::lround(surface->WidthText(font, segText, endSeg - startSeg)));
xEnd = x + static_cast<int>(Sci::lround(surface->WidthText(font, segText, (int)(endSeg - startSeg))));
if (draw) {
rcClient.left = static_cast<XYPOSITION>(x);
rcClient.right = static_cast<XYPOSITION>(xEnd);
surface->DrawTextTransparent(rcClient, font, static_cast<XYPOSITION>(ytext),
segText, endSeg - startSeg,
segText, (int)(endSeg - startSeg),
asHighlight ? colourSel : colourUnSel);
}
}

View file

@ -1208,7 +1208,7 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
PRectangle rcSegment = rcLine;
FontAlias fontText = vsDraw.styles[style].font;
const int widthEOLAnnotationText = static_cast<int>(surface->WidthText(fontText, stEOLAnnotation.text, stEOLAnnotation.length));
const int widthEOLAnnotationText = static_cast<int>(surface->WidthText(fontText, stEOLAnnotation.text, (int)stEOLAnnotation.length));
const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth;
const XYPOSITION virtualSpace = model.sel.VirtualSpaceFor(
@ -1250,11 +1250,11 @@ void EditView::DrawEOLAnnotationText(Surface *surface, const EditModel &model, c
if (phase & drawText) {
if (phasesDraw != phasesOne) {
surface->DrawTextTransparent(rcSegment, fontText,
rcSegment.top + vsDraw.maxAscent, stEOLAnnotation.text, stEOLAnnotation.length,
rcSegment.top + vsDraw.maxAscent, stEOLAnnotation.text, (int)stEOLAnnotation.length,
textFore);
} else {
surface->DrawTextNoClip(rcSegment, fontText,
rcSegment.top + vsDraw.maxAscent, stEOLAnnotation.text, stEOLAnnotation.length,
rcSegment.top + vsDraw.maxAscent, stEOLAnnotation.text, (int)stEOLAnnotation.length,
textFore, textBack);
}
}

View file

@ -35,7 +35,7 @@ public:
FontAlias() noexcept;
// FontAlias objects can not be assigned except for initialization
FontAlias(const FontAlias &) noexcept;
FontAlias(FontAlias &&) = delete;
FontAlias(FontAlias &&) = default;
FontAlias &operator=(const FontAlias &) = delete;
FontAlias &operator=(FontAlias &&) = delete;
~FontAlias() override;