Replace pointers with references

This commit is contained in:
Markus Gans 2020-10-25 01:21:45 +02:00
parent 61eb8b8166
commit 98f9cd5718
39 changed files with 2061 additions and 2229 deletions

View File

@ -147,7 +147,7 @@ int main (int argc, char* argv[])
dgl.show(); dgl.show();
// Get the checked radio button text // Get the checked radio button text
for (int n{1}; n <= int(checkButtonGroup.getCount()); n++) for (auto n{1}; n <= int(checkButtonGroup.getCount()); n++)
{ {
if ( checkButtonGroup.isChecked(n) ) if ( checkButtonGroup.isChecked(n) )
{ {

View File

@ -116,12 +116,12 @@ Listbox::Listbox (FWidget* parent)
list1.setGeometry(FPoint{2, 1}, FSize{18, 10}); list1.setGeometry(FPoint{2, 1}, FSize{18, 10});
list1.setText ("FListBoxItem"); list1.setText ("FListBoxItem");
for (int i{1}; i < 30; i++) for (auto i{1}; i < 30; i++)
list1.insert (L"----- " + (FString{} << i) + L" -----"); list1.insert (L"----- " + (FString{} << i) + L" -----");
// listbox 2 // listbox 2
//---------- //----------
for (int i{1}; i <= 15; i++) for (auto i{1}; i <= 15; i++)
double_list.push_back(2 * double(i) + (double(i) / 100)); double_list.push_back(2 * double(i) + (double(i) / 100));
list2.setGeometry(FPoint{21, 1}, FSize{10, 10}); list2.setGeometry(FPoint{21, 1}, FSize{10, 10});

View File

@ -152,7 +152,7 @@ void ColorChooser::onMouseDown (finalcut::FMouseEvent* ev)
if ( ev->getButton() == fc::MiddleButton ) if ( ev->getButton() == fc::MiddleButton )
return; return;
for (int c{0}; c < 16; c++) for (auto c{0}; c < 16; c++)
{ {
const int xmin = 2 + (c / 8) * 3; const int xmin = 2 + (c / 8) * 3;
const int xmax = 4 + (c / 8) * 3; const int xmax = 4 + (c / 8) * 3;
@ -434,7 +434,7 @@ void MouseDraw::draw()
if ( finalcut::FTerm::isNewFont() ) if ( finalcut::FTerm::isNewFont() )
{ {
for (int y{2}; y < y_max; y++) for (auto y{2}; y < y_max; y++)
{ {
print() << FPoint{10, y} print() << FPoint{10, y}
<< fc::NF_rev_border_line_right; << fc::NF_rev_border_line_right;
@ -448,7 +448,7 @@ void MouseDraw::draw()
print() << FPoint{10, 2} print() << FPoint{10, 2}
<< fc::BoxDrawingsDownAndHorizontal; << fc::BoxDrawingsDownAndHorizontal;
for (int y{3}; y < y_max; y++) for (auto y{3}; y < y_max; y++)
{ {
print() << FPoint{10, y} << fc::BoxDrawingsVertical; print() << FPoint{10, y} << fc::BoxDrawingsVertical;
} }
@ -503,14 +503,14 @@ void MouseDraw::drawCanvas()
const int x_end = canvas->width; const int x_end = canvas->width;
const int w_line_len = printarea->width + printarea->right_shadow; const int w_line_len = printarea->width + printarea->right_shadow;
for (int y{0}; y < y_end; y++) // line loop for (auto y{0}; y < y_end; y++) // line loop
{ {
const finalcut::FChar* canvaschar{}; // canvas character // canvas character
finalcut::FChar* winchar{}; // window character const auto& canvaschar = canvas->data[y * x_end];
canvaschar = &canvas->data[y * x_end]; // window character
winchar = &printarea->data[(ay + y) * w_line_len + ax]; auto& winchar = printarea->data[(ay + y) * w_line_len + ax];
std::memcpy ( winchar std::memcpy ( &winchar
, canvaschar , &canvaschar
, sizeof(finalcut::FChar) * unsigned(x_end) ); , sizeof(finalcut::FChar) * unsigned(x_end) );
if ( int(printarea->changes[ay + y].xmin) > ax ) if ( int(printarea->changes[ay + y].xmin) > ax )

View File

@ -157,13 +157,13 @@ void RotoZoomer::rotozoomer (double cx, double cy, double r, double a)
int dxdy = (Cx - Ax) / 23; int dxdy = (Cx - Ax) / 23;
int dydy = (Cy - Ay) / 23; int dydy = (Cy - Ay) / 23;
for (int y = 0; y < Lines; y++) for (auto y = 0; y < Lines; y++)
{ {
Cx = Ax; Cx = Ax;
Cy = Ay; Cy = Ay;
print() << FPoint{2, 3 + y}; print() << FPoint{2, 3 + y};
for (int x = 0; x < Cols; x++) for (auto x = 0; x < Cols; x++)
{ {
auto ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)]; auto ch = data[((Cy >> 14) & 0xf) + ((Cx >> 10) & 0xf0)];

View File

@ -135,11 +135,11 @@ void Scrollview::draw()
setColor (wc->label_inactive_fg, wc->dialog_bg); setColor (wc->label_inactive_fg, wc->dialog_bg);
clearArea(); clearArea();
for (int y{0}; y < int(getScrollHeight()); y++) for (auto y{0}; y < int(getScrollHeight()); y++)
{ {
print() << FPoint{1, 1 + y}; print() << FPoint{1, 1 + y};
for (int x{0}; x < int(getScrollWidth()); x++) for (auto x{0}; x < int(getScrollWidth()); x++)
print (32 + ((x + y) % 0x5f)); print (32 + ((x + y) % 0x5f));
} }

View File

@ -113,7 +113,7 @@ void Transparent::draw()
const finalcut::FString line{getClientWidth(), '.'}; const finalcut::FString line{getClientWidth(), '.'};
// Fill window area // Fill window area
for (int n{1}; n <= int(getClientHeight()); n++) for (auto n{1}; n <= int(getClientHeight()); n++)
{ {
print() << FPoint{2, 2 + n} print() << FPoint{2, 2 + n}
<< line; << line;

View File

@ -597,7 +597,7 @@ void MyDialog::initWidgets()
myList.setMultiSelection(); myList.setMultiSelection();
myList.reserve(100); myList.reserve(100);
for (int z{1}; z < 100; z++) for (auto z{1}; z < 100; z++)
myList.insert (finalcut::FString{} << z << L" placeholder"); myList.insert (finalcut::FString{} << z << L" placeholder");
// Text labels // Text labels

View File

@ -776,7 +776,7 @@ inline void FApplication::sendKeyboardAccelerator()
auto window = static_cast<const FWidget*>(getActiveWindow()); auto window = static_cast<const FWidget*>(getActiveWindow());
if ( window ) if ( window )
accpt = processAccelerator (window); accpt = processAccelerator(*window);
} }
// Global keyboard accelerator // Global keyboard accelerator
@ -785,7 +785,7 @@ inline void FApplication::sendKeyboardAccelerator()
auto root_widget = getRootWidget(); auto root_widget = getRootWidget();
if ( root_widget ) if ( root_widget )
processAccelerator (root_widget); processAccelerator(*root_widget);
} }
} }
@ -836,12 +836,12 @@ bool FApplication::processDialogSwitchAccelerator() const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FApplication::processAccelerator (const FWidget* const& widget) const bool FApplication::processAccelerator (const FWidget& widget) const
{ {
if ( ! widget || widget->getAcceleratorList().empty() ) if ( widget.getAcceleratorList().empty() )
return false; return false;
for (auto&& item : widget->getAcceleratorList()) for (auto&& item : widget.getAcceleratorList())
{ {
if ( item.key == keyboard->getKey() ) if ( item.key == keyboard->getKey() )
{ {

View File

@ -443,7 +443,7 @@ inline std::size_t FButton::clickAnimationIndent (const FWidget* parent_widget)
setColor ( parent_widget->getForegroundColor() setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() ); , parent_widget->getBackgroundColor() );
for (int y{1}; y <= int(getHeight()); y++) for (auto y{1}; y <= int(getHeight()); y++)
{ {
print() << FPoint{1, y} << ' '; // clear one left █ print() << FPoint{1, y} << ' '; // clear one left █
} }
@ -462,7 +462,7 @@ inline void FButton::clearRightMargin (const FWidget* parent_widget)
setColor ( parent_widget->getForegroundColor() setColor ( parent_widget->getForegroundColor()
, parent_widget->getBackgroundColor() ); , parent_widget->getBackgroundColor() );
for (int y{1}; y <= int(getHeight()); y++) for (auto y{1}; y <= int(getHeight()); y++)
{ {
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(true); // Light background setReverse(true); // Light background

View File

@ -210,7 +210,7 @@ void FButtonGroup::hide()
// Hide border // Hide border
unsetViewportPrint(); unsetViewportPrint();
for (int y{0}; y < int(getHeight()); y++) for (auto y{0}; y < int(getHeight()); y++)
print() << FPoint{1, 1 + y} << FString{size, L' '}; print() << FPoint{1, 1 + y} << FString{size, L' '};
setViewportPrint(); setViewportPrint();

View File

@ -436,7 +436,7 @@ void FComboBox::onMouseMove (FMouseEvent* ev)
if ( isMouseOverListWindow(ev->getTermPos()) ) if ( isMouseOverListWindow(ev->getTermPos()) )
{ {
passEventToListWindow(ev); // Event handover to window list passEventToListWindow(*ev); // Event handover to window list
return; return;
} }
} }
@ -590,13 +590,13 @@ void FComboBox::onePosDown()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FComboBox::passEventToListWindow (FMouseEvent* const& ev) void FComboBox::passEventToListWindow (const FMouseEvent& ev)
{ {
// Mouse event handover to list window // Mouse event handover to list window
const auto& t = ev->getTermPos(); const auto& t = ev.getTermPos();
const auto& p = list_window.list.termToWidgetPos(t); const auto& p = list_window.list.termToWidgetPos(t);
const int b = ev->getButton(); const int b = ev.getButton();
try try
{ {

View File

@ -960,7 +960,7 @@ void FDialog::drawBorder()
{ {
const FRect r{FPoint{1, 1}, getSize()}; const FRect r{FPoint{1, 1}, getSize()};
for (int y = r.getY1() + 1; y < r.getY2(); y++) for (auto y = r.getY1() + 1; y < r.getY2(); y++)
{ {
print() << FPoint{r.getX1(), y} print() << FPoint{r.getX1(), y}
<< fc::NF_border_line_left // border left ⎸ << fc::NF_border_line_left // border left ⎸

View File

@ -179,7 +179,7 @@ FString FFileDialog::getSelectedFile() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFileDialog::setPath (const FString& dir) void FFileDialog::setPath (const FString& dir)
{ {
const char* const dirname = dir.c_str(); const auto& dirname = dir.c_str();
std::array<char, MAXPATHLEN> resolved_path{}; std::array<char, MAXPATHLEN> resolved_path{};
FString r_dir{}; FString r_dir{};
struct stat sb{}; struct stat sb{};
@ -491,7 +491,7 @@ void FFileDialog::sortDir()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FFileDialog::readDir() int FFileDialog::readDir()
{ {
const char* const dir = directory.c_str(); const auto& dir = directory.c_str();
directory_stream = opendir(dir); directory_stream = opendir(dir);
if ( ! directory_stream ) if ( ! directory_stream )
@ -555,7 +555,7 @@ int FFileDialog::readDir()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry) void FFileDialog::getEntry (const char* const dir, const struct dirent* d_entry)
{ {
const char* const filter = filter_pattern.c_str(); const auto& filter = filter_pattern.c_str();
FDirEntry entry{}; FDirEntry entry{};
entry.name = d_entry->d_name; entry.name = d_entry->d_name;

View File

@ -280,7 +280,7 @@ void FListBox::clear()
if ( size == 0 ) if ( size == 0 )
return; return;
for (int y{0}; y < int(getHeight()) - 2; y++) for (auto y{0}; y < int(getHeight()) - 2; y++)
{ {
print() << FPoint{2, 2 + y} << FString{size, L' '}; print() << FPoint{2, 2 + y} << FString{size, L' '};
} }
@ -724,7 +724,7 @@ void FListBox::draw()
{ {
setColor(); setColor();
for (int y{2}; y < int(getHeight()); y++) for (auto y{2}; y < int(getHeight()); y++)
{ {
print() << FPoint{int(getWidth()) - 1, y} print() << FPoint{int(getWidth()) - 1, y}
<< ' '; // clear right side of the scrollbar << ' '; // clear right side of the scrollbar

View File

@ -1601,7 +1601,7 @@ void FListView::draw()
{ {
setColor(); setColor();
for (int y{2}; y < int(getHeight()); y++) for (auto y{2}; y < int(getHeight()); y++)
{ {
print() << FPoint{int(getWidth()) - 1, y} print() << FPoint{int(getWidth()) - 1, y}
<< ' '; // clear right side of the scrollbar << ' '; // clear right side of the scrollbar
@ -1838,7 +1838,7 @@ void FListView::clearList()
if ( size == 0 ) if ( size == 0 )
return; return;
for (int y{0}; y < int(getHeight()) - 2; y++) for (auto y{0}; y < int(getHeight()) - 2; y++)
{ {
print() << FPoint{2, 2 + y} << FString{size, L' '}; print() << FPoint{2, 2 + y} << FString{size, L' '};
} }

View File

@ -279,19 +279,19 @@ void FMenu::onMouseMove (FMouseEvent* ev)
if ( ms.mouse_over_submenu ) if ( ms.mouse_over_submenu )
{ {
passEventToSubMenu(ev); // Event handover to sub-menu passEventToSubMenu(*ev); // Event handover to sub-menu
return; return;
} }
if ( ! ms.mouse_over_menu && ms.mouse_over_supermenu ) if ( ! ms.mouse_over_menu && ms.mouse_over_supermenu )
{ {
passEventToSuperMenu(ev); // Event handover to super-menu passEventToSuperMenu(*ev); // Event handover to super-menu
return; return;
} }
if ( ms.mouse_over_menubar ) if ( ms.mouse_over_menubar )
{ {
passEventToMenuBar(ev); // Event handover to the menu bar passEventToMenuBar(*ev); // Event handover to the menu bar
return; return;
} }
@ -909,13 +909,13 @@ void FMenu::mouseMoveOverBorder (MouseStates& ms) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToSubMenu (FMouseEvent* const& ev) void FMenu::passEventToSubMenu (const FMouseEvent& ev)
{ {
// Mouse event handover to sub-menu // Mouse event handover to sub-menu
const auto& t = ev->getTermPos(); const auto& t = ev.getTermPos();
const auto& p = opened_sub_menu->termToWidgetPos(t); const auto& p = opened_sub_menu->termToWidgetPos(t);
const int b = ev->getButton(); const int b = ev.getButton();
try try
{ {
@ -932,14 +932,14 @@ void FMenu::passEventToSubMenu (FMouseEvent* const& ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToSuperMenu (FMouseEvent* const& ev) void FMenu::passEventToSuperMenu (const FMouseEvent& ev)
{ {
// Mouse event handover to super-menu // Mouse event handover to super-menu
auto smenu = superMenuAt (ev->getTermPos()); auto smenu = superMenuAt (ev.getTermPos());
const auto& t = ev->getTermPos(); const auto& t = ev.getTermPos();
const auto& p = smenu->termToWidgetPos(t); const auto& p = smenu->termToWidgetPos(t);
const int b = ev->getButton(); const int b = ev.getButton();
try try
{ {
@ -956,14 +956,14 @@ void FMenu::passEventToSuperMenu (FMouseEvent* const& ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::passEventToMenuBar (FMouseEvent* const& ev) const void FMenu::passEventToMenuBar (const FMouseEvent& ev) const
{ {
// Mouse event handover to the menu bar // Mouse event handover to the menu bar
auto menu_bar = getMenuBar(); auto menu_bar = getMenuBar();
const auto& t = ev->getTermPos(); const auto& t = ev.getTermPos();
const auto& p = menu_bar->termToWidgetPos(t); const auto& p = menu_bar->termToWidgetPos(t);
const int b = ev->getButton(); const int b = ev.getButton();
try try
{ {

View File

@ -223,6 +223,8 @@ void FMenuBar::onAccel (FAccelEvent* ev)
getStatusBar()->drawMessage(); getStatusBar()->drawMessage();
redraw(); redraw();
processTerminalUpdate();
flush();
ev->accept(); ev->accept();
} }
@ -902,7 +904,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
else else
{ {
// Event handover to the menu // Event handover to the menu
passEventToMenu(ev); passEventToMenu(*ev);
} }
} }
} }
@ -916,11 +918,15 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev)
} }
if ( focus_changed ) if ( focus_changed )
{
redraw(); redraw();
processTerminalUpdate();
flush();
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) const void FMenuBar::passEventToMenu (const FMouseEvent& ev) const
{ {
if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() )
return; return;
@ -930,11 +936,11 @@ void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) const
const auto& menu_geometry = menu->getTermGeometry(); const auto& menu_geometry = menu->getTermGeometry();
if ( menu->getCount() > 0 if ( menu->getCount() > 0
&& menu_geometry.contains(ev->getTermPos()) ) && menu_geometry.contains(ev.getTermPos()) )
{ {
const auto& t = ev->getTermPos(); const auto& t = ev.getTermPos();
const auto& p = menu->termToWidgetPos(t); const auto& p = menu->termToWidgetPos(t);
const int b = ev->getButton(); const int b = ev.getButton();
try try
{ {

View File

@ -417,6 +417,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
mbar->redraw(); mbar->redraw();
mbar->drop_down = true; mbar->drop_down = true;
} }
else else
{ {
@ -427,6 +428,8 @@ void FMenuItem::onAccel (FAccelEvent* ev)
mbar->drop_down = false; mbar->drop_down = false;
} }
processTerminalUpdate();
flush();
ev->accept(); ev->accept();
} }

File diff suppressed because it is too large Load Diff

View File

@ -463,7 +463,7 @@ void FScrollbar::drawVerticalBar()
const auto& wc = getColorTheme(); const auto& wc = getColorTheme();
setColor (wc->scrollbar_fg, wc->scrollbar_bg); setColor (wc->scrollbar_fg, wc->scrollbar_bg);
for (int z{1}; z <= slider_pos; z++) for (auto z{1}; z <= slider_pos; z++)
{ {
print() << FPoint{1, 1 + z}; print() << FPoint{1, 1 + z};
drawVerticalBackgroundLine(); drawVerticalBackgroundLine();
@ -474,7 +474,7 @@ void FScrollbar::drawVerticalBar()
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(false); setReverse(false);
for (int z{1}; z <= int(slider_length); z++) // Draw slider for (auto z{1}; z <= int(slider_length); z++) // Draw slider
{ {
print() << FPoint{1, 1 + slider_pos + z}; print() << FPoint{1, 1 + slider_pos + z};
@ -489,7 +489,7 @@ void FScrollbar::drawVerticalBar()
setColor (wc->scrollbar_fg, wc->scrollbar_bg); setColor (wc->scrollbar_fg, wc->scrollbar_bg);
for (int z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++) for (auto z = slider_pos + int(slider_length) + 1; z <= int(bar_length); z++)
{ {
print() << FPoint{1, 1 + z}; print() << FPoint{1, 1 + z};
drawVerticalBackgroundLine(); drawVerticalBackgroundLine();
@ -529,7 +529,7 @@ void FScrollbar::drawHorizontalBar()
else else
print() << FPoint{2, 1}; print() << FPoint{2, 1};
for (int z{0}; z < slider_pos; z++) for (auto z{0}; z < slider_pos; z++)
drawHorizontalBackgroundColumn(); drawHorizontalBackgroundColumn();
setColor (wc->scrollbar_bg, wc->scrollbar_fg); setColor (wc->scrollbar_bg, wc->scrollbar_fg);
@ -537,7 +537,7 @@ void FScrollbar::drawHorizontalBar()
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(false); setReverse(false);
for (int z{0}; z < int(slider_length); z++) // Draw slider for (auto z{0}; z < int(slider_length); z++) // Draw slider
print (' '); print (' ');
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )

View File

@ -647,10 +647,7 @@ void FScrollView::copy2area()
if ( ! hasPrintArea() ) if ( ! hasPrintArea() )
FWidget::getPrintArea(); FWidget::getPrintArea();
if ( ! (hasPrintArea() && viewport) ) if ( ! (hasPrintArea() && viewport && viewport->has_changes) )
return;
if ( ! viewport->has_changes )
return; return;
auto printarea = getCurrentPrintArea(); auto printarea = getCurrentPrintArea();
@ -669,15 +666,15 @@ void FScrollView::copy2area()
if ( printarea->height <= ay + y_end ) if ( printarea->height <= ay + y_end )
y_end = printarea->height - ay; y_end = printarea->height - ay;
for (int y{0}; y < y_end; y++) // line loop for (auto y{0}; y < y_end; y++) // line loop
{ {
const FChar* vc{}; // viewport character
FChar* ac{}; // area character
const int v_line_len = viewport->width; const int v_line_len = viewport->width;
const int a_line_len = printarea->width + printarea->right_shadow; const int a_line_len = printarea->width + printarea->right_shadow;
vc = &viewport->data[(dy + y) * v_line_len + dx]; // viewport character
ac = &printarea->data[(ay + y) * a_line_len + ax]; const auto& vc = viewport->data[(dy + y) * v_line_len + dx];
std::memcpy (ac, vc, sizeof(FChar) * unsigned(x_end)); // area character
auto& ac = printarea->data[(ay + y) * a_line_len + ax];
std::memcpy (&ac, &vc, sizeof(FChar) * unsigned(x_end));
if ( int(printarea->changes[ay + y].xmin) > ax ) if ( int(printarea->changes[ay + y].xmin) > ax )
printarea->changes[ay + y].xmin = uInt(ax); printarea->changes[ay + y].xmin = uInt(ax);

View File

@ -255,7 +255,7 @@ void FStatusBar::drawMessage()
} }
} }
for (int i = x; i <= int(termWidth); i++) for (auto i = x; i <= int(termWidth); i++)
print (' '); print (' ');
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )

View File

@ -444,7 +444,7 @@ FTermDebugData& FTerm::getFTermDebugData()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isNormal (const FChar& ch) bool FTerm::isNormal (const FChar& ch)
{ {
return FOptiAttr::isNormal(&ch); return FOptiAttr::isNormal(ch);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1319,7 +1319,7 @@ void FTerm::initScreenSettings()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* FTerm::changeAttribute (FChar*& term_attr, FChar*& next_attr) const char* FTerm::changeAttribute (FChar& term_attr, FChar& next_attr)
{ {
return opti_attr->changeAttribute (term_attr, next_attr); return opti_attr->changeAttribute (term_attr, next_attr);
} }

View File

@ -163,8 +163,8 @@ void FTermDetection::deallocation()
void FTermDetection::getSystemTermType() void FTermDetection::getSystemTermType()
{ {
// Import the untrusted environment variable TERM // Import the untrusted environment variable TERM
const char* const& term_env = std::getenv("TERM"); const auto& term_env = std::getenv("TERM");
const char* termfilename = fterm_data->getTermFileName(); const auto& termfilename = fterm_data->getTermFileName();
if ( term_env ) if ( term_env )
{ {

View File

@ -322,7 +322,7 @@ void FTextView::clear()
if ( size == 0 ) if ( size == 0 )
return; return;
for (int y{0}; y < int(getTextHeight()); y++) for (auto y{0}; y < int(getTextHeight()); y++)
{ {
print() << FPoint{2, 2 - nf_offset + y} print() << FPoint{2, 2 - nf_offset + y}
<< FString{size, L' '}; << FString{size, L' '};

View File

@ -255,7 +255,7 @@ void FVTerm::resizeVTerm (const FSize& size) const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::putVTerm() const void FVTerm::putVTerm() const
{ {
for (int i{0}; i < vterm->height; i++) for (auto i{0}; i < vterm->height; i++)
{ {
vterm->changes[i].xmin = 0; vterm->changes[i].xmin = 0;
vterm->changes[i].xmax = uInt(vterm->width - 1); vterm->changes[i].xmax = uInt(vterm->width - 1);
@ -799,11 +799,11 @@ void FVTerm::restoreVTerm (const FRect& box)
if ( h < 0 ) if ( h < 0 )
return; return;
for (int ty{0}; ty < h; ty++) for (auto ty{0}; ty < h; ty++)
{ {
const int ypos = y + ty; const int ypos = y + ty;
for (int tx{0}; tx < w; tx++) for (auto tx{0}; tx < w; tx++)
{ {
const int xpos = x + tx; const int xpos = x + tx;
auto& tc = vterm->data[ypos * vterm->width + xpos]; // terminal character auto& tc = vterm->data[ypos * vterm->width + xpos]; // terminal character
@ -888,7 +888,7 @@ void FVTerm::getArea (const FPoint& pos, const FTermArea* area)
else else
length = area->width; length = area->width;
for (int y{0}; y < y_end; y++) // line loop for (auto y{0}; y < y_end; y++) // line loop
{ {
const auto& tc = vterm->data[(ay + y) * vterm->width + ax]; // terminal character const auto& tc = vterm->data[(ay + y) * vterm->width + ax]; // terminal character
auto& ac = area->data[y * area->width]; // area character auto& ac = area->data[y * area->width]; // area character
@ -935,7 +935,7 @@ void FVTerm::getArea (const FRect& box, const FTermArea* area)
if ( length < 1 ) if ( length < 1 )
return; return;
for (int _y = 0; _y < y_end; _y++) // line loop for (auto _y = 0; _y < y_end; _y++) // line loop
{ {
const int line_len = area->width + area->right_shadow; const int line_len = area->width + area->right_shadow;
const auto& tc = vterm->data[(y + _y - 1) * vterm->width + x - 1]; // terminal character const auto& tc = vterm->data[(y + _y - 1) * vterm->width + x - 1]; // terminal character
@ -979,7 +979,7 @@ void FVTerm::putArea (const FTermArea* area) const
else else
y_end = height; y_end = height;
for (int y{0}; y < y_end; y++) // Line loop for (auto y{0}; y < y_end; y++) // Line loop
{ {
bool modified{false}; bool modified{false};
auto line_xmin = int(area->changes[y].xmin); auto line_xmin = int(area->changes[y].xmin);
@ -997,7 +997,7 @@ void FVTerm::putArea (const FTermArea* area) const
if ( ax + line_xmin >= vterm->width ) if ( ax + line_xmin >= vterm->width )
continue; continue;
for (int x = line_xmin; x <= line_xmax; x++) // Column loop for (auto x = line_xmin; x <= line_xmax; x++) // Column loop
{ {
// Global terminal positions // Global terminal positions
int tx = ax + x; int tx = ax + x;
@ -1071,7 +1071,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
if ( length < 1 ) if ( length < 1 )
return; return;
for (int y{0}; y < y_end; y++) // line loop for (auto y{0}; y < y_end; y++) // line loop
{ {
if ( area->changes[y].trans_count == 0 ) if ( area->changes[y].trans_count == 0 )
{ {
@ -1083,7 +1083,7 @@ void FVTerm::putArea (const FPoint& pos, const FTermArea* area)
else else
{ {
// Line has one or more transparent characters // Line has one or more transparent characters
for (int x{0}; x < length; x++) // column loop for (auto x{0}; x < length; x++) // column loop
{ {
const int cx = ax + x; const int cx = ax + x;
const int cy = ay + y; const int cy = ay + y;
@ -1118,7 +1118,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const
const int total_width = area->width + area->right_shadow; const int total_width = area->width + area->right_shadow;
const int y_max = area->height - 1; const int y_max = area->height - 1;
for (int y{0}; y < y_max; y++) for (auto y{0}; y < y_max; y++)
{ {
const int pos1 = y * total_width; const int pos1 = y * total_width;
const int pos2 = (y + 1) * total_width; const int pos2 = (y + 1) * total_width;
@ -1148,7 +1148,7 @@ void FVTerm::scrollAreaForward (FTermArea* area) const
putArea (FPoint{1, 1}, vdesktop); putArea (FPoint{1, 1}, vdesktop);
// avoid update lines from 0 to (y_max - 1) // avoid update lines from 0 to (y_max - 1)
for (int y{0}; y < y_max; y++) for (auto y{0}; y < y_max; y++)
{ {
area->changes[y].xmin = uInt(area->width - 1); area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0; area->changes[y].xmax = 0;
@ -1171,7 +1171,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const
const int total_width = area->width + area->right_shadow; const int total_width = area->width + area->right_shadow;
const int y_max = area->height - 1; const int y_max = area->height - 1;
for (int y = y_max; y > 0; y--) for (auto y = y_max; y > 0; y--)
{ {
const int pos1 = (y - 1) * total_width; const int pos1 = (y - 1) * total_width;
const int pos2 = y * total_width; const int pos2 = y * total_width;
@ -1200,7 +1200,7 @@ void FVTerm::scrollAreaReverse (FTermArea* area) const
putArea (FPoint{1, 1}, vdesktop); putArea (FPoint{1, 1}, vdesktop);
// avoid update lines from 1 to y_max // avoid update lines from 1 to y_max
for (int y{1}; y <= y_max; y++) for (auto y{1}; y <= y_max; y++)
{ {
area->changes[y].xmin = uInt(area->width - 1); area->changes[y].xmin = uInt(area->width - 1);
area->changes[y].xmax = 0; area->changes[y].xmax = 0;
@ -1235,7 +1235,7 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const
else else
clearAreaWithShadow(area, nc); clearAreaWithShadow(area, nc);
for (int i{0}; i < area->height; i++) for (auto i{0}; i < area->height; i++)
{ {
area->changes[i].xmin = 0; area->changes[i].xmin = 0;
area->changes[i].xmax = w - 1; area->changes[i].xmax = w - 1;
@ -1250,7 +1250,7 @@ void FVTerm::clearArea (FTermArea* area, int fillchar) const
area->changes[i].trans_count = 0; area->changes[i].trans_count = 0;
} }
for (int i{0}; i < area->bottom_shadow; i++) for (auto i{0}; i < area->bottom_shadow; i++)
{ {
const int y = area->height + i; const int y = area->height + i;
area->changes[y].xmin = 0; area->changes[y].xmin = 0;
@ -2034,8 +2034,7 @@ bool FVTerm::clearTerm (int fillchar) const
const auto& cb = TCAP(fc::t_clr_eol); const auto& cb = TCAP(fc::t_clr_eol);
const bool ut = FTermcap::background_color_erase; const bool ut = FTermcap::background_color_erase;
const bool normal = FTerm::isNormal (next_attribute); const bool normal = FTerm::isNormal (next_attribute);
auto next = &next_attribute; appendAttributes (next_attribute);
appendAttributes(next);
if ( ! ( (cl || cd || cb) && (normal || ut) ) if ( ! ( (cl || cd || cb) && (normal || ut) )
|| fillchar != ' ' ) || fillchar != ' ' )
@ -2058,7 +2057,7 @@ bool FVTerm::clearTerm (int fillchar) const
{ {
term_pos->setPoint(-1, -1); term_pos->setPoint(-1, -1);
for (int i{0}; i < int(FTerm::getLineNumber()); i++) for (auto i{0}; i < int(FTerm::getLineNumber()); i++)
{ {
setTermXY (0, i); setTermXY (0, i);
appendOutputBuffer (cb); appendOutputBuffer (cb);
@ -2089,7 +2088,7 @@ bool FVTerm::clearFullArea (const FTermArea* area, FChar& nc) const
} }
else else
{ {
for (int i{0}; i < vdesktop->height; i++) for (auto i{0}; i < vdesktop->height; i++)
{ {
vdesktop->changes[i].xmin = 0; vdesktop->changes[i].xmin = 0;
vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1; vdesktop->changes[i].xmax = uInt(vdesktop->width) - 1;
@ -2109,7 +2108,7 @@ void FVTerm::clearAreaWithShadow (const FTermArea* area, const FChar& nc)
const int total_width = area->width + area->right_shadow; const int total_width = area->width + area->right_shadow;
t_char.attr.bit.transparent = true; t_char.attr.bit.transparent = true;
for (int y{0}; y < area->height; y++) for (auto y{0}; y < area->height; y++)
{ {
const int pos = y * total_width; const int pos = y * total_width;
// Clear area // Clear area
@ -2119,7 +2118,7 @@ void FVTerm::clearAreaWithShadow (const FTermArea* area, const FChar& nc)
} }
// Make bottom shadow transparent // Make bottom shadow transparent
for (int y{0}; y < area->bottom_shadow; y++) for (auto y{0}; y < area->bottom_shadow; y++)
{ {
const int pos = total_width * (y + area->height); const int pos = total_width * (y + area->height);
std::fill_n (&area->data[pos], total_width, t_char); std::fill_n (&area->data[pos], total_width, t_char);
@ -2132,7 +2131,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
// Is the line from xmin to the end of the line blank? // Is the line from xmin to the end of the line blank?
// => clear to end of line // => clear to end of line
FTermArea*& vt = vterm; auto& vt = vterm;
const auto& ce = TCAP(fc::t_clr_eol); const auto& ce = TCAP(fc::t_clr_eol);
const auto& min_char = vt->data[y * uInt(vt->width) + xmin]; const auto& min_char = vt->data[y * uInt(vt->width) + xmin];
@ -2167,7 +2166,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
// Line has leading whitespace // Line has leading whitespace
// => clear from xmin to beginning of line // => clear from xmin to beginning of line
FTermArea*& vt = vterm; auto& vt = vterm;
const auto& cb = TCAP(fc::t_clr_bol); const auto& cb = TCAP(fc::t_clr_bol);
const auto& first_char = vt->data[y * uInt(vt->width)]; const auto& first_char = vt->data[y * uInt(vt->width)];
@ -2205,7 +2204,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
// Line has trailing whitespace // Line has trailing whitespace
// => clear from xmax to end of line // => clear from xmax to end of line
FTermArea*& vt = vterm; auto& vt = vterm;
const auto& ce = TCAP(fc::t_clr_eol); const auto& ce = TCAP(fc::t_clr_eol);
const auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1]; const auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1];
@ -2242,7 +2241,7 @@ bool FVTerm::skipUnchangedCharacters (uInt& x, uInt xmax, uInt y) const
{ {
// Skip characters without changes if it is faster than redrawing // Skip characters without changes if it is faster than redrawing
FTermArea*& vt = vterm; auto& vt = vterm;
auto print_char = &vt->data[y * uInt(vt->width) + x]; auto print_char = &vt->data[y * uInt(vt->width) + x];
print_char->attr.bit.printed = true; print_char->attr.bit.printed = true;
@ -2277,11 +2276,11 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
{ {
for (uInt x = xmin; x <= xmax; x++) for (uInt x = xmin; x <= xmax; x++)
{ {
FTermArea*& vt = vterm; auto& vt = vterm;
const auto& ec = TCAP(fc::t_erase_chars); const auto& ec = TCAP(fc::t_erase_chars);
const auto& rp = TCAP(fc::t_repeat_char); const auto& rp = TCAP(fc::t_repeat_char);
auto print_char = &vt->data[y * uInt(vt->width) + x]; auto& print_char = vt->data[y * uInt(vt->width) + x];
print_char->attr.bit.printed = true; print_char.attr.bit.printed = true;
replaceNonPrintableFullwidth (x, print_char); replaceNonPrintableFullwidth (x, print_char);
// skip character with no changes // skip character with no changes
@ -2289,7 +2288,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
continue; continue;
// Erase character // Erase character
if ( ec && print_char->ch == ' ' ) if ( ec && print_char.ch == ' ' )
{ {
exit_state erase_state = \ exit_state erase_state = \
eraseCharacters(x, xmax, y, draw_trailing_ws); eraseCharacters(x, xmax, y, draw_trailing_ws);
@ -2311,36 +2310,36 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::replaceNonPrintableFullwidth ( uInt x inline void FVTerm::replaceNonPrintableFullwidth ( uInt x
, FChar*& print_char ) const , FChar& print_char ) const
{ {
// Replace non-printable full-width characters that are truncated // Replace non-printable full-width characters that are truncated
// from the right or left terminal side // from the right or left terminal side
if ( x == 0 && isFullWidthPaddingChar(*print_char) ) if ( x == 0 && isFullWidthPaddingChar(print_char) )
{ {
print_char->ch = fc::SingleLeftAngleQuotationMark; // print_char.ch = fc::SingleLeftAngleQuotationMark; //
print_char->attr.bit.fullwidth_padding = false; print_char.attr.bit.fullwidth_padding = false;
} }
else if ( x == uInt(vterm->width - 1) else if ( x == uInt(vterm->width - 1)
&& isFullWidthChar(*print_char) ) && isFullWidthChar(print_char) )
{ {
print_char->ch = fc::SingleRightAngleQuotationMark; // print_char.ch = fc::SingleRightAngleQuotationMark; //
print_char->attr.bit.char_width = 1; print_char.attr.bit.char_width = 1;
} }
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max
, FChar*& print_char) const , FChar& print_char) const
{ {
// General character output on terminal // General character output on terminal
if ( x < uInt(vterm->width - 1) && isFullWidthChar(*print_char) ) if ( x < uInt(vterm->width - 1) && isFullWidthChar(print_char) )
{ {
printFullWidthCharacter (x, y, print_char); printFullWidthCharacter (x, y, print_char);
} }
else if ( x > 0 && x < uInt(vterm->width - 1) else if ( x > 0 && x < uInt(vterm->width - 1)
&& isFullWidthPaddingChar(*print_char) ) && isFullWidthPaddingChar(print_char) )
{ {
printFullWidthPaddingCharacter (x, y, print_char); printFullWidthPaddingCharacter (x, y, print_char);
} }
@ -2358,17 +2357,17 @@ void FVTerm::printCharacter ( uInt& x, uInt y, bool min_and_not_max
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::printFullWidthCharacter ( uInt& x, uInt y void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
, FChar*& print_char ) const , FChar& print_char ) const
{ {
const auto vt = vterm; const auto vt = vterm;
auto next_char = &vt->data[y * uInt(vt->width) + x + 1]; auto& next_char = vt->data[y * uInt(vt->width) + x + 1];
if ( print_char->attr.byte[0] == next_char->attr.byte[0] if ( print_char.attr.byte[0] == next_char.attr.byte[0]
&& print_char->attr.byte[1] == next_char->attr.byte[1] && print_char.attr.byte[1] == next_char.attr.byte[1]
&& print_char->fg_color == next_char->fg_color && print_char.fg_color == next_char.fg_color
&& print_char->bg_color == next_char->bg_color && print_char.bg_color == next_char.bg_color
&& isFullWidthChar(*print_char) && isFullWidthChar(print_char)
&& isFullWidthPaddingChar(*next_char) ) && isFullWidthPaddingChar(next_char) )
{ {
// Print a full-width character // Print a full-width character
appendCharacter (print_char); appendCharacter (print_char);
@ -2383,7 +2382,7 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
term_pos->x_ref()++; term_pos->x_ref()++;
markAsPrinted (x, y); markAsPrinted (x, y);
if ( isFullWidthPaddingChar(*next_char) ) if ( isFullWidthPaddingChar(next_char) )
{ {
// Print ellipses for the 2nd full-width character column // Print ellipses for the 2nd full-width character column
x++; x++;
@ -2397,17 +2396,17 @@ void FVTerm::printFullWidthCharacter ( uInt& x, uInt y
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
, FChar*& print_char) const , FChar& print_char) const
{ {
const auto vt = vterm; const auto vt = vterm;
auto prev_char = &vt->data[y * uInt(vt->width) + x - 1]; auto& prev_char = vt->data[y * uInt(vt->width) + x - 1];
if ( print_char->attr.byte[0] == prev_char->attr.byte[0] if ( print_char.attr.byte[0] == prev_char.attr.byte[0]
&& print_char->attr.byte[1] == prev_char->attr.byte[1] && print_char.attr.byte[1] == prev_char.attr.byte[1]
&& print_char->fg_color == prev_char->fg_color && print_char.fg_color == prev_char.fg_color
&& print_char->bg_color == prev_char->bg_color && print_char.bg_color == prev_char.bg_color
&& isFullWidthChar(*prev_char) && isFullWidthChar(prev_char)
&& isFullWidthPaddingChar(*print_char) ) && isFullWidthPaddingChar(print_char) )
{ {
// Move cursor one character to the left // Move cursor one character to the left
const auto& le = TCAP(fc::t_cursor_left); const auto& le = TCAP(fc::t_cursor_left);
@ -2442,12 +2441,12 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
, FChar*& print_char ) const , FChar& print_char ) const
{ {
const auto vt = vterm; const auto vt = vterm;
auto prev_char = &vt->data[y * uInt(vt->width) + x - 1]; auto& prev_char = vt->data[y * uInt(vt->width) + x - 1];
if ( isFullWidthChar(*prev_char) && ! isFullWidthPaddingChar(*print_char) ) if ( isFullWidthChar(prev_char) && ! isFullWidthPaddingChar(print_char) )
{ {
// Move cursor one character to the left // Move cursor one character to the left
const auto& le = TCAP(fc::t_cursor_left); const auto& le = TCAP(fc::t_cursor_left);
@ -2478,9 +2477,9 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y
, const FChar* const& print_char ) const , const FChar& print_char ) const
{ {
if ( isFullWidthChar(*print_char) ) // full-width character if ( isFullWidthChar(print_char) ) // full-width character
{ {
x++; // Skip the following padding character x++; // Skip the following padding character
term_pos->x_ref()++; term_pos->x_ref()++;
@ -2497,7 +2496,6 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
const auto& vt = vterm; const auto& vt = vterm;
const auto& ec = TCAP(fc::t_erase_chars); const auto& ec = TCAP(fc::t_erase_chars);
auto& print_char = vt->data[y * uInt(vt->width) + x]; auto& print_char = vt->data[y * uInt(vt->width) + x];
auto print_ch = &print_char;
if ( ! ec || print_char.ch != ' ' ) if ( ! ec || print_char.ch != ' ' )
return not_used; return not_used;
@ -2517,7 +2515,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
if ( whitespace == 1 ) if ( whitespace == 1 )
{ {
appendCharacter (print_ch); appendCharacter (print_char);
markAsPrinted (x, y); markAsPrinted (x, y);
} }
else else
@ -2528,7 +2526,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
if ( whitespace > erase_char_length + cursor_address_length if ( whitespace > erase_char_length + cursor_address_length
&& (ut || normal) ) && (ut || normal) )
{ {
appendAttributes (print_ch); appendAttributes (print_char);
appendOutputBuffer (FTermcap::encodeParameter(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermcap::encodeParameter(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0));
if ( x + whitespace - 1 < xmax || draw_trailing_ws ) if ( x + whitespace - 1 < xmax || draw_trailing_ws )
@ -2544,7 +2542,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
for (uInt i{0}; i < whitespace; i++) for (uInt i{0}; i < whitespace; i++)
{ {
appendCharacter (print_ch); appendCharacter (print_char);
x++; x++;
} }
} }
@ -2562,7 +2560,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
const auto& vt = vterm; const auto& vt = vterm;
const auto& rp = TCAP(fc::t_repeat_char); const auto& rp = TCAP(fc::t_repeat_char);
auto print_char = &vt->data[y * uInt(vt->width) + x]; auto& print_char = vt->data[y * uInt(vt->width) + x];
if ( ! rp ) if ( ! rp )
return not_used; return not_used;
@ -2573,7 +2571,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
{ {
const auto& ch = vt->data[y * uInt(vt->width) + i]; const auto& ch = vt->data[y * uInt(vt->width) + i];
if ( *print_char == ch ) if ( print_char == ch )
repetitions++; repetitions++;
else else
break; break;
@ -2589,12 +2587,12 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) const
const uInt start_pos = x; const uInt start_pos = x;
if ( repetitions > repeat_char_length if ( repetitions > repeat_char_length
&& print_char->ch < 128 ) && print_char.ch < 128 )
{ {
newFontChanges (print_char); newFontChanges (print_char);
charsetChanges (print_char); charsetChanges (print_char);
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (FTermcap::encodeParameter(rp, print_char->ch, repetitions, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermcap::encodeParameter(rp, print_char.ch, repetitions, 0, 0, 0, 0, 0, 0, 0));
term_pos->x_ref() += int(repetitions); term_pos->x_ref() += int(repetitions);
x = x + repetitions - 1; x = x + repetitions - 1;
} }
@ -2768,9 +2766,9 @@ bool FVTerm::updateTerminalLine (uInt y) const
bool draw_leading_ws = false; bool draw_leading_ws = false;
bool draw_trailing_ws = false; bool draw_trailing_ws = false;
const auto& ce = TCAP(fc::t_clr_eol); const auto& ce = TCAP(fc::t_clr_eol);
auto first_char = &vt->data[y * uInt(vt->width)]; auto& first_char = vt->data[y * uInt(vt->width)];
auto last_char = &vt->data[(y + 1) * uInt(vt->width) - 1]; auto& last_char = vt->data[(y + 1) * uInt(vt->width) - 1];
auto min_char = &vt->data[y * uInt(vt->width) + xmin]; auto& min_char = vt->data[y * uInt(vt->width) + xmin];
// Clear rest of line // Clear rest of line
bool is_eol_clean = canClearToEOL (xmin, y); bool is_eol_clean = canClearToEOL (xmin, y);
@ -2912,26 +2910,26 @@ inline void FVTerm::markAsPrinted (uInt from, uInt to, uInt line)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::newFontChanges (FChar*& next_char) inline void FVTerm::newFontChanges (FChar& next_char)
{ {
// NewFont special cases // NewFont special cases
if ( ! FTerm::isNewFont() ) if ( ! FTerm::isNewFont() )
return; return;
if ( next_char->ch == fc::LowerHalfBlock ) if ( next_char.ch == fc::LowerHalfBlock )
{ {
next_char->ch = fc::UpperHalfBlock; next_char.ch = fc::UpperHalfBlock;
next_char->attr.bit.reverse = true; next_char.attr.bit.reverse = true;
} }
else if ( isReverseNewFontchar(next_char->ch) ) else if ( isReverseNewFontchar(next_char.ch) )
next_char->attr.bit.reverse = true; // Show in reverse video next_char.attr.bit.reverse = true; // Show in reverse video
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::charsetChanges (FChar*& next_char) inline void FVTerm::charsetChanges (FChar& next_char)
{ {
const wchar_t& ch = next_char->ch; const wchar_t& ch = next_char.ch;
next_char->encoded_char = ch; next_char.encoded_char = ch;
if ( FTerm::getEncoding() == fc::UTF8 ) if ( FTerm::getEncoding() == fc::UTF8 )
return; return;
@ -2943,17 +2941,17 @@ inline void FVTerm::charsetChanges (FChar*& next_char)
if ( ch_enc == 0 ) if ( ch_enc == 0 )
{ {
next_char->encoded_char = wchar_t(FTerm::charEncode(ch, fc::ASCII)); next_char.encoded_char = wchar_t(FTerm::charEncode(ch, fc::ASCII));
return; return;
} }
next_char->encoded_char = ch_enc; next_char.encoded_char = ch_enc;
if ( FTerm::getEncoding() == fc::VT100 ) if ( FTerm::getEncoding() == fc::VT100 )
next_char->attr.bit.alt_charset = true; next_char.attr.bit.alt_charset = true;
else if ( FTerm::getEncoding() == fc::PC ) else if ( FTerm::getEncoding() == fc::PC )
{ {
next_char->attr.bit.pc_charset = true; next_char.attr.bit.pc_charset = true;
if ( FTerm::isPuttyTerminal() ) if ( FTerm::isPuttyTerminal() )
return; return;
@ -2961,18 +2959,18 @@ inline void FVTerm::charsetChanges (FChar*& next_char)
if ( FTerm::isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f if ( FTerm::isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f
{ {
if ( FTerm::hasUTF8() ) if ( FTerm::hasUTF8() )
next_char->encoded_char = int(FTerm::charEncode(ch, fc::ASCII)); next_char.encoded_char = int(FTerm::charEncode(ch, fc::ASCII));
else else
{ {
next_char->encoded_char += 0x5f; next_char.encoded_char += 0x5f;
next_char->attr.bit.alt_charset = true; next_char.attr.bit.alt_charset = true;
} }
} }
} }
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendCharacter (FChar*& next_char) const inline void FVTerm::appendCharacter (FChar& next_char) const
{ {
const int term_width = vterm->width - 1; const int term_width = vterm->width - 1;
const int term_height = vterm->height - 1; const int term_height = vterm->height - 1;
@ -2987,41 +2985,39 @@ inline void FVTerm::appendCharacter (FChar*& next_char) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendChar (FChar*& next_char) const inline void FVTerm::appendChar (FChar& next_char) const
{ {
newFontChanges (next_char); newFontChanges (next_char);
charsetChanges (next_char); charsetChanges (next_char);
appendAttributes (next_char); appendAttributes (next_char);
characterFilter (next_char); characterFilter (next_char);
appendOutputBuffer (next_char->encoded_char); appendOutputBuffer (next_char.encoded_char);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendAttributes (FChar*& next_attr) const inline void FVTerm::appendAttributes (FChar& next_attr) const
{ {
auto term_attr = &term_attribute;
// generate attribute string for the next character // generate attribute string for the next character
const char* attr_str = FTerm::changeAttribute (term_attr, next_attr); const auto attr_str = FTerm::changeAttribute (term_attribute, next_attr);
if ( attr_str ) if ( attr_str )
appendOutputBuffer (attr_str); appendOutputBuffer (attr_str);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::appendLowerRight (FChar*& screen_char) const void FVTerm::appendLowerRight (FChar& last_char) const
{ {
const auto& SA = TCAP(fc::t_enter_am_mode); const auto& SA = TCAP(fc::t_enter_am_mode);
const auto& RA = TCAP(fc::t_exit_am_mode); const auto& RA = TCAP(fc::t_exit_am_mode);
if ( ! FTermcap::automatic_right_margin ) if ( ! FTermcap::automatic_right_margin )
{ {
appendChar (screen_char); appendChar (last_char);
} }
else if ( SA && RA ) else if ( SA && RA )
{ {
appendOutputBuffer (RA); appendOutputBuffer (RA);
appendChar (screen_char); appendChar (last_char);
appendOutputBuffer (SA); appendOutputBuffer (SA);
} }
else else
@ -3035,21 +3031,21 @@ int FVTerm::appendLowerRight (FChar*& screen_char) const
const int x = int(FTerm::getColumnNumber()) - 2; const int x = int(FTerm::getColumnNumber()) - 2;
const int y = int(FTerm::getLineNumber()) - 1; const int y = int(FTerm::getLineNumber()) - 1;
setTermXY (x, y); setTermXY (x, y);
appendChar (screen_char); appendChar (last_char);
term_pos->x_ref()++; term_pos->x_ref()++;
setTermXY (x, y); setTermXY (x, y);
screen_char--; FChar& second_last = *(&last_char - 1);
if ( IC ) if ( IC )
{ {
appendOutputBuffer (FTermcap::encodeParameter(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (FTermcap::encodeParameter(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0));
appendChar (screen_char); appendChar (second_last);
} }
else if ( im && ei ) else if ( im && ei )
{ {
appendOutputBuffer (im); appendOutputBuffer (im);
appendChar (screen_char); appendChar (second_last);
if ( ip ) if ( ip )
appendOutputBuffer (ip); appendOutputBuffer (ip);
@ -3059,29 +3055,27 @@ int FVTerm::appendLowerRight (FChar*& screen_char) const
else if ( ic ) else if ( ic )
{ {
appendOutputBuffer (ic); appendOutputBuffer (ic);
appendChar (screen_char); appendChar (second_last);
if ( ip ) if ( ip )
appendOutputBuffer (ip); appendOutputBuffer (ip);
} }
} }
return screen_char->ch;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::characterFilter (FChar*& next_char) inline void FVTerm::characterFilter (FChar& next_char)
{ {
charSubstitution& sub_map = fterm->getCharSubstitutionMap(); charSubstitution& sub_map = fterm->getCharSubstitutionMap();
if ( sub_map.find(next_char->encoded_char) != sub_map.end() ) if ( sub_map.find(next_char.encoded_char) != sub_map.end() )
next_char->encoded_char = sub_map[next_char->encoded_char]; next_char.encoded_char = sub_map[next_char.encoded_char];
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FVTerm::appendOutputBuffer (const std::string& s) inline void FVTerm::appendOutputBuffer (const std::string& s)
{ {
const char* const& c_string = s.c_str(); const auto& c_string = s.c_str();
FTermcap::paddingPrint (c_string, 1, appendOutputBuffer); FTermcap::paddingPrint (c_string, 1, appendOutputBuffer);
} }

View File

@ -1360,7 +1360,7 @@ void FWidget::hideArea (const FSize& size)
if ( size.getWidth() == 0 ) if ( size.getWidth() == 0 )
return; return;
for (int y{0}; y < int(size.getHeight()); y++) for (auto y{0}; y < int(size.getHeight()); y++)
{ {
print() << FPoint{1, 1 + y} << FString{size.getWidth(), L' '}; print() << FPoint{1, 1 + y} << FString{size.getWidth(), L' '};
} }

View File

@ -451,7 +451,7 @@ inline void drawBox (FWidget* w, const FRect& r)
<< FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─ << FString{r.getWidth() - 2, fc::BoxDrawingsHorizontal} // ─
<< fc::BoxDrawingsDownAndLeft; // ┐ << fc::BoxDrawingsDownAndLeft; // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++) for (auto y = r.getY1() + 1; y < r.getY2(); y++)
{ {
w->print() << FPoint{r.getX1(), y} w->print() << FPoint{r.getX1(), y}
<< fc::BoxDrawingsVertical // │ << fc::BoxDrawingsVertical // │
@ -475,7 +475,7 @@ inline void drawNewFontBox (FWidget* w, const FRect& r)
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─ << FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
<< fc::NF_border_corner_middle_upper_right; // ┐ << fc::NF_border_corner_middle_upper_right; // ┐
for (int y = r.getY1() + 1; y < r.getY2(); y++) for (auto y = r.getY1() + 1; y < r.getY2(); y++)
{ {
w->print() << FPoint{r.getX1(), y} w->print() << FPoint{r.getX1(), y}
<< fc::NF_border_line_vertical // │ << fc::NF_border_line_vertical // │
@ -497,7 +497,7 @@ inline void drawNewFontListBox (FWidget* w, const FRect& r)
<< FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─ << FString{r.getWidth() - 2, fc::NF_border_line_horizontal} // ─
<< fc::NF_border_line_left_down; // ╷ << fc::NF_border_line_left_down; // ╷
for (int y = r.getY1() + 1; y < r.getY2(); y++) for (auto y = r.getY1() + 1; y < r.getY2(); y++)
{ {
w->print() << FPoint{r.getX1(), y} w->print() << FPoint{r.getX1(), y}
<< fc::NF_border_line_left // border left ⎸ << fc::NF_border_line_left // border left ⎸

View File

@ -247,7 +247,7 @@ void FWindow::drawBorder()
<< FString{r.getWidth() - 2, fc::NF_border_line_upper} // ¯ << FString{r.getWidth() - 2, fc::NF_border_line_upper} // ¯
<< fc::NF_rev_border_corner_upper_right; // ⎤ << fc::NF_rev_border_corner_upper_right; // ⎤
for (int y = r.getY1() + 1; y < r.getY2(); y++) for (auto y = r.getY1() + 1; y < r.getY2(); y++)
{ {
print() << FPoint{r.getX1(), y} print() << FPoint{r.getX1(), y}
<< fc::NF_border_line_left // border left ⎸ << fc::NF_border_line_left // border left ⎸

View File

@ -189,7 +189,7 @@ class FApplication : public FWidget
void sendKeyboardAccelerator(); void sendKeyboardAccelerator();
void processKeyboardEvent() const; void processKeyboardEvent() const;
bool processDialogSwitchAccelerator() const; bool processDialogSwitchAccelerator() const;
bool processAccelerator (const FWidget* const&) const; bool processAccelerator (const FWidget&) const;
bool getMouseEvent() const; bool getMouseEvent() const;
FWidget*& determineClickedWidget(); FWidget*& determineClickedWidget();
void unsetMoveSizeMode() const; void unsetMoveSizeMode() const;

View File

@ -216,7 +216,7 @@ class FComboBox : public FWidget
void draw() override; void draw() override;
void onePosUp(); void onePosUp();
void onePosDown(); void onePosDown();
void passEventToListWindow (FMouseEvent* const&); void passEventToListWindow (const FMouseEvent&);
void processClick() const; void processClick() const;
void processChanged() const; void processChanged() const;

View File

@ -192,9 +192,9 @@ class FMenu : public FWindow, public FMenuList
void mouseMoveDeselection (FMenuItem*, MouseStates&); void mouseMoveDeselection (FMenuItem*, MouseStates&);
void mouseUpOverBorder(); void mouseUpOverBorder();
void mouseMoveOverBorder (MouseStates&) const; void mouseMoveOverBorder (MouseStates&) const;
void passEventToSubMenu (FMouseEvent* const&); void passEventToSubMenu (const FMouseEvent&);
void passEventToSuperMenu (FMouseEvent* const&); void passEventToSuperMenu (const FMouseEvent&);
void passEventToMenuBar (FMouseEvent* const&) const; void passEventToMenuBar (const FMouseEvent&) const;
bool containsMenuStructure (const FPoint&); bool containsMenuStructure (const FPoint&);
bool containsMenuStructure (int, int); bool containsMenuStructure (int, int);
FMenu* superMenuAt (const FPoint&); FMenu* superMenuAt (const FPoint&);

View File

@ -140,7 +140,7 @@ class FMenuBar : public FWindow, public FMenuList
void mouseDownOverList (const FMouseEvent*); void mouseDownOverList (const FMouseEvent*);
void mouseUpOverList (const FMouseEvent*); void mouseUpOverList (const FMouseEvent*);
void mouseMoveOverList (const FMouseEvent*); void mouseMoveOverList (const FMouseEvent*);
void passEventToMenu (const FMouseEvent* const&) const; void passEventToMenu (const FMouseEvent&) const;
void leaveMenuBar(); void leaveMenuBar();
// Data members // Data members

View File

@ -152,12 +152,12 @@ class FOptiAttr final
void set_orig_orig_colors (const char[]); void set_orig_orig_colors (const char[]);
// Inquiry // Inquiry
static bool isNormal (const FChar* const&); static bool isNormal (const FChar&);
// Methods // Methods
void initialize(); void initialize();
static FColor vga2ansi (FColor); static FColor vga2ansi (FColor);
const char* changeAttribute (FChar*&, FChar*&); const char* changeAttribute (FChar&, FChar&);
private: private:
// Typedefs and Enumerations // Typedefs and Enumerations
@ -202,62 +202,62 @@ class FOptiAttr final
}; };
// Mutators // Mutators
bool setTermBold (FChar*&); bool setTermBold (FChar&);
bool unsetTermBold (FChar*&); bool unsetTermBold (FChar&);
bool setTermDim (FChar*&); bool setTermDim (FChar&);
bool unsetTermDim (FChar*&); bool unsetTermDim (FChar&);
bool setTermItalic (FChar*&); bool setTermItalic (FChar&);
bool unsetTermItalic (FChar*&); bool unsetTermItalic (FChar&);
bool setTermUnderline (FChar*&); bool setTermUnderline (FChar&);
bool unsetTermUnderline (FChar*&); bool unsetTermUnderline (FChar&);
bool setTermBlink (FChar*&); bool setTermBlink (FChar&);
bool unsetTermBlink (FChar*&); bool unsetTermBlink (FChar&);
bool setTermReverse (FChar*&); bool setTermReverse (FChar&);
bool unsetTermReverse (FChar*&); bool unsetTermReverse (FChar&);
bool setTermStandout (FChar*&); bool setTermStandout (FChar&);
bool unsetTermStandout (FChar*&); bool unsetTermStandout (FChar&);
bool setTermInvisible (FChar*&); bool setTermInvisible (FChar&);
bool unsetTermInvisible (FChar*&); bool unsetTermInvisible (FChar&);
bool setTermProtected (FChar*&); bool setTermProtected (FChar&);
bool unsetTermProtected (FChar*&); bool unsetTermProtected (FChar&);
bool setTermCrossedOut (FChar*&); bool setTermCrossedOut (FChar&);
bool unsetTermCrossedOut (FChar*&); bool unsetTermCrossedOut (FChar&);
bool setTermDoubleUnderline (FChar*&); bool setTermDoubleUnderline (FChar&);
bool unsetTermDoubleUnderline (FChar*&); bool unsetTermDoubleUnderline (FChar&);
bool setTermAttributes ( FChar*& bool setTermAttributes ( FChar&
, bool, bool, bool , bool, bool, bool
, bool, bool, bool , bool, bool, bool
, bool, bool, bool ); , bool, bool, bool );
bool unsetTermAttributes (FChar*&); bool unsetTermAttributes (FChar&);
bool setTermAltCharset (FChar*&); bool setTermAltCharset (FChar&);
bool unsetTermAltCharset (FChar*&); bool unsetTermAltCharset (FChar&);
bool setTermPCcharset (FChar*&); bool setTermPCcharset (FChar&);
bool unsetTermPCcharset (FChar*&); bool unsetTermPCcharset (FChar&);
bool setTermDefaultColor (FChar*&); bool setTermDefaultColor (FChar&);
void setAttributesOn (FChar*&); void setAttributesOn (FChar&);
void setAttributesOff (FChar*&); void setAttributesOff (FChar&);
// Inquiries // Inquiries
static bool hasColor (const FChar* const&); static bool hasColor (const FChar&);
static bool hasAttribute (const FChar* const&); static bool hasAttribute (const FChar&);
static bool hasNoAttribute (const FChar* const&); static bool hasNoAttribute (const FChar&);
// Methods // Methods
bool hasColorChanged (const FChar* const&, const FChar* const&) const; bool hasColorChanged (const FChar&, const FChar&) const;
void resetColor (FChar*&) const; void resetColor (FChar&) const;
void prevent_no_color_video_attributes (FChar*&, bool = false); void prevent_no_color_video_attributes (FChar&, bool = false);
void deactivateAttributes (FChar*&, FChar*&); void deactivateAttributes (FChar&, FChar&);
void changeAttributeSGR (FChar*&, FChar*&); void changeAttributeSGR (FChar&, FChar&);
void changeAttributeSeparately (FChar*&, FChar*&); void changeAttributeSeparately (FChar&, FChar&);
void change_color (FChar*&, FChar*&); void change_color (FChar&, FChar&);
void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&); void change_to_default_color (FChar&, FChar&, FColor&, FColor&);
void change_current_color (const FChar* const&, FColor, FColor); void change_current_color (const FChar&, FColor, FColor);
void resetAttribute (FChar*&) const; void resetAttribute (FChar&) const;
void reset (FChar*&) const; void reset (FChar&) const;
bool caused_reset_attributes (const char[], uChar = all_tests) const; bool caused_reset_attributes (const char[], uChar = all_tests) const;
bool hasCharsetEquivalence() const; bool hasCharsetEquivalence() const;
void detectSwitchOn (const FChar* const&, const FChar* const&); void detectSwitchOn (const FChar&, const FChar&);
void detectSwitchOff (const FChar* const&, const FChar* const&); void detectSwitchOff (const FChar&, const FChar&);
bool switchOn() const; bool switchOn() const;
bool switchOff() const; bool switchOff() const;
bool append_sequence (const char[]); bool append_sequence (const char[]);

View File

@ -304,7 +304,7 @@ class FTerm final
void initTerminal(); void initTerminal();
static void initScreenSettings(); static void initScreenSettings();
static const char* changeAttribute (FChar*&, FChar*&); static const char* changeAttribute (FChar&, FChar&);
static void changeTermSizeFinished(); static void changeTermSizeFinished();
private: private:

View File

@ -387,12 +387,12 @@ class FVTerm
static bool canClearTrailingWS (uInt&, uInt); static bool canClearTrailingWS (uInt&, uInt);
bool skipUnchangedCharacters (uInt&, uInt, uInt) const; bool skipUnchangedCharacters (uInt&, uInt, uInt) const;
void printRange (uInt, uInt, uInt, bool) const; void printRange (uInt, uInt, uInt, bool) const;
void replaceNonPrintableFullwidth (uInt, FChar*&) const; void replaceNonPrintableFullwidth (uInt, FChar&) const;
void printCharacter (uInt&, uInt, bool, FChar*&) const; void printCharacter (uInt&, uInt, bool, FChar&) const;
void printFullWidthCharacter (uInt&, uInt, FChar*&) const; void printFullWidthCharacter (uInt&, uInt, FChar&) const;
void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&) const; void printFullWidthPaddingCharacter (uInt&, uInt, FChar&) const;
void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&) const; void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar&) const;
void skipPaddingCharacter (uInt&, uInt, const FChar* const&) const; void skipPaddingCharacter (uInt&, uInt, const FChar&) const;
exit_state eraseCharacters (uInt&, uInt, uInt, bool) const; exit_state eraseCharacters (uInt&, uInt, uInt, bool) const;
exit_state repeatCharacter (uInt&, uInt, uInt) const; exit_state repeatCharacter (uInt&, uInt, uInt) const;
bool isFullWidthChar (const FChar&) const; bool isFullWidthChar (const FChar&) const;
@ -412,13 +412,13 @@ class FVTerm
static bool hasPendingUpdates (const FTermArea*); static bool hasPendingUpdates (const FTermArea*);
static void markAsPrinted (uInt, uInt); static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt); static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (FChar*&); static void newFontChanges (FChar&);
static void charsetChanges (FChar*&); static void charsetChanges (FChar&);
void appendCharacter (FChar*&) const; void appendCharacter (FChar&) const;
void appendChar (FChar*&) const; void appendChar (FChar&) const;
void appendAttributes (FChar*&) const; void appendAttributes (FChar&) const;
int appendLowerRight (FChar*&) const; void appendLowerRight (FChar&) const;
static void characterFilter (FChar*&); static void characterFilter (FChar&);
static void appendOutputBuffer (const std::string&); static void appendOutputBuffer (const std::string&);
static void appendOutputBuffer (const char[]); static void appendOutputBuffer (const char[]);
static int appendOutputBuffer (int); static int appendOutputBuffer (int);

View File

@ -695,7 +695,7 @@ void FObjectTest::performTimerActionTest()
CPPUNIT_ASSERT ( t2.getValue() == 0 ); CPPUNIT_ASSERT ( t2.getValue() == 0 );
finalcut::FTimerEvent timer_ev (finalcut::fc::Timer_Event, 1); finalcut::FTimerEvent timer_ev (finalcut::fc::Timer_Event, 1);
for (int x = 0; x < 10; x++) for (auto x = 0; x < 10; x++)
finalcut::FApplication::sendEvent (&t2, &timer_ev); finalcut::FApplication::sendEvent (&t2, &timer_ev);
CPPUNIT_ASSERT ( t2.getValue() == 10 ); CPPUNIT_ASSERT ( t2.getValue() == 10 );

File diff suppressed because it is too large Load Diff

View File

@ -2196,7 +2196,7 @@ void FStringTest::controlCodesTest()
// C0 control codes (0x01 - 0x1f) - without null (0x00) // C0 control codes (0x01 - 0x1f) - without null (0x00)
finalcut::FString c0(0x1f); finalcut::FString c0(0x1f);
for (int i = 0; i < 0x1f; i++) for (auto i = 0; i < 0x1f; i++)
c0[i] = i + 1; c0[i] = i + 1;
CPPUNIT_ASSERT ( c0.getLength() == 31 ); CPPUNIT_ASSERT ( c0.getLength() == 31 );
@ -2210,7 +2210,8 @@ void FStringTest::controlCodesTest()
// C1 control codes (0x80 - 0x9f) // C1 control codes (0x80 - 0x9f)
// Used as print characters in some character sets // Used as print characters in some character sets
finalcut::FString c1(0x20); finalcut::FString c1(0x20);
for (int i = 0; i <= 0x1f; i++)
for (auto i = 0; i <= 0x1f; i++)
c1[i] = i + 0x80; c1[i] = i + 0x80;
CPPUNIT_ASSERT ( c1.replaceControlCodes() == finalcut::FString(32, L' ') ); CPPUNIT_ASSERT ( c1.replaceControlCodes() == finalcut::FString(32, L' ') );