Skip to content

Conversation

@No0ne558
Copy link
Contributor

@No0ne558 No0ne558 commented Jan 16, 2026

Title: Merge dev branch into master - C++23 Modernization, UI Improvements, and Bug Fixes

Description:

This pull request merges the latest developments from the dev branch into master, incorporating significant code modernization, UI enhancements, performance optimizations, and bug fixes. The changes span approximately the last 88 commits, focusing on transitioning to C++23 standards, improving code quality through clang-tidy compliance, enhancing user interface components, and removing deprecated subsystems.

Summary of Changes

  • C++23 Modernization: Complete migration to modern C++ features including std::format for string formatting, nullptr usage, std::array for fixed-size buffers, and extensive enum conversions from legacy macros.
  • Code Quality: Resolved numerous clang-tidy warnings including branch-clone patterns, narrowing conversions, missing default cases, and added proper override specifiers throughout the codebase.
  • UI/UX Improvements: Modernized quantity entry keypad, redesigned order comment dialogs, fixed double-touch issues, and improved button highlighting and view separations.
  • Performance: Optimized screen saver drawing, added Raspberry Pi CM5 memory optimizations, and reduced enum sizes for better memory footprint.
  • Bug Fixes: Addressed crashes in user edit zones, NULL pointer dereferences, rounding errors, and various compiler warnings.
  • Testing: Expanded test suite with 26 new test cases, achieving 40/40 passing tests.
  • CI/Build: Updated CI workflows to use C++23 standard and GCC 14+ for better stdlib support.
  • Documentation: Updated changelogs, added development documentation, and maintained comprehensive commit history.

Detailed Commit Breakdown

C++23 Modernization and Code Quality Improvements

  • 0da2cb7 feat: Complete C++23 modernization - convert all snprintf/sprintf to std::format
  • 3aff81b feat: comprehensive nullptr modernization across entire codebase
  • 6a53f44 feat: extend clang-tidy modernizations
  • d59dd89 feat: apply targeted C++ modernizations
  • 676ea8d refactor: modernize C-arrays to std::array in manager.cc
  • e50273b Modernize fixed-size buffers to std::array in manager.cc
  • c96a911 Enum migration: Complete settings format enums (PriceRounding, MeasureSystem, Date/Number/TimeFormat)
  • e0302f8 Clean up lingering SERVER_* macro references in debug/locale strings
  • 36408a0 Macro → Enum sweep: DrawerModeType + printer/server/op/window protocols
  • d6a8ded drawer-print: migrate to DrawerPrintType enum; remove legacy arrays; use enum in UI and drawer flow; tests green
  • 296ac34 settings-ui: switch ReceiptPrint display/cycle to ReceiptPrintType; remove ReceiptPrintName/Value arrays; tests green
  • 852ab3e settings: use ReceiptPrintType at call sites (check/payment) via vt::IntToEnum; behavior unchanged; tests green
  • e5598fa receipt: convert RECEIPT_* macros to enums (ReceiptCopy, ReceiptPrintMode); preserve values; tests green
  • 98cb9d3 print: convert PRINT_* macros to enum PrintModeFlags; dedupe in report.hh; tests green
  • 83ff2f5 zone: convert ZONE_* macros to enum ZoneType for type safety; preserve numeric IDs; all tests green
  • da5e043 refactor: resolve remaining branch-clone warnings
  • c283fdd fix: eliminate narrowing conversions in check.cc
  • fa6afa4 refactor: consolidate duplicate branch bodies in check.cc
  • 6f282b9 fix: add missing default cases in switch statements
  • 5f19499 Fix duplicate branch bodies in settings.cc (clang-tidy bugprone-branch-clone)
  • df56674 Fix critical bugprone warnings: empty catch blocks and narrowing conversions
  • 4caefc0 refactor: reduce branch-clone patterns in dialogs and credit card list
  • c6d1e47 refactor: eliminate branch-clone patterns in button_zone.cc
  • 69b671d refactor: remove duplicate branch bodies (bugprone-branch-clone)
  • 67ade57 fix: add missing default cases to switch statements (bugprone-switch-missing-default-case)
  • e64d8fa fix: resolve narrowing conversion warnings (bugprone-narrowing-conversions)
  • b5c984b zone(chart): add/remove override specifiers and fix mismatched annotations
  • 425d151 zone(creditcard): add override specifiers to CreditCardListZone methods
  • 22b301d zone(drawer): add safe override specifiers to DrawerAssignZone and DrawerManageZone
  • eff1cad Annotate CDUZone destructor and overrides in cdu_zone.hh
  • 4076feb Add override annotations to AccountZone methods
  • 39b8911 Annotate ListField destructor with override in form_zone.cc
  • 7b99b5b Annotate ButtonZone-derived classes with override where appropriate; remove erroneous override on ValidateCommand
  • 0d3ac17 Add missing override specifiers to ButtonZone methods
  • cd49d24 Add override specifiers to DialogZone-derived classes (clang-tidy: modernize-use-override)
  • 6aecb92 Add override specifiers to LayoutZone methods (clang-tidy: modernize-use-override)
  • 86de43a Add override specifiers to PosZone/PosPage (clang-tidy: modernize-use-override)
  • 0067463 Add missing override specifiers to inline getters and ReadZone::FileName() (clang-tidy: modernize-use-override)
  • cd2531c Add missing override specifiers (report_zone.hh, settings.hh) — clang-tidy: modernize-use-override
  • a45dd24 Add missing override specifiers to CDU derived classes (clang-tidy: modernize-use-override)
  • 9ec84ec Add missing override specifiers to Printer derived classes (clang-tidy: modernize-use-override)
  • d2d5ed6 fix(check.cc): correct floating point rounding with lround()
  • 40cbbbe fix(clang-tidy): replace NULL with nullptr and bzero with memset
  • e08abc4 fix(clang-tidy): remove reserved identifier prefixes from header guards
  • 9dc9807 fix(clang-tidy): replace NULL with nullptr and fix reserved identifiers
  • 6aea88d Fix compiler warnings: use safe string concat in SMTP, silence unused params, fix assignment bug, annotate fallthrough, avoid hidden overloads, and bracket empty bodies

