From 865e78d9de580e997038457852b82c5091757987 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Wed, 31 Mar 2021 23:03:05 +0200 Subject: [PATCH] Small code improvements --- src/flistview.cpp | 2 +- src/fstring.cpp | 2 +- src/ftermcap.cpp | 2 +- src/ftermlinux.cpp | 10 +++++----- src/include/final/ftermlinux.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/flistview.cpp b/src/flistview.cpp index 5a2a6056..8a199fc1 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -1617,7 +1617,7 @@ void FListView::drawList() { const bool is_current_line( iter == current_iter ); const auto& item = static_cast(*iter); - const int tree_offset = ( tree_view ) ? int(item->getDepth() << 1) + 1 : 0; + const int tree_offset = tree_view ? int(item->getDepth() << 1) + 1 : 0; const int checkbox_offset = item->isCheckable() ? 1 : 0; path_end = getListEnd(item); print() << FPoint{2, 2 + int(y)}; diff --git a/src/fstring.cpp b/src/fstring.cpp index b460d2ae..7179865e 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -1402,7 +1402,7 @@ inline const char* FString::_to_cstring (const wchar_t s[]) const } if ( c_string ) - delete[](c_string); + delete[] c_string; const wchar_t* src = s; auto state = std::mbstate_t(); diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index 335e2bd8..776b3cc4 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -115,7 +115,7 @@ char* FTermcap::getString (const std::string& cap) std::string FTermcap::encodeMotionParameter (const std::string& cap, int col, int row) { auto str = ::tgoto(C_STR(cap.data()), col, row); - return ( str ) ? str : std::string(); + return str ? str : std::string(); } //---------------------------------------------------------------------- diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index 25f96bf1..f9a900a9 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -877,7 +877,7 @@ void FTermLinux::getVGAPalette() { const auto& fsystem = FTerm::getFSystem(); - if ( fsystem->ioctl(0, GIO_CMAP, &cmap) != 0 ) + if ( fsystem->ioctl(0, GIO_CMAP, cmap.color.data()) != 0 ) setVGADefaultPalette(); // Fallback, if GIO_CMAP does not work } @@ -920,7 +920,7 @@ bool FTermLinux::setVGAPalette (FColor index, int r, int g, int b) const auto& fsystem = FTerm::getFSystem(); - if ( fsystem->ioctl(0, PIO_CMAP, &cmap) == 0 ) + if ( fsystem->ioctl(0, PIO_CMAP, cmap.color.data()) == 0 ) return true; else return false; @@ -933,7 +933,7 @@ bool FTermLinux::saveVGAPalette() const auto& fsystem = FTerm::getFSystem(); - if ( fsystem->ioctl(0, GIO_CMAP, &saved_color_map) == 0 ) + if ( fsystem->ioctl(0, GIO_CMAP, saved_color_map.color.data()) == 0 ) has_saved_palette = true; else has_saved_palette = false; @@ -950,14 +950,14 @@ bool FTermLinux::resetVGAPalette() if ( has_saved_palette ) { - if ( fsystem->ioctl (0, PIO_CMAP, &saved_color_map) ) + if ( fsystem->ioctl (0, PIO_CMAP, saved_color_map.color.data()) ) return false; } else { setVGADefaultPalette(); - if ( fsystem->ioctl(0, PIO_CMAP, &cmap) != 0 ) + if ( fsystem->ioctl(0, PIO_CMAP, cmap.color.data()) != 0 ) return false; } diff --git a/src/include/final/ftermlinux.h b/src/include/final/ftermlinux.h index 4b13408b..d119c0c7 100644 --- a/src/include/final/ftermlinux.h +++ b/src/include/final/ftermlinux.h @@ -149,7 +149,7 @@ class FTermLinux final struct ColorMap { - RGB color[16]; + std::array color; }; struct Pair