forked from osmocom/wireshark
[MSVC 2015] Use intptr_t for "pointer stored as int" to make MSVC happy.
Change-Id: I5dbbea8527a8bb73b17e5a8a5611c3923d82459c Reviewed-on: https://code.wireshark.org/review/8852 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
c4fbede67a
commit
4e60e8fb39
|
@ -29,6 +29,7 @@ extern "C" {
|
|||
|
||||
#ifndef _WIN32
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "capture_opts.h"
|
||||
|
@ -47,20 +48,20 @@ struct _capture_file;
|
|||
* State of a capture session.
|
||||
*/
|
||||
typedef struct _capture_session {
|
||||
int fork_child; /**< If not -1, in parent, process ID of child */
|
||||
int fork_child_status; /**< Child exit status */
|
||||
intptr_t fork_child; /**< If not -1, in parent, process ID of child */
|
||||
int fork_child_status; /**< Child exit status */
|
||||
#ifdef _WIN32
|
||||
int signal_pipe_write_fd; /**< the pipe to signal the child */
|
||||
int signal_pipe_write_fd; /**< the pipe to signal the child */
|
||||
#endif
|
||||
capture_state state; /**< current state of the capture engine */
|
||||
capture_state state; /**< current state of the capture engine */
|
||||
#ifndef _WIN32
|
||||
uid_t owner; /**< owner of the cfile */
|
||||
gid_t group; /**< group of the cfile */
|
||||
uid_t owner; /**< owner of the cfile */
|
||||
gid_t group; /**< group of the cfile */
|
||||
#endif
|
||||
gboolean session_started;
|
||||
guint32 count; /**< Total number of frames captured */
|
||||
capture_options *capture_opts; /**< options for this capture */
|
||||
struct _capture_file *cf; /**< handle to cfile */
|
||||
gboolean session_started;
|
||||
guint32 count; /**< Total number of frames captured */
|
||||
capture_options *capture_opts; /**< options for this capture */
|
||||
struct _capture_file *cf; /**< handle to cfile */
|
||||
} capture_session;
|
||||
|
||||
extern void
|
||||
|
|
|
@ -118,7 +118,7 @@ static const char *sync_pipe_signame(int);
|
|||
|
||||
|
||||
static gboolean sync_pipe_input_cb(gint source, gpointer user_data);
|
||||
static int sync_pipe_wait_for_child(int fork_child, gchar **msgp);
|
||||
static int sync_pipe_wait_for_child(intptr_t fork_child, gchar **msgp);
|
||||
static void pipe_convert_header(const guchar *header, int header_len, char *indicator, int *block_len);
|
||||
static ssize_t pipe_read_block(int pipe_fd, char *indicator, int len, char *msg,
|
||||
char **err_msg);
|
||||
|
@ -659,15 +659,15 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
|
|||
g_free( (gpointer) argv);
|
||||
return FALSE;
|
||||
}
|
||||
cap_session->fork_child = (int) pi.hProcess;
|
||||
cap_session->fork_child = (intptr_t) pi.hProcess;
|
||||
g_string_free(args, TRUE);
|
||||
|
||||
/* associate the operating system filehandle to a C run-time file handle */
|
||||
/* (good file handle infos at: http://www.flounder.com/handles.htm) */
|
||||
sync_pipe_read_fd = _open_osfhandle( (long) sync_pipe_read, _O_BINARY);
|
||||
sync_pipe_read_fd = _open_osfhandle( (intptr_t) sync_pipe_read, _O_BINARY);
|
||||
|
||||
/* associate the operating system filehandle to a C run-time file handle */
|
||||
cap_session->signal_pipe_write_fd = _open_osfhandle( (long) signal_pipe, _O_BINARY);
|
||||
cap_session->signal_pipe_write_fd = _open_osfhandle( (intptr_t) signal_pipe, _O_BINARY);
|
||||
|
||||
#else /* _WIN32 */
|
||||
if (pipe(sync_pipe) < 0) {
|
||||
|
@ -771,7 +771,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
|
|||
#define PIPE_BUF_SIZE 5120
|
||||
static int
|
||||
sync_pipe_open_command(char** argv, int *data_read_fd,
|
||||
int *message_read_fd, int *fork_child, gchar **msg, void(*update_cb)(void))
|
||||
int *message_read_fd, intptr_t *fork_child, gchar **msg, void(*update_cb)(void))
|
||||
{
|
||||
enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */
|
||||
#ifdef _WIN32
|
||||
|
@ -875,13 +875,13 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
|
|||
g_free( (gpointer) argv);
|
||||
return -1;
|
||||
}
|
||||
*fork_child = (int) pi.hProcess;
|
||||
*fork_child = (intptr_t) pi.hProcess;
|
||||
g_string_free(args, TRUE);
|
||||
|
||||
/* associate the operating system filehandles to C run-time file handles */
|
||||
/* (good file handle infos at: http://www.flounder.com/handles.htm) */
|
||||
*data_read_fd = _open_osfhandle( (long) data_pipe[PIPE_READ], _O_BINARY);
|
||||
*message_read_fd = _open_osfhandle( (long) sync_pipe[PIPE_READ], _O_BINARY);
|
||||
*data_read_fd = _open_osfhandle( (intptr_t) data_pipe[PIPE_READ], _O_BINARY);
|
||||
*message_read_fd = _open_osfhandle( (intptr_t) sync_pipe[PIPE_READ], _O_BINARY);
|
||||
#else /* _WIN32 */
|
||||
/* Create a pipe for the child process to send us messages */
|
||||
if (pipe(sync_pipe) < 0) {
|
||||
|
@ -983,7 +983,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
|
|||
*/
|
||||
static int
|
||||
sync_pipe_close_command(int *data_read_fd, int *message_read_fd,
|
||||
int *fork_child, gchar **msgp)
|
||||
intptr_t *fork_child, gchar **msgp)
|
||||
{
|
||||
ws_close(*data_read_fd);
|
||||
if (message_read_fd != NULL)
|
||||
|
@ -1017,7 +1017,8 @@ sync_pipe_run_command_actual(char** argv, gchar **data, gchar **primary_msg,
|
|||
gchar **secondary_msg, void(*update_cb)(void))
|
||||
{
|
||||
gchar *msg;
|
||||
int data_pipe_read_fd, sync_pipe_read_fd, fork_child, ret;
|
||||
int data_pipe_read_fd, sync_pipe_read_fd, ret;
|
||||
intptr_t fork_child;
|
||||
char *wait_msg;
|
||||
gchar buffer[PIPE_BUF_SIZE+1] = {0};
|
||||
ssize_t nread;
|
||||
|
@ -1362,7 +1363,7 @@ sync_if_capabilities_open(const gchar *ifname, gboolean monitor_mode,
|
|||
* that must be g_free()d, and -1 will be returned.
|
||||
*/
|
||||
int
|
||||
sync_interface_stats_open(int *data_read_fd, int *fork_child, gchar **msg, void (*update_cb)(void))
|
||||
sync_interface_stats_open(int *data_read_fd, intptr_t *fork_child, gchar **msg, void (*update_cb)(void))
|
||||
{
|
||||
int argc;
|
||||
char **argv;
|
||||
|
@ -1514,7 +1515,7 @@ sync_interface_stats_open(int *data_read_fd, int *fork_child, gchar **msg, void
|
|||
|
||||
/* Close down the stats process */
|
||||
int
|
||||
sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg)
|
||||
sync_interface_stats_close(int *read_fd, intptr_t *fork_child, gchar **msg)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
/*
|
||||
|
@ -1868,7 +1869,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
|
|||
* must be freed with g_free().
|
||||
*/
|
||||
static int
|
||||
sync_pipe_wait_for_child(int fork_child, gchar **msgp)
|
||||
sync_pipe_wait_for_child(intptr_t fork_child, gchar **msgp)
|
||||
{
|
||||
int fork_child_status;
|
||||
#ifndef _WIN32
|
||||
|
@ -2139,7 +2140,7 @@ sync_pipe_stop(capture_session *cap_session)
|
|||
|
||||
/* Wireshark has to exit, force the capture child to close */
|
||||
void
|
||||
sync_pipe_kill(int fork_child)
|
||||
sync_pipe_kill(intptr_t fork_child)
|
||||
{
|
||||
if (fork_child != -1) {
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -54,7 +54,7 @@ sync_pipe_stop(capture_session *cap_session);
|
|||
|
||||
/** User wants to stop the program, just kill the child as soon as possible */
|
||||
extern void
|
||||
sync_pipe_kill(int fork_child);
|
||||
sync_pipe_kill(intptr_t fork_child);
|
||||
|
||||
/** Set wireless channel using dumpcap */
|
||||
extern int
|
||||
|
@ -75,11 +75,11 @@ sync_if_capabilities_open(const gchar *ifname, gboolean monitor_mode,
|
|||
|
||||
/** Start getting interface statistics using dumpcap. */
|
||||
extern int
|
||||
sync_interface_stats_open(int *read_fd, int *fork_child, gchar **msg, void (*update_cb)(void));
|
||||
sync_interface_stats_open(int *read_fd, intptr_t *fork_child, gchar **msg, void (*update_cb)(void));
|
||||
|
||||
/** Stop gathering statistics. */
|
||||
extern int
|
||||
sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg);
|
||||
sync_interface_stats_close(int *read_fd, intptr_t *fork_child, gchar **msg);
|
||||
|
||||
/** Read a line from a pipe, similar to fgets. Non-blocking. */
|
||||
extern int
|
||||
|
|
4
tshark.c
4
tshark.c
|
@ -2278,7 +2278,7 @@ DIAG_ON(cast-qual)
|
|||
typedef struct pipe_input_tag {
|
||||
gint source;
|
||||
gpointer user_data;
|
||||
int *child_process;
|
||||
intptr_t *child_process;
|
||||
pipe_input_cb_t input_cb;
|
||||
guint pipe_input_id;
|
||||
#ifdef _WIN32
|
||||
|
@ -2351,7 +2351,7 @@ pipe_timer_cb(gpointer data)
|
|||
|
||||
|
||||
void
|
||||
pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb)
|
||||
pipe_input_set_handler(gint source, gpointer user_data, intptr_t *child_process, pipe_input_cb_t input_cb)
|
||||
{
|
||||
|
||||
pipe_input.source = source;
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct if_stat_cache_item_s {
|
|||
|
||||
struct if_stat_cache_s {
|
||||
int stat_fd;
|
||||
int fork_child;
|
||||
intptr_t fork_child;
|
||||
GList *cache_list; /* List of if_stat_chache_entry_t */
|
||||
};
|
||||
|
||||
|
@ -644,7 +644,8 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
|
|||
|
||||
if_stat_cache_t *
|
||||
capture_stat_start(capture_options *capture_opts) {
|
||||
int stat_fd, fork_child;
|
||||
int stat_fd;
|
||||
intptr_t fork_child;
|
||||
gchar *msg;
|
||||
if_stat_cache_t *sc = NULL;
|
||||
if_stat_cache_item_t *sc_item;
|
||||
|
|
|
@ -580,7 +580,7 @@ main_window_quit(void)
|
|||
typedef struct pipe_input_tag {
|
||||
gint source;
|
||||
gpointer user_data;
|
||||
int *child_process;
|
||||
intptr_t *child_process;
|
||||
pipe_input_cb_t input_cb;
|
||||
guint pipe_input_id;
|
||||
#ifdef _WIN32
|
||||
|
@ -693,7 +693,7 @@ pipe_input_cb(GIOChannel *source _U_,
|
|||
void
|
||||
pipe_input_set_handler(gint source,
|
||||
gpointer user_data,
|
||||
int *child_process,
|
||||
intptr_t *child_process,
|
||||
pipe_input_cb_t input_cb)
|
||||
{
|
||||
static pipe_input_t pipe_input;
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
// If we ever add support for multiple windows this will need to be replaced.
|
||||
static MainWindow *gbl_cur_main_window_ = NULL;
|
||||
|
||||
void pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb)
|
||||
void pipe_input_set_handler(gint source, gpointer user_data, intptr_t *child_process, pipe_input_cb_t input_cb)
|
||||
{
|
||||
gbl_cur_main_window_->setPipeInputHandler(source, user_data, child_process, input_cb);
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ QString MainWindow::getFilter()
|
|||
return df_combo_box_->itemText(df_combo_box_->count());
|
||||
}
|
||||
|
||||
void MainWindow::setPipeInputHandler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb)
|
||||
void MainWindow::setPipeInputHandler(gint source, gpointer user_data, intptr_t *child_process, pipe_input_cb_t input_cb)
|
||||
{
|
||||
pipe_source_ = source;
|
||||
pipe_child_process_ = child_process;
|
||||
|
|
|
@ -78,7 +78,7 @@ class MainWindow : public QMainWindow
|
|||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
void setPipeInputHandler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb);
|
||||
void setPipeInputHandler(gint source, gpointer user_data, intptr_t *child_process, pipe_input_cb_t input_cb);
|
||||
|
||||
QString getFilter();
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -140,7 +140,7 @@ private:
|
|||
// Pipe input
|
||||
gint pipe_source_;
|
||||
gpointer pipe_user_data_;
|
||||
int *pipe_child_process_;
|
||||
intptr_t *pipe_child_process_;
|
||||
pipe_input_cb_t pipe_input_cb_;
|
||||
#ifdef _WIN32
|
||||
QTimer *pipe_timer_;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#ifndef __UI_UTIL_H__
|
||||
#define __UI_UTIL_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "epan/packet_info.h"
|
||||
#include "epan/column-utils.h"
|
||||
|
||||
|
@ -56,7 +58,7 @@ extern void main_window_quit(void);
|
|||
/* read from a pipe (callback) */
|
||||
typedef gboolean (*pipe_input_cb_t) (gint source, gpointer user_data);
|
||||
/* install callback function, called if pipe input is available */
|
||||
extern void pipe_input_set_handler(gint source, gpointer user_data, int *child_process, pipe_input_cb_t input_cb);
|
||||
extern void pipe_input_set_handler(gint source, gpointer user_data, intptr_t *child_process, pipe_input_cb_t input_cb);
|
||||
|
||||
/* packet_list.c */
|
||||
|
||||
|
|
Loading…
Reference in New Issue