forked from osmocom/wireshark
From beroset:
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48038
This commit is contained in:
parent
7176e06a63
commit
85973068cc
36
dumpcap.c
36
dumpcap.c
|
@ -226,6 +226,18 @@ typedef enum {
|
|||
INITFILTER_OTHER_ERROR
|
||||
} initfilter_status_t;
|
||||
|
||||
typedef enum {
|
||||
STATE_EXPECT_REC_HDR,
|
||||
STATE_READ_REC_HDR,
|
||||
STATE_EXPECT_DATA,
|
||||
STATE_READ_DATA
|
||||
} cap_pipe_state_t;
|
||||
typedef enum {
|
||||
PIPOK,
|
||||
PIPEOF,
|
||||
PIPERR,
|
||||
PIPNEXIST
|
||||
} cap_pipe_err_t;
|
||||
typedef struct _pcap_options {
|
||||
guint32 received;
|
||||
guint32 dropped;
|
||||
|
@ -258,13 +270,9 @@ typedef struct _pcap_options {
|
|||
size_t cap_pipe_bytes_to_read; /**< Used by cap_pipe_dispatch */
|
||||
size_t cap_pipe_bytes_read; /**< Used by cap_pipe_dispatch */
|
||||
#endif
|
||||
enum {
|
||||
STATE_EXPECT_REC_HDR,
|
||||
STATE_READ_REC_HDR,
|
||||
STATE_EXPECT_DATA,
|
||||
STATE_READ_DATA
|
||||
} cap_pipe_state;
|
||||
enum { PIPOK, PIPEOF, PIPERR, PIPNEXIST } cap_pipe_err;
|
||||
cap_pipe_state_t cap_pipe_state;
|
||||
cap_pipe_err_t cap_pipe_err;
|
||||
|
||||
#if defined(_WIN32)
|
||||
GMutex *cap_pipe_read_mtx;
|
||||
GAsyncQueue *cap_pipe_pending_q, *cap_pipe_done_q;
|
||||
|
@ -1128,7 +1136,7 @@ get_if_capabilities(const char *devicename, gboolean monitor_mode
|
|||
/*
|
||||
* Allocate the interface capabilities structure.
|
||||
*/
|
||||
caps = g_malloc(sizeof *caps);
|
||||
caps = (if_capabilities_t *)g_malloc(sizeof *caps);
|
||||
|
||||
/*
|
||||
* WinPcap 4.1.2, and possibly earlier versions, have a bug
|
||||
|
@ -2592,7 +2600,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
|
|||
#endif
|
||||
pcap_opts->cap_pipe_bytes_to_read = 0;
|
||||
pcap_opts->cap_pipe_bytes_read = 0;
|
||||
pcap_opts->cap_pipe_state = 0;
|
||||
pcap_opts->cap_pipe_state = STATE_EXPECT_REC_HDR;
|
||||
pcap_opts->cap_pipe_err = PIPOK;
|
||||
#ifdef _WIN32
|
||||
#if GLIB_CHECK_VERSION(2,31,0)
|
||||
|
@ -3583,14 +3591,14 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
|||
#if GLIB_CHECK_VERSION(2,31,18)
|
||||
|
||||
g_async_queue_lock(pcap_queue);
|
||||
queue_element = g_async_queue_timeout_pop_unlocked(pcap_queue, WRITER_THREAD_TIMEOUT);
|
||||
queue_element = (pcap_queue_element *)g_async_queue_timeout_pop_unlocked(pcap_queue, WRITER_THREAD_TIMEOUT);
|
||||
#else
|
||||
GTimeVal write_thread_time;
|
||||
|
||||
g_get_current_time(&write_thread_time);
|
||||
g_time_val_add(&write_thread_time, WRITER_THREAD_TIMEOUT);
|
||||
g_async_queue_lock(pcap_queue);
|
||||
queue_element = g_async_queue_timed_pop_unlocked(pcap_queue, &write_thread_time);
|
||||
queue_element = (pcap_queue_element *)g_async_queue_timed_pop_unlocked(pcap_queue, &write_thread_time);
|
||||
#endif
|
||||
if (queue_element) {
|
||||
pcap_queue_bytes -= queue_element->phdr.caplen;
|
||||
|
@ -3714,7 +3722,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
|
|||
}
|
||||
while (1) {
|
||||
g_async_queue_lock(pcap_queue);
|
||||
queue_element = g_async_queue_try_pop_unlocked(pcap_queue);
|
||||
queue_element = (pcap_queue_element *)g_async_queue_try_pop_unlocked(pcap_queue);
|
||||
if (queue_element) {
|
||||
pcap_queue_bytes -= queue_element->phdr.caplen;
|
||||
pcap_queue_packets -= 1;
|
||||
|
@ -4296,13 +4304,15 @@ main(int argc, char *argv[])
|
|||
/* with the correct format. */
|
||||
|
||||
log_flags =
|
||||
(GLogLevelFlags)(
|
||||
G_LOG_LEVEL_ERROR|
|
||||
G_LOG_LEVEL_CRITICAL|
|
||||
G_LOG_LEVEL_WARNING|
|
||||
G_LOG_LEVEL_MESSAGE|
|
||||
G_LOG_LEVEL_INFO|
|
||||
G_LOG_LEVEL_DEBUG|
|
||||
G_LOG_FLAG_FATAL|G_LOG_FLAG_RECURSION;
|
||||
G_LOG_FLAG_FATAL|
|
||||
G_LOG_FLAG_RECURSION);
|
||||
|
||||
g_log_set_handler(NULL,
|
||||
log_flags,
|
||||
|
|
|
@ -464,7 +464,7 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
|
|||
line_prefix_info = g_new(line_prefix_info_t,1);
|
||||
|
||||
/* Create and use buffer for contents before time */
|
||||
line_prefix_info->before_time = g_malloc(before_time_offset+1);
|
||||
line_prefix_info->before_time = (gchar *)g_malloc(before_time_offset+1);
|
||||
memcpy(line_prefix_info->before_time, linebuff, before_time_offset);
|
||||
line_prefix_info->before_time[before_time_offset] = '\0';
|
||||
|
||||
|
@ -478,13 +478,13 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
|
|||
}
|
||||
else {
|
||||
/* Allocate & write buffer for line between timestamp and data */
|
||||
line_prefix_info->after_time = g_malloc(dollar_offset - after_time_offset);
|
||||
line_prefix_info->after_time = (gchar *)g_malloc(dollar_offset - after_time_offset);
|
||||
memcpy(line_prefix_info->after_time, linebuff+after_time_offset, dollar_offset - after_time_offset);
|
||||
line_prefix_info->after_time[dollar_offset - after_time_offset-1] = '\0';
|
||||
}
|
||||
|
||||
/* Add packet entry into table */
|
||||
pkey = g_malloc(sizeof(*pkey));
|
||||
pkey = (gint64 *)g_malloc(sizeof(*pkey));
|
||||
*pkey = this_offset;
|
||||
g_hash_table_insert(file_externals->packet_prefix_table, pkey, line_prefix_info);
|
||||
|
||||
|
@ -1378,7 +1378,7 @@ write_stub_header(guint8 *frame_buffer, char *timestamp_string,
|
|||
stub_offset += (int)(length + 1);
|
||||
|
||||
/* Protocol variant number (as string) */
|
||||
length = g_strlcpy((void*)&frame_buffer[stub_offset], variant_name, MAX_VARIANT_DIGITS+1);
|
||||
length = g_strlcpy((gchar*)&frame_buffer[stub_offset], variant_name, MAX_VARIANT_DIGITS+1);
|
||||
stub_offset += (int)(length + 1);
|
||||
|
||||
/* Outhdr */
|
||||
|
|
|
@ -33,7 +33,7 @@ struct mpa {
|
|||
unsigned int copyright :1;
|
||||
unsigned int modeext :2;
|
||||
unsigned int mode :2;
|
||||
unsigned int private :1;
|
||||
unsigned int priv :1;
|
||||
unsigned int padding :1;
|
||||
unsigned int frequency :2;
|
||||
unsigned int bitrate :4;
|
||||
|
@ -65,7 +65,7 @@ struct mpa {
|
|||
(mpa)->bitrate = MPA_UNMARSHAL_BITRATE(n); \
|
||||
(mpa)->frequency = MPA_UNMARSHAL_FREQUENCY(n); \
|
||||
(mpa)->padding = MPA_UNMARSHAL_PADDING(n); \
|
||||
(mpa)->private = MPA_UNMARSHAL_PRIVATE(n); \
|
||||
(mpa)->priv = MPA_UNMARSHAL_PRIVATE(n); \
|
||||
(mpa)->mode = MPA_UNMARSHAL_MODE(n); \
|
||||
(mpa)->modeext = MPA_UNMARSHAL_MODEEXT(n); \
|
||||
(mpa)->copyright = MPA_UNMARSHAL_COPYRIGHT(n); \
|
||||
|
|
Loading…
Reference in New Issue