From 88de58fd1af9ffb1c6afcc53cf6279aadc51f58c Mon Sep 17 00:00:00 2001 From: Ankit Meel Date: Tue, 17 Nov 2020 17:10:03 +0530 Subject: Clang-tidy, fix bugprone-exception-escape. Remove redundant call to `ofstream::close()` from `~PSStrokeRenderer` and `~TextStrokeRenderer`. ofstream will be destructed automatically. - For `~Depsgraph`, `std::function`'s constructor can throw. - Passing throwing statements in the lambda will not be detected by clang-tidy. Fix these issues by using lambda as function argument. Reviewed By: sergey, sybren Differential Revision: https://developer.blender.org/D9497 --- source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp | 12 ------------ source/blender/freestyle/intern/stroke/PSStrokeRenderer.h | 4 ---- .../blender/freestyle/intern/stroke/TextStrokeRenderer.cpp | 12 ------------ source/blender/freestyle/intern/stroke/TextStrokeRenderer.h | 4 ---- 4 files changed, 32 deletions(-) (limited to 'source/blender/freestyle') diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp index 0e3fea3ddf8..11787e9f2a2 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp @@ -41,11 +41,6 @@ PSStrokeRenderer::PSStrokeRenderer(const char *iFileName) _ofstream << "%%EndComments" << endl; } -PSStrokeRenderer::~PSStrokeRenderer() -{ - Close(); -} - void PSStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const { RenderStrokeRepBasic(iStrokeRep); @@ -90,11 +85,4 @@ void PSStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const } } -void PSStrokeRenderer::Close() -{ - if (_ofstream.is_open()) { - _ofstream.close(); - } -} - } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h index 78aa17d26b6..46bb46ad8b2 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h @@ -40,15 +40,11 @@ namespace Freestyle { class PSStrokeRenderer : public StrokeRenderer { public: PSStrokeRenderer(const char *iFileName = NULL); - virtual ~PSStrokeRenderer(); /*! Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; - /*! Closes the output PS file */ - void Close(); - protected: mutable ofstream _ofstream; }; diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp index fa131743afc..dc98096129d 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp @@ -38,11 +38,6 @@ TextStrokeRenderer::TextStrokeRenderer(const char *iFileName) _ofstream << "%u x y z tleft tright r g b ..." << endl; } -TextStrokeRenderer::~TextStrokeRenderer() -{ - Close(); -} - void TextStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const { RenderStrokeRepBasic(iStrokeRep); @@ -68,11 +63,4 @@ void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const _ofstream << endl; } -void TextStrokeRenderer::Close() -{ - if (_ofstream.is_open()) { - _ofstream.close(); - } -} - } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h index c6497aba808..bbc3b5058a3 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h @@ -53,15 +53,11 @@ namespace Freestyle { class TextStrokeRenderer : public StrokeRenderer { public: TextStrokeRenderer(const char *iFileName = NULL); - virtual ~TextStrokeRenderer(); /*! Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; - /*! Closes the output file */ - void Close(); - protected: mutable ofstream _ofstream; }; -- cgit v1.2.3