Control: tags -1 + patch

On 2023-12-05 23:07 +0100, Santiago Vila wrote:

> Package: src:nfstrace
> Version: 0.4.3.2+git20200805+b220d04-2.2
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> --------------------------------------------------------------------------------
> [  7%] Building CXX object 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o
> cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/analyzers/src/watch && /usr/bin/c++ 
> -Dwatch_EXPORTS -I/<<PKGBUILDDIR>>/src -I/usr/include/tirpc 
> -I/<<PKGBUILDDIR>>/analyzers/src/watch -g -O2 
> -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong 
> -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection 
> -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++14 -pedantic -Wall -Werror -Wextra 
> -Wno-invalid-offsetof -Wno-error=address-of-packed-member -fPIC 
> -fvisibility=hidden -fPIC -MD -MT 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o -MF 
> CMakeFiles/watch.dir/nc_windows/header_window.cpp.o.d -o 
> CMakeFiles/watch.dir/nc_windows/header_window.cpp.o -c 
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.cpp
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.cpp: In member 
> function ‘void HeaderWindow::resize(MainWindow&)’:
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.cpp:90:72: 
> error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}
>    90 |         _window = subwin(m._window, 
> std::min(static_cast<int>(m._window->_maxy), GUI_HEADER_HEIGHT), 
> std::min(static_cast<int>(m._window->_maxx), GUI_LENGTH), 0, 0);
>       |                                                                       
>  ^~
> In file included from 
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.h:25,
>                  from 
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.cpp:28:
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>       |                ^~~~~~~
> /<<PKGBUILDDIR>>/analyzers/src/watch/nc_windows/header_window.cpp:90:137: 
> error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}
>    90 |         _window = subwin(m._window, 
> std::min(static_cast<int>(m._window->_maxy), GUI_HEADER_HEIGHT), 
> std::min(static_cast<int>(m._window->_maxx), GUI_LENGTH), 0, 0);
>       |                                                                       
>                                                                   ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>       |                ^~~~~~~
> make[3]: *** [analyzers/src/watch/CMakeFiles/watch.dir/build.make:79: 
> analyzers/src/watch/CMakeFiles/watch.dir/nc_windows/header_window.cpp.o] 
> Error 1

The attached patch fixes these errors and similar ones in
analyzers/src/watch/nc_windows/statistics_window.cpp.  Note that
getmaxx(window) returns window->_maxx + 1, and similar for getmaxy().

Disclaimer: I have only tested that the package builds, not if it works.

Cheers,
       Sven

From dcffbee1fa8170fdf6906791eb0239fac63e5333 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Thu, 21 Dec 2023 17:12:56 +0100
Subject: [PATCH] Fix FTBFS with opqaque ncurses

Since ncurses patchlevel 20231021 the WINDOW structure is opaque, its
members cannot be addressed directly.  Use the getmaxy/getmaxx
functions ncurses provides for this purpose instead.
---
 analyzers/src/watch/nc_windows/header_window.cpp     | 2 +-
 analyzers/src/watch/nc_windows/statistics_window.cpp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/analyzers/src/watch/nc_windows/header_window.cpp b/analyzers/src/watch/nc_windows/header_window.cpp
index a376488..047d555 100644
--- a/analyzers/src/watch/nc_windows/header_window.cpp
+++ b/analyzers/src/watch/nc_windows/header_window.cpp
@@ -87,7 +87,7 @@ void HeaderWindow::resize(MainWindow& m)
     }
     if(m._window != nullptr)
     {
-        _window = subwin(m._window, std::min(static_cast<int>(m._window->_maxy), GUI_HEADER_HEIGHT), std::min(static_cast<int>(m._window->_maxx), GUI_LENGTH), 0, 0);
+        _window = subwin(m._window, std::min(static_cast<int>(getmaxy(m._window) - 1 ), GUI_HEADER_HEIGHT), std::min(static_cast<int>(getmaxx(m._window) - 1 ), GUI_LENGTH), 0, 0);
     }
     if(_window != nullptr)
     {
diff --git a/analyzers/src/watch/nc_windows/statistics_window.cpp b/analyzers/src/watch/nc_windows/statistics_window.cpp
index b580bba..c2e27fc 100644
--- a/analyzers/src/watch/nc_windows/statistics_window.cpp
+++ b/analyzers/src/watch/nc_windows/statistics_window.cpp
@@ -50,7 +50,7 @@ void StatisticsWindow::destroy()

 bool StatisticsWindow::canWrite(unsigned int i)
 {
-    return (i >= _scrollOffset.at(_activeProtocol) + STATISTICS::FIRST_OPERATION_LINE && i - _scrollOffset.at(_activeProtocol) + BORDER_SIZE < static_cast<unsigned int>(_window->_maxy));
+    return (i >= _scrollOffset.at(_activeProtocol) + STATISTICS::FIRST_OPERATION_LINE && i - _scrollOffset.at(_activeProtocol) + BORDER_SIZE < static_cast<unsigned int>(getmaxy(_window) - 1));
 }

 StatisticsWindow::StatisticsWindow(MainWindow& w, StatisticsContainers& c)
@@ -182,10 +182,10 @@ void StatisticsWindow::resize(MainWindow& m)
     {
         tmp_size = _activeProtocol->getAmount() + 2 * BORDER_SIZE + 2 * EMPTY_LINE + STATISTICS::PROTOCOLS_LINE + _activeProtocol->getGroups() * EMPTY_LINE * _activeProtocol->getGroups();
     }
-    if(m._window != nullptr && m._window->_maxy > GUI_HEADER_HEIGHT)
+    if(m._window != nullptr && getmaxy(m._window) - 1 > GUI_HEADER_HEIGHT)
     {
-        _window = subwin(m._window, std::min(static_cast<int>(m._window->_maxy - GUI_HEADER_HEIGHT), tmp_size),
-                         std::min(static_cast<int>(m._window->_maxx), GUI_LENGTH), GUI_HEADER_HEIGHT - BORDER_SIZE, 0);
+        _window = subwin(m._window, std::min(static_cast<int>(getmaxy(m._window) - 1 - GUI_HEADER_HEIGHT), tmp_size),
+                         std::min(static_cast<int>(getmaxx(m._window) - 1), GUI_LENGTH), GUI_HEADER_HEIGHT - BORDER_SIZE, 0);
         updateProtocol(_activeProtocol);
     }
 }
--
2.43.0

Reply via email to