Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/hostmon.c | 13 +++++++------
src/ifstats.c | 24 +++++++++++++-----------
src/ipfilter.c | 3 ++-
src/itrafmon.c | 16 ++++++++--------
src/options.c | 7 +++----
src/options.h | 8 ++++----
src/pktsize.c | 8 ++++----
src/serv.c | 10 +++++-----
src/tcptable.c | 2 +-
src/tui/input.c | 2 +-
10 files changed, 48 insertions(+), 45 deletions(-)
diff --git a/src/hostmon.c b/src/hostmon.c
index ff28fb3..cd9d2d7 100644
--- a/src/hostmon.c
+++ b/src/hostmon.c
@@ -630,7 +630,7 @@ void quicksort_lan_entries(struct ethtab *table, struct ethtabent
*low,
void sort_hosttab(struct ethtab *list, unsigned int *idx, int command)
{
struct ethtabent *ptemp1;
- unsigned int idxtmp;
+ int idxtmp;
if (!list->head)
return;
@@ -662,7 +662,7 @@ void sort_hosttab(struct ethtab *list, unsigned int *idx, int
command)
* The LAN station monitor
*/
-void hostmon(const struct OPTIONS *options, int facilitytime, char *ifptr,
+void hostmon(const struct OPTIONS *options, time_t facilitytime, char *ifptr,
struct filterstate *ofilter)
{
int logging = options->logging;
@@ -681,11 +681,12 @@ void hostmon(const struct OPTIONS *options, int facilitytime, char
*ifptr,
char *ifname = ifptr;
struct timeval tv;
- unsigned long starttime;
- unsigned long now = 0;
+ time_t starttime;
+ time_t now = 0;
unsigned long long unow = 0;
- unsigned long statbegin = 0, startlog = 0;
- unsigned long updtime = 0;
+ time_t statbegin = 0;
+ time_t startlog = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
struct eth_desc *list = NULL;
diff --git a/src/ifstats.c b/src/ifstats.c
index f398749..77fb7ac 100644
--- a/src/ifstats.c
+++ b/src/ifstats.c
@@ -388,7 +388,7 @@ void pagegstatwin(struct iftab *table, int direction, unsigned int
*idx)
*/
void ifstats(const struct OPTIONS *options, struct filterstate *ofilter,
- int facilitytime)
+ time_t facilitytime)
{
int logging = options->logging;
struct iftab table;
@@ -412,12 +412,12 @@ void ifstats(const struct OPTIONS *options, struct filterstate
*ofilter,
int fd;
struct timeval tv;
- unsigned long starttime = 0;
- unsigned long statbegin = 0;
- unsigned long now = 0;
+ time_t starttime = 0;
+ time_t statbegin = 0;
+ time_t now = 0;
unsigned long long unow = 0;
- unsigned long startlog = 0;
- unsigned long updtime = 0;
+ time_t startlog = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
struct promisc_states *promisc_list;
@@ -730,7 +730,7 @@ void update_proto_counter(struct proto_counter *proto_counter, int
outgoing, int
* The detailed interface statistics function
*/
-void detstats(char *iface, const struct OPTIONS *options, int facilitytime,
+void detstats(char *iface, const struct OPTIONS *options, time_t facilitytime,
struct filterstate *ofilter)
{
int logging = options->logging;
@@ -758,11 +758,13 @@ void detstats(char *iface, const struct OPTIONS *options, int
facilitytime,
int ch;
struct timeval tv;
- unsigned long updtime = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
- unsigned long starttime, now;
- unsigned long statbegin, startlog;
- unsigned long rate_interval;
+ time_t starttime;
+ time_t now;
+ time_t statbegin;
+ time_t startlog;
+ time_t rate_interval;
unsigned long long unow;
struct proto_counter span;
diff --git a/src/ipfilter.c b/src/ipfilter.c
index c917972..d5b7dd6 100644
--- a/src/ipfilter.c
+++ b/src/ipfilter.c
@@ -46,7 +46,8 @@ void gethostparams(struct hostparams *data, char *init_saddr, char
*init_smask,
unsigned int rangeproto1, rangeproto2;
int parse_result;
char *bptr, *cptr;
- int i, doagain;
+ int doagain;
+ unsigned int i;
char msgstr[60];
char actual_address[30];
unsigned int maskbits;
diff --git a/src/itrafmon.c b/src/itrafmon.c
index ae6cbb1..eac620d 100644
--- a/src/itrafmon.c
+++ b/src/itrafmon.c
@@ -163,7 +163,7 @@ void scrollupperwin(struct tcptable *table, int direction, unsigned
long *idx,
void pageupperwin(struct tcptable *table, int direction, unsigned long *idx)
{
- int i = 1;
+ unsigned int i = 1;
wattrset(table->tcpscreen, STDATTR);
if (direction == SCROLLUP) {
@@ -224,7 +224,7 @@ void scrolllowerwin(struct othptable *table, int direction)
void pagelowerwin(struct othptable *table, int direction)
{
- int i = 1;
+ unsigned int i = 1;
if (direction == SCROLLUP) {
while ((i <= table->oimaxy - 2)
@@ -564,7 +564,7 @@ void update_flowrate(WINDOW * win, struct tcptableent *entry, time_t
now,
*/
void ipmon(struct OPTIONS *options, struct filterstate *ofilter,
- int facilitytime, char *ifptr)
+ time_t facilitytime, char *ifptr)
{
int logging = options->logging;
struct sockaddr_ll fromaddr; /* iface info */
@@ -582,13 +582,13 @@ void ipmon(struct OPTIONS *options, struct filterstate *ofilter,
unsigned long screen_idx = 1;
struct timeval tv;
- unsigned long starttime = 0;
- unsigned long now = 0;
- unsigned long timeint = 0;
- unsigned long updtime = 0;
+ time_t starttime = 0;
+ time_t now = 0;
+ time_t timeint = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
unsigned long long unow = 0;
- unsigned long closedint = 0;
+ time_t closedint = 0;
WINDOW *statwin;
PANEL *statpanel;
diff --git a/src/options.c b/src/options.c
index b1896fb..0cbd35f 100644
--- a/src/options.c
+++ b/src/options.c
@@ -200,13 +200,13 @@ void showoptions(struct OPTIONS *options, WINDOW * win)
updatetimes(options, win);
}
-void settimeout(unsigned int *value, const char *units, int allow_zero,
+void settimeout(time_t *value, const char *units, int allow_zero,
int *aborted)
{
WINDOW *dlgwin;
PANEL *dlgpanel;
struct FIELDLIST field;
- unsigned int tmval = 0;
+ time_t tmval = 0;
dlgwin = newwin(7, 40, (LINES - 7) / 2, (COLS - 40) / 4);
dlgpanel = new_panel(dlgwin);
@@ -335,8 +335,7 @@ void setoptions(struct OPTIONS *options, struct porttab **ports)
updatetimes(options, statwin);
break;
case 2:
- settimeout((unsigned int *)
- &(options->logspan),
+ settimeout(&(options->logspan),
"minutes", DONT_ALLOW_ZERO,
&aborted);
if (!aborted) {
diff --git a/src/options.h b/src/options.h
index 1994010..80299a3 100644
--- a/src/options.h
+++ b/src/options.h
@@ -4,10 +4,10 @@
struct OPTIONS {
unsigned int color:1, logging:1, revlook:1, servnames:1, promisc:1,
actmode:1, mac:1, v6inv4asv6:1, dummy:8;
- unsigned int timeout;
- unsigned int logspan;
- unsigned int updrate;
- unsigned int closedint;
+ time_t timeout;
+ time_t logspan;
+ time_t updrate;
+ time_t closedint;
};
#define DEFAULT_UPDATE_DELAY 50000 /* usec screen delay if update rate 0 */
diff --git a/src/pktsize.c b/src/pktsize.c
index 091e239..601345c 100644
--- a/src/pktsize.c
+++ b/src/pktsize.c
@@ -140,7 +140,7 @@ void update_size_distrib(unsigned int length, struct ifstat_brackets
*brackets,
}
void packet_size_breakdown(struct OPTIONS *options, char *ifname,
- int facilitytime, struct filterstate *ofilter)
+ time_t facilitytime, struct filterstate *ofilter)
{
WINDOW *win;
PANEL *panel;
@@ -161,10 +161,10 @@ void packet_size_breakdown(struct OPTIONS *options, char *ifname,
int pkt_result;
struct timeval tv;
- unsigned long starttime, startlog, timeint;
- unsigned long now;
+ time_t starttime, startlog, timeint;
+ time_t now;
unsigned long long unow;
- unsigned long updtime = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
int logging = options->logging;
diff --git a/src/serv.c b/src/serv.c
index e15986c..275c223 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -524,7 +524,7 @@ void quicksort_port_entries(struct portlist *table, struct portlistent
*low,
void sortportents(struct portlist *list, unsigned int *idx, int command)
{
struct portlistent *ptemp1;
- unsigned int idxtmp;
+ int idxtmp;
if (!(list->head))
return;
@@ -686,7 +686,7 @@ void update_serv_rates(struct portlist *list, WINDOW * win, int
actmode,
*/
void servmon(char *ifname, struct porttab *ports, const struct OPTIONS *options,
- int facilitytime, struct filterstate *ofilter)
+ time_t facilitytime, struct filterstate *ofilter)
{
int logging = options->logging;
int pkt_result;
@@ -705,10 +705,10 @@ void servmon(char *ifname, struct porttab *ports, const struct
OPTIONS *options,
unsigned int dport = 0;
struct timeval tv;
- unsigned long starttime, startlog, timeint;
- unsigned long now;
+ time_t starttime, startlog, timeint;
+ time_t now;
unsigned long long unow;
- unsigned long updtime = 0;
+ time_t updtime = 0;
unsigned long long updtime_usec = 0;
unsigned int tot_br;
diff --git a/src/tcptable.c b/src/tcptable.c
index 317e9fd..63123a2 100644
--- a/src/tcptable.c
+++ b/src/tcptable.c
@@ -65,7 +65,7 @@ unsigned int tcp_hash(unsigned long saddr, uint32_t * s6addr,
unsigned int sport, unsigned long daddr,
uint32_t * d6addr, unsigned int dport, char *ifname)
{
- int i;
+ size_t i;
int ifsum = 0;
for (i = 0; i <= strlen(ifname) - 1; i++)
diff --git a/src/tui/input.c b/src/tui/input.c
index 074cbf6..3206ddf 100644
--- a/src/tui/input.c
+++ b/src/tui/input.c
@@ -35,7 +35,7 @@ void tx_addfield(struct FIELDLIST *list, unsigned int len, unsigned int
y,
unsigned int x, const char *initstr)
{
struct FIELD *newfield;
- int i;
+ unsigned int i;
newfield = malloc(sizeof(struct FIELD));
--
1.7.8.4