UI and UX Enhancements

  • d02a77c UI: Modernize quantity entry keypad
  • ffb3673 Complete OrderCommentDialog redesign with modern layout
  • 9aade33 Fix ListField double-touch and improve Order Comment dialog
  • 46163ff Fix double-touch and click area issues in ListField
  • 2ab82a1 Fix Sales Item List button view separation - show list and form separately
  • 896892b Fix job security touch flow and hardware view toggle

Performance Optimizations

  • 6439b95 Performance: Optimize screen saver drawing efficiency
  • e3191f3 perf: Add memory efficiency optimizations for Raspberry Pi CM5
  • e751a1f perf: optimize enum sizes to reduce memory footprint

Bug Fixes

  • 1b7f546 fix: Remove broken static tile cache causing button highlighting bugs
  • 0523bc1 fix: Preload all textures to fix button highlighting bug
  • 5160ede Fix User Edit Zone crashes on save operations
  • c259bcf fix: Prevent NULL pointer dereference crash in UserEditZone::SaveRecord
  • b8b033b Fix lambda capture of member variable file_version in Archive constructor
  • a46404b fix: correct rounding in tax calculation
  • 4e1cb47 Fix logging system test failure to achieve 40/40 passing tests
  • fcd9c90 fix: Add C++20/C++23 feature detection for compiler compatibility
  • 0d56140 fix: Remove default case breaking page inheritance in Page::Init()
  • 1bf525b fix(clang-analyzer): initialize char arrays in PrintWorkOrder to avoid potential undefined value access

Testing

  • 96b0300 test: Add comprehensive test suite expansion with 26 new test cases

CI and Build Updates

  • 0474d4c ci: Remove old compiler entries from include section
  • 86d59cb ci: Restrict CI to GCC 14+ for C++23 stdlib support
  • 5165581 ci: Update Linux builds workflow to use C++23 standard

Documentation Updates

  • dd00023 docs: note branch-clone cleanups in dialog and credit card modules
  • 8e3fbba docs: extend changelog with button_zone.cc branch-clone cleanup details
  • 0631955 docs: changelog for bugprone-branch-clone refactor in manager.cc
  • 262b4a5 docs: add changelog entry for bugprone-switch-missing-default-case fixes
  • f88a1c3 docs(changelog): document clang-tidy/override audit and current test status (12-21-2025)
  • da08966 docs(changelog): document clang-tidy fixes, nullptr conversions, memset substitution, rounding fixes, and test status (39/40)
  • f65f603 docs(changelog): record removal of Reverse SSH subsystem
  • 56432de Add README for development branch
  • a5bd65f Add Development.md for dev branch and remove README.md
  • 457c654 Delete Development.md
  • c08ccdd Address clang-tidy findings and update changelog

