Control: tags -1 + patch

On 2023-12-10 20:17 +0100, Santiago Vila wrote:

> Package: src:cunit
> Version: 2.1-3-dfsg-2.6
> Severity: serious
> Tags: ftbfs
>
> Dear maintainer:
>
> During a rebuild of all packages in unstable, your package failed to build:
>
> --------------------------------------------------------------------------------
> [...]
>>/debian/build-ncurses/CUnit/Headers -std=c99 -c -o Curses.lo Curses.c
> Curses.c: In function ‘initialize_windows’:
> Curses.c:259:41: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   259 |   f_nLeft = application_windows.pMainWin->_begx;
>       |                                         ^~
> Curses.c:260:40: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   260 |   f_nTop = application_windows.pMainWin->_begy;
>       |                                        ^~
> Curses.c:261:42: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   261 |   f_nWidth = application_windows.pMainWin->_maxx;
>       |                                          ^~
> Curses.c:262:43: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   262 |   f_nHeight = application_windows.pMainWin->_maxy;
>       |                                           ^~
> Curses.c: In function ‘refresh_windows’:
> Curses.c:361:41: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   361 |   f_nLeft = application_windows.pMainWin->_begx;
>       |                                         ^~
> Curses.c:362:40: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   362 |   f_nTop = application_windows.pMainWin->_begy;
>       |                                        ^~
> Curses.c:363:42: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   363 |   f_nWidth = application_windows.pMainWin->_maxx;
>       |                                          ^~
> Curses.c:364:43: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   364 |   f_nHeight = application_windows.pMainWin->_maxy;
>       |                                           ^~
> Curses.c: In function ‘create_pad’:
> Curses.c:910:52: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   910 |   pPad->uiWinLeft = application_windows.pDetailsWin->_begx + 1;
>       |                                                    ^~
> Curses.c:911:51: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   911 |   pPad->uiWinTop = application_windows.pDetailsWin->_begy + 1;
>       |                                                   ^~
> Curses.c:912:55: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   912 |   pPad->uiWinColumns = application_windows.pDetailsWin->_maxx - 2;
>       |                                                       ^~
> Curses.c:913:52: error: invalid use of incomplete typedef ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   913 |   pPad->uiWinRows = application_windows.pDetailsWin->_maxy - 2;
>       |                                                    ^~

The attached patch, which can be added to the series file, fixes these
errors, but I have only tested that the package builds, not if it works.
Note that getmaxx(win) returns win->_maxx + 1, and similar for getmaxy.

Cheers,
       Sven

From 6412a56519dabfc18365d97abb06388c029d84aa Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Sat, 16 Dec 2023 11:23:40 +0100
Subject: [PATCH] Fix FTBFS with newer ncurses

Since ncurses patchlevel 20231021 the WINDOW structure is opaque, its
members cannot be addressed directly.  Use the functions ncurses
provides for this purpose instead.
---
 CUnit/Sources/Curses/Curses.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/CUnit/Sources/Curses/Curses.c b/CUnit/Sources/Curses/Curses.c
index 17eaa30..eda272e 100644
--- a/CUnit/Sources/Curses/Curses.c
+++ b/CUnit/Sources/Curses/Curses.c
@@ -256,10 +256,10 @@ static bool initialize_windows(void)

   start_color();

-  f_nLeft = application_windows.pMainWin->_begx;
-  f_nTop = application_windows.pMainWin->_begy;
-  f_nWidth = application_windows.pMainWin->_maxx;
-  f_nHeight = application_windows.pMainWin->_maxy;
+  f_nLeft = getbegx(application_windows.pMainWin);
+  f_nTop = getbegy(application_windows.pMainWin);
+  f_nWidth = getmaxx(application_windows.pMainWin) - 1;
+  f_nHeight = getmaxy(application_windows.pMainWin) - 1;

   if (NULL == (application_windows.pTitleWin = newwin(3, f_nWidth, 0, 0))) {
     goto title_fail;
@@ -358,10 +358,10 @@ static void refresh_windows(void)
 {
   refresh();

-  f_nLeft = application_windows.pMainWin->_begx;
-  f_nTop = application_windows.pMainWin->_begy;
-  f_nWidth = application_windows.pMainWin->_maxx;
-  f_nHeight = application_windows.pMainWin->_maxy;
+  f_nLeft = getbegx(application_windows.pMainWin);
+  f_nTop = getbegy(application_windows.pMainWin);
+  f_nWidth = getmaxx(application_windows.pMainWin) - 1;
+  f_nHeight = getmaxy(application_windows.pMainWin) - 1;

   refresh_title_window();
   refresh_progress_window();
@@ -907,10 +907,10 @@ static bool create_pad(APPPAD* pPad, WINDOW* pParent, unsigned int uiRows,
   pPad->uiColumns = uiCols;
   pPad->uiPadRow = 0;
   pPad->uiPadCol = 0;
-  pPad->uiWinLeft = application_windows.pDetailsWin->_begx + 1;
-  pPad->uiWinTop = application_windows.pDetailsWin->_begy + 1;
-  pPad->uiWinColumns = application_windows.pDetailsWin->_maxx - 2;
-  pPad->uiWinRows = application_windows.pDetailsWin->_maxy - 2;
+  pPad->uiWinLeft = getbegx(application_windows.pDetailsWin) + 1;
+  pPad->uiWinTop = getbegy(application_windows.pDetailsWin) + 1;
+  pPad->uiWinColumns = getmaxx(application_windows.pDetailsWin) - 3;
+  pPad->uiWinRows = getmaxy(application_windows.pDetailsWin) - 3;

   bStatus = true;

--
2.43.0

Reply via email to