diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-18 19:39:42 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-18 19:39:42 +1100 |
commit | 402e089842d5aa2bb3774a665e26c42dc91fa5b4 (patch) | |
tree | 58304e9b27215782eec1a5c38e0636b2a18bafef /src | |
parent | 43c4b61bdd3669c2cc08d50f10401f0b04befcc9 (diff) | |
download | scintilla-mirror-402e089842d5aa2bb3774a665e26c42dc91fa5b4.tar.gz |
Use unique_ptr for Surface::Allocate to show transfer of ownership.
Diffstat (limited to 'src')
-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 |
5 files changed, 10 insertions, 10 deletions
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; |