epam / nfstrace

Network file system monitor and analyzer
http://epam.github.io/nfstrace/
GNU General Public License v2.0
149 stars 33 forks source link

fix some issue in sources #54

Open aurelien-enchanted-tools opened 2 months ago

aurelien-enchanted-tools commented 2 months ago

Hello,

From branch tirpc commit b5576b5f5c917cf621ed893b19b350aeb88c7068, I had to make these changes to compile

gcc (GCC) 14.1.1 20240522 ncurses 6.5

diff --git a/analyzers/src/watch/nc_windows/header_window.cpp b/analyzers/src/watch/nc_windows/header_window.cpp
index 8e04818..e9d2c80 100644
--- a/analyzers/src/watch/nc_windows/header_window.cpp
+++ b/analyzers/src/watch/nc_windows/header_window.cpp
@@ -74,7 +74,7 @@ void HeaderWindow::update()
     time_t shift_time  = actual_time - _start_time;
     /* tm starts with 0 month and 1900 year*/
     mvwprintw(_window, HEADER::DATE_LINE, FIRST_CHAR_POS, "Date: \t %d.%d.%d \t Time: %d:%d:%d  ", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900, t->tm_hour, t->tm_min, t->tm_sec);
-    mvwprintw(_window, HEADER::ELAPSED_LINE, FIRST_CHAR_POS, "Elapsed time:  \t %d days; %d:%d:%d times",
+    mvwprintw(_window, HEADER::ELAPSED_LINE, FIRST_CHAR_POS, "Elapsed time:  \t %ld days; %ld:%ld:%ld times",
               shift_time / SECINDAY, shift_time % SECINDAY / SECINHOUR, shift_time % SECINHOUR / SECINMIN, shift_time % SECINMIN);
     wrefresh(_window);
 }
@@ -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)), GUI_HEADER_HEIGHT), std::min(static_cast<int>(getmaxx(m._window)), 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 dccd980..b2c74d9 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)));
 }

 StatisticsWindow::StatisticsWindow(MainWindow& w, StatisticsContainers& c)
@@ -153,7 +153,7 @@ void StatisticsWindow::update(const ProtocolStatistic& d)
         }
         if(canWrite(line))
         {
-            mvwprintw(_window, line - (_scrollOffset.at(_activeProtocol)), FIRST_CHAR_POS + 25, "%d", m);
+            mvwprintw(_window, line - (_scrollOffset.at(_activeProtocol)), FIRST_CHAR_POS + 25, "%ld", m);
         }
         line++;
         for(unsigned int j = _activeProtocol->getGroupBegin(i); j < _activeProtocol->getGroupBegin(i + 1); j++)
@@ -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) > 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) - GUI_HEADER_HEIGHT), tmp_size),
+                         std::min(static_cast<int>(getmaxx(m._window)), GUI_LENGTH), GUI_HEADER_HEIGHT - BORDER_SIZE, 0);
         updateProtocol(_activeProtocol);
     }
 }

Could you fix them, thank you in advance

avoidik commented 1 month ago

does this issue persist in the master branch as well?