aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-23 06:52:50 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-23 06:52:50 +0000
commitbb846842f84a5b53462f70f1a00adbc526f3dac3 (patch)
treea1dab495244fc7c05117d22d19c504df6bbae50c /dumpcap.c
parent9a9fd20ece95c6f30d83529c151c97b6b3e34dbe (diff)
Fix indentation.
svn path=/trunk/; revision=46712
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c112
1 files changed, 54 insertions, 58 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 0eb959c009..7e21c15245 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -2306,44 +2306,42 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
/* Fall through */
case STATE_READ_REC_HDR:
- if ((pcap_opts->from_cap_socket)
+ if ((pcap_opts->from_cap_socket)
#ifndef _WIN32
- || 1
+ || 1
#endif
- )
- {
- b = cap_pipe_read(pcap_opts->cap_pipe_fd, ((char *)&pcap_opts->cap_pipe_rechdr)+pcap_opts->cap_pipe_bytes_read,
+ ) {
+ b = cap_pipe_read(pcap_opts->cap_pipe_fd, ((char *)&pcap_opts->cap_pipe_rechdr)+pcap_opts->cap_pipe_bytes_read,
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read, pcap_opts->from_cap_socket);
- if (b <= 0) {
- if (b == 0)
- result = PD_PIPE_EOF;
- else
- result = PD_PIPE_ERR;
- break;
+ if (b <= 0) {
+ if (b == 0)
+ result = PD_PIPE_EOF;
+ else
+ result = PD_PIPE_ERR;
+ break;
+ }
+ pcap_opts->cap_pipe_bytes_read += b;
}
- pcap_opts->cap_pipe_bytes_read += b;
- }
#ifdef _WIN32
- else
- {
+ else {
#if GLIB_CHECK_VERSION(2,31,18)
- q_status = g_async_queue_timeout_pop(pcap_opts->cap_pipe_done_q, PIPE_READ_TIMEOUT);
+ q_status = g_async_queue_timeout_pop(pcap_opts->cap_pipe_done_q, PIPE_READ_TIMEOUT);
#else
- g_get_current_time(&wait_time);
- g_time_val_add(&wait_time, PIPE_READ_TIMEOUT);
- q_status = g_async_queue_timed_pop(pcap_opts->cap_pipe_done_q, &wait_time);
+ g_get_current_time(&wait_time);
+ g_time_val_add(&wait_time, PIPE_READ_TIMEOUT);
+ q_status = g_async_queue_timed_pop(pcap_opts->cap_pipe_done_q, &wait_time);
#endif
- if (pcap_opts->cap_pipe_err == PIPEOF) {
- result = PD_PIPE_EOF;
- break;
- } else if (pcap_opts->cap_pipe_err == PIPERR) {
- result = PD_PIPE_ERR;
- break;
- }
- if (!q_status) {
- return 0;
+ if (pcap_opts->cap_pipe_err == PIPEOF) {
+ result = PD_PIPE_EOF;
+ break;
+ } else if (pcap_opts->cap_pipe_err == PIPERR) {
+ result = PD_PIPE_ERR;
+ break;
+ }
+ if (!q_status) {
+ return 0;
+ }
}
- }
#endif
if ((pcap_opts->cap_pipe_bytes_read) < pcap_opts->cap_pipe_bytes_to_read)
return 0;
@@ -2368,45 +2366,43 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er
/* Fall through */
case STATE_READ_DATA:
- if ((pcap_opts->from_cap_socket)
+ if ((pcap_opts->from_cap_socket)
#ifndef _WIN32
- || 1
+ || 1
#endif
- )
- {
- b = cap_pipe_read(pcap_opts->cap_pipe_fd, data+pcap_opts->cap_pipe_bytes_read,
+ ) {
+ b = cap_pipe_read(pcap_opts->cap_pipe_fd, data+pcap_opts->cap_pipe_bytes_read,
pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read, pcap_opts->from_cap_socket);
- if (b <= 0) {
- if (b == 0)
- result = PD_PIPE_EOF;
- else
- result = PD_PIPE_ERR;
- break;
+ if (b <= 0) {
+ if (b == 0)
+ result = PD_PIPE_EOF;
+ else
+ result = PD_PIPE_ERR;
+ break;
+ }
+ pcap_opts->cap_pipe_bytes_read += b;
}
- pcap_opts->cap_pipe_bytes_read += b;
- }
#ifdef _WIN32
- else
- {
+ else {
#if GLIB_CHECK_VERSION(2,31,18)
- q_status = g_async_queue_timeout_pop(pcap_opts->cap_pipe_done_q, PIPE_READ_TIMEOUT);
+ q_status = g_async_queue_timeout_pop(pcap_opts->cap_pipe_done_q, PIPE_READ_TIMEOUT);
#else
- g_get_current_time(&wait_time);
- g_time_val_add(&wait_time, PIPE_READ_TIMEOUT);
- q_status = g_async_queue_timed_pop(pcap_opts->cap_pipe_done_q, &wait_time);
+ g_get_current_time(&wait_time);
+ g_time_val_add(&wait_time, PIPE_READ_TIMEOUT);
+ q_status = g_async_queue_timed_pop(pcap_opts->cap_pipe_done_q, &wait_time);
#endif
- if (pcap_opts->cap_pipe_err == PIPEOF) {
- result = PD_PIPE_EOF;
- break;
- } else if (pcap_opts->cap_pipe_err == PIPERR) {
- result = PD_PIPE_ERR;
- break;
- }
- if (!q_status) {
- return 0;
+ if (pcap_opts->cap_pipe_err == PIPEOF) {
+ result = PD_PIPE_EOF;
+ break;
+ } else if (pcap_opts->cap_pipe_err == PIPERR) {
+ result = PD_PIPE_ERR;
+ break;
+ }
+ if (!q_status) {
+ return 0;
+ }
}
- }
#endif
if ((pcap_opts->cap_pipe_bytes_read) < pcap_opts->cap_pipe_bytes_to_read)
return 0;