diff options
-rw-r--r-- | cocoa/PlatCocoa.mm | 4 | ||||
-rwxr-xr-x | gtk/PlatGTK.cxx | 4 | ||||
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 4 | ||||
-rw-r--r-- | qt/ScintillaEditBase/ScintillaQt.cpp | 5 | ||||
-rw-r--r-- | src/CallTip.cxx | 2 | ||||
-rw-r--r-- | src/EditView.cxx | 6 | ||||
-rw-r--r-- | src/Editor.h | 4 | ||||
-rw-r--r-- | src/MarginView.cxx | 6 | ||||
-rw-r--r-- | src/Platform.h | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 8 |
10 files changed, 22 insertions, 23 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index f2eee85c8..4eb3bfd1b 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1258,8 +1258,8 @@ void SurfaceImpl::SetDBCSMode(int codePage_) { void SurfaceImpl::SetBidiR2L(bool) { } -Surface *Surface::Allocate(int) { - return new SurfaceImpl(); +std::unique_ptr<Surface> Surface::Allocate(int) { + return std::make_unique<SurfaceImpl>(); } //----------------- Window ------------------------------------------------------------------------- diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index e5daf5b1a..aff6b5e30 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -949,8 +949,8 @@ void SurfaceImpl::SetDBCSMode(int codePage) { void SurfaceImpl::SetBidiR2L(bool) { } -Surface *Surface::Allocate(int) { - return new SurfaceImpl(); +std::unique_ptr<Surface> Surface::Allocate(int) { + return std::make_unique<SurfaceImpl>(); } Window::~Window() {} diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index d49d22f0f..9cbf591b9 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -611,9 +611,9 @@ QPainter *SurfaceImpl::GetPainter() return painter; } -Surface *Surface::Allocate(int) +std::unique_ptr<Surface> Surface::Allocate(int) { - return new SurfaceImpl; + return std::make_unique<SurfaceImpl>(); } diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp index 859396aa2..707862416 100644 --- a/qt/ScintillaEditBase/ScintillaQt.cpp +++ b/qt/ScintillaEditBase/ScintillaQt.cpp @@ -668,12 +668,11 @@ public: void paintEvent(QPaintEvent *) override { if (pct->inCallTipMode) { - Surface *surfaceWindow = Surface::Allocate(0); + std::unique_ptr<Surface> surfaceWindow = Surface::Allocate(0); surfaceWindow->Init(this); surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == pct->codePage); surfaceWindow->SetDBCSMode(pct->codePage); - pct->PaintCT(surfaceWindow); - delete surfaceWindow; + pct->PaintCT(surfaceWindow.get()); } } diff --git a/src/CallTip.cxx b/src/CallTip.cxx index fccf20025..31ca35ed0 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -278,7 +278,7 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co clickPlace = 0; val = defn; codePage = codePage_; - std::unique_ptr<Surface> surfaceMeasure(Surface::Allocate(technology)); + std::unique_ptr<Surface> surfaceMeasure = Surface::Allocate(technology); surfaceMeasure->Init(wParent.GetID()); surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); surfaceMeasure->SetDBCSMode(codePage); diff --git a/src/EditView.cxx b/src/EditView.cxx index 1c6e41096..1ec163d27 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -268,11 +268,11 @@ void EditView::DropGraphics(bool freeObjects) { void EditView::AllocateGraphics(const ViewStyle &vsDraw) { if (!pixmapLine) - pixmapLine.reset(Surface::Allocate(vsDraw.technology)); + pixmapLine = Surface::Allocate(vsDraw.technology); if (!pixmapIndentGuide) - pixmapIndentGuide.reset(Surface::Allocate(vsDraw.technology)); + pixmapIndentGuide = Surface::Allocate(vsDraw.technology); if (!pixmapIndentGuideHighlight) - pixmapIndentGuideHighlight.reset(Surface::Allocate(vsDraw.technology)); + pixmapIndentGuideHighlight = Surface::Allocate(vsDraw.technology); } static const char *ControlCharacterString(unsigned char ch) noexcept { diff --git a/src/Editor.h b/src/Editor.h index 9a86d12e1..c08c8288e 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -643,7 +643,7 @@ private: public: AutoSurface(const Editor *ed, int technology = -1) { if (ed->wMain.GetID()) { - surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology)); + surf = Surface::Allocate(technology != -1 ? technology : ed->technology); surf->Init(ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); surf->SetDBCSMode(ed->CodePage()); @@ -652,7 +652,7 @@ public: } AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) { if (ed->wMain.GetID()) { - surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology)); + surf = Surface::Allocate(technology != -1 ? technology : ed->technology); surf->Init(sid, ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); surf->SetDBCSMode(ed->CodePage()); diff --git a/src/MarginView.cxx b/src/MarginView.cxx index c7da7e667..555720536 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -126,11 +126,11 @@ void MarginView::DropGraphics(bool freeObjects) { void MarginView::AllocateGraphics(const ViewStyle &vsDraw) { if (!pixmapSelMargin) - pixmapSelMargin.reset(Surface::Allocate(vsDraw.technology)); + pixmapSelMargin = Surface::Allocate(vsDraw.technology); if (!pixmapSelPattern) - pixmapSelPattern.reset(Surface::Allocate(vsDraw.technology)); + pixmapSelPattern = Surface::Allocate(vsDraw.technology); if (!pixmapSelPatternOffset1) - pixmapSelPatternOffset1.reset(Surface::Allocate(vsDraw.technology)); + pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology); } void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { diff --git a/src/Platform.h b/src/Platform.h index 5ba79a936..0c0f37ff6 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -168,7 +168,7 @@ public: Surface &operator=(const Surface &) = delete; Surface &operator=(Surface &&) = delete; virtual ~Surface() {} - static Surface *Allocate(int technology); + static std::unique_ptr<Surface> Allocate(int technology); virtual void Init(WindowID wid)=0; virtual void Init(SurfaceID sid, WindowID wid)=0; diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index aac888693..fc4d56cf1 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -2237,14 +2237,14 @@ void SurfaceD2D::SetBidiR2L(bool) { #endif -Surface *Surface::Allocate(int technology) { +std::unique_ptr<Surface> Surface::Allocate(int technology) { #if defined(USE_D2D) if (technology == SCWIN_TECH_GDI) - return new SurfaceGDI; + return std::make_unique<SurfaceGDI>(); else - return new SurfaceD2D; + return std::make_unique<SurfaceD2D>(); #else - return new SurfaceGDI; + return std::make_unique<SurfaceGDI>(); #endif } |