rebus / rpms / tcptrack

Forked from rpms/tcptrack a year ago
Clone
Blob Blame History Raw
https://github.com/bchretien/tcptrack/commit/409007afbce8ec5a81312a2a4123dd83b62b4494.patch#/tcptrack-1.4.3-type-mismatch.patch
From 409007afbce8ec5a81312a2a4123dd83b62b4494 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Fri, 19 Nov 2021 08:49:56 +0000
Subject: [PATCH] src/TextUI.cc: fix format arguments

-Wformat detects type mismatch as:

    TextUI.cc:315:34: error: format '%d' expects argument of type 'int',
        but argument 2 has type 'time_t' {aka 'long int'} [-Werror=format=]
      315 |                         printw("%ds",ic->getIdleSeconds());
          |                                 ~^   ~~~~~~~~~~~~~~~~~~~~
          |                                  |                     |
          |                                  int                   time_t {aka long int}
          |                                 %ld
---
 src/TextUI.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -ru tcptrack-1.4.3/src/TextUI.cc tcptrack-1.4.3.new/src/TextUI.cc
--- tcptrack-1.4.3/src/TextUI.cc	2015-04-23 10:04:40.000000000 +0200
+++ tcptrack-1.4.3.new/src/TextUI.cc	2023-01-20 09:34:15.223578489 +0100
@@ -309,11 +309,11 @@
 
 		move(row,58);
 		if( ic->getIdleSeconds() < 60 )
-			printw("%ds",ic->getIdleSeconds());
-		else if( ic->getIdleSeconds() > 59 ) 
-			printw("%dm",ic->getIdleSeconds()/60);
+			printw("%ds",(int)(ic->getIdleSeconds()));
+		else if( ic->getIdleSeconds() > 59 )
+			printw("%dm",(int)(ic->getIdleSeconds()/60));
 		else if( ic->getIdleSeconds() > 3559 )
-			printw("%dh",ic->getIdleSeconds()/3600);
+			printw("%ldh",(long)(ic->getIdleSeconds()/3600));
 
 		move(row,63);
 		if( ic->activityToggle() )