Feature Removals

  • 38890c3 Remove reverse SSH configuration, settings, init/shutdown, and CMake targets/installs
  • afed011 Remove Reverse SSH subsystem: sources, daemon, scripts, config, and docs

Merge Commits

Testing Notes

  • All tests are passing (40/40) as confirmed in recent commits.
  • CI has been updated to use C++23 standard with GCC 14+.
  • Comprehensive test suite expansion ensures stability.

Breaking Changes

  • Removal of Reverse SSH subsystem may affect deployments relying on this feature.
  • Enum migrations preserve numeric values but change internal representations - no breaking API changes.

Checklist

  • Code compiles successfully
  • All tests pass
  • Documentation updated
  • Changelog maintained
  • No new compiler warnings introduced

… params, fix assignment bug, annotate fallthrough, avoid hidden overloads, and bracket empty bodies
- Replace all NULL with nullptr in zone module (zone.hh, zone_object.hh, zone_object.cc)
- Replace NULL with nullptr in term_view.hh
- Fix reserved identifier _ZONE_OBJECT_HH → ZONE_OBJECT_HH
- Fix reserved identifier _TERM_VIEW_HH → TERM_VIEW_HH
- Addresses modernize-use-nullptr and bugprone-reserved-identifier checks

All tests passing (40/40). Build clean.
- Replaced NULL with nullptr in all header files and implementation files
- Replaced deprecated bzero() calls with memset() in socket.cc
- Build clean, 39/40 tests passing (log test pre-existing failure)
- Replace incorrect (value + 0.5) cast patterns with lround()
- Affects 7 lines in fee calculation and tax calculation logic
- Use static_cast<int> for clarity
- Add #include <cmath> header
- Fixes bugprone-incorrect-roundings clang-tidy warnings
- Build clean, 39/40 tests passing
…et substitution, rounding fixes, and test status (39/40)
…remove erroneous override on ValidateCommand
Replaced NULL with nullptr across 123 files throughout the codebase
to improve type safety and C++11+ compliance.

Scope:
- zone/ directory: 58 files modernized
- main/ directory: 30 files modernized (1,217 NULL occurrences)
- term/ directory: 8 files modernized (106 NULL occurrences)
- src/ directory: 24 files modernized (7 NULL occurrences)
- loader/ and cdu/: 2 files modernized
- Fixed form_zone.hh header guard mismatch

Methodology:
- Applied clang-tidy with modernize-use-nullptr check
- Used -fix and -fix-errors flags for automated refactoring
- Manual fixes for edge cases in headers and complex expressions

Verification:
- All 40/40 unit tests passing
- Build successful with no errors
- Zero NULL literals remaining in actual code

Benefits:
- Type-safe null pointer constant (no implicit conversions)
- Better overload resolution in template contexts
- Clearer intent in modern C++ code
- Full C++11/14/17/20 compliance
Applied three high-value modernizations to improve code quality:

1. modernize-use-using (3 fixes)
   - Converted typedef to using aliases in manager.hh
   - Modern C++11 syntax for function pointer types

2. modernize-macro-to-enum (6 fixes)
   - Converted VERSION macros to constexpr constants
   - Affects: account, check, customer, labor, sales, tips
   - Benefits: type safety, proper scoping, debugger-friendly

3. modernize-use-nodiscard (auto-applied across codebase)
   - Added [[nodiscard]] to functions with important return values
   - Prevents accidental ignoring of IsEmpty(), Count(), etc.
   - Applied to: time_info.hh, utility.hh, vt_logger.hh, terminal.hh

Verification:
- All 40/40 tests passing
- Build successful with no errors
- 15 files modified, 81 insertions(+), 81 deletions(-)
Applied additional clang-tidy modernizations (auto, headers, void args, range-for, braced init, default member init, raw string) across core modules and documented in changelog. Build and tests: 40/40 passing.
Added comprehensive documentation for the development branch, including guidelines for contributors, build instructions, and issue reporting.
…ately

Fixed bug where Sales Item List button type was showing both the list of items
and the selected item's configuration simultaneously.

Root Cause: ListFormZone::Render() was unconditionally calling FormZone::Render()
which displayed form fields even when showing the list view.

Solution:
- Modified ListFormZone::Render() to conditionally call FormZone::Render() only
  when show_list is false (form view)
- Modified ListFormZone::Touch() to not load form fields when selecting items from
  the list
