Skip to content

Commit

Permalink
Squelch some warnings that popped up on MinGW.
Browse files Browse the repository at this point in the history
  • Loading branch information
guyharris committed Nov 5, 2019
1 parent 15e4e80 commit de5f2d8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
10 changes: 6 additions & 4 deletions pcap-npf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include <dagapi.h>
#endif /* HAVE_DAG_API */

#include "diag-control.h"

static int pcap_setfilter_npf(pcap_t *, struct bpf_program *);
static int pcap_setfilter_win32_dag(pcap_t *, struct bpf_program *);
static int pcap_getnonblock_npf(pcap_t *);
Expand Down Expand Up @@ -246,7 +248,7 @@ pcap_stats_npf(pcap_t *p, struct pcap_stat *ps)
* statistics we are and are *not* providing, rather than having to provide
* possibly-bogus values for statistics we can't provide.
*/
struct pcap_stat *
static struct pcap_stat *
pcap_stats_ex_npf(pcap_t *p, int *pcap_stat_size)
{
struct pcap_win *pw = p->priv;
Expand Down Expand Up @@ -1872,10 +1874,10 @@ pcap_lookupdev(char *errbuf)
DWORD dwVersion;
DWORD dwWindowsMajorVersion;

#pragma warning (push)
#pragma warning (disable: 4996) /* disable MSVC's GetVersion() deprecated warning here */
/* disable MSVC's GetVersion() deprecated warning here */
DIAG_OFF_DEPRECATION
dwVersion = GetVersion(); /* get the OS version */
#pragma warning (pop)
DIAG_ON_DEPRECATION
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));

if (dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4) {
Expand Down
30 changes: 16 additions & 14 deletions pcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ struct rtentry; /* declarations in <net/if.h> */
* DllMain(), required when built as a Windows DLL.
*/
BOOL WINAPI DllMain(
HANDLE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved
HANDLE hinstDLL _U_,
DWORD dwReason _U_,
LPVOID lpvReserved _U_
)
{
return (TRUE);
Expand Down Expand Up @@ -257,7 +257,7 @@ pcap_stats_not_initialized(pcap_t *pcap, struct pcap_stat *ps _U_)
}

#ifdef _WIN32
struct pcap_stat *
static struct pcap_stat *
pcap_stats_ex_not_initialized(pcap_t *pcap, int *pcap_stat_size _U_)
{
pcap_set_not_initialized_message(pcap);
Expand Down Expand Up @@ -312,7 +312,8 @@ pcap_oid_set_request_not_initialized(pcap_t *pcap, bpf_u_int32 oid _U_,
}

static u_int
pcap_sendqueue_transmit_not_initialized(pcap_t *pcap, pcap_send_queue* queue, int sync)
pcap_sendqueue_transmit_not_initialized(pcap_t *pcap, pcap_send_queue* queue _U_,
int sync _U_)
{
pcap_set_not_initialized_message(pcap);
return (0);
Expand Down Expand Up @@ -3966,7 +3967,7 @@ pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_)
}

#ifdef _WIN32
struct pcap_stat *
static struct pcap_stat *
pcap_stats_ex_dead(pcap_t *p, int *pcap_stat_size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
Expand All @@ -3975,23 +3976,23 @@ pcap_stats_ex_dead(pcap_t *p, int *pcap_stat_size _U_)
}

static int
pcap_setbuff_dead(pcap_t *p, int dim)
pcap_setbuff_dead(pcap_t *p, int dim _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The kernel buffer size cannot be set on a pcap_open_dead pcap_t");
return (-1);
}

static int
pcap_setmode_dead(pcap_t *p, int mode)
pcap_setmode_dead(pcap_t *p, int mode _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"impossible to set mode on a pcap_open_dead pcap_t");
return (-1);
}

static int
pcap_setmintocopy_dead(pcap_t *p, int size)
pcap_setmintocopy_dead(pcap_t *p, int size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The mintocopy parameter cannot be set on a pcap_open_dead pcap_t");
Expand Down Expand Up @@ -4025,39 +4026,40 @@ pcap_oid_set_request_dead(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
}

static u_int
pcap_sendqueue_transmit_dead(pcap_t *p, pcap_send_queue *queue, int sync)
pcap_sendqueue_transmit_dead(pcap_t *p, pcap_send_queue *queue, int sync _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Packets cannot be transmitted on a pcap_open_dead pcap_t");
return (0);
}

static int
pcap_setuserbuffer_dead(pcap_t *p, int size)
pcap_setuserbuffer_dead(pcap_t *p, int size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The user buffer cannot be set on a pcap_open_dead pcap_t");
return (-1);
}

static int
pcap_live_dump_dead(pcap_t *p, char *filename, int maxsize, int maxpacks)
pcap_live_dump_dead(pcap_t *p, char *filename _U_, int maxsize _U_,
int maxpacks _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
return (-1);
}

static int
pcap_live_dump_ended_dead(pcap_t *p, int sync)
pcap_live_dump_ended_dead(pcap_t *p, int sync _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
return (-1);
}

static PAirpcapHandle
pcap_get_airpcap_handle_dead(pcap_t *p)
pcap_get_airpcap_handle_dead(pcap_t *p _U_)
{
return (NULL);
}
Expand Down
18 changes: 9 additions & 9 deletions savefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,31 +121,31 @@ sf_stats(pcap_t *p, struct pcap_stat *ps _U_)

#ifdef _WIN32
static struct pcap_stat *
sf_stats_ex(pcap_t *p, int *size)
sf_stats_ex(pcap_t *p, int *size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Statistics aren't available from savefiles");
return (NULL);
}

static int
sf_setbuff(pcap_t *p, int dim)
sf_setbuff(pcap_t *p, int dim _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The kernel buffer size cannot be set while reading from a file");
return (-1);
}

static int
sf_setmode(pcap_t *p, int mode)
sf_setmode(pcap_t *p, int mode _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"impossible to set mode while reading from a file");
return (-1);
}

static int
sf_setmintocopy(pcap_t *p, int size)
sf_setmintocopy(pcap_t *p, int size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The mintocopy parameter cannot be set while reading from a file");
Expand Down Expand Up @@ -179,39 +179,39 @@ sf_oid_set_request(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
}

static u_int
sf_sendqueue_transmit(pcap_t *p, pcap_send_queue *queue, int sync)
sf_sendqueue_transmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_)
{
pcap_strlcpy(p->errbuf, "Sending packets isn't supported on savefiles",
PCAP_ERRBUF_SIZE);
return (0);
}

static int
sf_setuserbuffer(pcap_t *p, int size)
sf_setuserbuffer(pcap_t *p, int size _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"The user buffer cannot be set when reading from a file");
return (-1);
}

static int
sf_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks)
sf_live_dump(pcap_t *p, char *filename _U_, int maxsize _U_, int maxpacks _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Live packet dumping cannot be performed when reading from a file");
return (-1);
}

static int
sf_live_dump_ended(pcap_t *p, int sync)
sf_live_dump_ended(pcap_t *p, int sync _U_)
{
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
return (-1);
}

static PAirpcapHandle
sf_get_airpcap_handle(pcap_t *pcap)
sf_get_airpcap_handle(pcap_t *pcap _U_)
{
return (NULL);
}
Expand Down

0 comments on commit de5f2d8

Please sign in to comment.