aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-05-24 00:46:43 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-06 20:05:26 +0000
commit4aff36d501400552d7df59473db17ef7add8b11c (patch)
tree05518b1962382e2c4edf5935e9c4284747a0b302 /wiretap
parentef0f022f8629009daf7c31e204b9d65b1805f6e4 (diff)
Replace g_assert() with ws_assert() in places
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/capsa.c3
-rw-r--r--wiretap/file_access.c15
-rw-r--r--wiretap/file_wrappers.c3
-rw-r--r--wiretap/iseries.c3
-rw-r--r--wiretap/libpcap.c5
-rw-r--r--wiretap/merge.c57
-rw-r--r--wiretap/netscaler.c11
-rw-r--r--wiretap/nettrace_3gpp_32_423.c3
-rw-r--r--wiretap/ngsniffer.c7
-rw-r--r--wiretap/pcapng.c9
-rw-r--r--wiretap/peekclassic.c7
-rw-r--r--wiretap/pppdump.c8
-rw-r--r--wiretap/vwr.c3
-rw-r--r--wiretap/wtap.c13
-rw-r--r--wiretap/wtap_opttypes.c11
15 files changed, 87 insertions, 71 deletions
diff --git a/wiretap/capsa.c b/wiretap/capsa.c
index 7aa9ae1c00..f49314312e 100644
--- a/wiretap/capsa.c
+++ b/wiretap/capsa.c
@@ -12,6 +12,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
#include "capsa.h"
+#include <wsutil/ws_assert.h>
/*
* A file begins with a header containing:
@@ -368,7 +369,7 @@ capsa_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
*err = WTAP_ERR_INTERNAL;
*err_info = g_strdup_printf("capsa: format indicator is %u", capsa->format_indicator);
return -1;
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index e549f99890..8a7a920ca1 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -18,6 +18,7 @@
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>
#endif
+#include <wsutil/ws_assert.h>
#include "wtap-int.h"
#include "wtap_modules.h"
@@ -461,7 +462,7 @@ static void
set_heuristic_routine(void)
{
guint i;
- g_assert(open_info_arr != NULL);
+ ws_assert(open_info_arr != NULL);
for (i = 0; i < open_info_arr->len; i++) {
if (open_routines[i].type == OPEN_INFO_HEURISTIC) {
@@ -469,10 +470,10 @@ set_heuristic_routine(void)
break;
}
/* sanity check */
- g_assert(open_routines[i].type == OPEN_INFO_MAGIC);
+ ws_assert(open_routines[i].type == OPEN_INFO_MAGIC);
}
- g_assert(heuristic_open_routine_idx > 0);
+ ws_assert(heuristic_open_routine_idx > 0);
}
void
@@ -1255,7 +1256,7 @@ void
wtap_init_file_type_subtypes(void)
{
/* Don't do this twice. */
- g_assert(file_type_subtype_table_arr == NULL);
+ ws_assert(file_type_subtype_table_arr == NULL);
/*
* Estimate the number of file types/subtypes as twice the
@@ -1833,7 +1834,7 @@ wtap_pcap_file_type_subtype(void)
* Make sure pcap was registered as a file type/subtype;
* it's one of our "native" formats.
*/
- g_assert(pcap_file_type_subtype != -1);
+ ws_assert(pcap_file_type_subtype != -1);
return pcap_file_type_subtype;
}
@@ -1847,7 +1848,7 @@ wtap_pcap_nsec_file_type_subtype(void)
* Make sure nanosecond-resolution pcap was registered
* as a file type/subtype; it's one of our "native" formats.
*/
- g_assert(pcap_nsec_file_type_subtype != -1);
+ ws_assert(pcap_nsec_file_type_subtype != -1);
return pcap_nsec_file_type_subtype;
}
@@ -1861,7 +1862,7 @@ wtap_pcapng_file_type_subtype(void)
* Make sure pcapng was registered as a file type/subtype;
* it's one of our "native" formats.
*/
- g_assert(pcapng_file_type_subtype != -1);
+ ws_assert(pcapng_file_type_subtype != -1);
return pcapng_file_type_subtype;
}
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 2fa6871c7f..0f5bb89318 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -21,6 +21,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
#ifdef HAVE_ZLIB
#define ZLIB_CONST
@@ -1072,7 +1073,7 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
guint n;
if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
- g_assert_not_reached();
+ ws_assert_not_reached();
/*
*err = EINVAL;
return -1;
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index 0ebe026138..96ca92b638 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -147,6 +147,7 @@ Number S/R Length Timer MAC Address MAC Address
#include <wsutil/str_util.h>
#include <wsutil/strtoi.h>
+#include <wsutil/ws_assert.h>
#define ISERIES_LINE_LENGTH 270
#define ISERIES_HDR_LINES_TO_CHECK 100
@@ -1015,7 +1016,7 @@ iseries_UNICODE_to_ASCII (guint8 * buf, guint bytes)
if (buf[i] == 0x0A)
break;
}
- g_assert(bufptr < buf + bytes);
+ ws_assert(bufptr < buf + bytes);
*bufptr = '\0';
return i;
}
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index 15e8a04e6d..70e85d2862 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -18,6 +18,7 @@
#include "pcap-encap.h"
#include "libpcap.h"
#include "erf-common.h"
+#include <wsutil/ws_assert.h>
/* See source to the "libpcap" library for information on the "libpcap"
file format. */
@@ -584,7 +585,7 @@ done:
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/*
@@ -969,7 +970,7 @@ static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
bytes_to_read = 0;
}
if (!wtap_read_bytes_or_eof(fh, hdr, bytes_to_read, err, err_info))
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 829ab8a431..7bca49627e 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -31,6 +31,7 @@
#include <wsutil/filesystem.h>
#include "wsutil/os_version_info.h"
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
@@ -70,7 +71,7 @@ merge_idb_merge_mode_to_string(const int mode)
static void
cleanup_in_file(merge_in_file_t *in_file)
{
- g_assert(in_file != NULL);
+ ws_assert(in_file != NULL);
wtap_close(in_file->wth);
in_file->wth = NULL;
@@ -83,17 +84,17 @@ cleanup_in_file(merge_in_file_t *in_file)
}
static void
-add_idb_index_map(merge_in_file_t *in_file, const guint orig_index, const guint found_index)
+add_idb_index_map(merge_in_file_t *in_file, const guint orig_index _U_, const guint found_index)
{
- g_assert(in_file != NULL);
- g_assert(in_file->idb_index_map != NULL);
+ ws_assert(in_file != NULL);
+ ws_assert(in_file->idb_index_map != NULL);
/*
* we didn't really need the orig_index, since just appending to the array
* should result in the orig_index being its location in the array; but we
* pass it into this function to do a sanity check here
*/
- g_assert(orig_index == in_file->idb_index_map->len);
+ ws_assert(orig_index == in_file->idb_index_map->len);
g_array_append_val(in_file->idb_index_map, found_index);
}
@@ -465,7 +466,7 @@ is_duplicate_idb(const wtap_block_t idb1, const wtap_block_t idb2)
char *idb1_if_hardware, *idb2_if_hardware;
char *idb1_if_os, *idb2_if_os;
- g_assert(idb1 && idb2);
+ ws_assert(idb1 && idb2);
idb1_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb1);
idb2_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb2);
@@ -627,18 +628,18 @@ all_idbs_are_duplicates(const merge_in_file_t *in_files, const guint in_file_cou
wtap_block_t first_file_idb, other_file_idb;
guint i, j;
- g_assert(in_files != NULL);
+ ws_assert(in_files != NULL);
/* get the first file's info */
first_idb_list = wtap_file_get_idb_info(in_files[0].wth);
- g_assert(first_idb_list->interface_data);
+ ws_assert(first_idb_list->interface_data);
first_idb_list_size = first_idb_list->interface_data->len;
/* now compare the other input files with that */
for (i = 1; i < in_file_count; i++) {
other_idb_list = wtap_file_get_idb_info(in_files[i].wth);
- g_assert(other_idb_list->interface_data);
+ ws_assert(other_idb_list->interface_data);
other_idb_list_size = other_idb_list->interface_data->len;
if (other_idb_list_size != first_idb_list_size) {
@@ -687,10 +688,10 @@ find_duplicate_idb(const wtap_block_t input_file_idb,
wtap_block_t merged_idb;
guint i;
- g_assert(input_file_idb != NULL);
- g_assert(merged_idb_list != NULL);
- g_assert(merged_idb_list->interface_data != NULL);
- g_assert(found_index != NULL);
+ ws_assert(input_file_idb != NULL);
+ ws_assert(merged_idb_list != NULL);
+ ws_assert(merged_idb_list->interface_data != NULL);
+ ws_assert(found_index != NULL);
for (i = 0; i < merged_idb_list->interface_data->len; i++) {
merged_idb = g_array_index(merged_idb_list->interface_data, wtap_block_t, i);
@@ -712,9 +713,9 @@ add_idb_to_merged_file(wtapng_iface_descriptions_t *merged_idb_list,
wtap_block_t idb = wtap_block_create(WTAP_BLOCK_IF_ID_AND_INFO);
wtapng_if_descr_mandatory_t* idb_mand;
- g_assert(merged_idb_list != NULL);
- g_assert(merged_idb_list->interface_data != NULL);
- g_assert(input_file_idb != NULL);
+ ws_assert(merged_idb_list != NULL);
+ ws_assert(merged_idb_list->interface_data != NULL);
+ ws_assert(input_file_idb != NULL);
wtap_block_copy(idb, input_file_idb);
idb_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb);
@@ -812,9 +813,9 @@ static gboolean
map_rec_interface_id(wtap_rec *rec, const merge_in_file_t *in_file)
{
guint current_interface_id = 0;
- g_assert(rec != NULL);
- g_assert(in_file != NULL);
- g_assert(in_file->idb_index_map != NULL);
+ ws_assert(rec != NULL);
+ ws_assert(in_file != NULL);
+ ws_assert(in_file->idb_index_map != NULL);
if (rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
current_interface_id = rec->rec_header.packet_header.interface_id;
@@ -1000,15 +1001,15 @@ merge_files_common(const gchar* out_filename, /* normal output mode */
wtapng_iface_descriptions_t *idb_inf = NULL;
GArray *dsb_combined = NULL;
- g_assert(in_file_count > 0);
- g_assert(in_filenames != NULL);
- g_assert(err != NULL);
- g_assert(err_info != NULL);
- g_assert(err_fileno != NULL);
- g_assert(err_framenum != NULL);
+ ws_assert(in_file_count > 0);
+ ws_assert(in_filenames != NULL);
+ ws_assert(err != NULL);
+ ws_assert(err_info != NULL);
+ ws_assert(err_fileno != NULL);
+ ws_assert(err_framenum != NULL);
/* if a callback was given, it has to have a callback function ptr */
- g_assert((cb != NULL) ? (cb->callback_func != NULL) : TRUE);
+ ws_assert((cb != NULL) ? (cb->callback_func != NULL) : TRUE);
ws_debug("merge_files: begin");
@@ -1116,7 +1117,7 @@ merge_files(const gchar* out_filename, const int file_type,
int *err, gchar **err_info, guint *err_fileno,
guint32 *err_framenum)
{
- g_assert(out_filename != NULL);
+ ws_assert(out_filename != NULL);
return merge_files_common(out_filename, NULL, NULL,
file_type, in_filenames, in_file_count,
@@ -1138,7 +1139,7 @@ merge_files_to_tempfile(gchar **out_filenamep, const char *pfx,
int *err, gchar **err_info, guint *err_fileno,
guint32 *err_framenum)
{
- g_assert(out_filenamep != NULL);
+ ws_assert(out_filenamep != NULL);
/* no temporary file name yet */
*out_filenamep = NULL;
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
index eb393430ca..1bd4b0adc7 100644
--- a/wiretap/netscaler.c
+++ b/wiretap/netscaler.c
@@ -12,6 +12,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
#include "netscaler.h"
+#include <wsutil/ws_assert.h>
/* Defines imported from netscaler code: nsperfrc.h */
@@ -2188,7 +2189,7 @@ static gboolean nstrace_add_signature(wtap_dumper *wdh, int *err)
nstrace->page_offset += (guint16) sig35.sig_RecordSize;
} else
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
@@ -2256,7 +2257,7 @@ nstrace_add_abstime(wtap_dumper *wdh, const wtap_rec *rec,
} else
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
@@ -2299,7 +2300,7 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const wtap_rec *rec,
return FALSE;
} else
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
}
@@ -2403,13 +2404,13 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const wtap_rec *rec,
nstrace->page_offset += (guint16) rec->rec_header.packet_header.caplen;
} else
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
diff --git a/wiretap/nettrace_3gpp_32_423.c b/wiretap/nettrace_3gpp_32_423.c
index 3cac893cf1..ea3befed18 100644
--- a/wiretap/nettrace_3gpp_32_423.c
+++ b/wiretap/nettrace_3gpp_32_423.c
@@ -30,6 +30,7 @@
#include "wsutil/os_version_info.h"
#include "wsutil/str_util.h"
#include <wsutil/inet_addr.h>
+#include <wsutil/ws_assert.h>
#include "nettrace_3gpp_32_423.h"
@@ -449,7 +450,7 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_COL_PROT_BIT) {
/* The assert prevents static code analyzers to raise warnings */
- g_assert(exported_pdu_info.proto_col_str);
+ ws_assert(exported_pdu_info.proto_col_str);
exp_pdu_tags_len += 4 + (int)strlen(exported_pdu_info.proto_col_str);
}
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 97504dffcf..b4cb3510ab 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -47,6 +47,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
#include "ngsniffer.h"
+#include <wsutil/ws_assert.h>
/* Magic number in Sniffer files. */
static const char ngsniffer_magic[] = {
@@ -1115,7 +1116,7 @@ ngsniffer_seek_read(wtap *wth, gint64 seek_off,
/*
* "Can't happen".
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
@@ -2500,7 +2501,7 @@ ng_read_bytes_or_eof(wtap *wth, void *buffer, unsigned int nbytes, gboolean is_r
random stream open, allocate the first element for the
list of blobs, and make it the last element as well. */
if (wth->random_fh != NULL) {
- g_assert(ngsniffer->first_blob == NULL);
+ ws_assert(ngsniffer->first_blob == NULL);
blob = g_new(blob_info_t,1);
blob->blob_comp_offset = comp_stream->comp_offset;
blob->blob_uncomp_offset = comp_stream->uncomp_offset;
@@ -2829,7 +2830,7 @@ ng_file_seek_rand(wtap *wth, gint64 offset, int *err, gchar **err_info)
the blob, as otherwise it'd mean we need to seek before
the beginning or after the end of this blob. */
delta = offset - ngsniffer->rand.uncomp_offset;
- g_assert(delta >= 0 && (unsigned long)delta < ngsniffer->rand.nbytes);
+ ws_assert(delta >= 0 && (unsigned long)delta < ngsniffer->rand.nbytes);
}
/* OK, the place to which we're seeking is in the buffer; adjust
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index f8472f98d0..6e9d5bd675 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -26,6 +26,7 @@
#include <wsutil/wslog.h>
#include <wsutil/strtoi.h>
#include <wsutil/glib-compat.h>
+#include <wsutil/ws_assert.h>
#include "wtap-int.h"
#include "file_wrappers.h"
@@ -412,7 +413,7 @@ static GHashTable *option_handlers[NUM_BT_INDICES];
static gboolean
get_block_type_index(guint block_type, guint *bt_index)
{
- g_assert(bt_index);
+ ws_assert(bt_index);
switch (block_type) {
@@ -3258,7 +3259,7 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
* First, make sure we have at least one section; if we don't, that's
* an internal error.
*/
- g_assert(pcapng->sections->len >= 1);
+ ws_assert(pcapng->sections->len >= 1);
/*
* Now scan backwards through the array to find the first section
@@ -3278,7 +3279,7 @@ pcapng_seek_read(wtap *wth, gint64 seek_off,
* If that's section 0, something's wrong; that section should
* have an offset of 0.
*/
- g_assert(section_number != 0);
+ ws_assert(section_number != 0);
section_number--;
}
@@ -4844,7 +4845,7 @@ static void write_wtap_idb_option(wtap_block_t block _U_, guint option_id, wtap_
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index bdd17877a2..906594e845 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -27,6 +27,7 @@
#include <wsutil/epochs.h>
#include <wsutil/802_11-utils.h>
+#include <wsutil/ws_assert.h>
#include "wtap-int.h"
#include "file_wrappers.h"
@@ -172,7 +173,7 @@ wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info)
* is zero, and check some other fields; this isn't perfect,
* and we may have to add more checks at some point.
*/
- g_assert(sizeof(ep_hdr.master) == PEEKCLASSIC_MASTER_HDR_SIZE);
+ ws_assert(sizeof(ep_hdr.master) == PEEKCLASSIC_MASTER_HDR_SIZE);
if (!wtap_read_bytes(wth->fh, &ep_hdr.master,
(int)sizeof(ep_hdr.master), err, err_info)) {
if (*err != WTAP_ERR_SHORT_READ)
@@ -201,7 +202,7 @@ wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info)
case 6:
case 7:
/* get the secondary header */
- g_assert(sizeof(ep_hdr.secondary.v567) ==
+ ws_assert(sizeof(ep_hdr.secondary.v567) ==
PEEKCLASSIC_V567_HDR_SIZE);
if (!wtap_read_bytes(wth->fh, &ep_hdr.secondary.v567,
(int)sizeof(ep_hdr.secondary.v567), err, err_info)) {
@@ -343,7 +344,7 @@ wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info)
default:
/* this is impossible */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
wth->snapshot_length = 0; /* not available in header */
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index 68799df933..7c72ccf74f 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -14,6 +14,8 @@
#include <errno.h>
#include <string.h>
+#include <wsutil/ws_assert.h>
+
/*
pppdump records
Daniel Thompson (STMicroelectronics) <daniel.thompson@st.com>
@@ -457,7 +459,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd,
pid->offset = pkt->id_offset;
pid->num_bytes_to_skip =
pkt->sd_offset - pkt->id_offset - 3;
- g_assert(pid->num_bytes_to_skip >= 0);
+ ws_assert(pid->num_bytes_to_skip >= 0);
}
num_bytes--;
@@ -557,7 +559,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
* sequential processing.
*/
if (state->num_bytes > 0) {
- g_assert(num_bytes_to_skip == 0);
+ ws_assert(num_bytes_to_skip == 0);
pkt = state->pkt;
num_written = process_data(state, fh, pkt, state->num_bytes,
pd, err, err_info, pid);
@@ -631,7 +633,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
if (n == 0)
continue;
- g_assert(num_bytes_to_skip < n);
+ ws_assert(num_bytes_to_skip < n);
while (num_bytes_to_skip) {
if (file_getc(fh) == EOF)
goto done;
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
index 768a4e6892..58201373eb 100644
--- a/wiretap/vwr.c
+++ b/wiretap/vwr.c
@@ -16,6 +16,7 @@
#include "file_wrappers.h"
#include "vwr.h"
+#include <wsutil/ws_assert.h>
/* platform-specific definitions for portability */
@@ -3362,7 +3363,7 @@ vwr_process_rec_data(FILE_T fh, int rec_size,
break;
default:
g_free(rec);
- g_assert_not_reached();
+ ws_assert_not_reached();
return ret;
}
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 209e99185f..e37836adc8 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -19,6 +19,7 @@
#include "file_wrappers.h"
#include <wsutil/file_util.h>
#include <wsutil/buffer.h>
+#include <wsutil/ws_assert.h>
#ifdef HAVE_PLUGINS
#include <wsutil/plugins.h>
#endif
@@ -209,9 +210,9 @@ wtap_add_generated_idb(wtap *wth)
wtapng_if_descr_mandatory_t *if_descr_mand;
int snaplen;
- g_assert(wth->file_encap != WTAP_ENCAP_UNKNOWN &&
+ ws_assert(wth->file_encap != WTAP_ENCAP_UNKNOWN &&
wth->file_encap != WTAP_ENCAP_PER_PACKET);
- g_assert(wth->file_tsprec != WTAP_TSPREC_UNKNOWN &&
+ ws_assert(wth->file_tsprec != WTAP_TSPREC_UNKNOWN &&
wth->file_tsprec != WTAP_TSPREC_PER_PACKET);
idb = wtap_block_create(WTAP_BLOCK_IF_ID_AND_INFO);
@@ -257,7 +258,7 @@ wtap_add_generated_idb(wtap *wth)
/*
* Don't do this.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
snaplen = wth->snapshot_length;
@@ -316,7 +317,7 @@ wtap_get_debug_if_descr(const wtap_block_t if_descr,
guint8 tmp8;
if_filter_opt_t if_filter;
- g_assert(if_descr);
+ ws_assert(if_descr);
if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(if_descr);
if (wtap_block_get_string_option_value(if_descr, OPT_IDB_NAME, &tmp_content) == WTAP_OPTTYPE_SUCCESS) {
@@ -1557,7 +1558,7 @@ wtap_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err,
* but the read routine didn't set this packet's
* encapsulation type.
*/
- g_assert(rec->rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
+ ws_assert(rec->rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
}
return TRUE; /* success */
@@ -1702,7 +1703,7 @@ wtap_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec, Buffer *buf,
* but the read routine didn't set this packet's
* encapsulation type.
*/
- g_assert(rec->rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
+ ws_assert(rec->rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
}
return TRUE;
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index 408815c0d9..6c8c0ff5ab 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -15,6 +15,7 @@
#include "wtap_opttypes.h"
#include "wtap-int.h"
#include "pcapng_module.h"
+#include <wsutil/ws_assert.h>
#include <wsutil/glib-compat.h>
@@ -120,15 +121,15 @@ static void wtap_opttype_block_register(wtap_blocktype_t *blocktype)
block_type = blocktype->block_type;
/* Check input */
- g_assert(block_type < MAX_WTAP_BLOCK_TYPE_VALUE);
+ ws_assert(block_type < MAX_WTAP_BLOCK_TYPE_VALUE);
/* Don't re-register. */
- g_assert(blocktype_list[block_type] == NULL);
+ ws_assert(blocktype_list[block_type] == NULL);
/* Sanity check */
- g_assert(blocktype->name);
- g_assert(blocktype->description);
- g_assert(blocktype->create);
+ ws_assert(blocktype->name);
+ ws_assert(blocktype->description);
+ ws_assert(blocktype->create);
/*
* Initialize the set of supported options.