diff --git a/ChangeLog b/ChangeLog index 361530a1..5289e0a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2020-02-19 Markus Gans + * Some small code improvements + 2020-02-16 Markus Gans * Printing a FStyle object allows you to change video attributes diff --git a/examples/calculator.cpp b/examples/calculator.cpp index ad3f43a5..d1981ab7 100644 --- a/examples/calculator.cpp +++ b/examples/calculator.cpp @@ -113,7 +113,7 @@ class Calc : public finalcut::FDialog explicit Calc (finalcut::FWidget* parent = nullptr); // Destructor - ~Calc(); + ~Calc() override; // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; diff --git a/examples/checklist.cpp b/examples/checklist.cpp index 81a13660..a8e80fb7 100644 --- a/examples/checklist.cpp +++ b/examples/checklist.cpp @@ -46,7 +46,7 @@ class CheckList : public finalcut::FDialog CheckList (const CheckList&) = delete; // Destructor - ~CheckList(); + ~CheckList() override; // Disable assignment operator (=) CheckList& operator = (const CheckList&) = delete; diff --git a/examples/listbox.cpp b/examples/listbox.cpp index b0c16d20..e5270522 100644 --- a/examples/listbox.cpp +++ b/examples/listbox.cpp @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2017-2019 Markus Gans * +* Copyright 2017-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -86,7 +86,7 @@ class Listbox : public FDialog Listbox (const Listbox&) = delete; // Destructor - ~Listbox(); + ~Listbox() override; // Disable assignment operator (=) Listbox& operator = (const Listbox&) = delete; diff --git a/examples/listview.cpp b/examples/listview.cpp index 2f1925eb..654c7f97 100644 --- a/examples/listview.cpp +++ b/examples/listview.cpp @@ -46,7 +46,7 @@ class Listview : public finalcut::FDialog Listview (const Listview&) = delete; // Destructor - ~Listview(); + ~Listview() override; // Disable assignment operator (=) Listview& operator = (const Listview&) = delete; diff --git a/examples/mandelbrot.cpp b/examples/mandelbrot.cpp index 4cc217df..12e6d0df 100644 --- a/examples/mandelbrot.cpp +++ b/examples/mandelbrot.cpp @@ -38,7 +38,7 @@ class Mandelbrot : public finalcut::FDialog explicit Mandelbrot (finalcut::FWidget* = nullptr); // Destructor - ~Mandelbrot(); + ~Mandelbrot() override; // Event handlers void onKeyPress (finalcut::FKeyEvent*) override; @@ -138,8 +138,15 @@ void Mandelbrot::onClose (finalcut::FCloseEvent* ev) //---------------------------------------------------------------------- void Mandelbrot::adjustSize() { - const std::size_t h = getDesktopHeight() - 1; - const std::size_t w = getDesktopWidth() - 10; + std::size_t h = getDesktopHeight(); + std::size_t w = getDesktopWidth(); + + if ( h > 1 ) + h--; + + if ( w > 10 ) + w -= 10; + setGeometry(FPoint(6, 1), FSize(w, h), false); finalcut::FDialog::adjustSize(); } diff --git a/examples/menu.cpp b/examples/menu.cpp index 6d177b22..8266898a 100644 --- a/examples/menu.cpp +++ b/examples/menu.cpp @@ -41,7 +41,7 @@ class Menu : public finalcut::FDialog Menu (const Menu&) = delete; // Destructor - ~Menu(); + ~Menu() override; // Disable assignment operator (=) Menu& operator = (const Menu&) = delete; diff --git a/examples/mouse.cpp b/examples/mouse.cpp index dc1912bc..82d01bfb 100644 --- a/examples/mouse.cpp +++ b/examples/mouse.cpp @@ -43,7 +43,7 @@ class ColorChooser : public finalcut::FWidget ColorChooser (const ColorChooser&) = delete; // Destructor - ~ColorChooser(); + ~ColorChooser() override; // Disable assignment operator (=) ColorChooser& operator = (const ColorChooser&) = delete; @@ -182,7 +182,7 @@ class Brushes : public finalcut::FWidget Brushes (const Brushes&) = delete; // Destructor - ~Brushes(); + ~Brushes() override; // Disable assignment operator (=) Brushes& operator = (const Brushes&) = delete; @@ -321,7 +321,7 @@ class MouseDraw : public finalcut::FDialog MouseDraw (const MouseDraw&) = delete; // Destructor - ~MouseDraw(); + ~MouseDraw() override; // Disable assignment operator (=) MouseDraw& operator = (const MouseDraw&) = delete; diff --git a/examples/scrollview.cpp b/examples/scrollview.cpp index 3f4a04db..c3e79767 100644 --- a/examples/scrollview.cpp +++ b/examples/scrollview.cpp @@ -41,7 +41,7 @@ class Scrollview : public finalcut::FScrollView Scrollview (const Scrollview&) = delete; // Destructor - ~Scrollview (); + ~Scrollview() override; // Disable assignment operator (=) Scrollview& operator = (const Scrollview&) = delete; @@ -197,7 +197,7 @@ class Scrollviewdemo : public finalcut::FDialog explicit Scrollviewdemo (finalcut::FWidget* = nullptr); // Destructor - ~Scrollviewdemo(); + ~Scrollviewdemo() override; // Event handler void onClose (finalcut::FCloseEvent*) override; diff --git a/examples/term-attributes.cpp b/examples/term-attributes.cpp index 78f0ae4d..5a8289da 100644 --- a/examples/term-attributes.cpp +++ b/examples/term-attributes.cpp @@ -44,7 +44,7 @@ class AttribDlg : public finalcut::FDialog AttribDlg (const AttribDlg&) = delete; // Destructor - ~AttribDlg(); + ~AttribDlg() override; // Disable assignment operator (=) AttribDlg& operator = (const AttribDlg&) = delete; @@ -200,7 +200,7 @@ class AttribDemo : public finalcut::FWidget explicit AttribDemo (FWidget* = nullptr); // Destructor - ~AttribDemo() + ~AttribDemo() override { } // Event handler diff --git a/examples/termcap.cpp b/examples/termcap.cpp index 235073c2..46c05e89 100644 --- a/examples/termcap.cpp +++ b/examples/termcap.cpp @@ -168,7 +168,7 @@ void tcapString (const std::string& name, const char cap_str[]) std::string sequence{}; std::cout << name << ": "; - if ( cap_str == 0 ) + if ( cap_str == nullptr ) { std::cout << "\r\n"; return; diff --git a/examples/transparent.cpp b/examples/transparent.cpp index 81fc9ecf..8245edae 100644 --- a/examples/transparent.cpp +++ b/examples/transparent.cpp @@ -52,7 +52,7 @@ class Transparent : public finalcut::FDialog Transparent (const Transparent&) = delete; // Destructor - ~Transparent(); + ~Transparent() override; // Disable assignment operator (=) Transparent& operator = (const Transparent&) = delete; @@ -149,7 +149,7 @@ class MainWindow : public finalcut::FDialog MainWindow (const MainWindow&) = delete; // Destructor - ~MainWindow(); + ~MainWindow() override; // Disable assignment operator (=) MainWindow& operator = (const MainWindow&) = delete; diff --git a/examples/treeview.cpp b/examples/treeview.cpp index 7cf1c071..c261a3bd 100644 --- a/examples/treeview.cpp +++ b/examples/treeview.cpp @@ -122,7 +122,7 @@ class Treeview : public finalcut::FDialog Treeview (const Treeview&) = delete; // Destructor - ~Treeview(); + ~Treeview() override; // Disable assignment operator (=) Treeview& operator = (const Treeview&) = delete; @@ -174,124 +174,124 @@ struct Treeview::TreeItem //---------------------------------------------------------------------- Treeview::TreeItem Treeview::africa[] = { - { "Algeria", "40,400,000", "15.9", 0 }, - { "Angola", "25,789,024", "20.69", 0 }, - { "Botswana", "2,250,260", "3.7", 0 }, - { "Cameroon", "22,534,532", "39.7", 0 }, - { "Chad", "13,670,084", "8.6", 0 }, - { "Egypt", "94,666,000", "87", 0 }, - { "Ethiopia", "102,374,044", "92.7", 0 }, - { "Ivory Coast", "23,740,424", "63.9", 0 }, - { "Libya", "6,541,948", "3.55", 0 }, - { "Madagascar", "24,430,325", "35.2", 0 }, - { "Mali", "14,517,176", "11.7", 0 }, - { "Mauritania", "4,301,018", "3.4", 0 }, - { "Mozambique", "24,692,144", "28.7", 0 }, - { "Namibia", "2,113,077", "2.54", 0 }, - { "Niger", "20,672,987", "12.1", 0 }, - { "Nigeria", "185,989,640", "197.2", 0 }, - { "Somalia", "14,317,996", "19.31", 0 }, - { "South Africa", "54,956,900", "42.4", 0 }, - { "South Sudan", "12,340,000", "13.33", 0 }, - { "Sudan", "39,578,828", "21.3", 0 }, - { "Tanzania", "51,820,00", "47.5", 0 }, - { "Zambia", "16,212,000", "17.2", 0 }, - { 0, 0, 0, 0 } + { "Algeria", "40,400,000", "15.9", nullptr }, + { "Angola", "25,789,024", "20.69", nullptr }, + { "Botswana", "2,250,260", "3.7", nullptr }, + { "Cameroon", "22,534,532", "39.7", nullptr }, + { "Chad", "13,670,084", "8.6", nullptr }, + { "Egypt", "94,666,000", "87", nullptr }, + { "Ethiopia", "102,374,044", "92.7", nullptr }, + { "Ivory Coast", "23,740,424", "63.9", nullptr }, + { "Libya", "6,541,948", "3.55", nullptr }, + { "Madagascar", "24,430,325", "35.2", nullptr }, + { "Mali", "14,517,176", "11.7", nullptr }, + { "Mauritania", "4,301,018", "3.4", nullptr }, + { "Mozambique", "24,692,144", "28.7", nullptr }, + { "Namibia", "2,113,077", "2.54", nullptr }, + { "Niger", "20,672,987", "12.1", nullptr }, + { "Nigeria", "185,989,640", "197.2", nullptr }, + { "Somalia", "14,317,996", "19.31", nullptr }, + { "South Africa", "54,956,900", "42.4", nullptr }, + { "South Sudan", "12,340,000", "13.33", nullptr }, + { "Sudan", "39,578,828", "21.3", nullptr }, + { "Tanzania", "51,820,00", "47.5", nullptr }, + { "Zambia", "16,212,000", "17.2", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; Treeview::TreeItem Treeview::asia[] = { - { "Afghanistan", "34,656,032", "49.88", 0 }, - { "China", "1,403,500,365", "145.0", 0 }, - { "India", "1,324,171,354", "393.9", 0 }, - { "Indonesia", "261,115,456", "124.66", 0 }, - { "Iran", "80,829,192", "48.0", 0 }, - { "Iraq", "37,202,572", "82.7", 0 }, - { "Japan", "126,740,000", "336.0", 0 }, - { "Kazakhstan", "17,987,736", "6.49", 0 }, - { "Mongolia", "3,081,677", "1.97", 0 }, - { "Myanmar", "51,486,253", "76.0", 0 }, - { "Pakistan", "207,774,520", "244.4", 0 }, - { "Russia", "144,463,451", "8.4", 0 }, - { "Saudi Arabia", "33,000,000", "15.0", 0 }, - { "Thailand", "68,863,514", "132.1", 0 }, - { "Turkey", "79,814,871", "102.0", 0 }, - { "Turkmenistan", "5,662,544", "10.5", 0 }, - { "Uzbekistan", "32,979,000", "70.5", 0 }, - { "Vietnam", "94,569,072", "276.03", 0 }, - { "Yemen", "27,584,213", "44.7", 0 }, - { 0, 0, 0, 0 } + { "Afghanistan", "34,656,032", "49.88", nullptr }, + { "China", "1,403,500,365", "145.0", nullptr }, + { "India", "1,324,171,354", "393.9", nullptr }, + { "Indonesia", "261,115,456", "124.66", nullptr }, + { "Iran", "80,829,192", "48.0", nullptr }, + { "Iraq", "37,202,572", "82.7", nullptr }, + { "Japan", "126,740,000", "336.0", nullptr }, + { "Kazakhstan", "17,987,736", "6.49", nullptr }, + { "Mongolia", "3,081,677", "1.97", nullptr }, + { "Myanmar", "51,486,253", "76.0", nullptr }, + { "Pakistan", "207,774,520", "244.4", nullptr }, + { "Russia", "144,463,451", "8.4", nullptr }, + { "Saudi Arabia", "33,000,000", "15.0", nullptr }, + { "Thailand", "68,863,514", "132.1", nullptr }, + { "Turkey", "79,814,871", "102.0", nullptr }, + { "Turkmenistan", "5,662,544", "10.5", nullptr }, + { "Uzbekistan", "32,979,000", "70.5", nullptr }, + { "Vietnam", "94,569,072", "276.03", nullptr }, + { "Yemen", "27,584,213", "44.7", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; Treeview::TreeItem Treeview::europe[] = { - { "Austria", "8,794,267", "104.0", 0 }, - { "Belarus", "9,498,700", "45.8", 0 }, - { "Bulgaria", "7,101,859", "64.9", 0 }, - { "Czech Republic", "10,610,947", "134.0", 0 }, - { "Finland", "5,506,312", "16.0", 0 }, - { "France", "66,991,000", "103.0", 0 }, - { "Germany", "82,175,700", "227.0", 0 }, - { "Greece", "11,183,716", "82.0", 0 }, - { "Hungary", "9,797,561", "105.3", 0 }, - { "Iceland", "332,529", "3.2", 0 }, - { "Italy", "60,589,445", "201.3", 0 }, - { "Norway", "5,267,146", "15.8", 0 }, - { "Poland", "38,634,007", "123.0", 0 }, - { "Portugal", "10,309,573", "115.0", 0 }, - { "Romania", "19,638,000", "84.4", 0 }, - { "Serbia", "7,058,322", "91.1", 0 }, - { "Spain", "46,468,102", "92.0", 0 }, - { "Sweden", "10,065,389", "22.0", 0 }, - { "United Kingdom", "65,648,000", "270.7", 0 }, - { 0, 0, 0, 0 } + { "Austria", "8,794,267", "104.0", nullptr }, + { "Belarus", "9,498,700", "45.8", nullptr }, + { "Bulgaria", "7,101,859", "64.9", nullptr }, + { "Czech Republic", "10,610,947", "134.0", nullptr }, + { "Finland", "5,506,312", "16.0", nullptr }, + { "France", "66,991,000", "103.0", nullptr }, + { "Germany", "82,175,700", "227.0", nullptr }, + { "Greece", "11,183,716", "82.0", nullptr }, + { "Hungary", "9,797,561", "105.3", nullptr }, + { "Iceland", "332,529", "3.2", nullptr }, + { "Italy", "60,589,445", "201.3", nullptr }, + { "Norway", "5,267,146", "15.8", nullptr }, + { "Poland", "38,634,007", "123.0", nullptr }, + { "Portugal", "10,309,573", "115.0", nullptr }, + { "Romania", "19,638,000", "84.4", nullptr }, + { "Serbia", "7,058,322", "91.1", nullptr }, + { "Spain", "46,468,102", "92.0", nullptr }, + { "Sweden", "10,065,389", "22.0", nullptr }, + { "United Kingdom", "65,648,000", "270.7", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; Treeview::TreeItem Treeview::north_america[] = { - { "Canada", "35,151,728", "3.92", 0 }, - { "Cuba", "11,239,224", "102.3", 0 }, - { "Greenland", "56,483", "0.028", 0 }, - { "Guatemala", "16,582,469", "129.0", 0 }, - { "Honduras", "9,112,867", "64.0", 0 }, - { "Mexico", "119,530,753", "61.0", 0 }, - { "Nicaragua", "6,167,237", "51.0", 0 }, - { "USA", "325,365,189", "35.0", 0 }, - { 0, 0, 0, 0 } + { "Canada", "35,151,728", "3.92", nullptr }, + { "Cuba", "11,239,224", "102.3", nullptr }, + { "Greenland", "56,483", "0.028", nullptr }, + { "Guatemala", "16,582,469", "129.0", nullptr }, + { "Honduras", "9,112,867", "64.0", nullptr }, + { "Mexico", "119,530,753", "61.0", nullptr }, + { "Nicaragua", "6,167,237", "51.0", nullptr }, + { "USA", "325,365,189", "35.0", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; Treeview::TreeItem Treeview::south_america[] = { - { "Argentina", "43,847,430", "14.4", 0 }, - { "Bolivia", "11,410,651", "10.4", 0 }, - { "Brazil", "208,064,000", "24.35", 0 }, - { "Chile", "18,006,407", "24.0", 0 }, - { "Colombia", "49,364,592", "40.74", 0 }, - { "Ecuador", "16,385,068", "58.95", 0 }, - { "Guyana", "773,303", "3.502", 0 }, - { "Paraguay", "6,725,308", "17.2", 0 }, - { "Peru", "31,826,018", "23.0", 0 }, - { "Venezuela", "31,568,179", "33.75", 0 }, - { 0, 0, 0, 0 } + { "Argentina", "43,847,430", "14.4", nullptr }, + { "Bolivia", "11,410,651", "10.4", nullptr }, + { "Brazil", "208,064,000", "24.35", nullptr }, + { "Chile", "18,006,407", "24.0", nullptr }, + { "Colombia", "49,364,592", "40.74", nullptr }, + { "Ecuador", "16,385,068", "58.95", nullptr }, + { "Guyana", "773,303", "3.502", nullptr }, + { "Paraguay", "6,725,308", "17.2", nullptr }, + { "Peru", "31,826,018", "23.0", nullptr }, + { "Venezuela", "31,568,179", "33.75", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; Treeview::TreeItem Treeview::oceania[] = { - { "Australia", "24,675,900", "3.2", 0 }, - { "Papua New Guinea", "7,059,653", "15.0", 0 }, - { "Papua", "3,486,432", "11.0", 0 }, - { "New Zealand", "4,823,090", "17.5", 0 }, - { "West Papua", "877,437", "6.3", 0 }, - { "Solomon Islands", "599,419", "18.1", 0 }, - { "New Caledonia", "268,767", "14.5", 0 }, - { "Fiji", "898,76", "46.4", 0 }, - { "Hawaii", "1,428,557", "82.6", 0 }, - { "Vanuatu", "270,402", "19.7", 0 }, - { "French Polynesia", "280,208", "76.0", 0 }, - { "Samoa", "192,342", "68.0", 0 }, - { "Kiribati", "110,136", "152.0", 0 }, - { 0, 0, 0, 0 } + { "Australia", "24,675,900", "3.2", nullptr }, + { "Papua New Guinea", "7,059,653", "15.0", nullptr }, + { "Papua", "3,486,432", "11.0", nullptr }, + { "New Zealand", "4,823,090", "17.5", nullptr }, + { "West Papua", "877,437", "6.3", nullptr }, + { "Solomon Islands", "599,419", "18.1", nullptr }, + { "New Caledonia", "268,767", "14.5", nullptr }, + { "Fiji", "898,76", "46.4", nullptr }, + { "Hawaii", "1,428,557", "82.6", nullptr }, + { "Vanuatu", "270,402", "19.7", nullptr }, + { "French Polynesia", "280,208", "76.0", nullptr }, + { "Samoa", "192,342", "68.0", nullptr }, + { "Kiribati", "110,136", "152.0", nullptr }, + { nullptr, nullptr, nullptr, nullptr } }; // constructors and destructor @@ -329,7 +329,7 @@ Treeview::Treeview (finalcut::FWidget* parent) { "Europe", "733,000,000", "69.9", europe }, { "North America", "523,000,000", "21", north_america }, { "South America", "381,000,000", "21.4", south_america }, - { "Antarctica", "1000", "0", 0 }, + { "Antarctica", "1000", "0", nullptr }, { "Australia/Oceania", "34,000,000", "4", oceania } }; diff --git a/examples/ui.cpp b/examples/ui.cpp index dae6bffd..8bb5e7cc 100644 --- a/examples/ui.cpp +++ b/examples/ui.cpp @@ -48,7 +48,7 @@ class ProgressDialog : public finalcut::FDialog ProgressDialog (const ProgressDialog&) = delete; // Destructor - ~ProgressDialog(); + ~ProgressDialog() override; // Disable assignment operator (=) ProgressDialog& operator = (const ProgressDialog&) = delete; @@ -191,7 +191,7 @@ class TextWindow : public finalcut::FDialog TextWindow (const TextWindow&) = delete; // Destructor - ~TextWindow(); + ~TextWindow() override; // Disable assignment operator (=) TextWindow& operator = (const TextWindow&) = delete; @@ -257,7 +257,7 @@ class MyDialog : public finalcut::FDialog MyDialog (const MyDialog&) = delete; // Destructor - ~MyDialog(); + ~MyDialog() override; // Disable assignment operator (=) MyDialog& operator = (const MyDialog&) = delete; diff --git a/examples/watch.cpp b/examples/watch.cpp index 400967c1..914234ab 100644 --- a/examples/watch.cpp +++ b/examples/watch.cpp @@ -41,7 +41,7 @@ class Watch : public finalcut::FDialog Watch (const Watch&) = delete; // Destructor - ~Watch(); + ~Watch() override; // Disable assignment operator (=) Watch& operator = (const Watch&) = delete; @@ -126,7 +126,7 @@ void Watch::printTime() finalcut::FString str{}; std::tm now{}; - const std::time_t t = std::time(0); // get current time + const std::time_t t = std::time(nullptr); // get current time localtime_r(&t, &now); if ( sec ) diff --git a/examples/windows.cpp b/examples/windows.cpp index 4612dd80..fb545804 100644 --- a/examples/windows.cpp +++ b/examples/windows.cpp @@ -42,7 +42,7 @@ class SmallWindow : public finalcut::FDialog SmallWindow (const SmallWindow&) = delete; // Destructor - ~SmallWindow(); + ~SmallWindow() override; // Disable assignment operator (=) SmallWindow& operator = (const SmallWindow&) = delete; @@ -173,7 +173,7 @@ class Window : public finalcut::FDialog Window (const Window&) = delete; // Destructor - ~Window(); + ~Window() override; // Disable assignment operator (=) Window& operator = (const Window&) = delete; diff --git a/src/fapplication.cpp b/src/fapplication.cpp index 99234e40..3eabbbeb 100644 --- a/src/fapplication.cpp +++ b/src/fapplication.cpp @@ -298,7 +298,7 @@ FWidget* FApplication::processParameters (const int& argc, char* argv[]) getStartOptions().setDefault(); cmd_options (argc, argv); - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -414,20 +414,20 @@ void FApplication::cmd_options (const int& argc, char* argv[]) { static struct option long_options[] = { - {C_STR("encoding"), required_argument, 0, 0 }, - {C_STR("no-mouse"), no_argument, 0, 0 }, - {C_STR("no-optimized-cursor"), no_argument, 0, 0 }, - {C_STR("no-terminal-detection"), no_argument, 0, 0 }, - {C_STR("no-color-change"), no_argument, 0, 0 }, - {C_STR("no-sgr-optimizer"), no_argument, 0, 0 }, - {C_STR("vgafont"), no_argument, 0, 0 }, - {C_STR("newfont"), no_argument, 0, 0 }, + {C_STR("encoding"), required_argument, nullptr, 0 }, + {C_STR("no-mouse"), no_argument, nullptr, 0 }, + {C_STR("no-optimized-cursor"), no_argument, nullptr, 0 }, + {C_STR("no-terminal-detection"), no_argument, nullptr, 0 }, + {C_STR("no-color-change"), no_argument, nullptr, 0 }, + {C_STR("no-sgr-optimizer"), no_argument, nullptr, 0 }, + {C_STR("vgafont"), no_argument, nullptr, 0 }, + {C_STR("newfont"), no_argument, nullptr, 0 }, #if defined(__FreeBSD__) || defined(__DragonFly__) - {C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 }, - {C_STR("no-cursorstyle-change"), no_argument, 0, 0 }, + {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, + {C_STR("no-cursorstyle-change"), no_argument, nullptr, 0 }, #elif defined(__NetBSD__) || defined(__OpenBSD__) - {C_STR("no-esc-for-alt-meta"), no_argument, 0, 0 }, + {C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, #endif {nullptr, 0, nullptr, 0 } @@ -719,7 +719,7 @@ bool FApplication::processDialogSwitchAccelerator() } //---------------------------------------------------------------------- -bool FApplication::processAccelerator (const FWidget*& widget) +bool FApplication::processAccelerator (const FWidget* const& widget) { bool accpt{false}; @@ -750,7 +750,7 @@ bool FApplication::processAccelerator (const FWidget*& widget) sendEvent (iter->object, &a_ev); accpt = a_ev.isAccepted(); break; - }; + } ++iter; } @@ -800,7 +800,7 @@ FWidget*& FApplication::determineClickedWidget() { // Determine the widget at the current click position auto child = window->childWidgetAt (mouse_position); - clicked = ( child != 0 ) ? child : window; + clicked = ( child != nullptr ) ? child : window; setClickedWidget (clicked); } diff --git a/src/fbuttongroup.cpp b/src/fbuttongroup.cpp index 7578ab96..96440c93 100644 --- a/src/fbuttongroup.cpp +++ b/src/fbuttongroup.cpp @@ -75,10 +75,10 @@ FButtonGroup::~FButtonGroup() // destructor FToggleButton* FButtonGroup::getButton (int index) const { if ( buttonlist.empty() ) - return 0; + return nullptr; if ( index <= 0 || index > int(getCount()) ) - return 0; + return nullptr; auto iter = buttonlist.begin(); std::advance (iter, index - 1); diff --git a/src/fcombobox.cpp b/src/fcombobox.cpp index 0f1dab68..9300a47a 100644 --- a/src/fcombobox.cpp +++ b/src/fcombobox.cpp @@ -595,7 +595,7 @@ void FComboBox::onePosDown() } //---------------------------------------------------------------------- -void FComboBox::passEventToListWindow (FMouseEvent*& ev) +void FComboBox::passEventToListWindow (FMouseEvent* const& ev) { // Mouse event handover to list window diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index e574da1f..58dd3fce 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -204,7 +204,7 @@ void FFileDialog::setPath (const FString& dir) return; } - if ( fsystem->realpath(dir.c_str(), resolved_path) != 0 ) + if ( fsystem->realpath(dir.c_str(), resolved_path) != nullptr ) r_dir.setString(resolved_path); else r_dir.setString(dir); @@ -460,7 +460,7 @@ sInt64 FFileDialog::numOfDirs() const sInt64 n = std::count_if ( std::begin(dir_entries) , std::end(dir_entries) - , [] (dir_entry& entry) + , [] (const dir_entry& entry) { return entry.directory && std::strcmp(entry.name, ".") != 0; @@ -614,7 +614,7 @@ void FFileDialog::followSymLink (const char* const dir, dir_entry& entry) , sizeof(symLink) - std::strlen(symLink) - 1); symLink[sizeof(symLink) - 1] = '\0'; - if ( fsystem->realpath(symLink, resolved_path) == 0 ) + if ( fsystem->realpath(symLink, resolved_path) == nullptr ) return; // Cannot follow the symlink if ( lstat(resolved_path, &sb) == -1 ) @@ -789,7 +789,7 @@ void FFileDialog::cb_processActivate (FWidget*, FDataPtr) { found = std::any_of ( std::begin(dir_entries) , std::end(dir_entries) - , [&input] (dir_entry& entry) + , [&input] (const dir_entry& entry) { return entry.name && input diff --git a/src/fkey_map.cpp b/src/fkey_map.cpp index 07c9e8a0..d0396424 100644 --- a/src/fkey_map.cpp +++ b/src/fkey_map.cpp @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2018-2019 Markus Gans * +* Copyright 2018-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -32,177 +32,177 @@ namespace fc FKeyMap fkey[] = { - { fc::Fkey_backspace , 0, "kb" }, // backspace key - { fc::Fkey_catab , 0, "ka" }, // clear-all-tabs key - { fc::Fkey_clear , 0, "kC" }, // clear-screen or erase key - { fc::Fkey_ctab , 0, "kt" }, // clear-tab key - { fc::Fkey_dc , 0, "kD" }, // delete-character key - { fc::Fkey_dc , 0, "kDx"}, // keypad delete - { fc::Fkey_dl , 0, "kL" }, // delete-line key - { fc::Fkey_down , 0, "kd" }, // down-arrow key - { fc::Fkey_down , 0, "kdx"}, // down-arrow key - { fc::Fkey_eic , 0, "kM" }, // sent by rmir or smir in insert mode - { fc::Fkey_eol , 0, "kE" }, // clear-to-end-of-line key - { fc::Fkey_eos , 0, "kS" }, // clear-to-end-of-screen key - { fc::Fkey_f0 , 0, "k0" }, // F0 function key - { fc::Fkey_f1 , 0, "k1" }, // F1 function key - { fc::Fkey_f1 , 0, "k1x"}, // F1 function key - { fc::Fkey_f1 , 0, "k1X"}, // F1 function key - { fc::Fkey_f2 , 0, "k2" }, // F2 function key - { fc::Fkey_f2 , 0, "k2x"}, // F2 function key - { fc::Fkey_f2 , 0, "k2X"}, // F2 function key - { fc::Fkey_f3 , 0, "k3" }, // F3 function key - { fc::Fkey_f3 , 0, "k3x"}, // F3 function key - { fc::Fkey_f3 , 0, "k3X"}, // F3 function key - { fc::Fkey_f4 , 0, "k4" }, // F4 function key - { fc::Fkey_f4 , 0, "k4x"}, // F4 function key - { fc::Fkey_f4 , 0, "k4X"}, // F4 function key - { fc::Fkey_f5 , 0, "k5" }, // F5 function key - { fc::Fkey_f6 , 0, "k6" }, // F6 function key - { fc::Fkey_f7 , 0, "k7" }, // F7 function key - { fc::Fkey_f8 , 0, "k8" }, // F8 fucntion key - { fc::Fkey_f9 , 0, "k9" }, // F9 function key - { fc::Fkey_f10 , 0, "k;" }, // F10 function key - { fc::Fkey_home , 0, "kh" }, // home key - { fc::Fkey_home , 0, "khx"}, // home key - { fc::Fkey_ic , 0, "kI" }, // insert-character key - { fc::Fkey_il , 0, "kA" }, // insert-line key - { fc::Fkey_left , 0, "kl" }, // left-arrow key - { fc::Fkey_left , 0, "klx"}, // left-arrow key - { fc::Fkey_ll , 0, "kH" }, // last-line key - { fc::Fkey_npage , 0, "kN" }, // next-page key - { fc::Fkey_ppage , 0, "kP" }, // prev-page key - { fc::Fkey_right , 0, "kr" }, // right-arrow key - { fc::Fkey_right , 0, "krx"}, // right-arrow key - { fc::Fkey_sf , 0, "kF" }, // scroll-forward key (shift-up) - { fc::Fkey_sr , 0, "kR" }, // scroll-backward key (shift-down) - { fc::Fkey_stab , 0, "kT" }, // set-tab key - { fc::Fkey_up , 0, "ku" }, // up-arrow key - { fc::Fkey_up , 0, "kux"}, // up-arrow key - { fc::Fkey_a1 , 0, "K1" }, // upper left of keypad - { fc::Fkey_a3 , 0, "K3" }, // upper right of keypad - { fc::Fkey_b2 , 0, "K2" }, // center of keypad - { fc::Fkey_c1 , 0, "K4" }, // lower left of keypad - { fc::Fkey_c3 , 0, "K5" }, // lower right of keypad - { fc::Fkey_btab , 0, "kB" }, // back-tab key - { fc::Fkey_beg , 0, "@1" }, // begin key - { fc::Fkey_cancel , 0, "@2" }, // cancel key - { fc::Fkey_close , 0, "@3" }, // close key - { fc::Fkey_command , 0, "@4" }, // command key - { fc::Fkey_copy , 0, "@5" }, // copy key - { fc::Fkey_create , 0, "@6" }, // create key - { fc::Fkey_end , 0, "@7" }, // end key - { fc::Fkey_end , 0, "@7x"}, // end key - { fc::Fkey_end , 0, "@7X"}, // end key - { fc::Fkey_enter , 0, "@8" }, // enter/send key - { fc::Fkey_enter , 0, "@8x"}, // enter/send key - { fc::Fkey_exit , 0, "@9" }, // exit key - { fc::Fkey_find , 0, "@0" }, // find key - { fc::Fkey_slash , 0, "KP1"}, // keypad slash - { fc::Fkey_asterisk , 0, "KP2"}, // keypad asterisk - { fc::Fkey_minus_sign, 0, "KP3"}, // keypad minus sign - { fc::Fkey_plus_sign , 0, "KP4"}, // keypad plus sign - { fc::Fkey_help , 0, "%1" }, // help key - { fc::Fkey_mark , 0, "%2" }, // mark key - { fc::Fkey_message , 0, "%3" }, // message key - { fc::Fkey_move , 0, "%4" }, // move key - { fc::Fkey_next , 0, "%5" }, // next key - { fc::Fkey_open , 0, "%6" }, // open key - { fc::Fkey_options , 0, "%7" }, // options key - { fc::Fkey_previous , 0, "%8" }, // previous key - { fc::Fkey_print , 0, "%9" }, // print key - { fc::Fkey_redo , 0, "%0" }, // redo key - { fc::Fkey_reference , 0, "&1" }, // reference key - { fc::Fkey_refresh , 0, "&2" }, // refresh key - { fc::Fkey_replace , 0, "&3" }, // replace key - { fc::Fkey_restart , 0, "&4" }, // restart key - { fc::Fkey_resume , 0, "&5" }, // resume key - { fc::Fkey_save , 0, "&6" }, // save key - { fc::Fkey_suspend , 0, "&7" }, // suspend key - { fc::Fkey_undo , 0, "&8" }, // undo key - { fc::Fkey_sbeg , 0, "&9" }, // shifted begin key - { fc::Fkey_scancel , 0, "&0" }, // shifted cancel key - { fc::Fkey_scommand , 0, "*1" }, // shifted command key - { fc::Fkey_scopy , 0, "*2" }, // shifted copy key - { fc::Fkey_screate , 0, "*3" }, // shifted create key - { fc::Fkey_sdc , 0, "*4" }, // shifted delete-character key - { fc::Fkey_sdl , 0, "*5" }, // shifted delete-line key - { fc::Fkey_select , 0, "*6" }, // select key - { fc::Fkey_send , 0, "*7" }, // shifted end key - { fc::Fkey_seol , 0, "*8" }, // shifted clear-to-end-of-line key - { fc::Fkey_sexit , 0, "*9" }, // shifted exit key - { fc::Fkey_sfind , 0, "*0" }, // shifted find key - { fc::Fkey_shelp , 0, "#1" }, // shifted help key - { fc::Fkey_shome , 0, "#2" }, // shifted home key - { fc::Fkey_sic , 0, "#3" }, // shifted insert-character key - { fc::Fkey_sleft , 0, "#4" }, // shifted left-arrow key - { fc::Fkey_smessage , 0, "%a" }, // shifted message key - { fc::Fkey_smove , 0, "%b" }, // shifted move key - { fc::Fkey_snext , 0, "%c" }, // shifted next key - { fc::Fkey_soptions , 0, "%d" }, // shifted options key - { fc::Fkey_sprevious , 0, "%e" }, // shifted previous key - { fc::Fkey_sprint , 0, "%f" }, // shifted print key - { fc::Fkey_sredo , 0, "%g" }, // shifted redo key - { fc::Fkey_sreplace , 0, "%h" }, // shifted replace key - { fc::Fkey_sright , 0, "%i" }, // shifted right-arrow key - { fc::Fkey_srsume , 0, "%j" }, // shifted resume key - { fc::Fkey_ssave , 0, "!1" }, // shifted save key - { fc::Fkey_ssuspend , 0, "!2" }, // shifted suspend key - { fc::Fkey_sundo , 0, "!3" }, // shifted undo key - { fc::Fkey_f11 , 0, "F1" }, // F11 function key - { fc::Fkey_f12 , 0, "F2" }, // F12 function key - { fc::Fkey_f13 , 0, "F3" }, // F13 function key - { fc::Fkey_f14 , 0, "F4" }, // F14 function key - { fc::Fkey_f15 , 0, "F5" }, // F15 function key - { fc::Fkey_f16 , 0, "F6" }, // F16 function key - { fc::Fkey_f17 , 0, "F7" }, // F17 function key - { fc::Fkey_f18 , 0, "F8" }, // F18 function key - { fc::Fkey_f19 , 0, "F9" }, // F19 function key - { fc::Fkey_f20 , 0, "FA" }, // F20 function key - { fc::Fkey_f21 , 0, "FB" }, // F21 function key - { fc::Fkey_f22 , 0, "FC" }, // F22 function key - { fc::Fkey_f23 , 0, "FD" }, // F23 function key - { fc::Fkey_f24 , 0, "FE" }, // F24 function key - { fc::Fkey_f25 , 0, "FF" }, // F25 function key - { fc::Fkey_f26 , 0, "FG" }, // F26 function key - { fc::Fkey_f27 , 0, "FH" }, // F27 function key - { fc::Fkey_f28 , 0, "FI" }, // F28 function key - { fc::Fkey_f29 , 0, "FJ" }, // F29 function key - { fc::Fkey_f30 , 0, "FK" }, // F30 function key - { fc::Fkey_f31 , 0, "FL" }, // F31 function key - { fc::Fkey_f32 , 0, "FM" }, // F32 function key - { fc::Fkey_f33 , 0, "FN" }, // F33 function key - { fc::Fkey_f34 , 0, "FO" }, // F34 function key - { fc::Fkey_f35 , 0, "FP" }, // F35 function key - { fc::Fkey_f36 , 0, "FQ" }, // F36 function key - { fc::Fkey_f37 , 0, "FR" }, // F37 function key - { fc::Fkey_f38 , 0, "FS" }, // F38 function key - { fc::Fkey_f39 , 0, "FT" }, // F39 function key - { fc::Fkey_f40 , 0, "FU" }, // F40 function key - { fc::Fkey_f41 , 0, "FV" }, // F41 function key - { fc::Fkey_f42 , 0, "FW" }, // F42 function key - { fc::Fkey_f43 , 0, "FX" }, // F43 function key - { fc::Fkey_f44 , 0, "FY" }, // F44 function key - { fc::Fkey_f45 , 0, "FZ" }, // F45 function key - { fc::Fkey_f46 , 0, "Fa" }, // F46 function key - { fc::Fkey_f47 , 0, "Fb" }, // F47 function key - { fc::Fkey_f48 , 0, "Fc" }, // F48 function key - { fc::Fkey_f49 , 0, "Fd" }, // F49 function key - { fc::Fkey_f50 , 0, "Fe" }, // F50 function key - { fc::Fkey_f51 , 0, "Ff" }, // F51 function key - { fc::Fkey_f52 , 0, "Fg" }, // F52 function key - { fc::Fkey_f53 , 0, "Fh" }, // F53 function key - { fc::Fkey_f54 , 0, "Fi" }, // F54 function key - { fc::Fkey_f55 , 0, "Fj" }, // F55 function key - { fc::Fkey_f56 , 0, "Fk" }, // F56 function key - { fc::Fkey_f57 , 0, "Fl" }, // F57 function key - { fc::Fkey_f58 , 0, "Fm" }, // F58 function key - { fc::Fkey_f59 , 0, "Fn" }, // F59 function key - { fc::Fkey_f60 , 0, "Fo" }, // F60 function key - { fc::Fkey_f61 , 0, "Fp" }, // F61 function key - { fc::Fkey_f62 , 0, "Fq" }, // F62 function key - { fc::Fkey_f63 , 0, "Fr" }, // F63 function key - { 0 , 0, "\0" } + { fc::Fkey_backspace , nullptr, "kb" }, // backspace key + { fc::Fkey_catab , nullptr, "ka" }, // clear-all-tabs key + { fc::Fkey_clear , nullptr, "kC" }, // clear-screen or erase key + { fc::Fkey_ctab , nullptr, "kt" }, // clear-tab key + { fc::Fkey_dc , nullptr, "kD" }, // delete-character key + { fc::Fkey_dc , nullptr, "kDx"}, // keypad delete + { fc::Fkey_dl , nullptr, "kL" }, // delete-line key + { fc::Fkey_down , nullptr, "kd" }, // down-arrow key + { fc::Fkey_down , nullptr, "kdx"}, // down-arrow key + { fc::Fkey_eic , nullptr, "kM" }, // sent by rmir or smir in insert mode + { fc::Fkey_eol , nullptr, "kE" }, // clear-to-end-of-line key + { fc::Fkey_eos , nullptr, "kS" }, // clear-to-end-of-screen key + { fc::Fkey_f0 , nullptr, "k0" }, // F0 function key + { fc::Fkey_f1 , nullptr, "k1" }, // F1 function key + { fc::Fkey_f1 , nullptr, "k1x"}, // F1 function key + { fc::Fkey_f1 , nullptr, "k1X"}, // F1 function key + { fc::Fkey_f2 , nullptr, "k2" }, // F2 function key + { fc::Fkey_f2 , nullptr, "k2x"}, // F2 function key + { fc::Fkey_f2 , nullptr, "k2X"}, // F2 function key + { fc::Fkey_f3 , nullptr, "k3" }, // F3 function key + { fc::Fkey_f3 , nullptr, "k3x"}, // F3 function key + { fc::Fkey_f3 , nullptr, "k3X"}, // F3 function key + { fc::Fkey_f4 , nullptr, "k4" }, // F4 function key + { fc::Fkey_f4 , nullptr, "k4x"}, // F4 function key + { fc::Fkey_f4 , nullptr, "k4X"}, // F4 function key + { fc::Fkey_f5 , nullptr, "k5" }, // F5 function key + { fc::Fkey_f6 , nullptr, "k6" }, // F6 function key + { fc::Fkey_f7 , nullptr, "k7" }, // F7 function key + { fc::Fkey_f8 , nullptr, "k8" }, // F8 fucntion key + { fc::Fkey_f9 , nullptr, "k9" }, // F9 function key + { fc::Fkey_f10 , nullptr, "k;" }, // F10 function key + { fc::Fkey_home , nullptr, "kh" }, // home key + { fc::Fkey_home , nullptr, "khx"}, // home key + { fc::Fkey_ic , nullptr, "kI" }, // insert-character key + { fc::Fkey_il , nullptr, "kA" }, // insert-line key + { fc::Fkey_left , nullptr, "kl" }, // left-arrow key + { fc::Fkey_left , nullptr, "klx"}, // left-arrow key + { fc::Fkey_ll , nullptr, "kH" }, // last-line key + { fc::Fkey_npage , nullptr, "kN" }, // next-page key + { fc::Fkey_ppage , nullptr, "kP" }, // prev-page key + { fc::Fkey_right , nullptr, "kr" }, // right-arrow key + { fc::Fkey_right , nullptr, "krx"}, // right-arrow key + { fc::Fkey_sf , nullptr, "kF" }, // scroll-forward key (shift-up) + { fc::Fkey_sr , nullptr, "kR" }, // scroll-backward key (shift-down) + { fc::Fkey_stab , nullptr, "kT" }, // set-tab key + { fc::Fkey_up , nullptr, "ku" }, // up-arrow key + { fc::Fkey_up , nullptr, "kux"}, // up-arrow key + { fc::Fkey_a1 , nullptr, "K1" }, // upper left of keypad + { fc::Fkey_a3 , nullptr, "K3" }, // upper right of keypad + { fc::Fkey_b2 , nullptr, "K2" }, // center of keypad + { fc::Fkey_c1 , nullptr, "K4" }, // lower left of keypad + { fc::Fkey_c3 , nullptr, "K5" }, // lower right of keypad + { fc::Fkey_btab , nullptr, "kB" }, // back-tab key + { fc::Fkey_beg , nullptr, "@1" }, // begin key + { fc::Fkey_cancel , nullptr, "@2" }, // cancel key + { fc::Fkey_close , nullptr, "@3" }, // close key + { fc::Fkey_command , nullptr, "@4" }, // command key + { fc::Fkey_copy , nullptr, "@5" }, // copy key + { fc::Fkey_create , nullptr, "@6" }, // create key + { fc::Fkey_end , nullptr, "@7" }, // end key + { fc::Fkey_end , nullptr, "@7x"}, // end key + { fc::Fkey_end , nullptr, "@7X"}, // end key + { fc::Fkey_enter , nullptr, "@8" }, // enter/send key + { fc::Fkey_enter , nullptr, "@8x"}, // enter/send key + { fc::Fkey_exit , nullptr, "@9" }, // exit key + { fc::Fkey_find , nullptr, "@0" }, // find key + { fc::Fkey_slash , nullptr, "KP1"}, // keypad slash + { fc::Fkey_asterisk , nullptr, "KP2"}, // keypad asterisk + { fc::Fkey_minus_sign, nullptr, "KP3"}, // keypad minus sign + { fc::Fkey_plus_sign , nullptr, "KP4"}, // keypad plus sign + { fc::Fkey_help , nullptr, "%1" }, // help key + { fc::Fkey_mark , nullptr, "%2" }, // mark key + { fc::Fkey_message , nullptr, "%3" }, // message key + { fc::Fkey_move , nullptr, "%4" }, // move key + { fc::Fkey_next , nullptr, "%5" }, // next key + { fc::Fkey_open , nullptr, "%6" }, // open key + { fc::Fkey_options , nullptr, "%7" }, // options key + { fc::Fkey_previous , nullptr, "%8" }, // previous key + { fc::Fkey_print , nullptr, "%9" }, // print key + { fc::Fkey_redo , nullptr, "%0" }, // redo key + { fc::Fkey_reference , nullptr, "&1" }, // reference key + { fc::Fkey_refresh , nullptr, "&2" }, // refresh key + { fc::Fkey_replace , nullptr, "&3" }, // replace key + { fc::Fkey_restart , nullptr, "&4" }, // restart key + { fc::Fkey_resume , nullptr, "&5" }, // resume key + { fc::Fkey_save , nullptr, "&6" }, // save key + { fc::Fkey_suspend , nullptr, "&7" }, // suspend key + { fc::Fkey_undo , nullptr, "&8" }, // undo key + { fc::Fkey_sbeg , nullptr, "&9" }, // shifted begin key + { fc::Fkey_scancel , nullptr, "&0" }, // shifted cancel key + { fc::Fkey_scommand , nullptr, "*1" }, // shifted command key + { fc::Fkey_scopy , nullptr, "*2" }, // shifted copy key + { fc::Fkey_screate , nullptr, "*3" }, // shifted create key + { fc::Fkey_sdc , nullptr, "*4" }, // shifted delete-character key + { fc::Fkey_sdl , nullptr, "*5" }, // shifted delete-line key + { fc::Fkey_select , nullptr, "*6" }, // select key + { fc::Fkey_send , nullptr, "*7" }, // shifted end key + { fc::Fkey_seol , nullptr, "*8" }, // shifted clear-to-end-of-line key + { fc::Fkey_sexit , nullptr, "*9" }, // shifted exit key + { fc::Fkey_sfind , nullptr, "*0" }, // shifted find key + { fc::Fkey_shelp , nullptr, "#1" }, // shifted help key + { fc::Fkey_shome , nullptr, "#2" }, // shifted home key + { fc::Fkey_sic , nullptr, "#3" }, // shifted insert-character key + { fc::Fkey_sleft , nullptr, "#4" }, // shifted left-arrow key + { fc::Fkey_smessage , nullptr, "%a" }, // shifted message key + { fc::Fkey_smove , nullptr, "%b" }, // shifted move key + { fc::Fkey_snext , nullptr, "%c" }, // shifted next key + { fc::Fkey_soptions , nullptr, "%d" }, // shifted options key + { fc::Fkey_sprevious , nullptr, "%e" }, // shifted previous key + { fc::Fkey_sprint , nullptr, "%f" }, // shifted print key + { fc::Fkey_sredo , nullptr, "%g" }, // shifted redo key + { fc::Fkey_sreplace , nullptr, "%h" }, // shifted replace key + { fc::Fkey_sright , nullptr, "%i" }, // shifted right-arrow key + { fc::Fkey_srsume , nullptr, "%j" }, // shifted resume key + { fc::Fkey_ssave , nullptr, "!1" }, // shifted save key + { fc::Fkey_ssuspend , nullptr, "!2" }, // shifted suspend key + { fc::Fkey_sundo , nullptr, "!3" }, // shifted undo key + { fc::Fkey_f11 , nullptr, "F1" }, // F11 function key + { fc::Fkey_f12 , nullptr, "F2" }, // F12 function key + { fc::Fkey_f13 , nullptr, "F3" }, // F13 function key + { fc::Fkey_f14 , nullptr, "F4" }, // F14 function key + { fc::Fkey_f15 , nullptr, "F5" }, // F15 function key + { fc::Fkey_f16 , nullptr, "F6" }, // F16 function key + { fc::Fkey_f17 , nullptr, "F7" }, // F17 function key + { fc::Fkey_f18 , nullptr, "F8" }, // F18 function key + { fc::Fkey_f19 , nullptr, "F9" }, // F19 function key + { fc::Fkey_f20 , nullptr, "FA" }, // F20 function key + { fc::Fkey_f21 , nullptr, "FB" }, // F21 function key + { fc::Fkey_f22 , nullptr, "FC" }, // F22 function key + { fc::Fkey_f23 , nullptr, "FD" }, // F23 function key + { fc::Fkey_f24 , nullptr, "FE" }, // F24 function key + { fc::Fkey_f25 , nullptr, "FF" }, // F25 function key + { fc::Fkey_f26 , nullptr, "FG" }, // F26 function key + { fc::Fkey_f27 , nullptr, "FH" }, // F27 function key + { fc::Fkey_f28 , nullptr, "FI" }, // F28 function key + { fc::Fkey_f29 , nullptr, "FJ" }, // F29 function key + { fc::Fkey_f30 , nullptr, "FK" }, // F30 function key + { fc::Fkey_f31 , nullptr, "FL" }, // F31 function key + { fc::Fkey_f32 , nullptr, "FM" }, // F32 function key + { fc::Fkey_f33 , nullptr, "FN" }, // F33 function key + { fc::Fkey_f34 , nullptr, "FO" }, // F34 function key + { fc::Fkey_f35 , nullptr, "FP" }, // F35 function key + { fc::Fkey_f36 , nullptr, "FQ" }, // F36 function key + { fc::Fkey_f37 , nullptr, "FR" }, // F37 function key + { fc::Fkey_f38 , nullptr, "FS" }, // F38 function key + { fc::Fkey_f39 , nullptr, "FT" }, // F39 function key + { fc::Fkey_f40 , nullptr, "FU" }, // F40 function key + { fc::Fkey_f41 , nullptr, "FV" }, // F41 function key + { fc::Fkey_f42 , nullptr, "FW" }, // F42 function key + { fc::Fkey_f43 , nullptr, "FX" }, // F43 function key + { fc::Fkey_f44 , nullptr, "FY" }, // F44 function key + { fc::Fkey_f45 , nullptr, "FZ" }, // F45 function key + { fc::Fkey_f46 , nullptr, "Fa" }, // F46 function key + { fc::Fkey_f47 , nullptr, "Fb" }, // F47 function key + { fc::Fkey_f48 , nullptr, "Fc" }, // F48 function key + { fc::Fkey_f49 , nullptr, "Fd" }, // F49 function key + { fc::Fkey_f50 , nullptr, "Fe" }, // F50 function key + { fc::Fkey_f51 , nullptr, "Ff" }, // F51 function key + { fc::Fkey_f52 , nullptr, "Fg" }, // F52 function key + { fc::Fkey_f53 , nullptr, "Fh" }, // F53 function key + { fc::Fkey_f54 , nullptr, "Fi" }, // F54 function key + { fc::Fkey_f55 , nullptr, "Fj" }, // F55 function key + { fc::Fkey_f56 , nullptr, "Fk" }, // F56 function key + { fc::Fkey_f57 , nullptr, "Fl" }, // F57 function key + { fc::Fkey_f58 , nullptr, "Fm" }, // F58 function key + { fc::Fkey_f59 , nullptr, "Fn" }, // F59 function key + { fc::Fkey_f60 , nullptr, "Fo" }, // F60 function key + { fc::Fkey_f61 , nullptr, "Fp" }, // F61 function key + { fc::Fkey_f62 , nullptr, "Fq" }, // F62 function key + { fc::Fkey_f63 , nullptr, "Fr" }, // F63 function key + { 0 , nullptr, "\0" } }; FMetakeyMap fmetakey[] = diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 4bd40b79..87230f63 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -124,7 +124,7 @@ bool FKeyboard::isKeyPressed() FD_SET(stdin_no, &ifds); tv.tv_sec = 0; tv.tv_usec = 100000; // 100 ms - const int result = select (stdin_no + 1, &ifds, 0, 0, &tv); + const int result = select (stdin_no + 1, &ifds, nullptr, nullptr, &tv); if ( result > 0 && FD_ISSET(stdin_no, &ifds) ) FD_CLR (stdin_no, &ifds); diff --git a/src/flineedit.cpp b/src/flineedit.cpp index 5526cfde..46c857e5 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -1107,10 +1107,7 @@ inline bool FLineEdit::keyInput (FKey key) else if ( len > 0 ) { if ( insert_mode ) - { text.insert(ch, cursor_pos); - len++; - } else text.overwrite(ch, cursor_pos); } diff --git a/src/fmenu.cpp b/src/fmenu.cpp index a7844965..0cec0142 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -895,7 +895,7 @@ void FMenu::mouseMoveOverBorder (mouseStates& ms) } //---------------------------------------------------------------------- -void FMenu::passEventToSubMenu (FMouseEvent*& ev) +void FMenu::passEventToSubMenu (FMouseEvent* const& ev) { // Mouse event handover to sub-menu @@ -918,7 +918,7 @@ void FMenu::passEventToSubMenu (FMouseEvent*& ev) } //---------------------------------------------------------------------- -void FMenu::passEventToSuperMenu (FMouseEvent*& ev) +void FMenu::passEventToSuperMenu (FMouseEvent* const& ev) { // Mouse event handover to super-menu @@ -942,7 +942,7 @@ void FMenu::passEventToSuperMenu (FMouseEvent*& ev) } //---------------------------------------------------------------------- -void FMenu::passEventToMenuBar (FMouseEvent*& ev) +void FMenu::passEventToMenuBar (FMouseEvent* const& ev) { // Mouse event handover to the menu bar @@ -989,7 +989,7 @@ FMenu* FMenu::superMenuAt (int x, int y) // Check mouse click position for super menu if ( getTermGeometry().contains(x, y) ) - return 0; + return nullptr; auto super = getSuperMenu(); @@ -1006,7 +1006,7 @@ FMenu* FMenu::superMenuAt (int x, int y) } } - return 0; + return nullptr; } //---------------------------------------------------------------------- diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index ea378f16..c157bec1 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -925,7 +925,7 @@ void FMenuBar::mouseMoveOverList (const FMouseEvent* ev) } //---------------------------------------------------------------------- -void FMenuBar::passEventToMenu (const FMouseEvent*& ev) +void FMenuBar::passEventToMenu (const FMouseEvent* const& ev) { if ( ! hasSelectedItem() || ! getSelectedItem()->hasMenu() ) return; diff --git a/src/fmessagebox.cpp b/src/fmessagebox.cpp index 29651464..5a3b0ba0 100644 --- a/src/fmessagebox.cpp +++ b/src/fmessagebox.cpp @@ -31,7 +31,7 @@ namespace finalcut static const char* const button_text[] = { - 0, + nullptr, "&OK", "&Cancel", "&Yes", @@ -39,7 +39,7 @@ static const char* const button_text[] = "&Abort", "&Retry", "&Ignore", - 0 + nullptr }; //---------------------------------------------------------------------- diff --git a/src/fmouse.cpp b/src/fmouse.cpp index bc7b4bb8..73ed15bf 100644 --- a/src/fmouse.cpp +++ b/src/fmouse.cpp @@ -183,7 +183,7 @@ inline FMouse* FMouse::createMouseObject (const mouse_type mt) switch ( mt ) { case none: - return 0; + return nullptr; case gpm: #ifdef F_HAVE_LIBGPM @@ -528,7 +528,7 @@ int FMouseGPM::gpmEvent (bool clear) FD_SET(gpm_fd, &ifds); tv.tv_sec = 0; tv.tv_usec = 100000; // 100 ms - const int result = select (max + 1, &ifds, 0, 0, &tv); + const int result = select (max + 1, &ifds, nullptr, nullptr, &tv); if ( result > 0 && FD_ISSET(stdin_no, &ifds) ) { @@ -1249,7 +1249,7 @@ void FMouseControl::clearEvent() { FMouse* mouse_object; - while ( (mouse_object = getMouseWithEvent()) != 0 ) + while ( (mouse_object = getMouseWithEvent()) != nullptr ) mouse_object->clearEvent(); } @@ -1612,7 +1612,7 @@ FMouse* FMouseControl::getMouseWithData() } ); - return ( iter != mouse_protocol.end() ) ? iter->second : 0; + return ( iter != mouse_protocol.end() ) ? iter->second : nullptr; } //---------------------------------------------------------------------- @@ -1628,7 +1628,7 @@ FMouse* FMouseControl::getMouseWithEvent() } ); - return ( iter != mouse_protocol.end() ) ? iter->second : 0; + return ( iter != mouse_protocol.end() ) ? iter->second : nullptr; } //---------------------------------------------------------------------- diff --git a/src/fobject.cpp b/src/fobject.cpp index ef9e92a5..e53e3214 100644 --- a/src/fobject.cpp +++ b/src/fobject.cpp @@ -105,10 +105,10 @@ FObject* FObject::getChild (int index) const // returns the child for the index number if ( ! hasChildren() ) - return 0; + return nullptr; if ( index <= 0 || index > numOfChildren() ) - return 0; + return nullptr; auto iter = begin(); std::advance (iter, index - 1); @@ -213,7 +213,7 @@ void FObject::getCurrentTime (timeval* time) { // Get the current time as timeval struct - gettimeofday(time, 0); + gettimeofday(time, nullptr); // NTP fix while ( time->tv_usec >= 1000000 ) diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 1ce4f2fe..c55cf9e1 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -451,7 +451,7 @@ void FOptiAttr::set_orig_orig_colors (char cap[]) } //---------------------------------------------------------------------- -bool FOptiAttr::isNormal (FChar*& ch) +bool FOptiAttr::isNormal (const FChar* const& ch) { return hasNoAttribute(ch) && ! hasColor(ch); } @@ -563,7 +563,7 @@ char* FOptiAttr::changeAttribute (FChar*& term, FChar*& next) // Look for no changes if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) ) - return 0; + return nullptr; if ( hasNoAttribute(next) ) { @@ -1180,7 +1180,7 @@ void FOptiAttr::setAttributesOff (FChar*& term) } //---------------------------------------------------------------------- -bool FOptiAttr::hasColor (FChar*& attr) +bool FOptiAttr::hasColor (const FChar* const& attr) { if ( attr && attr->fg_color == fc::Default @@ -1191,7 +1191,7 @@ bool FOptiAttr::hasColor (FChar*& attr) } //---------------------------------------------------------------------- -bool FOptiAttr::hasAttribute (FChar*& attr) +bool FOptiAttr::hasAttribute (const FChar* const& attr) { if ( attr ) { @@ -1214,13 +1214,14 @@ bool FOptiAttr::hasAttribute (FChar*& attr) } //---------------------------------------------------------------------- -bool FOptiAttr::hasNoAttribute (FChar*& attr) +bool FOptiAttr::hasNoAttribute (const FChar* const& attr) { return ! hasAttribute(attr); } //---------------------------------------------------------------------- -inline bool FOptiAttr::hasColorChanged (FChar*& term, FChar*& next) +inline bool FOptiAttr::hasColorChanged ( const FChar* const& term + , const FChar* const& next ) { if ( term && next ) { @@ -1478,7 +1479,7 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term } //---------------------------------------------------------------------- -inline void FOptiAttr::change_current_color ( FChar*& term +inline void FOptiAttr::change_current_color ( const FChar* const& term , FColor fg, FColor bg ) { char* color_str{}; @@ -1597,7 +1598,7 @@ inline bool FOptiAttr::hasCharsetEquivalence() } //---------------------------------------------------------------------- -inline void FOptiAttr::detectSwitchOn (FChar*& term, FChar*& next) +inline void FOptiAttr::detectSwitchOn (const FChar* const& term, const FChar* const& next) { if ( ! (term && next) ) return; @@ -1618,7 +1619,7 @@ inline void FOptiAttr::detectSwitchOn (FChar*& term, FChar*& next) } //---------------------------------------------------------------------- -inline void FOptiAttr::detectSwitchOff (FChar*& term, FChar*& next) +inline void FOptiAttr::detectSwitchOff (const FChar* const& term, const FChar* const& next) { if ( ! (term && next) ) return; diff --git a/src/foptimove.cpp b/src/foptimove.cpp index 74faf030..5108369d 100644 --- a/src/foptimove.cpp +++ b/src/foptimove.cpp @@ -59,7 +59,6 @@ FOptiMove::~FOptiMove() // destructor void FOptiMove::setBaudRate (int baud) { assert ( baud >= 0 ); - baudrate = baud; calculateCharDuration(); } @@ -497,7 +496,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew) || yold < 0 || isWideMove (xold, yold, xnew, ynew) ) { - return ( move_time < LONG_DURATION ) ? move_buf : 0; + return ( move_time < LONG_DURATION ) ? move_buf : nullptr; } } @@ -527,7 +526,7 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew) if ( move_time < LONG_DURATION ) return move_buf; else - return 0; + return nullptr; } diff --git a/src/fprogressbar.cpp b/src/fprogressbar.cpp index 8903505b..4ec8b17d 100644 --- a/src/fprogressbar.cpp +++ b/src/fprogressbar.cpp @@ -167,7 +167,7 @@ void FProgressbar::drawProgressLabel() if ( percentage > 100 ) print ("--- %"); else - printf ("%3d %%", percentage); + printf ("%3zu %%", percentage); if ( isMonochron() ) setReverse(false); diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index caa11901..63ed1bd3 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -709,7 +709,7 @@ inline FPoint FScrollView::getViewportCursorPos() //---------------------------------------------------------------------- void FScrollView::init (FWidget* parent) { - assert ( parent != 0 ); + assert ( parent != nullptr ); assert ( ! parent->isInstanceOf("FScrollView") ); initScrollbar (vbar, fc::vertical, &FScrollView::cb_VBarChange); diff --git a/src/fstartoptions.cpp b/src/fstartoptions.cpp index da7658ed..b2d910ee 100644 --- a/src/fstartoptions.cpp +++ b/src/fstartoptions.cpp @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2019 Markus Gans * +* Copyright 2019-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -59,7 +59,7 @@ FStartOptions::~FStartOptions() // destructor //---------------------------------------------------------------------- FStartOptions& FStartOptions::getFStartOptions() { - if ( start_options == 0 ) + if ( start_options == nullptr ) { try { diff --git a/src/fstring.cpp b/src/fstring.cpp index 3d8ad466..2253eae7 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -397,7 +397,7 @@ const char* FString::c_str() const else if ( string ) return const_cast(""); else - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -410,7 +410,7 @@ char* FString::c_str() else if ( string ) return const_cast(""); else - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -617,7 +617,7 @@ double FString::toDouble() const wchar_t* p{}; const double ret = std::wcstod(string, &p); - if ( p != 0 && *p != '\0' ) + if ( p != nullptr && *p != '\0' ) throw std::invalid_argument ("no valid floating point value"); if ( errno == ERANGE ) @@ -758,7 +758,7 @@ FStringList FString::split (const FString& delimiter) while ( token ) { string_list.push_back (FString(token)); - token = extractToken (&rest, 0, delimiter.wc_str()); + token = extractToken (&rest, nullptr, delimiter.wc_str()); } return string_list; @@ -1205,7 +1205,7 @@ bool FString::includes (const FString& s) const if ( ! (string && s.string) ) return false; - return ( std::wcsstr(string, s.string) != 0 ); + return ( std::wcsstr(string, s.string) != nullptr ); } @@ -1398,7 +1398,7 @@ void FString::_remove (std::size_t pos, std::size_t len) inline char* FString::wc_to_c_str (const wchar_t s[]) const { if ( ! s ) // handle NULL string - return 0; + return nullptr; if ( ! *s ) // handle empty string { @@ -1410,7 +1410,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const catch (const std::bad_alloc& ex) { std::cerr << bad_alloc_str << " " << ex.what() << std::endl; - return 0; + return nullptr; } return c_string; @@ -1435,7 +1435,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const catch (const std::bad_alloc& ex) { std::cerr << bad_alloc_str << " " << ex.what() << std::endl; - return 0; + return nullptr; } const int mblength = \ @@ -1455,7 +1455,7 @@ inline char* FString::wc_to_c_str (const wchar_t s[]) const inline wchar_t* FString::c_to_wc_str (const char s[]) const { if ( ! s ) // handle NULL string - return 0; + return nullptr; if ( ! *s ) // handle empty string { @@ -1467,7 +1467,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const catch (const std::bad_alloc& ex) { std::cerr << bad_alloc_str << " " << ex.what() << std::endl; - return 0; + return nullptr; } } @@ -1487,7 +1487,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const catch (const std::bad_alloc& ex) { std::cerr << bad_alloc_str << " " << ex.what() << std::endl; - return 0; + return nullptr; } const int wclength = \ @@ -1500,7 +1500,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const else { delete[] dest; - return 0; + return nullptr; } } @@ -1512,7 +1512,7 @@ inline wchar_t* FString::c_to_wc_str (const char s[]) const else { delete[] dest; - return 0; + return nullptr; } } @@ -1524,10 +1524,10 @@ inline wchar_t* FString::extractToken ( wchar_t* rest[] wchar_t* token = ( s ) ? const_cast(s) : *rest; if ( ! token ) - return 0; + return nullptr; if ( ! token[0] ) - return 0; + return nullptr; *rest = std::wcspbrk(token, delim); diff --git a/src/fterm.cpp b/src/fterm.cpp index 9bc8a4b3..aa738bbf 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -183,7 +183,7 @@ int FTerm::getMaxColor() //---------------------------------------------------------------------- FTermData* FTerm::getFTermData() { - if ( data == 0 ) + if ( data == nullptr ) { try { @@ -202,7 +202,7 @@ FTermData* FTerm::getFTermData() //---------------------------------------------------------------------- FSystem* FTerm::getFSystem() { - if ( fsys == 0 ) + if ( fsys == nullptr ) { try { @@ -221,7 +221,7 @@ FSystem* FTerm::getFSystem() //---------------------------------------------------------------------- FOptiMove* FTerm::getFOptiMove() { - if ( opti_move == 0 ) + if ( opti_move == nullptr ) { try { @@ -240,7 +240,7 @@ FOptiMove* FTerm::getFOptiMove() //---------------------------------------------------------------------- FOptiAttr* FTerm::getFOptiAttr() { - if ( opti_attr == 0 ) + if ( opti_attr == nullptr ) { try { @@ -259,7 +259,7 @@ FOptiAttr* FTerm::getFOptiAttr() //---------------------------------------------------------------------- FTermDetection* FTerm::getFTermDetection() { - if ( term_detection == 0 ) + if ( term_detection == nullptr ) { try { @@ -278,7 +278,7 @@ FTermDetection* FTerm::getFTermDetection() //---------------------------------------------------------------------- FTermXTerminal* FTerm::getFTermXTerminal() { - if ( xterm == 0 ) + if ( xterm == nullptr ) { try { @@ -297,7 +297,7 @@ FTermXTerminal* FTerm::getFTermXTerminal() //---------------------------------------------------------------------- FKeyboard* FTerm::getFKeyboard() { - if ( keyboard == 0 ) + if ( keyboard == nullptr ) { try { @@ -316,7 +316,7 @@ FKeyboard* FTerm::getFKeyboard() //---------------------------------------------------------------------- FMouseControl* FTerm::getFMouseControl() { - if ( mouse == 0 ) + if ( mouse == nullptr ) { try { @@ -336,7 +336,7 @@ FMouseControl* FTerm::getFMouseControl() //---------------------------------------------------------------------- FTermLinux* FTerm::getFTermLinux() { - if ( linux == 0 ) + if ( linux == nullptr ) { try { @@ -356,7 +356,7 @@ FTermLinux* FTerm::getFTermLinux() //---------------------------------------------------------------------- FTermFreeBSD* FTerm::getFTermFreeBSD() { - if ( freebsd == 0 ) + if ( freebsd == nullptr ) { try { @@ -376,7 +376,7 @@ FTermFreeBSD* FTerm::getFTermFreeBSD() //---------------------------------------------------------------------- FTermOpenBSD* FTerm::getFTermOpenBSD() { - if ( openbsd == 0 ) + if ( openbsd == nullptr ) { try { @@ -397,7 +397,7 @@ FTermOpenBSD* FTerm::getFTermOpenBSD() //---------------------------------------------------------------------- FTermDebugData& FTerm::getFTermDebugData() { - if ( debug_data == 0 ) + if ( debug_data == nullptr ) { try { @@ -415,7 +415,7 @@ FTermDebugData& FTerm::getFTermDebugData() #endif // DEBUG //---------------------------------------------------------------------- -bool FTerm::isNormal (FChar*& ch) +bool FTerm::isNormal (const FChar* const& ch) { return opti_attr->isNormal(ch); } @@ -782,7 +782,7 @@ int FTerm::openConsole() "/dev/vc/0", "/dev/systty", "/dev/console", - 0 + nullptr }; if ( fd >= 0 ) // console is already opened @@ -791,7 +791,7 @@ int FTerm::openConsole() if ( ! *termfilename || ! fsys ) return 0; - for (std::size_t i{0}; terminal_devices[i] != 0; i++) + for (std::size_t i{0}; terminal_devices[i] != nullptr; i++) { fd = fsys->open(terminal_devices[i], O_RDWR, 0); data->setTTYFileDescriptor(fd); @@ -847,7 +847,7 @@ char* FTerm::cursorsVisibilityString (bool enable) char* visibility_str{nullptr}; if ( data->isCursorHidden() == enable ) - return 0; + return nullptr; if ( enable ) { @@ -1689,7 +1689,7 @@ void FTerm::init_locale() // Try to found a meaningful content for locale_name if ( locale_name ) - locale_name = std::setlocale (LC_CTYPE, 0); + locale_name = std::setlocale (LC_CTYPE, nullptr); else { locale_name = std::getenv("LC_ALL"); @@ -1770,7 +1770,7 @@ void FTerm::init_term_encoding() } else if ( fsys->isTTY(stdout_no) && (std::strlen(termtype) > 0) - && (TCAP(fc::t_exit_alt_charset_mode) != 0) ) + && (TCAP(fc::t_exit_alt_charset_mode) != nullptr) ) { data->setVT100Console (true); data->setTermEncoding (fc::VT100); @@ -1983,7 +1983,7 @@ char* FTerm::disableCursorString() if ( vi ) return vi; - return 0; + return nullptr; } //---------------------------------------------------------------------- diff --git a/src/fterm_functions.cpp b/src/fterm_functions.cpp index 5f5f7292..91d5d9d3 100644 --- a/src/fterm_functions.cpp +++ b/src/fterm_functions.cpp @@ -25,6 +25,7 @@ #endif #include +#include #include "final/fcharmap.h" #include "final/fterm.h" @@ -497,14 +498,16 @@ std::size_t getColumnWidth (FChar& term_char) } //---------------------------------------------------------------------- -std::size_t getColumnWidth (const FTermBuffer& termbuffer) +std::size_t getColumnWidth (const FTermBuffer& tb) { - std::size_t column_width{0}; - - for (auto&& tc : termbuffer) - column_width += tc.attr.bit.char_width; - - return column_width; + return std::accumulate ( std::next(tb.begin()) + , tb.end() + , tb.front().attr.bit.char_width + , [] (std::size_t s, FChar c) -> std::size_t + { + return std::move(s) + c.attr.bit.char_width; + } + ); } } // namespace finalcut diff --git a/src/ftermbuffer.cpp b/src/ftermbuffer.cpp index c6a57255..a9fcb7e5 100644 --- a/src/ftermbuffer.cpp +++ b/src/ftermbuffer.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include @@ -46,10 +47,14 @@ const FString FTermBuffer::toString() const { std::wstring wide_string{}; wide_string.reserve(data.size()); - - for (auto&& fchar : data) - wide_string.push_back(fchar.ch); - + std::transform ( data.begin() + , data.end() + , std::back_inserter(wide_string) + , [] (const FChar& fchar) -> wchar_t + { + return fchar.ch; + } + ); return FString(wide_string); } diff --git a/src/ftermcap.cpp b/src/ftermcap.cpp index dd2b5937..1b39e2a2 100644 --- a/src/ftermcap.cpp +++ b/src/ftermcap.cpp @@ -328,92 +328,92 @@ FTermcap::tcap_map FTermcap::strings[] = // | .-------- Tcap-code // | | // variable name -> description //------------------------------------------------------------------------------ - { 0, "bl" }, // bell -> audible signal (bell) (P) - { 0, "ec" }, // erase_chars -> erase #1 characters (P) - { 0, "cl" }, // clear_screen -> clear screen and home cursor (P*) - { 0, "cd" }, // clr_eos -> clear to end of screen (P*) - { 0, "ce" }, // clr_eol -> clear to end of line (P) - { 0, "cb" }, // clr_bol -> Clear to beginning of line - { 0, "ho" }, // cursor_home -> home cursor (if no cup) - { 0, "ll" }, // cursor_to_ll -> last line, first column (if no cup) - { 0, "cr" }, // carriage_return -> carriage return (P*) - { 0, "ta" }, // tab -> tab to next 8-space hardware tab stop - { 0, "bt" }, // back_tab -> back tab (P) - { 0, "ip" }, // insert_padding -> insert padding after inserted character - { 0, "ic" }, // insert_character -> insert character (P) - { 0, "IC" }, // parm_ich -> insert #1 characters (P*) - { 0, "rp" }, // repeat_char -> repeat char #1 #2 times (P*) - { 0, "Ic" }, // initialize_color -> initialize color #1 to (#2,#3,#4) - { 0, "Ip" }, // initialize_pair -> Initialize color pair #1 to - // fg=(#2,#3,#4), bg=(#5,#6,#7) - { 0, "AF" }, // set_a_foreground -> Set ANSI background color to #1 - { 0, "AB" }, // set_a_background -> Set ANSI background color to #1 - { 0, "Sf" }, // set_foreground -> Set foreground color #1 - { 0, "Sb" }, // set_background -> Set background color #1 - { 0, "sp" }, // set_color_pair -> Set current color pair to #1 - { 0, "op" }, // orig_pair -> Set default pair to original value - { 0, "oc" }, // orig_colors -> Set all color pairs to the original - { 0, "NC" }, // no_color_video -> video attributes that cannot be used - // with colors - { 0, "cm" }, // cursor_address -> move to row #1 columns #2 - { 0, "ch" }, // column_address -> horizontal position #1, absolute (P) - { 0, "cv" }, // row_address -> vertical position #1 absolute (P) - { 0, "vs" }, // cursor_visible -> make cursor very visible - { 0, "vi" }, // cursor_invisible -> make cursor invisible - { 0, "ve" }, // cursor_normal -> make cursor appear normal (undo vi/vs) - { 0, "up" }, // cursor_up -> up one line - { 0, "do" }, // cursor_down -> down one line - { 0, "le" }, // cursor_left -> move left one space - { 0, "nd" }, // cursor_right -> non-destructive space (move right) - { 0, "UP" }, // parm_up_cursor -> up #1 lines (P*) - { 0, "DO" }, // parm_down_cursor -> down #1 lines (P*) - { 0, "LE" }, // parm_left_cursor -> move #1 characters to the left (P) - { 0, "RI" }, // parm_right_cursor -> move #1 characters to the right (P*) - { 0, "sc" }, // save_cursor -> save current cursor position (P) - { 0, "rc" }, // restore_cursor -> restore cursor to save_cursor - { 0, "Ss" }, // set cursor style -> Select the DECSCUSR cursor style - { 0, "sf" }, // scroll_forward -> scroll text up (P) - { 0, "sr" }, // scroll_reverse -> scroll text down (P) - { 0, "ti" }, // enter_ca_mode -> string to start programs using cup - { 0, "te" }, // exit_ca_mode -> strings to end programs using cup - { 0, "eA" }, // enable_acs -> enable alternate char set - { 0, "md" }, // enter_bold_mode -> turn on bold (double-bright) mode - { 0, "me" }, // exit_bold_mode -> turn off bold mode - { 0, "mh" }, // enter_dim_mode -> turn on half-bright - { 0, "me" }, // exit_dim_mode -> turn off half-bright - { 0, "ZH" }, // enter_italics_mode -> Enter italic mode - { 0, "ZR" }, // exit_italics_mode -> End italic mode - { 0, "us" }, // enter_underline_mode -> begin underline mode - { 0, "ue" }, // exit_underline_mode -> exit underline mode - { 0, "mb" }, // enter_blink_mode -> turn on blinking - { 0, "me" }, // exit_blink_mode -> turn off blinking - { 0, "mr" }, // enter_reverse_mode -> turn on reverse video mode - { 0, "me" }, // exit_reverse_mode -> turn off reverse video mode - { 0, "so" }, // enter_standout_mode -> begin standout mode - { 0, "se" }, // exit_standout_mode -> exit standout mode - { 0, "mk" }, // enter_secure_mode -> turn on blank mode (characters invisible) - { 0, "me" }, // exit_secure_mode -> turn off blank mode (characters visible) - { 0, "mp" }, // enter_protected_mode -> turn on protected mode - { 0, "me" }, // exit_protected_mode -> turn off protected mode - { 0, "XX" }, // enter_crossed_out_mode -> turn on mark character as deleted - { 0, "me" }, // exit_crossed_out_mode -> turn off mark character as deleted - { 0, "Us" }, // enter_dbl_underline_mode -> begin double underline mode - { 0, "Ue" }, // exit_dbl_underline_mode -> exit double underline mode - { 0, "sa" }, // set_attributes -> define videoattributes #1-#9 (PG9) - { 0, "me" }, // exit_attribute_mode -> turn off all attributes - { 0, "as" }, // enter_alt_charset_mode -> start alternate character set (P) - { 0, "ae" }, // exit_alt_charset_mode -> end alternate character set (P) - { 0, "S2" }, // enter_pc_charset_mode -> Enter PC character display mode - { 0, "S3" }, // exit_pc_charset_mode -> Exit PC character display mode - { 0, "im" }, // enter_insert_mode -> enter insert mode - { 0, "ei" }, // exit_insert_mode -> exit insert mode - { 0, "SA" }, // enter_am_mode -> turn on automatic margins - { 0, "RA" }, // exit_am_mode -> turn off automatic margins - { 0, "ac" }, // acs_chars -> graphics charset pairs (vt100) - { 0, "ks" }, // keypad_xmit -> enter 'key-board_transmit' mode - { 0, "ke" }, // keypad_local -> leave 'key-board_transmit' mode - { 0, "Km" }, // key_mouse -> Mouse event has occurred - { 0, "\0" } + { nullptr, "bl" }, // bell -> audible signal (bell) (P) + { nullptr, "ec" }, // erase_chars -> erase #1 characters (P) + { nullptr, "cl" }, // clear_screen -> clear screen and home cursor (P*) + { nullptr, "cd" }, // clr_eos -> clear to end of screen (P*) + { nullptr, "ce" }, // clr_eol -> clear to end of line (P) + { nullptr, "cb" }, // clr_bol -> Clear to beginning of line + { nullptr, "ho" }, // cursor_home -> home cursor (if no cup) + { nullptr, "ll" }, // cursor_to_ll -> last line, first column (if no cup) + { nullptr, "cr" }, // carriage_return -> carriage return (P*) + { nullptr, "ta" }, // tab -> tab to next 8-space hardware tab stop + { nullptr, "bt" }, // back_tab -> back tab (P) + { nullptr, "ip" }, // insert_padding -> insert padding after inserted character + { nullptr, "ic" }, // insert_character -> insert character (P) + { nullptr, "IC" }, // parm_ich -> insert #1 characters (P*) + { nullptr, "rp" }, // repeat_char -> repeat char #1 #2 times (P*) + { nullptr, "Ic" }, // initialize_color -> initialize color #1 to (#2,#3,#4) + { nullptr, "Ip" }, // initialize_pair -> Initialize color pair #1 to + // fg=(#2,#3,#4), bg=(#5,#6,#7) + { nullptr, "AF" }, // set_a_foreground -> Set ANSI background color to #1 + { nullptr, "AB" }, // set_a_background -> Set ANSI background color to #1 + { nullptr, "Sf" }, // set_foreground -> Set foreground color #1 + { nullptr, "Sb" }, // set_background -> Set background color #1 + { nullptr, "sp" }, // set_color_pair -> Set current color pair to #1 + { nullptr, "op" }, // orig_pair -> Set default pair to original value + { nullptr, "oc" }, // orig_colors -> Set all color pairs to the original + { nullptr, "NC" }, // no_color_video -> video attributes that cannot be used + // with colors + { nullptr, "cm" }, // cursor_address -> move to row #1 columns #2 + { nullptr, "ch" }, // column_address -> horizontal position #1, absolute (P) + { nullptr, "cv" }, // row_address -> vertical position #1 absolute (P) + { nullptr, "vs" }, // cursor_visible -> make cursor very visible + { nullptr, "vi" }, // cursor_invisible -> make cursor invisible + { nullptr, "ve" }, // cursor_normal -> make cursor appear normal (undo vi/vs) + { nullptr, "up" }, // cursor_up -> up one line + { nullptr, "do" }, // cursor_down -> down one line + { nullptr, "le" }, // cursor_left -> move left one space + { nullptr, "nd" }, // cursor_right -> non-destructive space (move right) + { nullptr, "UP" }, // parm_up_cursor -> up #1 lines (P*) + { nullptr, "DO" }, // parm_down_cursor -> down #1 lines (P*) + { nullptr, "LE" }, // parm_left_cursor -> move #1 characters to the left (P) + { nullptr, "RI" }, // parm_right_cursor -> move #1 characters to the right (P*) + { nullptr, "sc" }, // save_cursor -> save current cursor position (P) + { nullptr, "rc" }, // restore_cursor -> restore cursor to save_cursor + { nullptr, "Ss" }, // set cursor style -> Select the DECSCUSR cursor style + { nullptr, "sf" }, // scroll_forward -> scroll text up (P) + { nullptr, "sr" }, // scroll_reverse -> scroll text down (P) + { nullptr, "ti" }, // enter_ca_mode -> string to start programs using cup + { nullptr, "te" }, // exit_ca_mode -> strings to end programs using cup + { nullptr, "eA" }, // enable_acs -> enable alternate char set + { nullptr, "md" }, // enter_bold_mode -> turn on bold (double-bright) mode + { nullptr, "me" }, // exit_bold_mode -> turn off bold mode + { nullptr, "mh" }, // enter_dim_mode -> turn on half-bright + { nullptr, "me" }, // exit_dim_mode -> turn off half-bright + { nullptr, "ZH" }, // enter_italics_mode -> Enter italic mode + { nullptr, "ZR" }, // exit_italics_mode -> End italic mode + { nullptr, "us" }, // enter_underline_mode -> begin underline mode + { nullptr, "ue" }, // exit_underline_mode -> exit underline mode + { nullptr, "mb" }, // enter_blink_mode -> turn on blinking + { nullptr, "me" }, // exit_blink_mode -> turn off blinking + { nullptr, "mr" }, // enter_reverse_mode -> turn on reverse video mode + { nullptr, "me" }, // exit_reverse_mode -> turn off reverse video mode + { nullptr, "so" }, // enter_standout_mode -> begin standout mode + { nullptr, "se" }, // exit_standout_mode -> exit standout mode + { nullptr, "mk" }, // enter_secure_mode -> turn on blank mode (characters invisible) + { nullptr, "me" }, // exit_secure_mode -> turn off blank mode (characters visible) + { nullptr, "mp" }, // enter_protected_mode -> turn on protected mode + { nullptr, "me" }, // exit_protected_mode -> turn off protected mode + { nullptr, "XX" }, // enter_crossed_out_mode -> turn on mark character as deleted + { nullptr, "me" }, // exit_crossed_out_mode -> turn off mark character as deleted + { nullptr, "Us" }, // enter_dbl_underline_mode -> begin double underline mode + { nullptr, "Ue" }, // exit_dbl_underline_mode -> exit double underline mode + { nullptr, "sa" }, // set_attributes -> define videoattributes #1-#9 (PG9) + { nullptr, "me" }, // exit_attribute_mode -> turn off all attributes + { nullptr, "as" }, // enter_alt_charset_mode -> start alternate character set (P) + { nullptr, "ae" }, // exit_alt_charset_mode -> end alternate character set (P) + { nullptr, "S2" }, // enter_pc_charset_mode -> Enter PC character display mode + { nullptr, "S3" }, // exit_pc_charset_mode -> Exit PC character display mode + { nullptr, "im" }, // enter_insert_mode -> enter insert mode + { nullptr, "ei" }, // exit_insert_mode -> exit insert mode + { nullptr, "SA" }, // enter_am_mode -> turn on automatic margins + { nullptr, "RA" }, // exit_am_mode -> turn off automatic margins + { nullptr, "ac" }, // acs_chars -> graphics charset pairs (vt100) + { nullptr, "ks" }, // keypad_xmit -> enter 'key-board_transmit' mode + { nullptr, "ke" }, // keypad_local -> leave 'key-board_transmit' mode + { nullptr, "Km" }, // key_mouse -> Mouse event has occurred + { nullptr, "\0" } }; /* diff --git a/src/ftermdetection.cpp b/src/ftermdetection.cpp index 8da3e132..8ccc7215 100644 --- a/src/ftermdetection.cpp +++ b/src/ftermdetection.cpp @@ -197,7 +197,7 @@ bool FTermDetection::getTTYtype() const char* termfilename = fterm_data->getTermFileName(); const char* term_basename = std::strrchr(termfilename, '/'); - if ( term_basename == 0 ) + if ( term_basename == nullptr ) term_basename = termfilename; else term_basename++; @@ -205,10 +205,10 @@ bool FTermDetection::getTTYtype() std::FILE* fp{}; char str[BUFSIZ]{}; - if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != 0 ) + if ( fsystem && (fp = fsystem->fopen(ttytypename, "r")) != nullptr ) { // Read and parse the file - while ( fgets(str, sizeof(str) - 1, fp) != 0 ) + while ( fgets(str, sizeof(str) - 1, fp) != nullptr ) { const char* type{nullptr}; // nullptr == not found const char* name{nullptr}; @@ -218,15 +218,15 @@ bool FTermDetection::getTTYtype() { if ( std::isspace(uChar(*p)) ) *p = '\0'; - else if ( type == 0 ) + else if ( type == nullptr ) type = p; - else if ( name == 0 && p != str && p[-1] == '\0' ) + else if ( name == nullptr && p != str && p[-1] == '\0' ) name = p; p++; } - if ( type != 0 && name != 0 && ! std::strcmp(name, term_basename) ) + if ( type != nullptr && name != nullptr && ! std::strcmp(name, term_basename) ) { // Save name in termtype std::strncpy (termtype, type, sizeof(termtype)); @@ -252,7 +252,7 @@ bool FTermDetection::getTTYSFileEntry() const char* termfilename = fterm_data->getTermFileName(); const char* term_basename = std::strrchr(termfilename, '/'); - if ( term_basename == 0 ) + if ( term_basename == nullptr ) term_basename = termfilename; else term_basename++; @@ -264,7 +264,7 @@ bool FTermDetection::getTTYSFileEntry() { const char* type = ttys_entryt->ty_type; - if ( type != 0 ) + if ( type != nullptr ) { // Save name in termtype std::strncpy (termtype, type, sizeof(termtype)); @@ -424,25 +424,25 @@ bool FTermDetection::get256colorEnvString() color_env.string6 = std::getenv("KONSOLE_DCOP"); color_env.string7 = std::getenv("COLORFGBG"); - if ( color_env.string1 != 0 ) + if ( color_env.string1 != nullptr ) return true; - if ( color_env.string2 != 0 ) + if ( color_env.string2 != nullptr ) return true; - if ( color_env.string3 != 0 ) + if ( color_env.string3 != nullptr ) return true; - if ( color_env.string4 != 0 ) + if ( color_env.string4 != nullptr ) return true; - if ( color_env.string5 != 0 ) + if ( color_env.string5 != nullptr ) return true; - if ( color_env.string6 != 0 ) + if ( color_env.string6 != nullptr ) return true; - if ( color_env.string7 != 0 ) + if ( color_env.string7 != nullptr ) return true; return false; @@ -556,7 +556,7 @@ const FString FTermDetection::getXTermColorName (FColor color) tv.tv_usec = 150000; // 150 ms // read the terminal answer - if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) { if ( std::scanf("\033]4;%10hu;%509[^\n]s", &color, temp) == 2 ) { @@ -590,7 +590,7 @@ char* FTermDetection::parseAnswerbackMsg (char current_termtype[]) catch (const std::bad_alloc& ex) { std::cerr << bad_alloc_str << ex.what() << std::endl; - return 0; + return nullptr; } if ( *answer_back == "PuTTY" ) @@ -638,8 +638,8 @@ const FString FTermDetection::getAnswerbackMsg() tv.tv_usec = 150000; // 150 ms // Read the answerback message - if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) - if ( std::fgets (temp, sizeof(temp) - 1, stdin) != 0 ) + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) + if ( std::fgets (temp, sizeof(temp) - 1, stdin) != nullptr ) answerback = temp; return answerback; @@ -749,7 +749,7 @@ const FString FTermDetection::getSecDA() tv.tv_usec = 600000; // 600 ms // Read the answer - if ( select (stdin_no + 1, &ifds, 0, 0, &tv) == 1 + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) == 1 && std::scanf("\033[>%10d;%10d;%10dc", &a, &b, &c) == 3 ) sec_da_str.sprintf("\033[>%d;%d;%dc", a, b, c); @@ -801,7 +801,7 @@ char* FTermDetection::secDA_Analysis (char current_termtype[]) break; case 82: // rxvt - new_termtype = secDA_Analysis_82(current_termtype); + new_termtype = secDA_Analysis_82(); break; case 83: // screen @@ -813,7 +813,7 @@ char* FTermDetection::secDA_Analysis (char current_termtype[]) break; case 85: // rxvt-unicode - new_termtype = secDA_Analysis_85(current_termtype); + new_termtype = secDA_Analysis_85(); break; default: @@ -933,11 +933,11 @@ inline char* FTermDetection::secDA_Analysis_77 (char[]) } //---------------------------------------------------------------------- -inline char* FTermDetection::secDA_Analysis_82 (char current_termtype[]) +inline char* FTermDetection::secDA_Analysis_82() { // Terminal ID 82 - rxvt - char* new_termtype = current_termtype; + char* new_termtype{}; terminal_type.rxvt = true; if ( std::strncmp(termtype, "rxvt-", 5) != 0 @@ -971,11 +971,11 @@ inline char* FTermDetection::secDA_Analysis_84 (char current_termtype[]) } //---------------------------------------------------------------------- -inline char* FTermDetection::secDA_Analysis_85 (char current_termtype[]) +inline char* FTermDetection::secDA_Analysis_85() { // Terminal ID 85 - rxvt-unicode - char* new_termtype = current_termtype; + char* new_termtype{}; terminal_type.rxvt = true; terminal_type.urxvt = true; diff --git a/src/ftermios.cpp b/src/ftermios.cpp index fc28cda2..e16df869 100644 --- a/src/ftermios.cpp +++ b/src/ftermios.cpp @@ -74,7 +74,7 @@ termios FTermios::getTTY() struct termios t{}; if ( tcgetattr(stdin_no, &t) == -1 ) - std::runtime_error("Cannot find tty"); + throw std::runtime_error("Cannot find tty"); return t; } diff --git a/src/ftermxterminal.cpp b/src/ftermxterminal.cpp index c91ef972..4e866281 100644 --- a/src/ftermxterminal.cpp +++ b/src/ftermxterminal.cpp @@ -704,7 +704,7 @@ const FString FTermXTerminal::captureXTermFont() tv.tv_usec = 150000; // 150 ms // Read the terminal answer - if ( select(stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) + if ( select(stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) { char temp[150]{}; @@ -743,7 +743,7 @@ const FString FTermXTerminal::captureXTermTitle() tv.tv_usec = 150000; // 150 ms // read the terminal answer - if ( select (stdin_no + 1, &ifds, 0, 0, &tv) > 0 ) + if ( select (stdin_no + 1, &ifds, nullptr, nullptr, &tv) > 0 ) { char temp[512]{}; diff --git a/src/fvterm.cpp b/src/fvterm.cpp index abd0f743..ec2db5d4 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -764,15 +764,15 @@ void FVTerm::removeArea (FTermArea*& area) { // remove the virtual window - if ( area != 0 ) + if ( area != nullptr ) { - if ( area->changes != 0 ) + if ( area->changes != nullptr ) { delete[] area->changes; area->changes = nullptr; } - if ( area->data != 0 ) + if ( area->data != nullptr ) { delete[] area->data; area->data = nullptr; @@ -1363,10 +1363,10 @@ inline bool FVTerm::reallocateTextArea ( FTermArea* area // Reallocate "height" lines for changes // and "size" bytes for the text area - if ( area->changes != 0 ) + if ( area->changes != nullptr ) delete[] area->changes; - if ( area->data != 0 ) + if ( area->data != nullptr ) delete[] area->data; try @@ -1388,7 +1388,7 @@ inline bool FVTerm::reallocateTextArea (FTermArea* area, std::size_t size) { // Reallocate "size" bytes for the text area - if ( area->data != 0 ) + if ( area->data != nullptr ) delete[] area->data; try @@ -1702,15 +1702,15 @@ bool FVTerm::hasChildAreaChanges (FTermArea* area) if ( ! area ) return false; - for (auto&& pcall : area->preproc_list) - { - if ( pcall.instance - && pcall.instance->child_print_area - && pcall.instance->child_print_area->has_changes ) - return true; - } - - return false; + return std::any_of ( area->preproc_list.begin() + , area->preproc_list.end() + , [] (const FVTermPreprocessing& pcall) -> bool + { + return pcall.instance + && pcall.instance->child_print_area + && pcall.instance->child_print_area->has_changes; + } + ); } //---------------------------------------------------------------------- @@ -2155,7 +2155,7 @@ bool FVTerm::clearFullArea (FTermArea* area, FChar& nc) } //---------------------------------------------------------------------- -void FVTerm::clearAreaWithShadow (FTermArea* area, FChar& nc) +void FVTerm::clearAreaWithShadow (FTermArea* area, const FChar& nc) { FChar t_char = nc; const int total_width = area->width + area->right_shadow; @@ -2530,7 +2530,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y //---------------------------------------------------------------------- inline void FVTerm::skipPaddingCharacter ( uInt& x, uInt y - , FChar*& print_char ) + , const FChar* const& print_char ) { if ( isFullWidthChar(print_char) ) // full-width character { @@ -2661,13 +2661,13 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y) } //---------------------------------------------------------------------- -inline bool FVTerm::isFullWidthChar (FChar*& ch) +inline bool FVTerm::isFullWidthChar (const FChar* const& ch) { return bool(ch->attr.bit.char_width == 2); } //---------------------------------------------------------------------- -inline bool FVTerm::isFullWidthPaddingChar (FChar*& ch) +inline bool FVTerm::isFullWidthPaddingChar (const FChar* const& ch) { return ch->attr.bit.fullwidth_padding; } diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 64828320..33b4c75d 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -162,14 +162,14 @@ FWidget* FWidget::getParentWidget() const if ( p_obj && p_obj->isWidget() ) return static_cast(p_obj); else - return 0; + return nullptr; } //---------------------------------------------------------------------- FWidget* FWidget::getFirstFocusableWidget (FObjectList list) { if ( list.empty() ) - return 0; + return nullptr; auto iter = list.begin(); @@ -186,14 +186,14 @@ FWidget* FWidget::getFirstFocusableWidget (FObjectList list) ++iter; } - return 0; + return nullptr; } //---------------------------------------------------------------------- FWidget* FWidget::getLastFocusableWidget (FObjectList list) { if ( list.empty() ) - return 0; + return nullptr; auto iter = list.end(); @@ -211,7 +211,7 @@ FWidget* FWidget::getLastFocusableWidget (FObjectList list) } while ( iter != list.begin() ); - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -720,7 +720,7 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit) FWidget* FWidget::childWidgetAt (const FPoint& pos) { if ( ! hasChildren() ) - return 0; + return nullptr; for (auto&& child : getChildren()) { @@ -735,11 +735,11 @@ FWidget* FWidget::childWidgetAt (const FPoint& pos) && widget->getTermGeometry().contains(pos) ) { auto sub_child = widget->childWidgetAt(pos); - return ( sub_child != 0 ) ? sub_child : widget; + return ( sub_child != nullptr ) ? sub_child : widget; } } - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -995,11 +995,11 @@ void FWidget::show() { // Sets the initial screen settings initScreenSettings(); - - // draw the vdesktop + // Draw the vdesktop const auto& r = getRootWidget(); setColor(r->getForegroundColor(), r->getBackgroundColor()); clearArea (getVirtualDesktop()); + // Destop is now initialized init_desktop = true; } diff --git a/src/fwindow.cpp b/src/fwindow.cpp index c6035901..ce59fee9 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -440,7 +440,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y) while ( iter != begin ); } - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -489,7 +489,7 @@ FWindow* FWindow::getWindowWidget (const FWidget* obj) if ( obj->isWindowWidget() ) return const_cast(reinterpret_cast(obj)); else - return 0; + return nullptr; } //---------------------------------------------------------------------- @@ -507,7 +507,7 @@ int FWindow::getWindowLayer (const FWidget* obj) if ( ! obj->isWindowWidget() ) { - if ( (window = getWindowWidget(obj)) == 0 ) + if ( (window = getWindowWidget(obj)) == nullptr ) return -1; } else diff --git a/src/include/final/fapplication.h b/src/include/final/fapplication.h index a8eb2ad4..49cc1132 100644 --- a/src/include/final/fapplication.h +++ b/src/include/final/fapplication.h @@ -96,7 +96,7 @@ class FApplication : public FWidget FApplication (const FApplication&) = delete; // Destructor - virtual ~FApplication(); + ~FApplication() override; // Disable assignment operator (=) FApplication& operator = (const FApplication&) = delete; @@ -154,7 +154,7 @@ class FApplication : public FWidget void sendKeyboardAccelerator(); void processKeyboardEvent(); bool processDialogSwitchAccelerator(); - bool processAccelerator (const FWidget*&); + bool processAccelerator (const FWidget* const&); bool getMouseEvent(); FWidget*& determineClickedWidget(); void unsetMoveSizeMode(); diff --git a/src/include/final/fbutton.h b/src/include/final/fbutton.h index 7622fa7d..82e74e19 100644 --- a/src/include/final/fbutton.h +++ b/src/include/final/fbutton.h @@ -68,7 +68,7 @@ class FButton : public FWidget FButton (const FButton&) = delete; // Destructor - virtual ~FButton(); + ~FButton() override; // Disable assignment operator (=) FButton& operator = (const FButton&) = delete; diff --git a/src/include/final/fbuttongroup.h b/src/include/final/fbuttongroup.h index 76d51d82..464582f4 100644 --- a/src/include/final/fbuttongroup.h +++ b/src/include/final/fbuttongroup.h @@ -72,7 +72,7 @@ class FButtonGroup : public FScrollView FButtonGroup (const FButtonGroup&) = delete; // Destructor - virtual ~FButtonGroup(); + ~FButtonGroup() override; // Disable assignment operator (=) FButtonGroup& operator = (const FButtonGroup&) = delete; diff --git a/src/include/final/fcheckbox.h b/src/include/final/fcheckbox.h index c6970d24..6039ebab 100644 --- a/src/include/final/fcheckbox.h +++ b/src/include/final/fcheckbox.h @@ -72,7 +72,7 @@ class FCheckBox : public FToggleButton FCheckBox (const FCheckBox&) = delete; // Destructor - virtual ~FCheckBox(); + ~FCheckBox() override; // Disable assignment operator (=) FCheckBox& operator = (const FCheckBox&) = delete; diff --git a/src/include/final/fcheckmenuitem.h b/src/include/final/fcheckmenuitem.h index 7a81c2a3..e380c756 100644 --- a/src/include/final/fcheckmenuitem.h +++ b/src/include/final/fcheckmenuitem.h @@ -72,7 +72,7 @@ class FCheckMenuItem : public FMenuItem FCheckMenuItem (const FCheckMenuItem&) = delete; // Destructor - virtual ~FCheckMenuItem(); + ~FCheckMenuItem() override; // Disable assignment operator (=) FCheckMenuItem& operator = (const FCheckMenuItem&) = delete; diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index 74b68892..c6aa1127 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -77,7 +77,7 @@ class FDropDownListBox : public FWindow FDropDownListBox (const FDropDownListBox&) = delete; // Destructor - virtual ~FDropDownListBox (); + ~FDropDownListBox () override; // Disable assignment operator (=) FDropDownListBox& operator = (const FDropDownListBox&) = delete; @@ -139,7 +139,7 @@ class FComboBox : public FWidget FComboBox (const FComboBox&) = delete; // Destructor - ~FComboBox(); + ~FComboBox() override; // Disable assignment operator (=) FComboBox& operator = (const FComboBox&) = delete; @@ -211,7 +211,7 @@ class FComboBox : public FWidget void draw() override; void onePosUp(); void onePosDown(); - void passEventToListWindow (FMouseEvent*&); + void passEventToListWindow (FMouseEvent* const&); void processClick(); void processChanged(); diff --git a/src/include/final/fdialog.h b/src/include/final/fdialog.h index 4b2a1097..329c6d7a 100644 --- a/src/include/final/fdialog.h +++ b/src/include/final/fdialog.h @@ -85,7 +85,7 @@ class FDialog : public FWindow FDialog (const FDialog&) = delete; // Destructor - virtual ~FDialog(); + ~FDialog() override; // Disable assignment operator (=) FDialog& operator = (const FDialog&) = delete; diff --git a/src/include/final/fdialoglistmenu.h b/src/include/final/fdialoglistmenu.h index 45031a51..16fc24c8 100644 --- a/src/include/final/fdialoglistmenu.h +++ b/src/include/final/fdialoglistmenu.h @@ -78,7 +78,7 @@ class FDialogListMenu : public FMenu FDialogListMenu (const FDialogListMenu&) = delete; // Destructor - virtual ~FDialogListMenu(); + ~FDialogListMenu() override; // Disable assignment operator (=) FDialogListMenu& operator = (const FDialogListMenu&) = delete; diff --git a/src/include/final/ffiledialog.h b/src/include/final/ffiledialog.h index a1097ad7..5b6c9283 100644 --- a/src/include/final/ffiledialog.h +++ b/src/include/final/ffiledialog.h @@ -106,7 +106,7 @@ class FFileDialog : public FDialog , FWidget* = nullptr ); // Destructor - virtual ~FFileDialog(); + ~FFileDialog() override; // Assignment operator (=) FFileDialog& operator = (const FFileDialog&); diff --git a/src/include/final/flabel.h b/src/include/final/flabel.h index 6f2ba68f..fdb2ecd1 100644 --- a/src/include/final/flabel.h +++ b/src/include/final/flabel.h @@ -73,7 +73,7 @@ class FLabel : public FWidget FLabel (const FLabel&) = delete; // Destructor - virtual ~FLabel(); + ~FLabel() override; // Disable assignment operator (=) FLabel& operator = (const FLabel&) = delete; diff --git a/src/include/final/flineedit.h b/src/include/final/flineedit.h index 6b90c82b..1c35a570 100644 --- a/src/include/final/flineedit.h +++ b/src/include/final/flineedit.h @@ -89,7 +89,7 @@ class FLineEdit : public FWidget FLineEdit (const FLineEdit&) = delete; // Destructor - virtual ~FLineEdit(); + ~FLineEdit() override; // Disable assignment operator (=) FLineEdit& operator = (const FLineEdit&) = delete; diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h index acfcee14..02950acc 100644 --- a/src/include/final/flistbox.h +++ b/src/include/final/flistbox.h @@ -154,7 +154,7 @@ class FListBox : public FWidget FListBox (const FListBox&) = delete; // Destructor - virtual ~FListBox(); + ~FListBox() override; // Disable assignment operator (=) FListBox& operator = (const FListBox&) = delete; diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h index 3ae1bc7b..05268c18 100644 --- a/src/include/final/flistview.h +++ b/src/include/final/flistview.h @@ -78,7 +78,7 @@ class FListViewItem : public FObject , iterator ); // Destructor - virtual ~FListViewItem(); + ~FListViewItem() override; // Assignment operator (=) FListViewItem& operator = (const FListViewItem&); @@ -265,7 +265,7 @@ class FListView : public FWidget FListView (const FListView&) = delete; // Destructor - virtual ~FListView(); + ~FListView() override; // Disable assignment operator (=) FListView& operator = (const FListView&) = delete; @@ -556,7 +556,7 @@ inline FObject::iterator inline FObject::iterator FListView::insert ( const FStringList& cols , iterator parent_iter ) -{ return insert (cols, 0, parent_iter); } +{ return insert (cols, nullptr, parent_iter); } //---------------------------------------------------------------------- template diff --git a/src/include/final/fmenu.h b/src/include/final/fmenu.h index b0d8554d..a3ce91a5 100644 --- a/src/include/final/fmenu.h +++ b/src/include/final/fmenu.h @@ -79,7 +79,7 @@ class FMenu : public FWindow, public FMenuList FMenu (const FMenu&) = delete; // Destructor - virtual ~FMenu(); + ~FMenu() override; // Disable assignment operator (=) FMenu& operator = (const FMenu&) = delete; @@ -183,9 +183,9 @@ class FMenu : public FWindow, public FMenuList void mouseMoveDeselection (FMenuItem*, mouseStates&); void mouseUpOverBorder(); void mouseMoveOverBorder (mouseStates&); - void passEventToSubMenu (FMouseEvent*&); - void passEventToSuperMenu (FMouseEvent*&); - void passEventToMenuBar (FMouseEvent*&); + void passEventToSubMenu (FMouseEvent* const&); + void passEventToSuperMenu (FMouseEvent* const&); + void passEventToMenuBar (FMouseEvent* const&); bool containsMenuStructure (const FPoint&); bool containsMenuStructure (int, int); FMenu* superMenuAt (const FPoint&); diff --git a/src/include/final/fmenubar.h b/src/include/final/fmenubar.h index 51551654..76144dd1 100644 --- a/src/include/final/fmenubar.h +++ b/src/include/final/fmenubar.h @@ -77,7 +77,7 @@ class FMenuBar : public FWindow, public FMenuList FMenuBar (const FMenuBar&) = delete; // Destructor - virtual ~FMenuBar(); + ~FMenuBar() override; // Disable assignment operator (=) FMenuBar& operator = (const FMenuBar&) = delete; @@ -139,7 +139,7 @@ class FMenuBar : public FWindow, public FMenuList void mouseDownOverList (const FMouseEvent*); void mouseUpOverList (const FMouseEvent*); void mouseMoveOverList (const FMouseEvent*); - void passEventToMenu (const FMouseEvent*&); + void passEventToMenu (const FMouseEvent* const&); void leaveMenuBar(); // Data members diff --git a/src/include/final/fmenuitem.h b/src/include/final/fmenuitem.h index 277b2d77..b7c2496b 100644 --- a/src/include/final/fmenuitem.h +++ b/src/include/final/fmenuitem.h @@ -82,7 +82,7 @@ class FMenuItem : public FWidget FMenuItem (const FMenuItem&) = delete; // Destructor - virtual ~FMenuItem(); + ~FMenuItem() override; // Disable assignment operator (=) FMenuItem& operator = (const FMenuItem&) = delete; @@ -293,7 +293,7 @@ inline bool FMenuItem::hasHotkey() const //---------------------------------------------------------------------- inline bool FMenuItem::hasMenu() const -{ return bool(menu != 0); } +{ return bool(menu != nullptr); } //---------------------------------------------------------------------- inline FWidget* FMenuItem::getSuperMenu() const diff --git a/src/include/final/fmenulist.h b/src/include/final/fmenulist.h index 6a3ebfca..3ce66a41 100644 --- a/src/include/final/fmenulist.h +++ b/src/include/final/fmenulist.h @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2015-2019 Markus Gans * +* Copyright 2015-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -113,7 +113,7 @@ inline std::size_t FMenuList::getCount() const //---------------------------------------------------------------------- inline FMenuItem* FMenuList::getItem (int index) const -{ return ( index > 0 ) ? item_list[uInt(index - 1)] : 0; } +{ return ( index > 0 ) ? item_list[uInt(index - 1)] : nullptr; } //---------------------------------------------------------------------- inline FMenuItem* FMenuList::getSelectedItem() const diff --git a/src/include/final/fmessagebox.h b/src/include/final/fmessagebox.h index a3fc36da..3ebb6334 100644 --- a/src/include/final/fmessagebox.h +++ b/src/include/final/fmessagebox.h @@ -95,7 +95,7 @@ class FMessageBox : public FDialog , int, int, int , FWidget* = nullptr ); // Destructor - virtual ~FMessageBox(); + ~FMessageBox() override; // Assignment operator (=) FMessageBox& operator = (const FMessageBox&); diff --git a/src/include/final/fmouse.h b/src/include/final/fmouse.h index 426e6026..ac1d1ad0 100644 --- a/src/include/final/fmouse.h +++ b/src/include/final/fmouse.h @@ -204,7 +204,7 @@ class FMouseGPM final : public FMouse FMouseGPM(); // Destructor - virtual ~FMouseGPM(); + ~FMouseGPM() override; // Accessors const FString getClassName() const override; @@ -272,7 +272,7 @@ class FMouseX11 final : public FMouse FMouseX11() = default; // Destructor - virtual ~FMouseX11() = default; + ~FMouseX11() override = default; // Accessors const FString getClassName() const override; @@ -331,7 +331,7 @@ class FMouseSGR final : public FMouse FMouseSGR() = default; // Destructor - virtual ~FMouseSGR() = default; + ~FMouseSGR() override = default; // Accessors const FString getClassName() const override; @@ -390,7 +390,7 @@ class FMouseUrxvt final : public FMouse FMouseUrxvt() = default; // Destructor - virtual ~FMouseUrxvt() = default; + ~FMouseUrxvt() override = default; // Accessors const FString getClassName() const override; diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index d4ffadde..9549a103 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2016-2019 Markus Gans * +* Copyright 2016-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -172,7 +172,7 @@ class FOptiAttr final void set_orig_orig_colors (char[]); // Inquiry - static bool isNormal (FChar*&); + static bool isNormal (const FChar* const&); // Methods void initialize(); @@ -258,12 +258,12 @@ class FOptiAttr final void setAttributesOff (FChar*&); // Inquiries - static bool hasColor (FChar*&); - static bool hasAttribute (FChar*&); - static bool hasNoAttribute (FChar*&); + static bool hasColor (const FChar* const&); + static bool hasAttribute (const FChar* const&); + static bool hasNoAttribute (const FChar* const&); // Methods - bool hasColorChanged (FChar*&, FChar*&); + bool hasColorChanged (const FChar* const&, const FChar* const&); void resetColor (FChar*&); void prevent_no_color_video_attributes (FChar*&, bool = false); void deactivateAttributes (FChar*&, FChar*&); @@ -271,13 +271,13 @@ class FOptiAttr final void changeAttributeSeparately (FChar*&, FChar*&); void change_color (FChar*&, FChar*&); void change_to_default_color (FChar*&, FChar*&, FColor&, FColor&); - void change_current_color (FChar*&, FColor, FColor); + void change_current_color (const FChar* const&, FColor, FColor); void resetAttribute (FChar*&); void reset (FChar*&); bool caused_reset_attributes (char[], uChar = all_tests); bool hasCharsetEquivalence(); - void detectSwitchOn (FChar*&, FChar*&); - void detectSwitchOff (FChar*&, FChar*&); + void detectSwitchOn (const FChar* const&, const FChar* const&); + void detectSwitchOff (const FChar* const&, const FChar* const&); bool switchOn(); bool switchOff(); bool append_sequence (char[]); diff --git a/src/include/final/fprogressbar.h b/src/include/final/fprogressbar.h index 7c6168a7..af83df28 100644 --- a/src/include/final/fprogressbar.h +++ b/src/include/final/fprogressbar.h @@ -66,7 +66,7 @@ class FProgressbar : public FWidget explicit FProgressbar(FWidget* = nullptr); // Destructor - virtual ~FProgressbar(); + ~FProgressbar() override; // Accessors const FString getClassName() const override; diff --git a/src/include/final/fradiobutton.h b/src/include/final/fradiobutton.h index ac0176fb..c72551e1 100644 --- a/src/include/final/fradiobutton.h +++ b/src/include/final/fradiobutton.h @@ -72,7 +72,7 @@ class FRadioButton : public FToggleButton FRadioButton (const FRadioButton&) = delete; // Destructor - virtual ~FRadioButton(); + ~FRadioButton() override; // Disable assignment operator (=) FRadioButton& operator = (const FRadioButton&) = delete; diff --git a/src/include/final/fradiomenuitem.h b/src/include/final/fradiomenuitem.h index 53e4fb0f..fb80dea0 100644 --- a/src/include/final/fradiomenuitem.h +++ b/src/include/final/fradiomenuitem.h @@ -72,7 +72,7 @@ class FRadioMenuItem : public FMenuItem FRadioMenuItem (const FRadioMenuItem&) = delete; // Destructor - virtual ~FRadioMenuItem(); + ~FRadioMenuItem() override; // Disable assignment operator (=) FRadioMenuItem& operator = (const FRadioMenuItem&) = delete; diff --git a/src/include/final/fscrollbar.h b/src/include/final/fscrollbar.h index 36497ce9..d59a523d 100644 --- a/src/include/final/fscrollbar.h +++ b/src/include/final/fscrollbar.h @@ -92,7 +92,7 @@ class FScrollbar : public FWidget FScrollbar (const FScrollbar&) = delete; // Destructor - virtual ~FScrollbar(); + ~FScrollbar() override; // Disable assignment operator (=) FScrollbar& operator = (const FScrollbar&) = delete; diff --git a/src/include/final/fscrollview.h b/src/include/final/fscrollview.h index eb7f4fa2..4d76c047 100644 --- a/src/include/final/fscrollview.h +++ b/src/include/final/fscrollview.h @@ -74,7 +74,7 @@ class FScrollView : public FWidget FScrollView (const FScrollView&) = delete; // Destructor - virtual ~FScrollView(); + ~FScrollView() override; // Disable assignment operator (=) FScrollView& operator = (const FScrollView&) = delete; diff --git a/src/include/final/fspinbox.h b/src/include/final/fspinbox.h index c3ec606c..d8dc5a98 100644 --- a/src/include/final/fspinbox.h +++ b/src/include/final/fspinbox.h @@ -72,7 +72,7 @@ class FSpinBox : public FWidget FSpinBox (const FSpinBox&) = delete; // Destructor - ~FSpinBox(); + ~FSpinBox() override; // Disable assignment operator (=) FSpinBox& operator = (const FSpinBox&) = delete; diff --git a/src/include/final/fstatusbar.h b/src/include/final/fstatusbar.h index d55280aa..c0057f6a 100644 --- a/src/include/final/fstatusbar.h +++ b/src/include/final/fstatusbar.h @@ -81,7 +81,7 @@ class FStatusKey : public FWidget FStatusKey (const FStatusKey&) = delete; // Destructor - virtual ~FStatusKey(); + ~FStatusKey() override; // Disable assignment operator (=) FStatusKey& operator = (const FStatusKey&) = delete; @@ -190,7 +190,7 @@ class FStatusBar : public FWindow FStatusBar (const FStatusBar&) = delete; // Destructor - virtual ~FStatusBar(); + ~FStatusBar() override; // Disable assignment operator (=) FStatusBar& operator = (const FStatusBar&) = delete; diff --git a/src/include/final/fswitch.h b/src/include/final/fswitch.h index eb29991d..a9cfb3f9 100644 --- a/src/include/final/fswitch.h +++ b/src/include/final/fswitch.h @@ -72,7 +72,7 @@ class FSwitch : public FToggleButton FSwitch (const FSwitch&) = delete; // Destructor - virtual ~FSwitch(); + ~FSwitch() override; // Disable assignment operator (=) FSwitch& operator = (const FSwitch&) = delete; diff --git a/src/include/final/fsystemimpl.h b/src/include/final/fsystemimpl.h index 36b135c0..a57147aa 100644 --- a/src/include/final/fsystemimpl.h +++ b/src/include/final/fsystemimpl.h @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2019 Markus Gans * +* Copyright 2019-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -95,7 +95,7 @@ class FSystemImpl : public FSystem FSystemImpl(); // Destructor - virtual ~FSystemImpl(); + ~FSystemImpl() override; // Methods #if defined(ISA_SYSCTL_SUPPORT) diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index 47b42bd8..a3004e8c 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -210,7 +210,7 @@ class FTerm final #endif // Inquiries - static bool isNormal (FChar*&); + static bool isNormal (const FChar* const&); static bool isRaw(); static bool hasUTF8(); static bool hasVT100(); @@ -424,8 +424,7 @@ inline bool FTerm::unsetUTF8() template inline void FTerm::putstringf (const char format[], Args&&... args) { - const int size = std::snprintf ( nullptr, 0, format - , std::forward(args)... ) + 1; + const int size = std::snprintf (nullptr, 0, format, args...) + 1; if ( size == -1 ) return; diff --git a/src/include/final/ftermcap.h b/src/include/final/ftermcap.h index b74f5cc5..f1dbe48b 100644 --- a/src/include/final/ftermcap.h +++ b/src/include/final/ftermcap.h @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2016-2019 Markus Gans * +* Copyright 2016-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -87,7 +87,7 @@ class FTermcap final FTermcap() = default; // Destructor - ~FTermcap() = default; + virtual ~FTermcap() = default; // Accessors const FString getClassName() const; diff --git a/src/include/final/ftermdata.h b/src/include/final/ftermdata.h index 12e79c7f..d3adeab3 100644 --- a/src/include/final/ftermdata.h +++ b/src/include/final/ftermdata.h @@ -57,13 +57,15 @@ class FTermData final typedef std::unordered_map encodingMap; // Constructors - FTermData() {} + FTermData() + { } // Disable copy constructor FTermData (const FTermData&) = delete; // Destructor - ~FTermData() {} + ~FTermData() + { } // Disable assignment operator (=) FTermData& operator = (const FTermData&) = delete; diff --git a/src/include/final/ftermdetection.h b/src/include/final/ftermdetection.h index 4b2fc9d1..42f82e55 100644 --- a/src/include/final/ftermdetection.h +++ b/src/include/final/ftermdetection.h @@ -176,10 +176,10 @@ class FTermDetection final static char* secDA_Analysis_65 (char[]); static char* secDA_Analysis_67 (char[]); static char* secDA_Analysis_77 (char[]); - static char* secDA_Analysis_82 (char[]); + static char* secDA_Analysis_82 (); static char* secDA_Analysis_83 (char[]); static char* secDA_Analysis_84 (char[]); - static char* secDA_Analysis_85 (char[]); + static char* secDA_Analysis_85 (); static char* secDA_Analysis_vte (char[]); // Data members diff --git a/src/include/final/ftextview.h b/src/include/final/ftextview.h index 5676b5c8..bc74045f 100644 --- a/src/include/final/ftextview.h +++ b/src/include/final/ftextview.h @@ -76,7 +76,7 @@ class FTextView : public FWidget FTextView (const FTextView&) = delete; // Destructor - virtual ~FTextView(); + ~FTextView() override; // Disable assignment operator (=) FTextView& operator = (const FTextView&) = delete; diff --git a/src/include/final/ftogglebutton.h b/src/include/final/ftogglebutton.h index 6d1026af..2df91f57 100644 --- a/src/include/final/ftogglebutton.h +++ b/src/include/final/ftogglebutton.h @@ -73,7 +73,7 @@ class FToggleButton : public FWidget FToggleButton (const FToggleButton&) = delete; // Destructor - virtual ~FToggleButton(); + ~FToggleButton() override; // Disable assignment operator (=) FToggleButton& operator = (const FToggleButton&) = delete; diff --git a/src/include/final/ftooltip.h b/src/include/final/ftooltip.h index 9097829f..49bf55e0 100644 --- a/src/include/final/ftooltip.h +++ b/src/include/final/ftooltip.h @@ -74,7 +74,7 @@ class FToolTip : public FWindow FToolTip (const FToolTip&) = delete; // Destructor - virtual ~FToolTip (); + ~FToolTip () override; // Disable assignment operator (=) FToolTip& operator = (const FToolTip&) = delete; diff --git a/src/include/final/fvterm.h b/src/include/final/fvterm.h index dfe4649c..bc2bd52a 100644 --- a/src/include/final/fvterm.h +++ b/src/include/final/fvterm.h @@ -437,7 +437,7 @@ class FVTerm , FChar*& ); bool clearTerm (int = ' '); bool clearFullArea (FTermArea*, FChar&); - static void clearAreaWithShadow (FTermArea*, FChar&); + static void clearAreaWithShadow (FTermArea*, const FChar&); static bool canClearToEOL (uInt, uInt); static bool canClearLeadingWS (uInt&, uInt); static bool canClearTrailingWS (uInt&, uInt); @@ -448,11 +448,11 @@ class FVTerm void printFullWidthCharacter (uInt&, uInt, FChar*&); void printFullWidthPaddingCharacter (uInt&, uInt, FChar*&); void printHalfCovertFullWidthCharacter (uInt&, uInt, FChar*&); - void skipPaddingCharacter (uInt&, uInt, FChar*&); + void skipPaddingCharacter (uInt&, uInt, const FChar* const&); exit_state eraseCharacters (uInt&, uInt, uInt, bool); exit_state repeatCharacter (uInt&, uInt, uInt); - bool isFullWidthChar (FChar*&); - bool isFullWidthPaddingChar (FChar*&); + bool isFullWidthChar (const FChar* const&); + bool isFullWidthPaddingChar (const FChar* const&); static void cursorWrap(); bool printWrap (FTermArea*); void printPaddingCharacter (FTermArea*, FChar&); diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h index 18c6766c..6049bb62 100644 --- a/src/include/final/fwidget.h +++ b/src/include/final/fwidget.h @@ -177,7 +177,7 @@ class FWidget : public FVTerm, public FObject FWidget (const FWidget&) = delete; // Destructor - virtual ~FWidget(); + ~FWidget() override; // Disable assignment operator (=) FWidget& operator = (const FWidget&) = delete; diff --git a/src/include/final/fwindow.h b/src/include/final/fwindow.h index da77fcb1..0e11c88e 100644 --- a/src/include/final/fwindow.h +++ b/src/include/final/fwindow.h @@ -77,7 +77,7 @@ class FWindow : public FWidget FWindow (const FWindow&) = delete; // Destructor - virtual ~FWindow (); + ~FWindow () override; // Disable assignment operator (=) FWindow& operator = (const FWindow&) = delete; diff --git a/src/include/final/sgr_optimizer.h b/src/include/final/sgr_optimizer.h index b0c34a77..a7508711 100644 --- a/src/include/final/sgr_optimizer.h +++ b/src/include/final/sgr_optimizer.h @@ -3,7 +3,7 @@ * * * This file is part of the Final Cut widget toolkit * * * -* Copyright 2019 Markus Gans * +* Copyright 2019-2020 Markus Gans * * * * The Final Cut is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -54,7 +54,7 @@ class SGRoptimizer final typedef char attributebuffer[ATTR_BUF_SIZE]; // Constructors - SGRoptimizer (attributebuffer&); + explicit SGRoptimizer (attributebuffer&); // Destructor virtual ~SGRoptimizer(); diff --git a/test/foptiattr-test.cpp b/test/foptiattr-test.cpp index b1cda4a2..5e338b78 100644 --- a/test/foptiattr-test.cpp +++ b/test/foptiattr-test.cpp @@ -269,6 +269,12 @@ void FOptiAttrTest::sgrOptimizerTest() sgr_optimizer.optimize(); CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") ); + + std::strcpy(buffer, CSI "m" CSI "38;5;20m" XXXX<<< CSI "48;5;229m"); + sgr_optimizer.optimize(); + CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") ); + + std::strcpy(buffer, CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m" CSI "5m" CSI "7m" CSI "8m" CSI "9m"); sgr_optimizer.optimize();