- Modified ListFormZone::Signal() to load form fields when switching from list to
  form view via 'change view' signal

Result: List view shows only items; form view shows only configuration fields;
switching between views requires explicit 'change view' signal.

This fix brings ListFormZone in line with the pattern established in HardwareZone
and affects all ListFormZone-based zones (ItemListZone, etc.).

Files modified:
- zone/form_zone.cc (ListFormZone::Render, Touch, Signal methods)
- docs/changelog.md
…std::format

- Converted ~450+ snprintf/sprintf calls to C++23 std::format using format_to_buffer()
- Added src/utils/cpp23_utils.hh library with format_to_buffer, to_underlying, Result<T>
- Modernized 60+ files across main/, zone/, src/, term/, loader/, cdu/
- Benefits: type safety, memory safety, readability, maintainability, zero overhead
- All builds passing with 0 errors

Known Issues:
- Some child pages not inheriting parent page buttons correctly
- Requires further investigation in page hierarchy handling
- Removed erroneous default case that forced parent_id = 0 for unhandled page types
- Restores inheritance for PAGE_SYSTEM, PAGE_TEMPLATE, PAGE_CHECKS, PAGE_KITCHEN_VID, PAGE_KITCHEN_VID2, PAGE_BAR1, PAGE_BAR2
- Matches master branch behavior where unhandled types retain initialized parent_id
- Fixes pages not showing inherited zones from parent pages
- Add __has_include detection for <format> and <expected> headers
- Provide fallback for std::to_underlying() using static_cast
- Conditionally compile std::expected types when available
- Add compile-time error if std::format unavailable
- Fixes Clang 18 build failures in CI (requires C++20+ stdlib with std::format)
- Change std: [20] to std: [23] in linux-simple-builds.yml
- Required due to C++23 modernization using std::format extensively
- Matches CMakeLists.txt default standard and local development
- Only test with g++-14 which has full C++23 stdlib (std::format, etc.)
- Older compilers lack std::format even with -std=c++23 flag
- Change #error to #warning for better diagnostics when std::format missing
- Documents minimum compiler requirements in workflow comments
- Keep only g++-14 in the include section
- Previous commit only removed from matrix but include re-added them
- Now truly restricts CI to GCC 14+ only
- Fixed double-triggering when using touchscreen by changing ListFormZone handlers to use LayoutZone::Touch instead of FormZone::Touch
- Fixed ListField click detection offset from .6 to 1 and boundary to match visual button area
- Resolves issues in Tender Settings and all form zones with list fields
- Fixed double-triggering in ListFormZone by calling LayoutZone::Touch instead of FormZone::Touch
- Fixed ListField click area boundaries to match visual button size
- Redesigned Order Comment dialog with 6-row QWERTY keyboard layout
- Added visible text entry box with absolute positioning
- Implemented text display updates showing typed characters in RED
- Added proper background clearing to prevent artifacting
- Adjusted text positioning for better centering

Work in progress: Still polishing the dialog keyboard implementation
- Redesigned keyboard with cleaner, more professional appearance
- Increased text entry box height to 80px for better visibility
- Repositioned entry box directly below title with optimal spacing
- Fine-tuned text baseline positioning for perfect vertical centering
- Changed entry box to IMAGE_LITE_WOOD with FRAME_INSET for cleaner look
- Improved button spacing (6px gaps) and heights (85px) for better touch targets
- Text displays in bold black (FONT_TIMES_34B) with high contrast
- Removed unused variables from Render method
- Entry box now properly contains all typed text with clear visibility
Complete OrderCommentDialog redesign with modern layout
- Add test_time_operations.cc with TimeInfo class tests
  * Time arithmetic operations (seconds, minutes, days, weeks, months, years)
  * Comparison operators and date ordering
  * Business logic scenarios (shift scheduling)
  * Operator overloads and edge cases

- Add test_error_handler.cc with error management tests
  * ErrorInfo construction and severity levels
  * Error categories (9 types: GENERAL, SYSTEM, NETWORK, etc.)
  * Context tracking (file, line, function, error code)
  * Real-world error scenarios

- Add test_sales_tax_calculations.cc with 43 test cases
  * US tax calculations, Canadian GST/PST/HST/QST
  * European VAT, discounts, coupons, modifiers
  * Quantity pricing and rounding

- Fix floating-point comparison precision issues
  * Apply Catch::Approx() to all float equality checks
  * Fix RAII scoping issue in test_memory_modernization.cc

- Update CMakeLists.txt to include new test files

