From d68cc71c3a0bd5f20ed0ef7f83ab02202ce9ead0 Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Sun, 25 Jun 2017 01:04:32 +0000 Subject: [PATCH] refactoring --- far/DlgBuilder.hpp | 2 +- far/FarDlgBuilder.cpp | 12 ++++++------ far/FarDlgBuilder.hpp | 2 +- far/PluginA.cpp | 19 ++++++++----------- far/TPreRedrawFunc.hpp | 4 ++-- far/TaskBar.hpp | 2 +- far/bitflags.hpp | 2 +- far/blob_builder.hpp | 2 +- far/cache.hpp | 4 ++-- far/changelog | 4 ++++ far/chgprior.hpp | 2 +- far/clipboard.hpp | 2 +- far/cmdline.hpp | 2 +- far/codepage_selection.hpp | 2 +- far/common/any.hpp | 2 +- far/common/enumerator.hpp | 2 +- far/common/null_iterator.hpp | 2 +- far/common/range.hpp | 2 +- far/common/smart_ptr.hpp | 4 ++-- far/common/zip_view.hpp | 4 ++-- far/components.hpp | 2 +- far/config.hpp | 2 +- far/configdb.cpp | 2 +- far/configdb.hpp | 5 +++-- far/delete.hpp | 2 +- far/desktop.hpp | 2 +- far/diskmenu.cpp | 2 +- far/dizviewer.hpp | 2 +- far/edit.hpp | 2 +- far/editcontrol.cpp | 20 +++++++------------- far/editor.cpp | 2 +- far/editor.hpp | 2 +- far/encoding.hpp | 2 +- far/exception.hpp | 4 ++-- far/farwinapi.hpp | 8 ++++---- far/fileedit.hpp | 2 +- far/filelist.cpp | 2 +- far/fileowner.cpp | 2 +- far/filepanels.hpp | 2 +- far/findfile.cpp | 2 +- far/findfile.hpp | 2 +- far/grabber.hpp | 2 +- far/help.cpp | 2 +- far/help.hpp | 2 +- far/hotplug.cpp | 2 +- far/imports.hpp | 2 +- far/keybar.hpp | 6 +++--- far/language.hpp | 4 ++-- far/macro.cpp | 6 +++--- far/menubar.hpp | 2 +- far/mix.cpp | 3 +-- far/mix.hpp | 6 +++--- far/notification.hpp | 6 +++--- far/panel.hpp | 4 ++-- far/plclass.cpp | 8 ++++---- far/plclass.hpp | 6 +++--- far/privilege.cpp | 16 ++++++++-------- far/privilege.hpp | 7 ++++--- far/refreshwindowmanager.hpp | 2 +- far/scantree.hpp | 2 +- far/scrobj.hpp | 6 +++--- far/sqlitedb.hpp | 4 ++-- far/synchro.hpp | 2 +- far/syslog.hpp | 2 +- far/tracer.hpp | 2 +- far/treelist.hpp | 2 +- far/usermenu.hpp | 4 ++-- far/vbuild.m4 | 2 +- far/viewer.hpp | 2 +- far/vmenu.hpp | 2 +- 70 files changed, 130 insertions(+), 134 deletions(-) diff --git a/far/DlgBuilder.hpp b/far/DlgBuilder.hpp index da0ae3ed93..748a9aa715 100644 --- a/far/DlgBuilder.hpp +++ b/far/DlgBuilder.hpp @@ -105,7 +105,7 @@ struct RadioButtonBinding: public DialogItemBinding int *Value; public: - RadioButtonBinding(int *aValue) : Value(aValue) { } + explicit RadioButtonBinding(int *aValue) : Value(aValue) { } virtual void SaveValue(T *Item, int RadioGroupIndex) override { diff --git a/far/FarDlgBuilder.cpp b/far/FarDlgBuilder.cpp index 5dbe564e40..e85caefbac 100644 --- a/far/FarDlgBuilder.cpp +++ b/far/FarDlgBuilder.cpp @@ -45,7 +45,7 @@ struct EditFieldBinding: public DialogItemBinding { T& TextValue; - EditFieldBinding(T& aTextValue) + explicit EditFieldBinding(T& aTextValue) : TextValue(aTextValue) { } @@ -94,7 +94,7 @@ template struct EditFieldHexBinding: public DialogItemBinding { public: - EditFieldHexBinding(T *aIntValue) : IntValue(aIntValue) + explicit EditFieldHexBinding(T *aIntValue) : IntValue(aIntValue) { Mask[0] = L'0'; Mask[1] = L'x'; @@ -126,7 +126,7 @@ struct FarCheckBoxIntBinding: public DialogItemBinding int Mask; public: - FarCheckBoxIntBinding(T& aValue, int aMask=0) : Value(aValue), Mask(aMask) { } + explicit FarCheckBoxIntBinding(T& aValue, int aMask=0) : Value(aValue), Mask(aMask) { } virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override { @@ -151,7 +151,7 @@ struct FarCheckBoxBool3Binding: public DialogItemBinding T& Value; public: - FarCheckBoxBool3Binding(T& aValue) : Value(aValue) { } + explicit FarCheckBoxBool3Binding(T& aValue) : Value(aValue) { } virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override { @@ -166,7 +166,7 @@ struct FarCheckBoxBoolBinding: public DialogItemBinding T& Value; public: - FarCheckBoxBoolBinding(T& aValue) : Value(aValue) { } + explicit FarCheckBoxBoolBinding(T& aValue) : Value(aValue) { } virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override { @@ -218,7 +218,7 @@ struct FarRadioButtonBinding: public DialogItemBinding T& Value; public: - FarRadioButtonBinding(T& aValue) : Value(aValue) { } + explicit FarRadioButtonBinding(T& aValue) : Value(aValue) { } virtual void SaveValue(DialogItemEx *Item, int RadioGroupIndex) override { diff --git a/far/FarDlgBuilder.hpp b/far/FarDlgBuilder.hpp index 7d4b23dd9f..95a2ffd89f 100644 --- a/far/FarDlgBuilder.hpp +++ b/far/FarDlgBuilder.hpp @@ -114,7 +114,7 @@ struct ListControlBinding: public DialogItemBinding class DialogBuilder: noncopyable, public base> { public: - DialogBuilder(lng TitleMessageId, const wchar_t *HelpTopic = nullptr, Dialog::dialog_handler handler = nullptr); + explicit DialogBuilder(lng TitleMessageId, const wchar_t *HelpTopic = nullptr, Dialog::dialog_handler handler = nullptr); DialogBuilder(); ~DialogBuilder(); diff --git a/far/PluginA.cpp b/far/PluginA.cpp index 750fa0af7c..e1f080b764 100644 --- a/far/PluginA.cpp +++ b/far/PluginA.cpp @@ -96,7 +96,7 @@ DECLARE_PLUGIN_FUNCTION(iProcessDialogEvent, int (WINAPI*)(int Event, void * class file_version: noncopyable { public: - file_version(const string& File): + explicit file_version(const string& File): m_File(File) { } @@ -148,7 +148,8 @@ class oem_plugin_module: public native_plugin_module { public: NONCOPYABLE(oem_plugin_module); - oem_plugin_module(const string& Name): + + explicit oem_plugin_module(const string& Name): native_plugin_module(Name), m_FileVersion(Name) { @@ -161,7 +162,8 @@ class oem_plugin_factory: public native_plugin_factory { public: NONCOPYABLE(oem_plugin_factory); - oem_plugin_factory(PluginManager* Owner): + + explicit oem_plugin_factory(PluginManager* Owner): native_plugin_factory(Owner) { static const export_name ExportsNames[] = @@ -1163,11 +1165,7 @@ static void FreeUnicodeDialogItem(FarDialogItem &di) { if (di.ListItems->Items) { - for (size_t i = 0; i < di.ListItems->ItemsNumber; i++) - { - delete[] di.ListItems->Items[i].Text; - } - + std::for_each(di.ListItems->Items, di.ListItems->Items + di.ListItems->ItemsNumber, [](const FarListItem& i) { delete[] i.Text; }); delete[] di.ListItems->Items; di.ListItems->Items = nullptr; } @@ -3215,8 +3213,7 @@ static intptr_t WINAPI FarSendDlgMessageA(HANDLE hDlg, int OldMsg, int Param1, v if (newlist.Items) { - for (size_t i=0; i()) { diff --git a/far/TPreRedrawFunc.hpp b/far/TPreRedrawFunc.hpp index 5bcd2b53ac..83e3ca2995 100644 --- a/far/TPreRedrawFunc.hpp +++ b/far/TPreRedrawFunc.hpp @@ -40,7 +40,7 @@ struct PreRedrawItem: noncopyable { using handler_type = std::function; - PreRedrawItem(const handler_type& PreRedrawFunc) : m_PreRedrawFunc(PreRedrawFunc) {} + explicit PreRedrawItem(const handler_type& PreRedrawFunc) : m_PreRedrawFunc(PreRedrawFunc) {} virtual ~PreRedrawItem() = default; handler_type m_PreRedrawFunc; @@ -70,7 +70,7 @@ inline TPreRedrawFunc& PreRedrawStack() class TPreRedrawFuncGuard: noncopyable { public: - TPreRedrawFuncGuard(std::unique_ptr&& Item) + explicit TPreRedrawFuncGuard(std::unique_ptr&& Item) { PreRedrawStack().push(std::move(Item)); } diff --git a/far/TaskBar.hpp b/far/TaskBar.hpp index 6d42eaea25..aeea60a323 100644 --- a/far/TaskBar.hpp +++ b/far/TaskBar.hpp @@ -59,7 +59,7 @@ taskbar& Taskbar(); class IndeterminateTaskBar: noncopyable { public: - IndeterminateTaskBar(bool EndFlash = true); + explicit IndeterminateTaskBar(bool EndFlash = true); ~IndeterminateTaskBar(); private: diff --git a/far/bitflags.hpp b/far/bitflags.hpp index 1941274cf4..6bcf8afc03 100644 --- a/far/bitflags.hpp +++ b/far/bitflags.hpp @@ -40,7 +40,7 @@ class TBitFlags { public: TBitFlags():m_Flags(0) {} - TBitFlags(const T& Flags):m_Flags(Flags) {} + explicit TBitFlags(const T& Flags):m_Flags(Flags) {} const T& Flags() const { return m_Flags; } // установить набор флагов diff --git a/far/blob_builder.hpp b/far/blob_builder.hpp index d84a96ef22..2a5337444a 100644 --- a/far/blob_builder.hpp +++ b/far/blob_builder.hpp @@ -38,7 +38,7 @@ class blob_builder public: NONCOPYABLE(blob_builder); - blob_builder(uintptr_t CodePage): + explicit blob_builder(uintptr_t CodePage): m_CodePage(CodePage), m_Signature(IsUnicodeOrUtfCodePage(m_CodePage)) { diff --git a/far/cache.hpp b/far/cache.hpp index 7628983c8c..c0771a51ff 100644 --- a/far/cache.hpp +++ b/far/cache.hpp @@ -37,7 +37,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class CachedRead: noncopyable { public: - CachedRead(os::fs::file& file, size_t buffer_size = 0); + explicit CachedRead(os::fs::file& file, size_t buffer_size = 0); void AdjustAlignment(); // file have to be opened already bool Read(void* Data, size_t DataSize, size_t* BytesRead); bool FillBuffer(); @@ -57,7 +57,7 @@ class CachedRead: noncopyable class CachedWrite: noncopyable { public: - CachedWrite(os::fs::file& file); + explicit CachedWrite(os::fs::file& file); ~CachedWrite(); bool Write(const void* Data, size_t DataSize); bool Flush(); diff --git a/far/changelog b/far/changelog index 0291c98f96..a3f12d9d52 100644 --- a/far/changelog +++ b/far/changelog @@ -1,3 +1,7 @@ +drkns 25.06.2017 02:03:37 +0000 - build 4979 + +1. Рефакторинг. + drkns 23.06.2017 16:48:00 +0000 - build 4978 1. С форума: ненужный запрос привилегий diff --git a/far/chgprior.hpp b/far/chgprior.hpp index 68e7593e86..c0db9c0bea 100644 --- a/far/chgprior.hpp +++ b/far/chgprior.hpp @@ -38,7 +38,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class ChangePriority: noncopyable { public: - ChangePriority(int NewPriority); + explicit ChangePriority(int NewPriority); ~ChangePriority(); private: diff --git a/far/clipboard.hpp b/far/clipboard.hpp index fc9030b574..72f09a246e 100644 --- a/far/clipboard.hpp +++ b/far/clipboard.hpp @@ -91,7 +91,7 @@ class Clipboard class clipboard_accessor:noncopyable { public: - clipboard_accessor(clipboard_mode Mode = default_clipboard_mode::get()): m_Clipboard(Clipboard::GetInstance(Mode)) {} + explicit clipboard_accessor(clipboard_mode Mode = default_clipboard_mode::get()): m_Clipboard(Clipboard::GetInstance(Mode)) {} ~clipboard_accessor() { m_Clipboard.Close(); } auto operator->() const { return &m_Clipboard; } diff --git a/far/cmdline.hpp b/far/cmdline.hpp index 6a0a028f30..6309795e26 100644 --- a/far/cmdline.hpp +++ b/far/cmdline.hpp @@ -66,7 +66,7 @@ class i_execution_context class CommandLine:public SimpleScreenObject { public: - CommandLine(window_ptr Owner); + explicit CommandLine(window_ptr Owner); virtual ~CommandLine() override; virtual bool ProcessKey(const Manager::Key& Key) override; diff --git a/far/codepage_selection.hpp b/far/codepage_selection.hpp index d87f40f144..58e44d4a02 100644 --- a/far/codepage_selection.hpp +++ b/far/codepage_selection.hpp @@ -113,7 +113,7 @@ codepages& Codepages(); class F8CP { public: - F8CP(bool viewer = false); + explicit F8CP(bool viewer = false); uintptr_t NextCP(uintptr_t cp) const; const string& NextCPname(uintptr_t cp) const; diff --git a/far/common/any.hpp b/far/common/any.hpp index 5e9525ab6c..12c3f74037 100644 --- a/far/common/any.hpp +++ b/far/common/any.hpp @@ -46,7 +46,7 @@ namespace detail { public: template - any_impl(Y&& Data): + explicit any_impl(Y&& Data): m_Data(std::forward(Data)) { } diff --git a/far/common/enumerator.hpp b/far/common/enumerator.hpp index cc56e240c9..dca92c80b3 100644 --- a/far/common/enumerator.hpp +++ b/far/common/enumerator.hpp @@ -106,7 +106,7 @@ class inline_enumerator: public enumerator(Callable)) { } diff --git a/far/common/null_iterator.hpp b/far/common/null_iterator.hpp index 2c359529ca..ccd1270184 100644 --- a/far/common/null_iterator.hpp +++ b/far/common/null_iterator.hpp @@ -38,7 +38,7 @@ class null_iterator_t: public rel_ops> { public: - null_iterator_t(T* Data): m_Data(Data) {} + explicit null_iterator_t(T* Data): m_Data(Data) {} auto& operator++() { ++m_Data; return *this; } auto operator++(int) { return null_iterator_t(m_Data++); } auto& operator*() { return *m_Data; } diff --git a/far/common/range.hpp b/far/common/range.hpp index bc07586041..25e163dcd2 100644 --- a/far/common/range.hpp +++ b/far/common/range.hpp @@ -107,7 +107,7 @@ class i_iterator: public std::iterator, publ public: using value_type = T; - i_iterator(const T& value): m_value(value) {} + explicit i_iterator(const T& value): m_value(value) {} i_iterator(const i_iterator& rhs): m_value(rhs.m_value) {} auto& operator=(const i_iterator& rhs) { m_value = rhs.m_value; return *this; } diff --git a/far/common/smart_ptr.hpp b/far/common/smart_ptr.hpp index a6bfb7c262..dde27bb107 100644 --- a/far/common/smart_ptr.hpp +++ b/far/common/smart_ptr.hpp @@ -40,7 +40,7 @@ class array_ptr: public conditional> MOVABLE(array_ptr); array_ptr() noexcept: m_size() {} - array_ptr(size_t size, bool init = false) { reset(size, init); } + explicit array_ptr(size_t size, bool init = false) { reset(size, init); } void reset(size_t size, bool init = false) { m_array.reset(init? new T[size]() : new T[size]); m_size = size;} void reset() noexcept { m_array.reset(); m_size = 0; } @@ -107,7 +107,7 @@ class ptr_setter_t public: NONCOPYABLE(ptr_setter_t) MOVABLE(ptr_setter_t) - ptr_setter_t(T& Ptr): m_Ptr(&Ptr) {} + explicit ptr_setter_t(T& Ptr): m_Ptr(&Ptr) {} ~ptr_setter_t() { if (m_Ptr) m_Ptr->reset(m_RawPtr); } auto operator&() { return &m_RawPtr; } diff --git a/far/common/zip_view.hpp b/far/common/zip_view.hpp index 0912b1699d..96f7123f7b 100644 --- a/far/common/zip_view.hpp +++ b/far/common/zip_view.hpp @@ -106,7 +106,7 @@ class zip_iterator: { public: zip_iterator() = default; - zip_iterator(const args&... Args): m_Tuple(Args...) {} + explicit zip_iterator(const args&... Args): m_Tuple(Args...) {} auto& operator++() { detail::traits::unary_for_each(detail::increment{}, m_Tuple); return *this; } auto& operator--() { detail::traits::unary_for_each(detail::decrement{}, m_Tuple); return *this; } // tuple's operators == and < are inappropriate as ranges might be of different length and we want to stop on a shortest one @@ -125,7 +125,7 @@ class zip_view public: using iterator = zip_iterator()))...>; - zip_view(args&&... Args): + explicit zip_view(args&&... Args): m_Begin(std::begin(Args)...), m_End(std::end(Args)...) { diff --git a/far/components.hpp b/far/components.hpp index ee7dbf79fb..6bf9ffea6b 100644 --- a/far/components.hpp +++ b/far/components.hpp @@ -42,7 +42,7 @@ namespace components using info = std::pair; using get_info = info(*)(); - component(get_info getInfo); + explicit component(get_info getInfo); private: friend class components_list; diff --git a/far/config.hpp b/far/config.hpp index 65de88ff77..0021341b13 100644 --- a/far/config.hpp +++ b/far/config.hpp @@ -121,7 +121,7 @@ class Option protected: template - Option(const T& Value): m_Value(Value) {} + explicit Option(const T& Value): m_Value(Value) {} template const T& GetT() const { return any_cast(m_Value); } diff --git a/far/configdb.cpp b/far/configdb.cpp index 1eb808105e..078afb7bf1 100644 --- a/far/configdb.cpp +++ b/far/configdb.cpp @@ -51,7 +51,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class representation_source { public: - representation_source(const string& File): + explicit representation_source(const string& File): m_File(File), m_Root(nullptr) { diff --git a/far/configdb.hpp b/far/configdb.hpp index a19c1e8971..24fd0e3214 100644 --- a/far/configdb.hpp +++ b/far/configdb.hpp @@ -107,7 +107,7 @@ class HierarchicalConfig: public representable, virtual public transactional, pu private: friend class HierarchicalConfig; - key(unsigned long long Key): m_Key(Key) {} + explicit key(unsigned long long Key): m_Key(Key) {} unsigned long long m_Key; }; @@ -369,7 +369,8 @@ class config_provider: noncopyable { public: enum class mode { m_default, m_import, m_export }; - config_provider(mode Mode = mode::m_default); + + explicit config_provider(mode Mode = mode::m_default); ~config_provider(); bool ShowProblems() const; bool ServiceMode(const string& File); diff --git a/far/delete.hpp b/far/delete.hpp index 2cc2de09e8..11c6eaf2a5 100644 --- a/far/delete.hpp +++ b/far/delete.hpp @@ -64,7 +64,7 @@ bool DeleteFileWithFolder(const string& FileName); class delayed_deleter: noncopyable { public: - delayed_deleter(const string& pathToDelete); + explicit delayed_deleter(const string& pathToDelete); ~delayed_deleter(); private: diff --git a/far/desktop.hpp b/far/desktop.hpp index 7edd6ca419..b6fa76ab30 100644 --- a/far/desktop.hpp +++ b/far/desktop.hpp @@ -42,7 +42,7 @@ class desktop: public window public: static desktop_ptr create(); - desktop(private_tag); + explicit desktop(private_tag); virtual int GetType() const override { return windowtype_desktop; } virtual int GetTypeAndName(string& Type, string& Name) override { Type = GetTitle(); return GetType(); } diff --git a/far/diskmenu.cpp b/far/diskmenu.cpp index 86917ef4c7..3d3c634e8c 100644 --- a/far/diskmenu.cpp +++ b/far/diskmenu.cpp @@ -623,7 +623,7 @@ static int ChangeDiskMenu(panel_ptr Owner, int Pos, bool FirstCall) class Guard_Macro_DskShowPosType //фигня какая-то { public: - Guard_Macro_DskShowPosType(panel_ptr curPanel) { Global->Macro_DskShowPosType = curPanel->Parent()->IsLeft(curPanel)? 1 : 2; } + explicit Guard_Macro_DskShowPosType(panel_ptr curPanel) { Global->Macro_DskShowPosType = curPanel->Parent()->IsLeft(curPanel)? 1 : 2; } ~Guard_Macro_DskShowPosType() { Global->Macro_DskShowPosType = 0; } }; SCOPED_ACTION(Guard_Macro_DskShowPosType)(Owner); diff --git a/far/dizviewer.hpp b/far/dizviewer.hpp index fe2097cde6..7bfdabc4e2 100644 --- a/far/dizviewer.hpp +++ b/far/dizviewer.hpp @@ -42,7 +42,7 @@ class DizViewer: public Viewer int InRecursion; public: - DizViewer(window_ptr Owner):Viewer(Owner), InRecursion(0) {} + explicit DizViewer(window_ptr Owner):Viewer(Owner), InRecursion(0) {} public: virtual bool ProcessKey(const Manager::Key& Key) override diff --git a/far/edit.hpp b/far/edit.hpp index 5edaf09df0..7d4bf5d47b 100644 --- a/far/edit.hpp +++ b/far/edit.hpp @@ -116,7 +116,7 @@ class Edit: public SimpleScreenObject using delete_color_condition = std::function; - Edit(window_ptr Owner); + explicit Edit(window_ptr Owner); virtual ~Edit() override = default; void FastShow(const ShowInfo* Info=nullptr); diff --git a/far/editcontrol.cpp b/far/editcontrol.cpp index e795132bcf..5d1896e324 100644 --- a/far/editcontrol.cpp +++ b/far/editcontrol.cpp @@ -167,14 +167,8 @@ static bool ParseStringWithQuotes(const string& Str, string& Start, string& Toke else { auto WordDiv = GetSpaces() + Global->Opt->strWordDiv.Get(); - static const string NoQuote = L"\":\\/%.-"; - for (size_t i = 0; i != WordDiv.size(); ++i) - { - if (contains(NoQuote, WordDiv[i])) - { - WordDiv.erase(i--, 1); - } - } + static const auto NoQuote = L"\":\\/%.-"s; + WordDiv.erase(std::remove_if(ALL_RANGE(WordDiv), [&](wchar_t i) { return contains(NoQuote, i); })); for (Pos = Str.size() - 1; Pos != static_cast(-1); Pos--) { @@ -436,19 +430,19 @@ int EditControl::AutoCompleteProc(bool Manual,bool DelBlock,Manager::Key& BackKe } else if (pList) { - for (size_t i = 0; i < pList->ItemsNumber; i++) + std::for_each(pList->Items, pList->Items + pList->ItemsNumber, [&](const FarListItem& i) { - if (starts_with_icase(pList->Items[i].Text, Str) && pList->Items[i].Text != Str.data()) + if (starts_with_icase(i.Text, Str) && i.Text != Str.data()) { MenuItemEx Item; // Preserve the case of the already entered part if (Global->Opt->AutoComplete.AppendCompletion) { - Item.UserData = cmp_user_data{ Str + (pList->Items[i].Text + Str.size()) }; + Item.UserData = cmp_user_data{ Str + (i.Text + Str.size()) }; } - ComplMenu->AddItem(pList->Items[i].Text); + ComplMenu->AddItem(i.Text); } - } + }); } string Prefix; diff --git a/far/editor.cpp b/far/editor.cpp index 45f22bc088..db49474158 100644 --- a/far/editor.cpp +++ b/far/editor.cpp @@ -3288,7 +3288,7 @@ struct FindCoord class undo_block { public: - undo_block(Editor* Owner): m_Owner(Owner) { m_Owner->AddUndoData(UNDO_BEGIN); } + explicit undo_block(Editor* Owner): m_Owner(Owner) { m_Owner->AddUndoData(UNDO_BEGIN); } ~undo_block() { m_Owner->AddUndoData(UNDO_END); } private: diff --git a/far/editor.hpp b/far/editor.hpp index 28dfec149e..87b17fce49 100644 --- a/far/editor.hpp +++ b/far/editor.hpp @@ -49,7 +49,7 @@ class Edit; class Editor: public SimpleScreenObject { public: - Editor(window_ptr Owner, bool DialogUsed = false); + explicit Editor(window_ptr Owner, bool DialogUsed = false); virtual ~Editor() override; virtual bool ProcessKey(const Manager::Key& Key) override; diff --git a/far/encoding.hpp b/far/encoding.hpp index e6f3db8cfc..d097aca71f 100644 --- a/far/encoding.hpp +++ b/far/encoding.hpp @@ -216,7 +216,7 @@ class raw_eol { public: raw_eol(): m_Cr('\r'), m_Lf('\n') {} - raw_eol(uintptr_t Codepage): m_Cr(to(Codepage, L'\r')), m_Lf(to(Codepage, L'\n')) {} + explicit raw_eol(uintptr_t Codepage): m_Cr(to(Codepage, L'\r')), m_Lf(to(Codepage, L'\n')) {} template T cr() const = delete; diff --git a/far/exception.hpp b/far/exception.hpp index d740d139b3..4706326f8d 100644 --- a/far/exception.hpp +++ b/far/exception.hpp @@ -37,7 +37,7 @@ struct error_codes struct ignore{}; error_codes(); - error_codes(ignore); + explicit error_codes(ignore); DWORD Win32Error; NTSTATUS NtError; @@ -79,7 +79,7 @@ class exception_context public: NONCOPYABLE(exception_context); - exception_context(DWORD Code = 0, const EXCEPTION_POINTERS* Pointers = nullptr, bool ResumeThread = false); + explicit exception_context(DWORD Code = 0, const EXCEPTION_POINTERS* Pointers = nullptr, bool ResumeThread = false); ~exception_context(); auto GetCode() const { return m_Code; } diff --git a/far/farwinapi.hpp b/far/farwinapi.hpp index 9da97487c2..daed96e189 100644 --- a/far/farwinapi.hpp +++ b/far/farwinapi.hpp @@ -273,7 +273,7 @@ namespace os } template - file(args... Args) + explicit file(args... Args) { Open(std::forward(Args)...); } @@ -462,7 +462,7 @@ namespace os IMPLEMENTS_ENUMERATOR(enum_key); public: - enum_key(const key& Key): m_KeyRef(Key) {} + explicit enum_key(const key& Key): m_KeyRef(Key) {} enum_key(HKEY RootKey, const wchar_t* SubKey, REGSAM Sam = 0): m_Key(open_key(RootKey, SubKey, KEY_ENUMERATE_SUB_KEYS | Sam)), m_KeyRef(m_Key) {} private: @@ -477,7 +477,7 @@ namespace os IMPLEMENTS_ENUMERATOR(enum_value); public: - enum_value(const key& Key): m_KeyRef(Key) {} + explicit enum_value(const key& Key): m_KeyRef(Key) {} enum_value(HKEY RootKey, const wchar_t* SubKey, REGSAM Sam = 0): m_Key(open_key(RootKey, SubKey, KEY_QUERY_VALUE | Sam)), m_KeyRef(m_Key) {} private: @@ -549,7 +549,7 @@ namespace os NONCOPYABLE(module); MOVABLE(module); - module(string name, bool AlternativeLoad = false): + explicit module(string name, bool AlternativeLoad = false): m_name(std::move(name)), m_tried(), m_AlternativeLoad(AlternativeLoad) diff --git a/far/fileedit.hpp b/far/fileedit.hpp index c5c5d8cfb2..3a7904260c 100644 --- a/far/fileedit.hpp +++ b/far/fileedit.hpp @@ -77,7 +77,7 @@ class FileEditor: public window,public EditorContainer static fileeditor_ptr create(const string& Name, uintptr_t codepage, DWORD InitFlags, int StartLine = -1, int StartChar = -1, const string* PluginData = nullptr, EDITOR_FLAGS OpenModeExstFile = EF_OPENMODE_QUERY); static fileeditor_ptr create(const string& Name, uintptr_t codepage, DWORD InitFlags, int StartLine, int StartChar, const string* Title, int X1, int Y1, int X2, int Y2, int DeleteOnClose = 0, const window_ptr& Update = nullptr, EDITOR_FLAGS OpenModeExstFile = EF_OPENMODE_QUERY); - FileEditor(private_tag) {} + explicit FileEditor(private_tag) {} virtual ~FileEditor() override; virtual bool IsFileModified() const override { return m_editor->IsFileModified(); } diff --git a/far/filelist.cpp b/far/filelist.cpp index 90b222dbd9..9d1cba9df7 100644 --- a/far/filelist.cpp +++ b/far/filelist.cpp @@ -479,7 +479,7 @@ void FileList::CorrectPosition() class list_less { public: - list_less(const FileList* Owner): m_Owner(Owner) {} + explicit list_less(const FileList* Owner): m_Owner(Owner) {} bool operator()(const FileListItem& Item1, const FileListItem& Item2) const { { diff --git a/far/fileowner.cpp b/far/fileowner.cpp index 5a979b42c1..6293f90932 100644 --- a/far/fileowner.cpp +++ b/far/fileowner.cpp @@ -78,7 +78,7 @@ static bool SidToNameCached(PSID Sid, string& Name, const string& Computer) NONCOPYABLE(sid); MOVABLE(sid); - sid(PSID rhs) + explicit sid(PSID rhs) { DWORD Size = GetLengthSid(rhs); m_Data.reset(Size); diff --git a/far/filepanels.hpp b/far/filepanels.hpp index 3662416773..79cfae4798 100644 --- a/far/filepanels.hpp +++ b/far/filepanels.hpp @@ -49,7 +49,7 @@ class FilePanels:public window, public ViewerContainer public: static filepanels_ptr create(bool CreateRealPanels, int DirCount); - FilePanels(private_tag); + explicit FilePanels(private_tag); virtual ~FilePanels() override; virtual bool ProcessKey(const Manager::Key& Key) override; diff --git a/far/findfile.cpp b/far/findfile.cpp index ca06582c4b..cccd06f704 100644 --- a/far/findfile.cpp +++ b/far/findfile.cpp @@ -311,7 +311,7 @@ enum FINDDLG struct background_searcher::CodePageInfo { - CodePageInfo(uintptr_t CodePage): + explicit CodePageInfo(uintptr_t CodePage): CodePage(CodePage), MaxCharSize(0), LastSymbol(0), diff --git a/far/findfile.hpp b/far/findfile.hpp index 98ee87d832..90e7d11a72 100644 --- a/far/findfile.hpp +++ b/far/findfile.hpp @@ -99,7 +99,7 @@ class FindFiles: noncopyable ArcListItem* m_Arc{}; AddMenuData() = default; - AddMenuData(type2 Type): m_Type(Type) {} + explicit AddMenuData(type2 Type): m_Type(Type) {} AddMenuData(const string& FullName, const os::FAR_FIND_DATA& FindData, void* Data, FARPANELITEMFREECALLBACK FreeData, ArcListItem* Arc): m_Type(data), m_FullName(FullName), diff --git a/far/grabber.hpp b/far/grabber.hpp index 2010964332..30eacdac2d 100644 --- a/far/grabber.hpp +++ b/far/grabber.hpp @@ -43,7 +43,7 @@ class Grabber: public SimpleModal public: static grabber_ptr create(); - Grabber(private_tag); + explicit Grabber(private_tag); virtual ~Grabber() override; virtual int GetType() const override { return windowtype_grabber; } diff --git a/far/help.cpp b/far/help.cpp index 797d819ed5..3eba7c29f8 100644 --- a/far/help.cpp +++ b/far/help.cpp @@ -87,7 +87,7 @@ class HelpRecord string HelpStr; - HelpRecord(const string& HStr): HelpStr(HStr) {} + explicit HelpRecord(const string& HStr): HelpStr(HStr) {} bool operator ==(const HelpRecord& rhs) const { diff --git a/far/help.hpp b/far/help.hpp index 95182cf6e2..fb400dd678 100644 --- a/far/help.hpp +++ b/far/help.hpp @@ -45,7 +45,7 @@ class Help:public Modal public: static help_ptr create(const string& Topic, const wchar_t *Mask = nullptr, unsigned long long Flags=0); - Help(private_tag); + explicit Help(private_tag); virtual ~Help() override; virtual bool ProcessKey(const Manager::Key& Key) override; diff --git a/far/hotplug.cpp b/far/hotplug.cpp index c530c8c482..0d0a1afbeb 100644 --- a/far/hotplug.cpp +++ b/far/hotplug.cpp @@ -69,7 +69,7 @@ class dev_info: noncopyable, public conditional using devinfo_handle = os::detail::handle_t; public: - dev_info(DEVINST DevInst) + explicit dev_info(DEVINST DevInst) { wchar_t szDeviceID[MAX_DEVICE_ID_LEN]; if (CM_Get_Device_ID(DevInst, szDeviceID, static_cast(std::size(szDeviceID)), 0) != CR_SUCCESS) diff --git a/far/imports.hpp b/far/imports.hpp index 4768029d5e..c46422cbba 100644 --- a/far/imports.hpp +++ b/far/imports.hpp @@ -55,7 +55,7 @@ class ImportedFunctions: noncopyable class unique_function_pointer: noncopyable, public conditional> { public: - unique_function_pointer(const os::rtdl::module& Module): m_module(Module) {} + explicit unique_function_pointer(const os::rtdl::module& Module): m_module(Module) {} operator T() const { return get_pointer(); } bool operator!() const noexcept { return get_pointer() == stub; } diff --git a/far/keybar.hpp b/far/keybar.hpp index df0a558ffe..e0447efa69 100644 --- a/far/keybar.hpp +++ b/far/keybar.hpp @@ -77,7 +77,7 @@ enum KEYBARAREA class KeyBar: public SimpleScreenObject { public: - KeyBar(window_ptr Owner); + explicit KeyBar(window_ptr Owner); virtual bool ProcessKey(const Manager::Key& Key) override; virtual bool ProcessMouse(const MOUSE_EVENT_RECORD *MouseEvent) override; @@ -90,14 +90,14 @@ class KeyBar: public SimpleScreenObject class keybar_area { public: - keybar_area(std::vector* Items): m_Items(Items) {} + explicit keybar_area(std::vector* Items): m_Items(Items) {} string& operator[](fkeys Key) const { return (*m_Items)[Key].first; } private: std::vector* m_Items; }; - keybar_area operator[](keybar_group Group) { return keybar_area(&Items[Group]); } + auto operator[](keybar_group Group) { return keybar_area(&Items[Group]); } size_t Change(const KeyBarTitles* Kbt); void RedrawIfChanged(); diff --git a/far/language.hpp b/far/language.hpp index c63214635f..c2d07a5826 100644 --- a/far/language.hpp +++ b/far/language.hpp @@ -62,7 +62,7 @@ class language virtual ~language() = default; protected: - language(std::unique_ptr& Data): m_Data(Data) {} + explicit language(std::unique_ptr& Data): m_Data(Data) {} // Throws on failure, strong exception safety guarantee void load(const string& Path, int CountNeed = -1); @@ -74,7 +74,7 @@ class language class plugin_language final: public language { public: - plugin_language(const string& Path); + explicit plugin_language(const string& Path); const wchar_t* GetMsg(intptr_t Id) const; private: diff --git a/far/macro.cpp b/far/macro.cpp index 3098de2b23..a8fac8fd71 100644 --- a/far/macro.cpp +++ b/far/macro.cpp @@ -1486,9 +1486,9 @@ static auto parseParams(size_t Count, FarMacroCall* Data) class LockOutput: noncopyable { - public: - LockOutput(bool Lock): m_Lock(Lock) { if (m_Lock) Global->ScrBuf->Lock(); } - ~LockOutput() { if (m_Lock) Global->ScrBuf->Unlock(); } +public: + explicit LockOutput(bool Lock): m_Lock(Lock) { if (m_Lock) Global->ScrBuf->Lock(); } + ~LockOutput() { if (m_Lock) Global->ScrBuf->Unlock(); } private: const bool m_Lock; diff --git a/far/menubar.hpp b/far/menubar.hpp index bd0802e02f..6ef9469b8a 100644 --- a/far/menubar.hpp +++ b/far/menubar.hpp @@ -40,7 +40,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class MenuBar:public SimpleScreenObject { public: - MenuBar(window_ptr Owner): SimpleScreenObject(Owner) {} + explicit MenuBar(window_ptr Owner): SimpleScreenObject(Owner) {} private: virtual void DisplayObject() override; diff --git a/far/mix.cpp b/far/mix.cpp index a0e163d492..7176738ef3 100644 --- a/far/mix.cpp +++ b/far/mix.cpp @@ -136,8 +136,7 @@ void FindDataExToPluginPanelItemHolder(const os::FAR_FIND_DATA& Src, PluginPanel Dest.CustomColumnData = nullptr; Dest.CustomColumnNumber = 0; Dest.Flags = 0; - Dest.UserData.Data = nullptr; - Dest.UserData.FreeData = nullptr; + Dest.UserData = {}; Dest.FileAttributes = Src.dwFileAttributes; Dest.NumberOfLinks = 1; Dest.CRC32 = 0; diff --git a/far/mix.hpp b/far/mix.hpp index fbe1a4b61e..c9fd684c20 100644 --- a/far/mix.hpp +++ b/far/mix.hpp @@ -90,9 +90,9 @@ WINDOWINFO_TYPE WindowTypeToPluginWindowType(const int fType); class SetAutocomplete: noncopyable { public: - SetAutocomplete(class EditControl* edit, bool NewState = false); - SetAutocomplete(class DlgEdit* dedit, bool NewState = false); - SetAutocomplete(class CommandLine* cedit, bool NewState = false); + explicit SetAutocomplete(class EditControl* edit, bool NewState = false); + explicit SetAutocomplete(class DlgEdit* dedit, bool NewState = false); + explicit SetAutocomplete(class CommandLine* cedit, bool NewState = false); ~SetAutocomplete(); private: diff --git a/far/notification.hpp b/far/notification.hpp index 23b82c4077..167dda8b16 100644 --- a/far/notification.hpp +++ b/far/notification.hpp @@ -69,7 +69,7 @@ namespace detail public: using handler_type = std::function; - event_handler(const handler_type& Handler): + explicit event_handler(const handler_type& Handler): m_Handler(Handler) { } @@ -88,7 +88,7 @@ namespace detail public: using handler_type = std::function; - parametrized_event_handler(const handler_type& Handler): + explicit parametrized_event_handler(const handler_type& Handler): m_Handler(Handler) { } @@ -156,7 +156,7 @@ namespace detail { } - listener_t(const typename T::handler_type& EventHandler): + explicit listener_t(const typename T::handler_type& EventHandler): listener_t(CreateEventName(), EventHandler) { } diff --git a/far/panel.hpp b/far/panel.hpp index 5f4e74bfe2..c1359e793b 100644 --- a/far/panel.hpp +++ b/far/panel.hpp @@ -269,7 +269,7 @@ class Panel: public ScreenObject, public std::enable_shared_from_this int ProcessingPluginCommand; protected: - Panel(window_ptr Owner); + explicit Panel(window_ptr Owner); virtual void ClearAllItem(){} void FastFind(const Manager::Key& FirstKey); @@ -320,7 +320,7 @@ class Panel: public ScreenObject, public std::enable_shared_from_this class dummy_panel : public Panel { public: - dummy_panel(window_ptr Owner): Panel(Owner){} + explicit dummy_panel(window_ptr Owner): Panel(Owner){} private: virtual void Update(int Mode) override {}; diff --git a/far/plclass.cpp b/far/plclass.cpp index 7c8b3aec56..a6189e7f8f 100644 --- a/far/plclass.cpp +++ b/far/plclass.cpp @@ -1199,7 +1199,7 @@ class custom_plugin_module: public i_plugin_module { public: NONCOPYABLE(custom_plugin_module); - custom_plugin_module(void* Opaque) : m_Opaque(Opaque) {} + explicit custom_plugin_module(void* Opaque) : m_Opaque(Opaque) {} virtual void* get_opaque() const override { return m_Opaque; } private: @@ -1226,7 +1226,7 @@ class custom_plugin_factory: public plugin_factory Info.Author && *Info.Author) { m_Success = CheckVersion(&FAR_VERSION, &Info.MinFarVersion) != FALSE; - ProcessError(L"Initialize"); + custom_plugin_factory::ProcessError(L"Initialize"); // TODO: store info, show message if version is bad } } @@ -1238,7 +1238,7 @@ class custom_plugin_factory: public plugin_factory ExitInfo Info = { sizeof(Info) }; m_Imports.pFree(&Info); - ProcessError(L"Free"); + custom_plugin_factory::ProcessError(L"Free"); } bool Success() const { return m_Success; } @@ -1310,7 +1310,7 @@ class custom_plugin_factory: public plugin_factory os::rtdl::function_pointer pDestroyInstance; os::rtdl::function_pointer pFree; - ModuleImports(const os::rtdl::module& Module): + explicit ModuleImports(const os::rtdl::module& Module): #define INIT_IMPORT(name) p ## name(Module, #name) INIT_IMPORT(Initialize), INIT_IMPORT(IsPlugin), diff --git a/far/plclass.hpp b/far/plclass.hpp index 9a1a64cf52..564d3b4e4d 100644 --- a/far/plclass.hpp +++ b/far/plclass.hpp @@ -108,7 +108,7 @@ class i_plugin_module class plugin_factory { public: - plugin_factory(PluginManager* owner); + explicit plugin_factory(PluginManager* owner); using plugin_module_ptr = std::unique_ptr; using function_address = void*; using exports_array = std::array, ExportsCount>; @@ -144,7 +144,7 @@ class native_plugin_module: public i_plugin_module { public: NONCOPYABLE(native_plugin_module); - native_plugin_module(const string& Name): m_Module(Name, true) {} + explicit native_plugin_module(const string& Name): m_Module(Name, true) {} virtual void* get_opaque() const override { return nullptr; } os::rtdl::module m_Module; @@ -284,7 +284,7 @@ class Plugin: noncopyable template struct ExecuteStruct: detail::ExecuteStruct { - ExecuteStruct(intptr_t FallbackValue = 0) + explicit ExecuteStruct(intptr_t FallbackValue = 0) { id = ExportId; Result = FallbackValue; diff --git a/far/privilege.cpp b/far/privilege.cpp index 812f9ec6e0..b58bd54098 100644 --- a/far/privilege.cpp +++ b/far/privilege.cpp @@ -44,9 +44,9 @@ static handle OpenCurrentProcessToken(DWORD DesiredAccess) return handle(OpenProcessToken(GetCurrentProcess(), DesiredAccess, &Handle)? Handle : nullptr); } -privilege::privilege(const wchar_t* const* Names, size_t Size) +privilege::privilege(const range& Names) { - if (!Size) + if (Names.empty()) return; m_Token = OpenCurrentProcessToken(TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY); @@ -55,10 +55,10 @@ privilege::privilege(const wchar_t* const* Names, size_t Size) if (!m_Token) return; - block_ptr NewState(sizeof(TOKEN_PRIVILEGES) + sizeof(LUID_AND_ATTRIBUTES) * (Size - 1)); - NewState->PrivilegeCount = static_cast(Size); + block_ptr NewState(sizeof(TOKEN_PRIVILEGES) + sizeof(LUID_AND_ATTRIBUTES) * (Names.size() - 1)); + NewState->PrivilegeCount = static_cast(Names.size()); - std::transform(Names, Names + Size, std::begin(NewState->Privileges), [](const auto& i) + std::transform(ALL_CONST_RANGE(Names), std::begin(NewState->Privileges), [](const auto& i) { LUID_AND_ATTRIBUTES laa = { {}, SE_PRIVILEGE_ENABLED }; LookupPrivilegeValue(nullptr, i, &laa.Luid); @@ -102,7 +102,7 @@ bool privilege::check(const range& Names) if (!GetTokenInformation(Token.native_handle(), TokenPrivileges, TokenInformation.get(), TokenInformationLength, &TokenInformationLength)) return false; - const auto PrivilegesEnd{ TokenInformation->Privileges + TokenInformation->PrivilegeCount }; + const auto Privileges = make_range(TokenInformation->Privileges, TokenInformation->PrivilegeCount); for (const auto& Name: Names) { @@ -110,8 +110,8 @@ bool privilege::check(const range& Names) if (!LookupPrivilegeValue(nullptr, Name, &Luid)) return false; - const auto ItemIterator = std::find_if(TokenInformation->Privileges, PrivilegesEnd, [&](const auto& Item) { return Item.Luid == Luid; }); - if (ItemIterator == PrivilegesEnd || !(ItemIterator->Attributes & (SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT))) + const auto ItemIterator = std::find_if(ALL_CONST_RANGE(Privileges), [&](const auto& Item) { return Item.Luid == Luid; }); + if (ItemIterator == Privileges.end() || !(ItemIterator->Attributes & (SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT))) return false; } diff --git a/far/privilege.hpp b/far/privilege.hpp index 50a3cb78d6..9582b5eee2 100644 --- a/far/privilege.hpp +++ b/far/privilege.hpp @@ -44,14 +44,15 @@ namespace os NONCOPYABLE(privilege); MOVABLE(privilege); - privilege(const std::initializer_list& Names): privilege(Names.begin(), Names.size()) {} - privilege(const std::vector& Names): privilege(Names.data(), Names.size()) {} - privilege(const wchar_t* const* Names, size_t Size); + privilege(const std::initializer_list& Names): privilege(make_range(Names.begin(), Names.size())) {} + explicit privilege(const std::vector& Names): privilege(make_range(Names.data(), Names.size())) {} + explicit privilege(const range& Names); ~privilege(); template static bool check(args&&... Args) { return check({ std::forward(Args)... }); } static bool check(const std::initializer_list& Names) { return check(make_range(Names.begin(), Names.size())); } + static bool check(const std::vector& Names) { return check(make_range(Names.data(), Names.size())); } static bool check(const range& Names); private: diff --git a/far/refreshwindowmanager.hpp b/far/refreshwindowmanager.hpp index 547209a3c0..3a465a548d 100644 --- a/far/refreshwindowmanager.hpp +++ b/far/refreshwindowmanager.hpp @@ -40,7 +40,7 @@ class SaveScreen; class UndoGlobalSaveScrPtr: noncopyable { public: - UndoGlobalSaveScrPtr(SaveScreen *SaveScr); + explicit UndoGlobalSaveScrPtr(SaveScreen *SaveScr); ~UndoGlobalSaveScrPtr(); }; diff --git a/far/scantree.hpp b/far/scantree.hpp index cc8ede1850..fd1e396d5a 100644 --- a/far/scantree.hpp +++ b/far/scantree.hpp @@ -60,7 +60,7 @@ enum class ScanTree: noncopyable { public: - ScanTree(bool RetUpDir, bool Recurse=true, int ScanJunction=-1); + explicit ScanTree(bool RetUpDir, bool Recurse=true, int ScanJunction=-1); ~ScanTree(); // 3-й параметр - флаги из старшего слова diff --git a/far/scrobj.hpp b/far/scrobj.hpp index 94b4666a67..003df85cde 100644 --- a/far/scrobj.hpp +++ b/far/scrobj.hpp @@ -77,7 +77,7 @@ class SimpleScreenObject: noncopyable window_ptr GetOwner() const {return m_Owner.lock();} protected: - SimpleScreenObject(window_ptr Owner); + explicit SimpleScreenObject(window_ptr Owner); private: virtual void DisplayObject() = 0; @@ -99,7 +99,7 @@ class ScreenObject:public SimpleScreenObject void HideButKeepSaveScreen(); protected: - ScreenObject(window_ptr Owner); + explicit ScreenObject(window_ptr Owner); virtual ~ScreenObject() override; public: // BUGBUG @@ -113,7 +113,7 @@ class ScreenObjectWithShadow:public ScreenObject virtual void Hide() override; protected: - ScreenObjectWithShadow(window_ptr Owner); + explicit ScreenObjectWithShadow(window_ptr Owner); virtual ~ScreenObjectWithShadow() override; void Shadow(bool Full=false); diff --git a/far/sqlitedb.hpp b/far/sqlitedb.hpp index 8a72c501ab..a38c32f466 100644 --- a/far/sqlitedb.hpp +++ b/far/sqlitedb.hpp @@ -69,12 +69,12 @@ class SQLiteDb: noncopyable, virtual transactional NONCOPYABLE(SQLiteStmt); MOVABLE(SQLiteStmt); - SQLiteStmt(sqlite::sqlite3_stmt* Stmt): m_Stmt(Stmt), m_Param(1) {} + explicit SQLiteStmt(sqlite::sqlite3_stmt* Stmt): m_Stmt(Stmt), m_Param(1) {} template struct transient_t { - transient_t(const T& Value): m_Value(Value) {} + explicit transient_t(const T& Value): m_Value(Value) {} const T& m_Value; }; diff --git a/far/synchro.hpp b/far/synchro.hpp index c8ee16eefe..bf2f18bacd 100644 --- a/far/synchro.hpp +++ b/far/synchro.hpp @@ -148,7 +148,7 @@ class mutex: public handle NONCOPYABLE(mutex); MOVABLE(mutex); - mutex(const wchar_t* Name = nullptr): handle(CreateMutex(nullptr, false, EmptyToNull(Name))) {} + explicit mutex(const wchar_t* Name = nullptr): handle(CreateMutex(nullptr, false, EmptyToNull(Name))) {} static auto get_namespace() { return L"Far_Manager_Mutex_"; } diff --git a/far/syslog.hpp b/far/syslog.hpp index b96eef6071..60aa5842f2 100644 --- a/far/syslog.hpp +++ b/far/syslog.hpp @@ -299,7 +299,7 @@ FILE *OpenLogStream(const string& file); class CleverSysLog // ;-) { public: - CleverSysLog(const wchar_t *Title=nullptr); + explicit CleverSysLog(const wchar_t *Title=nullptr); CleverSysLog(int Line,const wchar_t *Title); ~CleverSysLog(); }; diff --git a/far/tracer.hpp b/far/tracer.hpp index 8ae8a01edc..08d5471830 100644 --- a/far/tracer.hpp +++ b/far/tracer.hpp @@ -64,7 +64,7 @@ class tracer: noncopyable class veh_handler: noncopyable { public: - veh_handler(PVECTORED_EXCEPTION_HANDLER Handler); + explicit veh_handler(PVECTORED_EXCEPTION_HANDLER Handler); ~veh_handler(); private: diff --git a/far/treelist.hpp b/far/treelist.hpp index 75980a792a..9b64f1ac1d 100644 --- a/far/treelist.hpp +++ b/far/treelist.hpp @@ -65,7 +65,7 @@ class TreeList: public Panel { } - TreeItem(const string& Name): + explicit TreeItem(const string& Name): strName(Name), Last(MAX_PATH/2), Depth(0) diff --git a/far/usermenu.hpp b/far/usermenu.hpp index 4a5dfebffb..5d42b1cac9 100644 --- a/far/usermenu.hpp +++ b/far/usermenu.hpp @@ -41,8 +41,8 @@ class UserMenu: noncopyable struct UserMenuItem; public: - UserMenu(bool ChooseMenuType); // true - выбор типа меню (основное или локальное), false - зависит от наличия FarMenu.Ini в текущем каталоге - UserMenu(const string& MenuFileName); + explicit UserMenu(bool ChooseMenuType); // true - выбор типа меню (основное или локальное), false - зависит от наличия FarMenu.Ini в текущем каталоге + explicit UserMenu(const string& MenuFileName); ~UserMenu(); using menu_container = std::list; diff --git a/far/vbuild.m4 b/far/vbuild.m4 index d4a788ee1a..4f80319a8f 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -m4_define(BUILD,4978)m4_dnl +m4_define(BUILD,4979)m4_dnl diff --git a/far/viewer.hpp b/far/viewer.hpp index 9ff8492012..26212432a1 100644 --- a/far/viewer.hpp +++ b/far/viewer.hpp @@ -52,7 +52,7 @@ enum SEARCHER_RESULT: int; class Viewer:public SimpleScreenObject { public: - Viewer(window_ptr Owner, bool bQuickView = false, uintptr_t aCodePage = CP_DEFAULT); + explicit Viewer(window_ptr Owner, bool bQuickView = false, uintptr_t aCodePage = CP_DEFAULT); virtual ~Viewer() override; virtual bool ProcessKey(const Manager::Key& Key) override; diff --git a/far/vmenu.hpp b/far/vmenu.hpp index e9860460d3..8e0211167e 100644 --- a/far/vmenu.hpp +++ b/far/vmenu.hpp @@ -100,7 +100,7 @@ struct MenuItemEx NONCOPYABLE(MenuItemEx); MOVABLE(MenuItemEx); - MenuItemEx(const string& Text = {}): + explicit MenuItemEx(const string& Text = {}): strName(Text), Flags(), ShowPos(),