diff options
-rw-r--r-- | include/Platform.h | 2 | ||||
-rw-r--r-- | src/EditView.cxx | 26 | ||||
-rw-r--r-- | src/Editor.cxx | 24 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | src/PositionCache.cxx | 13 | ||||
-rw-r--r-- | src/PositionCache.h | 15 | ||||
-rw-r--r-- | src/XPM.cxx | 6 | ||||
-rw-r--r-- | src/XPM.h | 8 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 123 | ||||
-rw-r--r-- | win32/PlatWin.h | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 42 |
11 files changed, 136 insertions, 127 deletions
diff --git a/include/Platform.h b/include/Platform.h index 9606ecab4..8c5032596 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -535,7 +535,7 @@ public: static int DefaultFontSize(); static unsigned int DoubleClickTime(); static void DebugDisplay(const char *s); - static long LongFromTwoShorts(short a,short b) noexcept { + static constexpr long LongFromTwoShorts(short a,short b) noexcept { return (a) | ((b) << 16); } diff --git a/src/EditView.cxx b/src/EditView.cxx index 76edf1c68..5b58d367a 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -59,7 +59,7 @@ using namespace Scintilla; -static inline bool IsControlCharacter(int ch) { +static constexpr bool IsControlCharacter(int ch) noexcept { // iscntrl returns true for lots of chars > 127 which are displayable return ch >= 0 && ch < ' '; } @@ -95,7 +95,7 @@ static int WidthStyledText(Surface *surface, const ViewStyle &vs, int styleOffse while ((endSegment + 1 < len) && (styles[endSegment + 1] == style)) endSegment++; FontAlias fontText = vs.styles[style + styleOffset].font; - std::string_view sv(text + start, endSegment - start + 1); + const std::string_view sv(text + start, endSegment - start + 1); width += static_cast<int>(surface->WidthText(fontText, sv)); start = endSegment + 1; } @@ -112,7 +112,7 @@ int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, cons widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine); } else { FontAlias fontText = vs.styles[styleOffset + st.style].font; - std::string_view text(st.text + start, lenLine); + const std::string_view text(st.text + start, lenLine); widthSubLine = static_cast<int>(surface->WidthText(fontText, text)); } if (widthSubLine > widthMax) @@ -151,7 +151,7 @@ void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRec end++; style += styleOffset; FontAlias fontText = vs.styles[style].font; - std::string_view text(st.text + start + i, end - i + 1); + const std::string_view text(st.text + start + i, end - i + 1); const int width = static_cast<int>(surface->WidthText(fontText, text)); PRectangle rcSegment = rcText; rcSegment.left = static_cast<XYPOSITION>(x); @@ -457,7 +457,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa ll->positions[0] = 0; bool lastSegItalics = false; - BreakFinder bfLayout(ll, NULL, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, NULL); + BreakFinder bfLayout(ll, nullptr, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, nullptr); while (bfLayout.More()) { const TextSegment ts = bfLayout.Next(); @@ -931,7 +931,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; } - XYPOSITION xEol = static_cast<XYPOSITION>(ll->positions[lineEnd] - subLineStart); + const XYPOSITION xEol = static_cast<XYPOSITION>(ll->positions[lineEnd] - subLineStart); // Fill the virtual space and show selections within it if (virtualSpace > 0.0f) { @@ -1273,7 +1273,7 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con } } -static bool AnnotationBoxedOrIndented(int annotationVisible) { +static constexpr bool AnnotationBoxedOrIndented(int annotationVisible) noexcept { return annotationVisible == ANNOTATION_BOXED || annotationVisible == ANNOTATION_INDENTED; } @@ -1395,7 +1395,7 @@ static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewS // (inversed) for drawing the caret here. const int styleMain = ll->styles[offsetFirstChar]; FontAlias fontText = vsDraw.styles[styleMain].font; - std::string_view text(&ll->chars[offsetFirstChar], numCharsToDraw); + const std::string_view text(&ll->chars[offsetFirstChar], numCharsToDraw); surface->DrawTextClipped(rcCaret, fontText, rcCaret.top + vsDraw.maxAscent, text, vsDraw.styles[styleMain].back, caretColour); @@ -1547,7 +1547,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi // Does not take margin into account but not significant const int xStartVisible = static_cast<int>(subLineStart)-xStart; - BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, NULL); + BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, nullptr); const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet; @@ -1859,7 +1859,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi } else { // Normal text display if (vsDraw.styles[styleMain].visible) { - std::string_view text(&ll->chars[ts.start], i - ts.start + 1); + const std::string_view text(&ll->chars[ts.start], i - ts.start + 1); if (phasesDraw != phasesOne) { surface->DrawTextTransparent(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, text, textFore); @@ -2143,7 +2143,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))); Sci::Line lineDocPrevious = -1; // Used to avoid laying out one document line multiple times - AutoLineLayout ll(llc, 0); + AutoLineLayout ll(llc, nullptr); std::vector<DrawPhase> phases; if ((phasesDraw == phasesMultiple) && !bufferedDraw) { for (DrawPhase phase = drawBack; phase <= drawCarets; phase = static_cast<DrawPhase>(phase * 2)) { @@ -2172,7 +2172,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan ElapsedPeriod ep; #endif if (lineDoc != lineDocPrevious) { - ll.Set(0); + ll.Set(nullptr); ll.Set(RetrieveLineLayout(lineDoc, model)); LayoutLine(model, lineDoc, surface, vsDraw, ll, model.wrapWidth); lineDocPrevious = lineDoc; @@ -2246,7 +2246,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan visibleLine++; } } - ll.Set(0); + ll.Set(nullptr); #if defined(TIME_PAINTING) if (durPaint < 0.00000001) durPaint = 0.00000001; diff --git a/src/Editor.cxx b/src/Editor.cxx index 9e81a2ef3..86c0536a1 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -245,7 +245,7 @@ void Editor::SetRepresentations() { } else if (pdoc->dbcsCodePage) { // DBCS invalid single lead bytes for (int k = 0x80; k < 0x100; k++) { - char ch = static_cast<char>(k); + const char ch = static_cast<char>(k); if (pdoc->IsDBCSLeadByteNoExcept(ch) || pdoc->IsDBCSLeadByteInvalid(ch)) { const char hiByte[2] = { ch, 0 }; char hexits[5]; // Really only needs 4 but that causes warning from gcc 7.1 @@ -2284,7 +2284,7 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { ShowCaretAtCurrentPosition(); } -int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) { +int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) noexcept { return (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | @@ -3210,11 +3210,11 @@ Sci::Position Editor::StartEndDisplayLine(Sci::Position pos, bool start) { namespace { -short HighShortFromLong(long x) { +constexpr short HighShortFromWParam(uptr_t x) { return static_cast<short>(x >> 16); } -short LowShortFromLong(long x) { +constexpr short LowShortFromWParam(uptr_t x) { return static_cast<short>(x & 0xffff); } @@ -4072,7 +4072,7 @@ Sci::Position Editor::SearchText( sptr_t lParam) { ///< The text to search for. const char *txt = CharPtrFromSPtr(lParam); - Sci::Position pos; + Sci::Position pos = INVALID_POSITION; Sci::Position lengthFound = strlen(txt); if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); @@ -4088,9 +4088,9 @@ Sci::Position Editor::SearchText( } } catch (RegexError &) { errorStatus = SC_STATUS_WARN_REGEX; - return -1; + return INVALID_POSITION; } - if (pos != -1) { + if (pos != INVALID_POSITION) { SetSelection(pos, pos + lengthFound); } @@ -4463,7 +4463,7 @@ void Editor::MouseLeave() { } } -static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) { +static constexpr bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) noexcept { return (!rectangular && ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0)) || (rectangular && ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) != 0)); } @@ -7276,13 +7276,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return vs.caretWidth; case SCI_ASSIGNCMDKEY: - kmap.AssignCmdKey(LowShortFromLong(static_cast<long>(wParam)), - HighShortFromLong(static_cast<long>(wParam)), static_cast<unsigned int>(lParam)); + kmap.AssignCmdKey(LowShortFromWParam(wParam), + HighShortFromWParam(wParam), static_cast<unsigned int>(lParam)); break; case SCI_CLEARCMDKEY: - kmap.AssignCmdKey(LowShortFromLong(static_cast<long>(wParam)), - HighShortFromLong(static_cast<long>(wParam)), SCI_NULL); + kmap.AssignCmdKey(LowShortFromWParam(wParam), + HighShortFromWParam(wParam), SCI_NULL); break; case SCI_CLEARALLCMDKEYS: diff --git a/src/Editor.h b/src/Editor.h index 3c21ee092..fb892bdcb 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -412,7 +412,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void DelCharBack(bool allowLineStartDeletion); virtual void ClaimSelection() = 0; - static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false); + static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false) noexcept; virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void SetCtrlID(int identifier); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index b218c39e0..44f9caa0c 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -63,12 +63,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_); } @@ -422,7 +421,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) { @@ -512,12 +511,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 { @@ -536,7 +535,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()) { @@ -626,7 +625,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); diff --git a/src/PositionCache.h b/src/PositionCache.h index 512ec13f5..5657b667c 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -10,10 +10,14 @@ namespace Scintilla { -static inline bool IsEOLChar(char ch) { +inline constexpr bool IsEOLChar(int ch) noexcept { return (ch == '\r') || (ch == '\n'); } +inline constexpr bool IsSpaceOrTab(int ch) noexcept { + return ch == ' ' || ch == '\t'; +} + /** * A point in document space. * Uses double for sufficient resolution in large (>20,000,000 line) documents. @@ -122,6 +126,11 @@ struct ScreenLine : public IScreenLine { int tabWidthMinimumPixels; ScreenLine(const LineLayout *ll_, int subLine, const ViewStyle &vs, XYPOSITION width_, int tabWidthMinimumPixels_); + // Deleted so ScreenLine objects can not be copied. + ScreenLine(const ScreenLine &) = delete; + ScreenLine(ScreenLine &&) = delete; + void operator=(const ScreenLine &) = delete; + void operator=(ScreenLine &&) = delete; virtual ~ScreenLine(); std::string_view Text() const override; @@ -274,10 +283,6 @@ public: const char *s, unsigned int len, XYPOSITION *positions, const Document *pdoc); }; -inline bool IsSpaceOrTab(int ch) { - return ch == ' ' || ch == '\t'; -} - } #endif diff --git a/src/XPM.cxx b/src/XPM.cxx index 0d4a2a068..5df3ea7c9 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -58,9 +58,9 @@ unsigned int ValueOfHex(const char ch) noexcept { } ColourDesired ColourFromHex(const char *val) noexcept { - unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); - unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); - unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); + const unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); + const unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); + const unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); return ColourDesired(r, g, b); } @@ -14,12 +14,12 @@ namespace Scintilla { * Hold a pixmap in XPM format. */ class XPM { - int height; - int width; - int nColours; + int height=1; + int width=1; + int nColours=1; std::vector<unsigned char> pixels; ColourDesired colourCodeTable[256]; - char codeTransparent; + char codeTransparent=' '; ColourDesired ColourFromCode(int ch) const; void FillRun(Surface *surface, int code, int startX, int y, int x) const; public: diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 82b269c83..5529b7ba6 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -63,17 +63,17 @@ namespace Scintilla { UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage); -RECT RectFromPRectangle(PRectangle prc) { +RECT RectFromPRectangle(PRectangle prc) noexcept { RECT rc = {static_cast<LONG>(prc.left), static_cast<LONG>(prc.top), static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom)}; return rc; } #if defined(USE_D2D) -IDWriteFactory *pIDWriteFactory = 0; -ID2D1Factory *pD2DFactory = 0; -IDWriteRenderingParams *defaultRenderingParams = 0; -IDWriteRenderingParams *customClearTypeRenderingParams = 0; +IDWriteFactory *pIDWriteFactory = nullptr; +ID2D1Factory *pD2DFactory = nullptr; +IDWriteRenderingParams *defaultRenderingParams = nullptr; +IDWriteRenderingParams *customClearTypeRenderingParams = nullptr; static HMODULE hDLLD2D = NULL; static HMODULE hDLLDWrite = NULL; @@ -188,7 +188,7 @@ struct FormatAndMetrics { #if defined(USE_D2D) if (pTextFormat) pTextFormat->Release(); - pTextFormat = 0; + pTextFormat = nullptr; #endif extraFontFlag = 0; characterSet = 0; @@ -329,7 +329,7 @@ public: static void ReleaseId(FontID fid_); }; -FontCached *FontCached::first = 0; +FontCached *FontCached::first = nullptr; FontCached::FontCached(const FontParameters &fp) : next(0), usage(0), size(1.0), hash(0) { @@ -342,13 +342,13 @@ FontCached::FontCached(const FontParameters &fp) : fid = new FormatAndMetrics(hfont, fp.extraFontFlag, fp.characterSet); } else { #if defined(USE_D2D) - IDWriteTextFormat *pTextFormat; + IDWriteTextFormat *pTextFormat = nullptr; const int faceSize = 200; WCHAR wszFace[faceSize] = L""; UTF16FromUTF8(fp.faceName, wszFace, faceSize); const FLOAT fHeight = fp.size; const DWRITE_FONT_STYLE style = fp.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; - HRESULT hr = pIDWriteFactory->CreateTextFormat(wszFace, NULL, + HRESULT hr = pIDWriteFactory->CreateTextFormat(wszFace, nullptr, static_cast<DWRITE_FONT_WEIGHT>(fp.weight), style, DWRITE_FONT_STRETCH_NORMAL, fHeight, L"en-us", &pTextFormat); @@ -358,7 +358,7 @@ FontCached::FontCached(const FontParameters &fp) : FLOAT yAscent = 1.0f; FLOAT yDescent = 1.0f; FLOAT yInternalLeading = 0.0f; - IDWriteTextLayout *pTextLayout = 0; + IDWriteTextLayout *pTextLayout = nullptr; hr = pIDWriteFactory->CreateTextLayout(L"X", 1, pTextFormat, 100.0f, 100.0f, &pTextLayout); if (SUCCEEDED(hr)) { @@ -436,7 +436,7 @@ void FontCached::ReleaseId(FontID fid_) { if (cur->usage == 0) { *pcur = cur->next; cur->Release(); - cur->next = 0; + cur->next = nullptr; delete cur; } break; @@ -490,7 +490,7 @@ public: ~VarBuffer() { if (buffer != bufferStandard) { delete []buffer; - buffer = 0; + buffer = nullptr; } } }; @@ -748,7 +748,7 @@ void SurfaceGDI::FillRectangle(PRectangle rc, ColourDesired back) { // There is no need to allocate a brush either. const RECT rcw = RectFromPRectangle(rc); ::SetBkColor(hdc, back.AsInteger()); - ::ExtTextOut(hdc, rcw.left, rcw.top, ETO_OPAQUE, &rcw, TEXT(""), 0, NULL); + ::ExtTextOut(hdc, rcw.left, rcw.top, ETO_OPAQUE, &rcw, TEXT(""), 0, nullptr); } void SurfaceGDI::FillRectangle(PRectangle rc, Surface &surfacePattern) { @@ -782,7 +782,7 @@ void AllFour(DWORD *pixels, int width, int height, int x, int y, DWORD val) { pixels[(height-1-y)*width+width-1-x] = val; } -DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) { +DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) noexcept { union { byte pixVal[4]; DWORD val; @@ -1194,17 +1194,17 @@ SurfaceD2D::SurfaceD2D() : codePage = 0; codePageText = 0; - pRenderTarget = NULL; + pRenderTarget = nullptr; ownRenderTarget = false; clipsActive = 0; // From selected font - pTextFormat = NULL; + pTextFormat = nullptr; yAscent = 2; yDescent = 1; yInternalLeading = 0; - pBrush = NULL; + pBrush = nullptr; logPixelsY = 72; dpiScaleX = 1.0; @@ -1218,7 +1218,7 @@ SurfaceD2D::~SurfaceD2D() { void SurfaceD2D::Clear() { if (pBrush) { pBrush->Release(); - pBrush = 0; + pBrush = nullptr; } if (pRenderTarget) { while (clipsActive) { @@ -1228,7 +1228,7 @@ void SurfaceD2D::Clear() { if (ownRenderTarget) { pRenderTarget->Release(); } - pRenderTarget = 0; + pRenderTarget = nullptr; } } @@ -1267,7 +1267,7 @@ void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID) Release(); SetScale(); SurfaceD2D *psurfOther = static_cast<SurfaceD2D *>(surface_); - ID2D1BitmapRenderTarget *pCompatibleRenderTarget = NULL; + ID2D1BitmapRenderTarget *pCompatibleRenderTarget = nullptr; const D2D1_SIZE_F desiredSize = D2D1::SizeF(static_cast<float>(width), static_cast<float>(height)); D2D1_PIXEL_FORMAT desiredFormat; #ifdef __MINGW32__ @@ -1277,7 +1277,7 @@ void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID) #endif desiredFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; const HRESULT hr = psurfOther->pRenderTarget->CreateCompatibleRenderTarget( - &desiredSize, NULL, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pCompatibleRenderTarget); + &desiredSize, nullptr, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pCompatibleRenderTarget); if (SUCCEEDED(hr)) { pRenderTarget = pCompatibleRenderTarget; pRenderTarget->BeginDraw(); @@ -1304,7 +1304,7 @@ void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) { const HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush); if (!SUCCEEDED(hr) && pBrush) { pBrush->Release(); - pBrush = 0; + pBrush = nullptr; } } } @@ -1389,12 +1389,12 @@ void SurfaceD2D::LineTo(int x_, int y_) { void SurfaceD2D::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) { if (pRenderTarget) { - ID2D1Factory *pFactory = 0; + ID2D1Factory *pFactory = nullptr; pRenderTarget->GetFactory(&pFactory); ID2D1PathGeometry *geometry=0; HRESULT hr = pFactory->CreatePathGeometry(&geometry); if (SUCCEEDED(hr)) { - ID2D1GeometrySink *sink = 0; + ID2D1GeometrySink *sink = nullptr; hr = geometry->Open(&sink); if (SUCCEEDED(hr)) { sink->BeginFigure(D2D1::Point2F(pts[0].x + 0.5f, pts[0].y + 0.5f), D2D1_FIGURE_BEGIN_FILLED); @@ -1437,12 +1437,12 @@ void SurfaceD2D::FillRectangle(PRectangle rc, ColourDesired back) { void SurfaceD2D::FillRectangle(PRectangle rc, Surface &surfacePattern) { SurfaceD2D &surfOther = static_cast<SurfaceD2D &>(surfacePattern); surfOther.FlushDrawing(); - ID2D1Bitmap *pBitmap = NULL; + ID2D1Bitmap *pBitmap = nullptr; ID2D1BitmapRenderTarget *pCompatibleRenderTarget = reinterpret_cast<ID2D1BitmapRenderTarget *>( surfOther.pRenderTarget); HRESULT hr = pCompatibleRenderTarget->GetBitmap(&pBitmap); if (SUCCEEDED(hr)) { - ID2D1BitmapBrush *pBitmapBrush = NULL; + ID2D1BitmapBrush *pBitmapBrush = nullptr; const D2D1_BITMAP_BRUSH_PROPERTIES brushProperties = D2D1::BitmapBrushProperties(D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR); @@ -1574,7 +1574,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig } } - ID2D1Bitmap *bitmap = 0; + ID2D1Bitmap *bitmap = nullptr; const D2D1_SIZE_U size = D2D1::SizeU(width, height); D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}, 72.0, 72.0}; @@ -1607,7 +1607,7 @@ void SurfaceD2D::Copy(PRectangle rc, Point from, Surface &surfaceSource) { surfOther.FlushDrawing(); ID2D1BitmapRenderTarget *pCompatibleRenderTarget = reinterpret_cast<ID2D1BitmapRenderTarget *>( surfOther.pRenderTarget); - ID2D1Bitmap *pBitmap = NULL; + ID2D1Bitmap *pBitmap = nullptr; HRESULT hr = pCompatibleRenderTarget->GetBitmap(&pBitmap); if (SUCCEEDED(hr)) { D2D1_RECT_F rcDestination = {rc.left, rc.top, rc.right, rc.bottom}; @@ -1648,6 +1648,11 @@ class BlobInline : public IDWriteInlineObject { public: BlobInline(XYPOSITION width_=0.0f) noexcept : width(width_) { } + // Defaulted so BlobInline objects can be copied. + BlobInline(const BlobInline &) = default; + BlobInline(BlobInline &&) = default; + BlobInline &operator=(const BlobInline &) = default; + BlobInline &operator=(BlobInline &&) = default; virtual ~BlobInline() { } }; @@ -1655,7 +1660,7 @@ public: /// Implement IUnknown STDMETHODIMP BlobInline::QueryInterface(REFIID riid, PVOID *ppv) { // Never called so not checked. - *ppv = NULL; + *ppv = nullptr; if (riid == IID_IUnknown) *ppv = static_cast<IUnknown *>(this); if (riid == __uuidof(IDWriteInlineObject)) @@ -1738,7 +1743,7 @@ size_t SurfaceD2D::PositionFromX(const IScreenLine *screenLine, XYPOSITION xDist std::wstring buffer = ReplaceRepresentation(screenLine->Text()); // Create a text layout - IDWriteTextLayout *textLayout = 0; + IDWriteTextLayout *textLayout = nullptr; const HRESULT hrCreate = pIDWriteFactory->CreateTextLayout(buffer.c_str(), static_cast<UINT32>(buffer.length()), pfm->pTextFormat, screenLine->Width(), screenLine->Height(), &textLayout); @@ -1819,7 +1824,7 @@ XYPOSITION SurfaceD2D::XFromPosition(const IScreenLine *screenLine, size_t caret std::wstring buffer = ReplaceRepresentation(screenLine->Text()); // Create a text layout - IDWriteTextLayout *textLayout = 0; + IDWriteTextLayout *textLayout = nullptr; const HRESULT hrCreate = pIDWriteFactory->CreateTextLayout(buffer.c_str(), static_cast<UINT32>(buffer.length()+1), pfm->pTextFormat, screenLine->Width(), screenLine->Height(), &textLayout); @@ -1875,7 +1880,7 @@ std::vector<Interval> SurfaceD2D::FindRangeIntervals(const IScreenLine *screenLi std::wstring buffer = ReplaceRepresentation(screenLine->Text()); // Create a text layout - IDWriteTextLayout *textLayout = 0; + IDWriteTextLayout *textLayout = nullptr; const HRESULT hrCreate = pIDWriteFactory->CreateTextLayout(buffer.c_str(), static_cast<UINT32>(buffer.length() + 1), pfm->pTextFormat, screenLine->Width(), screenLine->Height(), &textLayout); @@ -1890,7 +1895,7 @@ std::vector<Interval> SurfaceD2D::FindRangeIntervals(const IScreenLine *screenLi FillTextLayoutFormats(screenLine, textLayout, blobs); // Find selection range length - size_t rangeLength = (endPos > startPos) ? (endPos - startPos) : (startPos - endPos); + const size_t rangeLength = (endPos > startPos) ? (endPos - startPos) : (startPos - endPos); // Determine actual number of hit-test ranges UINT32 actualHitTestCount = 0; @@ -1901,7 +1906,7 @@ std::vector<Interval> SurfaceD2D::FindRangeIntervals(const IScreenLine *screenLi static_cast<UINT32>(rangeLength), 0, // x 0, // y - NULL, + nullptr, 0, // metrics count &actualHitTestCount ); @@ -2105,7 +2110,7 @@ XYPOSITION SurfaceD2D::WidthText(Font &font_, std::string_view text) { const TextWide tbuf(text, unicodeMode, codePageText); if (pIDWriteFactory && pTextFormat) { // Create a layout - IDWriteTextLayout *pTextLayout = 0; + IDWriteTextLayout *pTextLayout = nullptr; const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 1000.0, 1000.0, &pTextLayout); if (SUCCEEDED(hr)) { DWRITE_TEXT_METRICS textMetrics; @@ -2128,12 +2133,12 @@ void SurfaceD2D::MeasureWidths(Font &font_, std::string_view text, XYPOSITION *p // Initialize poses for safety. std::fill(poses.buffer, poses.buffer + tbuf.tlen, 0.0f); // Create a layout - IDWriteTextLayout *pTextLayout = 0; + IDWriteTextLayout *pTextLayout = nullptr; const HRESULT hrCreate = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout); if (!SUCCEEDED(hrCreate)) { return; } - const int clusters = 1000; + const int clusters = stackBufferLength; DWRITE_CLUSTER_METRICS clusterMetrics[clusters]; UINT32 count = 0; const HRESULT hrGetCluster = pTextLayout->GetClusterMetrics(clusterMetrics, clusters, &count); @@ -2222,7 +2227,7 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) { SetFont(font_); if (pIDWriteFactory && pTextFormat) { // Create a layout - IDWriteTextLayout *pTextLayout = 0; + IDWriteTextLayout *pTextLayout = nullptr; const WCHAR wszAllAlpha[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; const size_t lenAllAlpha = wcslen(wszAllAlpha); const HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast<UINT32>(lenAllAlpha), @@ -2385,7 +2390,7 @@ namespace { void FlipBitmap(HBITMAP bitmap, int width, int height) { HDC hdc = ::CreateCompatibleDC(NULL); - if (hdc != NULL) { + if (hdc) { HGDIOBJ prevBmp = ::SelectObject(hdc, bitmap); ::StretchBlt(hdc, width - 1, 0, -width, height, hdc, 0, 0, width, height, SRCCOPY); ::SelectObject(hdc, prevBmp); @@ -2394,29 +2399,29 @@ void FlipBitmap(HBITMAP bitmap, int width, int height) { } HCURSOR GetReverseArrowCursor() { - if (reverseArrowCursor != NULL) + if (reverseArrowCursor) return reverseArrowCursor; ::EnterCriticalSection(&crPlatformLock); HCURSOR cursor = reverseArrowCursor; - if (cursor == NULL) { + if (!cursor) { cursor = ::LoadCursor(NULL, IDC_ARROW); ICONINFO info; if (::GetIconInfo(cursor, &info)) { BITMAP bmp; if (::GetObject(info.hbmMask, sizeof(bmp), &bmp)) { FlipBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); - if (info.hbmColor != NULL) + if (info.hbmColor) FlipBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); info.xHotspot = bmp.bmWidth - 1 - info.xHotspot; reverseArrowCursor = ::CreateIconIndirect(&info); - if (reverseArrowCursor != NULL) + if (reverseArrowCursor) cursor = reverseArrowCursor; } ::DeleteObject(info.hbmMask); - if (info.hbmColor != NULL) + if (info.hbmColor) ::DeleteObject(info.hbmColor); } } @@ -2572,9 +2577,9 @@ class ListBoxX : public ListBox { public: ListBoxX() : lineHeight(10), fontCopy(0), technology(0), lb(0), unicodeMode(false), desiredVisibleRows(9), maxItemCharacters(0), aveCharWidth(8), - parent(NULL), ctrlID(0), + parent(nullptr), ctrlID(0), delegate(nullptr), - widestItem(NULL), maxCharWidth(1), resizeHit(0), wheelDelta(0) { + widestItem(nullptr), maxCharWidth(1), resizeHit(0), wheelDelta(0) { } ~ListBoxX() override { if (fontCopy) { @@ -2720,7 +2725,7 @@ int ListBoxX::CaretFromEdge() { void ListBoxX::Clear() { ::SendMessage(lb, LB_RESETCONTENT, 0, 0); maxItemCharacters = 0; - widestItem = NULL; + widestItem = nullptr; lti.Clear(); } @@ -2829,7 +2834,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) { D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT ); - ID2D1DCRenderTarget *pDCRT = 0; + ID2D1DCRenderTarget *pDCRT = nullptr; HRESULT hr = pD2DFactory->CreateDCRenderTarget(&props, &pDCRT); if (SUCCEEDED(hr)) { RECT rcWindow; @@ -2883,7 +2888,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) { const size_t size = strlen(list); char *words = lti.SetWords(list); char *startword = words; - char *numword = NULL; + char *numword = nullptr; for (size_t i=0; i < size; i++) { if (words[i] == separator) { words[i] = '\0'; @@ -2891,7 +2896,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) { *numword = '\0'; AppendListItem(startword, numword); startword = words + i + 1; - numword = NULL; + numword = nullptr; } else if (words[i] == typesep) { numword = words + i; } @@ -3395,7 +3400,7 @@ void Menu::Destroy() { void Menu::Show(Point pt, Window &w) { ::TrackPopupMenu(static_cast<HMENU>(mid), TPM_RIGHTBUTTON, static_cast<int>(pt.x - 4), static_cast<int>(pt.y), 0, - HwndFromWindowID(w.GetID()), NULL); + HwndFromWindowID(w.GetID()), nullptr); Destroy(); } @@ -3408,13 +3413,13 @@ public: } ~DynamicLibraryImpl() override { - if (h != NULL) + if (h) ::FreeLibrary(h); } // Use GetProcAddress to get a pointer to the relevant function. Function FindFunction(const char *name) override { - if (h != NULL) { + if (h) { // C++ standard doesn't like casts between function pointers and void pointers so use a union union { FARPROC fp; @@ -3423,7 +3428,7 @@ public: fnConv.fp = ::GetProcAddress(h, name); return fnConv.f; } else { - return NULL; + return nullptr; } } @@ -3515,19 +3520,19 @@ void Platform_Finalise(bool fromDllMain) { if (!fromDllMain) { if (defaultRenderingParams) { defaultRenderingParams->Release(); - defaultRenderingParams = 0; + defaultRenderingParams = nullptr; } if (customClearTypeRenderingParams) { customClearTypeRenderingParams->Release(); - customClearTypeRenderingParams = 0; + customClearTypeRenderingParams = nullptr; } if (pIDWriteFactory) { pIDWriteFactory->Release(); - pIDWriteFactory = 0; + pIDWriteFactory = nullptr; } if (pD2DFactory) { pD2DFactory->Release(); - pD2DFactory = 0; + pD2DFactory = nullptr; } if (hDLLDWrite) { FreeLibrary(hDLLDWrite); @@ -3539,7 +3544,7 @@ void Platform_Finalise(bool fromDllMain) { } } #endif - if (reverseArrowCursor != NULL) + if (reverseArrowCursor) ::DestroyCursor(reverseArrowCursor); ListBoxX_Unregister(); ::DeleteCriticalSection(&crPlatformLock); diff --git a/win32/PlatWin.h b/win32/PlatWin.h index bff73ae70..cf357f72d 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -13,7 +13,7 @@ namespace Scintilla { extern void Platform_Initialise(void *hInstance); extern void Platform_Finalise(bool fromDllMain); -RECT RectFromPRectangle(PRectangle prc); +RECT RectFromPRectangle(PRectangle prc) noexcept; #if defined(USE_D2D) extern bool LoadD2D(); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index faab3844e..df4e1d248 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -160,7 +160,7 @@ Point PointFromPOINT(POINT pt) { Point PointFromLParam(sptr_t lpoint) { return Point::FromInts(GET_X_LPARAM(lpoint), GET_Y_LPARAM(lpoint)); } -POINT POINTFromPoint(Point pt) { +constexpr POINT POINTFromPoint(Point pt) noexcept { return POINT{ static_cast<LONG>(pt.x), static_cast<LONG>(pt.y) }; } bool KeyboardIsKeyDown(int key) { @@ -491,7 +491,7 @@ void ScintillaWin::Init() { // Initialize COM. If the app has already done this it will have // no effect. If the app hasn't, we really shouldn't ask them to call // it just so this internal feature works. - hrOle = ::OleInitialize(NULL); + hrOle = ::OleInitialize(nullptr); // Find SetCoalescableTimer which is only available from Windows 8+ HMODULE user32 = ::GetModuleHandle(TEXT("user32.dll")); @@ -551,13 +551,13 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) { drtp.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE); - ID2D1DCRenderTarget *pDCRT = NULL; + ID2D1DCRenderTarget *pDCRT = nullptr; const HRESULT hr = pD2DFactory->CreateDCRenderTarget(&drtp, &pDCRT); if (SUCCEEDED(hr)) { pRenderTarget = pDCRT; } else { Platform::DebugPrintf("Failed CreateDCRenderTarget 0x%x\n", hr); - pRenderTarget = NULL; + pRenderTarget = nullptr; } } else { @@ -567,13 +567,13 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) { dhrtp.presentOptions = (technology == SC_TECHNOLOGY_DIRECTWRITERETAIN) ? D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS : D2D1_PRESENT_OPTIONS_NONE; - ID2D1HwndRenderTarget *pHwndRenderTarget = NULL; + ID2D1HwndRenderTarget *pHwndRenderTarget = nullptr; const HRESULT hr = pD2DFactory->CreateHwndRenderTarget(drtp, dhrtp, &pHwndRenderTarget); if (SUCCEEDED(hr)) { pRenderTarget = pHwndRenderTarget; } else { Platform::DebugPrintf("Failed CreateHwndRenderTarget 0x%x\n", hr); - pRenderTarget = NULL; + pRenderTarget = nullptr; } } #else @@ -758,7 +758,7 @@ std::wstring StringDecode(const std::string &s, int codePage) { std::wstring StringMapCase(const std::wstring &ws, DWORD mapFlags) { const int charsConverted = ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags, - ws.c_str(), static_cast<int>(ws.length()), NULL, 0); + ws.c_str(), static_cast<int>(ws.length()), nullptr, 0); std::wstring wsConverted(charsConverted, 0); if (charsConverted) { ::LCMapStringW(LOCALE_SYSTEM_DEFAULT, mapFlags, @@ -802,7 +802,7 @@ Sci::Position ScintillaWin::EncodedFromUTF8(const char *utf8, char *encoded) con return inputLength; } else { // Need to convert - std::string_view utf8Input(utf8, inputLength); + const std::string_view utf8Input(utf8, inputLength); const int charsLen = WideCharLenFromMultiByte(CP_UTF8, utf8Input); std::wstring characters(charsLen, L'\0'); WideCharFromMultiByte(CP_UTF8, utf8Input, &characters[0], charsLen); @@ -2357,7 +2357,7 @@ void ScintillaWin::ClaimSelection() { STDMETHODIMP_(ULONG)FormatEnumerator_AddRef(FormatEnumerator *fe); STDMETHODIMP FormatEnumerator_QueryInterface(FormatEnumerator *fe, REFIID riid, PVOID *ppv) { //Platform::DebugPrintf("EFE QI"); - *ppv = NULL; + *ppv = nullptr; if (riid == IID_IUnknown) *ppv = reinterpret_cast<IEnumFORMATETC *>(fe); if (riid == IID_IEnumFORMATETC) @@ -2379,7 +2379,7 @@ STDMETHODIMP_(ULONG)FormatEnumerator_Release(FormatEnumerator *fe) { } /// Implement IEnumFORMATETC STDMETHODIMP FormatEnumerator_Next(FormatEnumerator *fe, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) { - if (rgelt == NULL) return E_POINTER; + if (!rgelt) return E_POINTER; unsigned int putPos = 0; while ((fe->pos < fe->formats.size()) && (putPos < celt)) { rgelt->cfFormat = fe->formats[fe->pos]; @@ -3012,7 +3012,7 @@ DWORD ScintillaWin::EffectFromState(DWORD grfKeyState) const { /// Implement IUnknown STDMETHODIMP ScintillaWin::QueryInterface(REFIID riid, PVOID *ppv) { - *ppv = NULL; + *ppv = nullptr; if (riid == IID_IUnknown) *ppv = reinterpret_cast<IDropTarget *>(&dt); if (riid == IID_IDropSource) @@ -3037,13 +3037,13 @@ STDMETHODIMP_(ULONG) ScintillaWin::Release() { /// Implement IDropTarget STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINTL, PDWORD pdwEffect) { - if (pIDataSource == NULL) + if (!pIDataSource ) return E_POINTER; - FORMATETC fmtu = {CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC fmtu = {CF_UNICODETEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; const HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu); hasOKText = (hrHasUText == S_OK); if (!hasOKText) { - FORMATETC fmte = {CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC fmte = {CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; const HRESULT hrHasText = pIDataSource->QueryGetData(&fmte); hasOKText = (hrHasText == S_OK); } @@ -3092,7 +3092,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, try { *pdwEffect = EffectFromState(grfKeyState); - if (pIDataSource == NULL) + if (!pIDataSource) return E_POINTER; SetDragPosition(SelectionPosition(Sci::invalidPosition)); @@ -3101,7 +3101,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, std::vector<char> data; // Includes terminating NUL - FORMATETC fmtu = {CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC fmtu = {CF_UNICODETEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; HRESULT hr = pIDataSource->GetData(&fmtu, &medium); if (SUCCEEDED(hr) && medium.hGlobal) { GlobalMemory memUDrop(medium.hGlobal); @@ -3128,7 +3128,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, } memUDrop.Unlock(); } else { - FORMATETC fmte = {CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + FORMATETC fmte = {CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; hr = pIDataSource->GetData(&fmte, &medium); if (SUCCEEDED(hr) && medium.hGlobal) { GlobalMemory memDrop(medium.hGlobal); @@ -3144,7 +3144,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, return hr; } - FORMATETC fmtr = {cfColumnSelect, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; + FORMATETC fmtr = {cfColumnSelect, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; const HRESULT hrRectangular = pIDataSource->QueryGetData(&fmtr); POINT rpt = {pt.x, pt.y}; @@ -3154,7 +3154,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, DropAt(movePos, &data[0], data.size(), *pdwEffect == DROPEFFECT_MOVE, hrRectangular == S_OK); // Free data - if (medium.pUnkForRelease != NULL) + if (medium.pUnkForRelease) medium.pUnkForRelease->Release(); else ::GlobalFree(medium.hGlobal); @@ -3329,7 +3329,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc( ::BeginPaint(hWnd, &ps); std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(sciThis->technology)); #if defined(USE_D2D) - ID2D1HwndRenderTarget *pCTRenderTarget = 0; + ID2D1HwndRenderTarget *pCTRenderTarget = nullptr; #endif RECT rc; GetClientRect(hWnd, &rc); @@ -3405,7 +3405,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc( sptr_t ScintillaWin::DirectFunction( sptr_t ptr, UINT iMessage, uptr_t wParam, sptr_t lParam) { - PLATFORM_ASSERT(::GetCurrentThreadId() == ::GetWindowThreadProcessId(reinterpret_cast<ScintillaWin *>(ptr)->MainHWND(), NULL)); + PLATFORM_ASSERT(::GetCurrentThreadId() == ::GetWindowThreadProcessId(reinterpret_cast<ScintillaWin *>(ptr)->MainHWND(), nullptr)); return reinterpret_cast<ScintillaWin *>(ptr)->WndProc(iMessage, wParam, lParam); } |