Small code improvements

This commit is contained in:
Markus Gans 2021-03-31 23:03:05 +02:00
parent 5a6644de98
commit 865e78d9de
5 changed files with 9 additions and 9 deletions

View File

@ -1617,7 +1617,7 @@ void FListView::drawList()
{
const bool is_current_line( iter == current_iter );
const auto& item = static_cast<FListViewItem*>(*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)};

View File

@ -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();

View File

@ -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();
}
//----------------------------------------------------------------------

View File

@ -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;
}

View File

@ -149,7 +149,7 @@ class FTermLinux final
struct ColorMap
{
RGB color[16];
std::array<RGB, 16> color;
};
struct Pair