Wiretap: Fix some compiler warnings.

Make various _dump_can_write_encap and _dump_open routines static. Add a
couple of casts.
This commit is contained in:
Gerald Combs 2021-04-16 11:24:52 -07:00 committed by Wireshark GitLab Utility
parent c92637bcd8
commit e513ed41d2
9 changed files with 26 additions and 24 deletions

View File

@ -392,7 +392,8 @@ commview_read_header(commview_header_t *cv_hdr, FILE_T fh, int *err,
/* Returns 0 if we can write out the specified encapsulation type /* Returns 0 if we can write out the specified encapsulation type
* into a CommView format file. */ * into a CommView format file. */
int commview_dump_can_write_encap(int encap) static int
commview_dump_can_write_encap(int encap)
{ {
switch (encap) { switch (encap) {
@ -410,7 +411,8 @@ int commview_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; /* Returns TRUE on success, FALSE on failure;
sets "*err" to an error code on failure */ sets "*err" to an error code on failure */
gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_, gchar **err_info _U_) static gboolean
commview_dump_open(wtap_dumper *wdh, int *err _U_, gchar **err_info _U_)
{ {
wdh->subtype_write = commview_dump; wdh->subtype_write = commview_dump;

View File

@ -2011,7 +2011,7 @@ static gboolean erf_dump(
return TRUE; return TRUE;
} }
int erf_dump_can_write_encap(int encap) static int erf_dump_can_write_encap(int encap)
{ {
if(encap == WTAP_ENCAP_PER_PACKET) if(encap == WTAP_ENCAP_PER_PACKET)
@ -2023,7 +2023,7 @@ int erf_dump_can_write_encap(int encap)
return 0; return 0;
} }
int erf_dump_open(wtap_dumper *wdh, int *err _U_, gchar **err_info _U_) static int erf_dump_open(wtap_dumper *wdh, int *err _U_, gchar **err_info _U_)
{ {
erf_dump_t *dump_priv; erf_dump_t *dump_priv;
gchar *s; gchar *s;

View File

@ -771,7 +771,7 @@ static gboolean lanalyzer_dump(wtap_dumper *wdh,
* Returns 0 if we could write the specified encapsulation type, * Returns 0 if we could write the specified encapsulation type,
* an error indication otherwise. * an error indication otherwise.
*---------------------------------------------------*/ *---------------------------------------------------*/
int lanalyzer_dump_can_write_encap(int encap) static int lanalyzer_dump_can_write_encap(int encap)
{ {
/* Per-packet encapsulations aren't supported. */ /* Per-packet encapsulations aren't supported. */
if (encap == WTAP_ENCAP_PER_PACKET) if (encap == WTAP_ENCAP_PER_PACKET)
@ -790,7 +790,7 @@ int lanalyzer_dump_can_write_encap(int encap)
* Returns TRUE on success, FALSE on failure; sets "*err" to an * Returns TRUE on success, FALSE on failure; sets "*err" to an
* error code on failure * error code on failure
*---------------------------------------------------*/ *---------------------------------------------------*/
gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_) static gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
{ {
int jump; int jump;
void *tmp; void *tmp;

View File

@ -1015,7 +1015,7 @@ typedef struct {
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. */ an error indication otherwise. */
int libpcap_dump_can_write_encap(int encap) static int libpcap_dump_can_write_encap(int encap)
{ {
/* Per-packet encapsulations aren't supported. */ /* Per-packet encapsulations aren't supported. */
if (encap == WTAP_ENCAP_PER_PACKET) if (encap == WTAP_ENCAP_PER_PACKET)

View File

@ -93,7 +93,7 @@ void register_log3gpp(void);
/***************************************************************************/ /***************************************************************************/
/* Free log3gpp-specific capture info from file that was open for reading */ /* Free log3gpp-specific capture info from file that was open for reading */
/***************************************************************************/ /***************************************************************************/
void log3gpp_close(wtap* wth) static void log3gpp_close(wtap* wth)
{ {
log3gpp_t* log3gpp = (log3gpp_t*)wth->priv; log3gpp_t* log3gpp = (log3gpp_t*)wth->priv;
/* Also free this capture info */ /* Also free this capture info */

View File

@ -2026,7 +2026,7 @@ typedef struct {
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
** an error indication otherwise. */ ** an error indication otherwise. */
int nstrace_10_dump_can_write_encap(int encap) static int nstrace_10_dump_can_write_encap(int encap)
{ {
if (encap == WTAP_ENCAP_NSTRACE_1_0) if (encap == WTAP_ENCAP_NSTRACE_1_0)
return 0; return 0;
@ -2037,7 +2037,7 @@ int nstrace_10_dump_can_write_encap(int encap)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
** an error indication otherwise. */ ** an error indication otherwise. */
int nstrace_20_dump_can_write_encap(int encap) static int nstrace_20_dump_can_write_encap(int encap)
{ {
if (encap == WTAP_ENCAP_NSTRACE_2_0) if (encap == WTAP_ENCAP_NSTRACE_2_0)
return 0; return 0;
@ -2047,7 +2047,7 @@ int nstrace_20_dump_can_write_encap(int encap)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
** an error indication otherwise. */ ** an error indication otherwise. */
int nstrace_30_dump_can_write_encap(int encap) static int nstrace_30_dump_can_write_encap(int encap)
{ {
if (encap == WTAP_ENCAP_NSTRACE_3_0) if (encap == WTAP_ENCAP_NSTRACE_3_0)
return 0; return 0;
@ -2057,7 +2057,7 @@ int nstrace_30_dump_can_write_encap(int encap)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
** an error indication otherwise. */ ** an error indication otherwise. */
int nstrace_35_dump_can_write_encap(int encap) static int nstrace_35_dump_can_write_encap(int encap)
{ {
if (encap == WTAP_ENCAP_NSTRACE_3_5) if (encap == WTAP_ENCAP_NSTRACE_3_5)
return 0; return 0;
@ -2467,7 +2467,7 @@ static const struct file_type_subtype_info nstrace_3_5_info = {
nstrace_35_dump_can_write_encap, nstrace_35_dump_open, NULL nstrace_35_dump_can_write_encap, nstrace_35_dump_open, NULL
}; };
void register_netscaler(void) void register_nstrace(void)
{ {
nstrace_1_0_file_type_subtype = wtap_register_file_type_subtype(&nstrace_1_0_info); nstrace_1_0_file_type_subtype = wtap_register_file_type_subtype(&nstrace_1_0_info);
nstrace_2_0_file_type_subtype = wtap_register_file_type_subtype(&nstrace_2_0_info); nstrace_2_0_file_type_subtype = wtap_register_file_type_subtype(&nstrace_2_0_info);

View File

@ -1716,7 +1716,7 @@ wtap_encap_to_netxray_1_1_encap(int encap)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. */ an error indication otherwise. */
int static int
netxray_dump_can_write_encap_1_1(int encap) netxray_dump_can_write_encap_1_1(int encap)
{ {
/* Per-packet encapsulations aren't supported. */ /* Per-packet encapsulations aren't supported. */
@ -1731,7 +1731,7 @@ netxray_dump_can_write_encap_1_1(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */ failure */
gboolean static gboolean
netxray_dump_open_1_1(wtap_dumper *wdh, int *err, gchar **err_info _U_) netxray_dump_open_1_1(wtap_dumper *wdh, int *err, gchar **err_info _U_)
{ {
netxray_dump_t *netxray; netxray_dump_t *netxray;
@ -1902,7 +1902,7 @@ wtap_encap_to_netxray_2_0_encap(int encap)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. */ an error indication otherwise. */
int static int
netxray_dump_can_write_encap_2_0(int encap) netxray_dump_can_write_encap_2_0(int encap)
{ {
/* Per-packet encapsulations aren't supported. */ /* Per-packet encapsulations aren't supported. */
@ -1917,7 +1917,7 @@ netxray_dump_can_write_encap_2_0(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */ failure */
gboolean static gboolean
netxray_dump_open_2_0(wtap_dumper *wdh, int *err, gchar **err_info _U_) netxray_dump_open_2_0(wtap_dumper *wdh, int *err, gchar **err_info _U_)
{ {
netxray_dump_t *netxray; netxray_dump_t *netxray;

View File

@ -131,7 +131,7 @@ typedef struct pcapng_name_resolution_block_s {
/* /*
* Minimum Sysdig size = minimum block size + packed size of sysdig_event_phdr. * Minimum Sysdig size = minimum block size + packed size of sysdig_event_phdr.
* Minimum Sysdig event v2 header size = minimum block size + packed size of sysdig_event_v2_phdr (which, in addition * Minimum Sysdig event v2 header size = minimum block size + packed size of sysdig_event_v2_phdr (which, in addition
* to sysdig_event_phdr, includes the nparams 32bit value). * to sysdig_event_phdr, includes the nparams 32bit value).
*/ */
#define SYSDIG_EVENT_HEADER_SIZE ((16 + 64 + 64 + 32 + 16)/8) /* CPU ID + TS + TID + Event len + Event type */ #define SYSDIG_EVENT_HEADER_SIZE ((16 + 64 + 64 + 32 + 16)/8) /* CPU ID + TS + TID + Event len + Event type */
@ -579,7 +579,7 @@ pcapng_process_string_option(wtapng_block_t *wblock,
* will fail on the second and later occurrences of the option; * will fail on the second and later occurrences of the option;
* we silently ignore the failure. * we silently ignore the failure.
*/ */
wtap_block_add_string_option(wblock->block, ohp->option_code, option_content, ohp->option_length); wtap_block_add_string_option(wblock->block, ohp->option_code, (const char *)option_content, ohp->option_length);
} }
} }
@ -1255,7 +1255,7 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh,
*err_info = g_strdup_printf("%s: secrets block is too large: %u", G_STRFUNC, dsb_mand->secrets_len); *err_info = g_strdup_printf("%s: secrets block is too large: %u", G_STRFUNC, dsb_mand->secrets_len);
return FALSE; return FALSE;
} }
dsb_mand->secrets_data = (char *)g_malloc0(dsb_mand->secrets_len); dsb_mand->secrets_data = (guint8 *)g_malloc0(dsb_mand->secrets_len);
if (!wtap_read_bytes(fh, dsb_mand->secrets_data, dsb_mand->secrets_len, err, err_info)) { if (!wtap_read_bytes(fh, dsb_mand->secrets_data, dsb_mand->secrets_len, err, err_info)) {
pcapng_debug("%s: failed to read DSB", G_STRFUNC); pcapng_debug("%s: failed to read DSB", G_STRFUNC);
return FALSE; return FALSE;
@ -5070,7 +5070,7 @@ static gboolean pcapng_dump_finish(wtap_dumper *wdh, int *err,
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */ failure */
gboolean static gboolean
pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_) pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
{ {
guint i; guint i;
@ -5120,7 +5120,7 @@ pcapng_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. */ an error indication otherwise. */
int pcapng_dump_can_write_encap(int wtap_encap) static int pcapng_dump_can_write_encap(int wtap_encap)
{ {
pcapng_debug("pcapng_dump_can_write_encap: encap = %d (%s)", pcapng_debug("pcapng_dump_can_write_encap: encap = %d (%s)",
wtap_encap, wtap_encap,

View File

@ -818,7 +818,7 @@ static const int wtap_encap[] = {
/* Returns 0 if we could write the specified encapsulation type, /* Returns 0 if we could write the specified encapsulation type,
an error indication otherwise. */ an error indication otherwise. */
int snoop_dump_can_write_encap(int encap) static int snoop_dump_can_write_encap(int encap)
{ {
/* Per-packet encapsulations aren't supported. */ /* Per-packet encapsulations aren't supported. */
if (encap == WTAP_ENCAP_PER_PACKET) if (encap == WTAP_ENCAP_PER_PACKET)
@ -832,7 +832,7 @@ int snoop_dump_can_write_encap(int encap)
/* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on /* Returns TRUE on success, FALSE on failure; sets "*err" to an error code on
failure */ failure */
gboolean snoop_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_) static gboolean snoop_dump_open(wtap_dumper *wdh, int *err, gchar **err_info _U_)
{ {
struct snoop_hdr file_hdr; struct snoop_hdr file_hdr;