Test suite now contains 80 test cases with 568 assertions (100% passing)
Fixes segmentation fault (SIGSEGV) when saving employee records in the
User Edit Zone. The crash occurred during form field iteration when the
field pointer became NULL.

Root Cause:
- Loop condition checked 'f != nullptr' but immediately dereferenced
  f->next without revalidation on the first line of the loop body
- This caused a segfault when f was NULL at loop entry or became NULL
  during iteration

Changes:
- Add explicit NULL check before dereferencing f->next in job info loop
- Add early validation for user pointer and FieldList() return value
- Add error logging with ReportError() for easier debugging
- Return error code 1 instead of continuing with NULL pointers

Crash Stack Trace Reference:
  TextField::Get(int&) <- UserEditZone::SaveRecord()
  Signal: SIGSEGV at zone/user_edit_zone.cc line 440

Tested: Compiles successfully, prevents crash on employee save operation
- Fixed SIGSEGV when saving employee records caused by NULL/dangling user pointers
- Added user pointer validation before SaveRecord calls in Signal() and Update()
- Enhanced SaveRecord field iteration with proper null checks and early breaks
- Added dangling pointer detection to catch freed memory access
- Improved error logging for better debugging

Root causes:
1. SaveRecord called without validating user pointer when toggling Active/Inactive
2. SaveRecord called without validation during job filter updates
3. Field pointer advanced without null checks in job info iteration loop

Testing: Validated with AddressSanitizer in Debug build
Fixes: User Edit button type save crashes
Fix User Edit Zone Crashes and Add Comprehensive Test Coverage
Object Pool System:
- Add src/core/object_pool.hh with thread-safe ObjectPool<T> template
- Add PooledObject<T> RAII wrapper for automatic return to pool
- Add BufferPool<Size> for fixed-size char buffer pooling
- Configurable max pool size (default 64 objects)

Thread Pool & Async I/O:
- Add src/core/thread_pool.hh with ThreadPool for async operations
- Add WriteBehindBuffer for deferred writes
- Add CloseAsync() for non-blocking printer operations
- Add 5-second socket timeouts to prevent hangs

Memory Management Improvements:
- Convert Report* to std::unique_ptr<Report> in 8 zone files
- Add O(1) Count() caching for DList/SList (was O(n))
- Add lazy texture loading with LRU cache in term_view
- Reduce CharQueue default size from 2MB to 256KB
- Add RemoveAndDelete() helpers for linked lists
- Add RAII for KeyValueInputFile/KeyValueOutputFile

Quick Fixes:
- Cache term->GetSettings() pointer in hot paths
- Fix socket leaks in socket.cc and loader_main.cc

Target: Raspberry Pi CM5 with 2GB RAM optimization
Tests: 83/83 passing
The lazy texture loading optimization conflicted with the static tile
cache in Layer::Rectangle(), causing buttons to incorrectly show
highlighted state.

- Add PreloadAllTextures() function to load all textures at startup
- Call PreloadAllTextures() after ResetView() during initialization
- Ensures consistent Pixmap values before any rendering occurs
The static cache optimization in Layer::Rectangle() was fundamentally
broken - static variables persisted across all rendering calls, causing
stale cache values to be used when different buttons needed different
textures.

- Remove static current_tile, current_origin_x, current_origin_y cache
- Each Rectangle() call now properly sets XSetTile and XSetTSOrigin
- Ensures correct texture rendering for all button states
Fix button highlighting bugs and optimize memory for Raspberry Pi CM5
- Remove 5-item increment limit, allow unlimited increases up to 10,000
- Redesign keypad with phone-style layout (1-2-3, 4-5-6, etc.)
- Larger entry field (200x50) with bigger font, centered at top
- Immediate redraw for responsive input
- Remove dialog title for cleaner interface
- Start entry field blank for new quantity input

Files: zone/order_zone.cc, zone/dialog_zone.cc, docs/changelog.md
UI: Modernize quantity entry keypad
- Cache font and text metrics to avoid recomputation every frame
- Eliminate full-screen fill on every animation frame
- Add selective erasure of previous text position
- Reduce CPU/GPU load during screen saver animation

Files: term/term_view.cc, docs/changelog.md
Performance: Optimize screen saver drawing efficiency
@No0ne558 No0ne558 merged commit 3f56773 into master Jan 16, 2026
2 checks passed
@GeneMosher
Copy link
Member

A whole lot of warnings during compile have vanished ! There are hardly any now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants