aboutsummaryrefslogtreecommitdiffstats
path: root/sharkd_session.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-25 20:27:13 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-26 04:08:59 +0000
commit19028ebab4f3c097c8e87d3b532b80a5c1369eae (patch)
tree62fe87dd1db3ded74f27b64be94b37af6170f3b9 /sharkd_session.c
parenteeab554cf2e1d893f144081a762cc52782271e2e (diff)
Fix sharkd compiling on Windows
Change-Id: I8c614189159f1263d9452d495cee34d1a2c1bfcb Reviewed-on: https://code.wireshark.org/review/19790 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'sharkd_session.c')
-rw-r--r--sharkd_session.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sharkd_session.c b/sharkd_session.c
index 0b6bb96d4c..12a85c8c2d 100644
--- a/sharkd_session.c
+++ b/sharkd_session.c
@@ -31,6 +31,7 @@
#include <glib.h>
#include <wsutil/wsjsmn.h>
+#include <wsutil/ws_printf.h>
#include <file.h>
#include <epan/exceptions.h>
@@ -655,7 +656,7 @@ sharkd_session_geoip_addr(address *addr, const char *suffix)
#ifdef HAVE_GEOIP
if (addr->type == AT_IPv4)
{
- uint32_t ip = pntoh32(addr->data);
+ guint32 ip = pntoh32(addr->data);
guint num_dbs = geoip_db_num_dbs();
guint dbnum;
@@ -960,7 +961,7 @@ sharkd_session_process_tap(char *buf, const jsmntok_t *tokens, int count)
taps_data[i] = NULL;
- snprintf(tapbuf, sizeof(tapbuf), "tap%d", i);
+ ws_snprintf(tapbuf, sizeof(tapbuf), "tap%d", i);
tok_tap = json_find_attr(buf, tokens, count, tapbuf);
if (!tok_tap)
break;
@@ -1360,7 +1361,7 @@ sharkd_session_process_intervals(char *buf, const jsmntok_t *tokens, int count)
for (framenum = 1; framenum <= cfile.count; framenum++)
{
frame_data *fdata = frame_data_sequence_find(cfile.frames, framenum);
- int msec_rel;
+ time_t msec_rel;
int new_idx;
if (start_ts == NULL)
@@ -1370,7 +1371,7 @@ sharkd_session_process_intervals(char *buf, const jsmntok_t *tokens, int count)
continue;
/* TODO, make it 64-bit, to avoid msec overflow after 24days */
- msec_rel = ((fdata->abs_ts.secs - start_ts->secs) * 1000 + (fdata->abs_ts.nsecs - start_ts->nsecs) / 1000000);
+ msec_rel = (time_t)((fdata->abs_ts.secs - start_ts->secs) * 1000 + (fdata->abs_ts.nsecs - start_ts->nsecs) / 1000000);
new_idx = msec_rel / interval_ms;
if (idx != new_idx)
@@ -1689,7 +1690,7 @@ sharkd_session_process_setconf(char *buf, const jsmntok_t *tokens, int count)
if (!tok_name || tok_name[0] == '\0' || !tok_value)
return;
- snprintf(pref, sizeof(pref), "%s:%s", tok_name, tok_value);
+ ws_snprintf(pref, sizeof(pref), "%s:%s", tok_name, tok_value);
ret = prefs_set_pref(pref);
printf("{\"err\":%d}\n", ret);
@@ -1874,7 +1875,7 @@ sharkd_session_process(char *buf, const jsmntok_t *tokens, int count)
else if (!strcmp(tok_req, "dumpconf"))
sharkd_session_process_dumpconf(buf, tokens, count);
else if (!strcmp(tok_req, "bye"))
- _Exit(0);
+ exit(0);
else
fprintf(stderr, "::: req = %s\n", tok_req);
@@ -1890,7 +1891,9 @@ sharkd_session_main(void)
int tokens_max = -1;
fprintf(stderr, "Hello in child!\n");
+#ifndef _WIN32
setlinebuf(stdout);
+#endif
while (fgets(buf, sizeof(buf), stdin))
{