From 5c67310903bc0d11f5f94a34093d8dbbdbb84827 Mon Sep 17 00:00:00 2001 From: zvon Date: Thu, 16 Apr 2020 13:23:02 +0200 Subject: [PATCH] Slight code cleanup --- filesystem.hpp | 2 +- network.hpp | 2 +- progress.hpp | 4 ++-- tv_rename.cpp | 4 ++-- tv_rename.hpp | 4 ++-- windows/mainwindow.cpp | 4 ++-- windows/searchwindow.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/filesystem.hpp b/filesystem.hpp index ce9ee33..0754eda 100644 --- a/filesystem.hpp +++ b/filesystem.hpp @@ -38,7 +38,7 @@ public: class Iterator { public: - Iterator( const Directory &d_ ); + explicit Iterator( const Directory &d_ ); ~Iterator(); #ifdef _WIN32 diff --git a/network.hpp b/network.hpp index d295988..6422af7 100644 --- a/network.hpp +++ b/network.hpp @@ -32,7 +32,7 @@ public: private: #ifdef _WIN32 - HINTERNET _hInternet = nullptr; + HINTERNET _hInternet; HINTERNET _hConnect = nullptr; std::wstring _headers = L""; int status_code{}; diff --git a/progress.hpp b/progress.hpp index 332094d..a237a07 100644 --- a/progress.hpp +++ b/progress.hpp @@ -20,9 +20,9 @@ public: ~ProgressBar() = default; #else #ifndef _WIN32 - ProgressBar( void *pw ) : ptr( pw ){}; + explicit ProgressBar( void *pw ) : ptr( pw ){}; #else - ProgressBar( void *hwnd ) : ptr( hwnd ){}; + explicit ProgressBar( void *hwnd ) : ptr( hwnd ){}; #endif // _WIN32 ~ProgressBar(); #endif // GUI diff --git a/tv_rename.cpp b/tv_rename.cpp index 716384b..4e4cf32 100644 --- a/tv_rename.cpp +++ b/tv_rename.cpp @@ -184,7 +184,7 @@ std::vector< string > getEpisodeNames( const string &id, const string &season, } std::vector< std::tuple< int, string, string, string > > -getRenamedFiles( const string &show, int season, const string id, +getRenamedFiles( const string &show, int season, const string &id, const string &language, const string &pattern, const bool &linux, const std::map< int, string > &files, bool dvd ) { @@ -392,7 +392,7 @@ void singleSeason( const string &path, const string &show, int season, #ifndef GUI void multipleSeasons( const string &path, string &show, - const std::set< int > seasons, const string &language, + const std::set< int > &seasons, const string &language, const string &pattern, const size_t &flags ) { std::map< int, std::map< int, string > > season_map; iterateFS( season_map, path ); diff --git a/tv_rename.hpp b/tv_rename.hpp index 62dadbc..61221ad 100644 --- a/tv_rename.hpp +++ b/tv_rename.hpp @@ -41,7 +41,7 @@ void singleSeason( const string &path, const string &show, int season, #ifdef GUI std::vector< std::tuple< int, string, string, string > > -getRenamedFiles( const string &show, int season, const string id, +getRenamedFiles( const string &show, int season, const string &id, const string &language, const string &pattern, const bool &linux, const std::map< int, string > &files, bool dvd = false ); @@ -55,7 +55,7 @@ std::vector< std::pair< string, string > > getLangs(); #else void multipleSeasons( const string &path, string &show, - const std::set< int > seasons, const string &language, + const std::set< int > &seasons, const string &language, const string &pattern, const size_t &flags ); void allSeasons( const string &path, string &show, const string &language, diff --git a/windows/mainwindow.cpp b/windows/mainwindow.cpp index 07d2d4f..66e4eb9 100644 --- a/windows/mainwindow.cpp +++ b/windows/mainwindow.cpp @@ -234,7 +234,7 @@ void MainWindow::readDefaultPattern( const std::wstring &base_dir ) { void MainWindow::process() { wchar_t show[256]; SendMessage( show_input, WM_GETTEXT, ( WPARAM )255, ( LPARAM )show ); - if ( wcslen( show ) == 0 ) { + if ( show[0] == '\0' ) { MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), MB_OK | MB_ICONERROR ); return; @@ -266,7 +266,7 @@ void MainWindow::rename() { wchar_t path[MAX_PATH]; SendMessage( dir_input, WM_GETTEXT, ( WPARAM )MAX_PATH - 1, ( LPARAM )path ); - if ( wcslen( path ) == 0 ) { + if ( path[0] == '\0' ) { MessageBox( window, _( DIR_EMPTY ), _( ERROR ), MB_OK | MB_ICONERROR ); return; } diff --git a/windows/searchwindow.cpp b/windows/searchwindow.cpp index 9254daa..9c13a36 100644 --- a/windows/searchwindow.cpp +++ b/windows/searchwindow.cpp @@ -110,7 +110,7 @@ void SearchWindow::mainLoop() { void SearchWindow::process() { wchar_t show[256]; SendMessage( show_input, WM_GETTEXT, ( WPARAM )255, ( LPARAM )show ); - if ( wcslen( show ) == 0 ) { + if ( show[0] == '\0' ) { MessageBox( window, _( SHOW_FIELD_EMPTY ), _( ERROR ), MB_OK | MB_ICONERROR ); return;