aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-06-18 19:21:42 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-06-19 01:23:31 +0000
commit0e50979b3f45250ee1dacd5c826a281ad9a9c460 (patch)
treecfaf2f2221f9ebd948fab14b180cd3219dcc3523
parentb4eddd32c18816b7b5f9e074b88559d88f28123c (diff)
Replace g_assert() with ws_assert()
-rw-r--r--capinfos.c7
-rw-r--r--capture/capture-wpcap.c79
-rw-r--r--capture/capture_sync.c9
-rw-r--r--capture_opts.c3
-rw-r--r--dumpcap.c11
-rw-r--r--editcap.c7
-rw-r--r--epan/addr_and_mask.c3
-rw-r--r--epan/addr_resolv.c31
-rw-r--r--epan/address.h19
-rw-r--r--epan/address_types.c35
-rw-r--r--epan/capture_dissectors.c5
-rw-r--r--epan/color_filters.c11
-rw-r--r--epan/column-utils.c55
-rw-r--r--epan/column.c15
-rw-r--r--epan/decode_as.c13
-rw-r--r--epan/dfilter/dfilter.c3
-rw-r--r--epan/dfilter/dfunctions.c9
-rw-r--r--epan/dfilter/dfvm.c21
-rw-r--r--epan/dfilter/drange.c9
-rw-r--r--epan/dfilter/gencode.c13
-rw-r--r--epan/dfilter/grammar.lemon4
-rw-r--r--epan/dfilter/scanner.l6
-rw-r--r--epan/dfilter/semcheck.c38
-rw-r--r--epan/dfilter/sttype-function.c11
-rw-r--r--epan/dfilter/sttype-range.c11
-rw-r--r--epan/dfilter/syntax-tree.c35
-rw-r--r--epan/dfilter/syntax-tree.h12
-rw-r--r--epan/dissectors/packet-frame.c1
-rw-r--r--epan/dissectors/packet-ncp2222.inc2
-rw-r--r--epan/dissectors/packet-scsi.c2
-rw-r--r--epan/dissectors/packet-tcp.c1
-rw-r--r--epan/dissectors/packet-tls-utils.c5
-rw-r--r--epan/dissectors/packet-tls.c3
-rw-r--r--epan/epan.c7
-rw-r--r--epan/exceptions.h3
-rw-r--r--epan/frame_data.c3
-rw-r--r--epan/ftypes/ftype-protocol.c5
-rw-r--r--epan/ftypes/ftype-string.c5
-rw-r--r--epan/ftypes/ftypes.c101
-rw-r--r--epan/oids.c7
-rw-r--r--epan/oids_test.c1
-rw-r--r--epan/packet.c79
-rw-r--r--epan/plugin_if.c31
-rw-r--r--epan/prefs.c49
-rw-r--r--epan/print.c63
-rw-r--r--epan/proto.c19
-rw-r--r--epan/reassemble.c3
-rw-r--r--epan/reassemble_test.c4
-rw-r--r--epan/show_exception.c3
-rw-r--r--epan/srt_table.c3
-rw-r--r--epan/stat_tap_ui.c9
-rw-r--r--epan/stats_tree.c19
-rw-r--r--epan/stream.c5
-rw-r--r--epan/tvbparse.c9
-rw-r--r--epan/tvbuff.c5
-rw-r--r--epan/uat.c15
-rw-r--r--epan/value_string.c9
-rw-r--r--extcap.c3
-rw-r--r--extcap/extcap-base.c5
-rw-r--r--file.c63
-rw-r--r--fileset.c5
-rw-r--r--mergecap.c3
-rw-r--r--plugins/epan/mate/mate_runtime.c3
-rw-r--r--ringbuffer.c1
-rw-r--r--sharkd_session.c3
-rw-r--r--sync_pipe_write.c3
-rw-r--r--tfshark.c11
-rw-r--r--tshark.c21
-rw-r--r--ui/capture.c23
-rw-r--r--ui/cli/tap-expert.c3
-rw-r--r--ui/cli/tap-follow.c9
-rw-r--r--ui/cli/tap-iostat.c9
-rw-r--r--ui/commandline.c5
-rw-r--r--ui/console.c1
-rw-r--r--ui/decode_as_utils.c17
-rw-r--r--ui/dissect_opts.c3
-rw-r--r--ui/filter_files.c7
-rw-r--r--ui/help_url.c3
-rw-r--r--ui/io_graph_item.c7
-rw-r--r--ui/io_graph_item.h3
-rw-r--r--ui/packet_range.c16
-rw-r--r--ui/profile.c5
-rw-r--r--ui/proto_hier_stats.c5
-rw-r--r--ui/qt/follow_stream_dialog.cpp5
-rw-r--r--ui/qt/io_graph_dialog.cpp5
-rw-r--r--ui/qt/main_window.cpp3
-rw-r--r--ui/qt/main_window_layout.cpp8
-rw-r--r--ui/qt/main_window_slots.cpp11
-rw-r--r--ui/qt/models/decode_as_model.cpp7
-rw-r--r--ui/qt/models/uat_delegate.cpp3
-rw-r--r--ui/qt/models/voip_calls_info_model.cpp5
-rw-r--r--ui/qt/packet_range_group_box.cpp5
-rw-r--r--ui/qt/service_response_time_dialog.cpp4
-rw-r--r--ui/voip_calls.c11
-rw-r--r--ui/win32/file_dlg_win32.c13
95 files changed, 679 insertions, 584 deletions
diff --git a/capinfos.c b/capinfos.c
index c0e0f6c29a..c81decd36f 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -83,6 +83,7 @@
#include <wsutil/report_message.h>
#include <wsutil/str_util.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
#include <wsutil/wsgcrypt.h>
@@ -781,7 +782,7 @@ print_stats(const gchar *filename, capture_info *cf_info)
if (cap_file_idb && cf_info->num_interfaces != 0) {
guint i;
- g_assert(cf_info->num_interfaces == cf_info->idb_info_strings->len);
+ ws_assert(cf_info->num_interfaces == cf_info->idb_info_strings->len);
printf ("Number of interfaces in file: %u\n", cf_info->num_interfaces);
for (i = 0; i < cf_info->idb_info_strings->len; i++) {
gchar *s = g_array_index(cf_info->idb_info_strings, gchar*, i);
@@ -1123,7 +1124,7 @@ static void
cleanup_capture_info(capture_info *cf_info)
{
guint i;
- g_assert(cf_info != NULL);
+ ws_assert(cf_info != NULL);
g_free(cf_info->encap_counts);
cf_info->encap_counts = NULL;
@@ -1210,7 +1211,7 @@ process_cap_file(const char *filename, gboolean need_separator)
idb_info = wtap_file_get_idb_info(cf_info.wth);
- g_assert(idb_info->interface_data != NULL);
+ ws_assert(idb_info->interface_data != NULL);
cf_info.num_interfaces = idb_info->interface_data->len;
cf_info.interface_packet_counts = g_array_sized_new(FALSE, TRUE, sizeof(guint32), cf_info.num_interfaces);
diff --git a/capture/capture-wpcap.c b/capture/capture-wpcap.c
index c3d8fdfea4..bbc54db4e8 100644
--- a/capture/capture-wpcap.c
+++ b/capture/capture-wpcap.c
@@ -35,6 +35,7 @@ gboolean has_wpcap = FALSE;
#include "capture/capture-pcap-util-int.h"
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
/* XXX - yes, I know, I should move cppmagic.h to a generic location. */
#include "tools/lemon/cppmagic.h"
@@ -247,7 +248,7 @@ local_code_page_str_to_utf8(char *str)
static void
prepare_errbuf(char *errbuf)
{
- g_assert(errbuf);
+ ws_assert(errbuf);
errbuf[0] = '\0';
}
@@ -283,49 +284,49 @@ cant_load_winpcap_err(const char *app_name)
void
pcap_close(pcap_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
p_pcap_close(a);
}
int
pcap_stats(pcap_t *a, struct pcap_stat *b)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_stats(a, b);
}
int
pcap_dispatch(pcap_t *a, int b, pcap_handler c, guchar *d)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_dispatch(a, b, c, d);
}
int
pcap_snapshot(pcap_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_snapshot(a);
}
int
pcap_datalink(pcap_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_datalink(a);
}
int
pcap_set_datalink(pcap_t *p, int dlt)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_set_datalink(p, dlt);
}
int
pcap_setfilter(pcap_t *a, struct bpf_program *b)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_setfilter(a, b);
}
@@ -333,7 +334,7 @@ char*
pcap_geterr(pcap_t *a)
{
char *errbuf;
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
errbuf = p_pcap_geterr(a);
convert_errbuf_to_utf8(errbuf);
return errbuf;
@@ -343,7 +344,7 @@ int
pcap_compile(pcap_t *a, struct bpf_program *b, const char *c, int d,
bpf_u_int32 e)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_compile(a, b, c, d, e);
}
@@ -351,7 +352,7 @@ int
pcap_compile_nopcap(int a, int b, struct bpf_program *c, const char *d, int e,
bpf_u_int32 f)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_compile_nopcap(a, b, c, d, e, f);
}
@@ -359,7 +360,7 @@ int
pcap_lookupnet(const char *a, bpf_u_int32 *b, bpf_u_int32 *c, char *errbuf)
{
int ret;
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
ret = p_pcap_lookupnet(a, b, c, errbuf);
if (ret == -1)
convert_errbuf_to_utf8(errbuf);
@@ -421,7 +422,7 @@ int
pcap_findalldevs_ex(const char *a, struct pcap_rmtauth *b, pcap_if_t **c, char *errbuf)
{
int ret;
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
ret = p_pcap_findalldevs_ex(a, b, c, errbuf);
if (ret == -1)
convert_errbuf_to_utf8(errbuf);
@@ -433,7 +434,7 @@ pcap_createsrcstr(char *a, int b, const char *c, const char *d, const char *e,
char *errbuf)
{
int ret;
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
ret = p_pcap_createsrcstr(a, b, c, d, e, errbuf);
if (ret == -1)
convert_errbuf_to_utf8(errbuf);
@@ -445,7 +446,7 @@ pcap_createsrcstr(char *a, int b, const char *c, const char *d, const char *e,
struct pcap_samp *
pcap_setsampling(pcap_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_setsampling != NULL) {
return p_pcap_setsampling(a);
}
@@ -456,14 +457,14 @@ pcap_setsampling(pcap_t *a)
int
pcap_loop(pcap_t *a, int b, pcap_handler c, guchar *d)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_loop(a, b, c, d);
}
void
pcap_freecode(struct bpf_program *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
p_pcap_freecode(a);
}
@@ -471,7 +472,7 @@ int
pcap_findalldevs(pcap_if_t **a, char *errbuf)
{
int ret;
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
ret = p_pcap_findalldevs(a, errbuf);
if (ret == -1)
convert_errbuf_to_utf8(errbuf);
@@ -481,7 +482,7 @@ pcap_findalldevs(pcap_if_t **a, char *errbuf)
void
pcap_freealldevs(pcap_if_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
p_pcap_freealldevs(a);
}
@@ -490,7 +491,7 @@ pcap_t *
pcap_create(const char *a, char *errbuf)
{
pcap_t *p;
- g_assert(has_wpcap && p_pcap_create != NULL);
+ ws_assert(has_wpcap && p_pcap_create != NULL);
p = p_pcap_create(a, errbuf);
if (p == NULL)
convert_errbuf_to_utf8(errbuf);
@@ -500,21 +501,21 @@ pcap_create(const char *a, char *errbuf)
int
pcap_set_snaplen(pcap_t *a, int b)
{
- g_assert(has_wpcap && p_pcap_set_snaplen != NULL);
+ ws_assert(has_wpcap && p_pcap_set_snaplen != NULL);
return p_pcap_set_snaplen(a, b);
}
int
pcap_set_promisc(pcap_t *a, int b)
{
- g_assert(has_wpcap && p_pcap_set_promisc != NULL);
+ ws_assert(has_wpcap && p_pcap_set_promisc != NULL);
return p_pcap_set_promisc(a, b);
}
int
pcap_can_set_rfmon(pcap_t *a)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_can_set_rfmon != NULL) {
return p_pcap_can_set_rfmon(a);
}
@@ -524,27 +525,27 @@ pcap_can_set_rfmon(pcap_t *a)
int
pcap_set_rfmon(pcap_t *a, int b)
{
- g_assert(has_wpcap && p_pcap_set_rfmon != NULL);
+ ws_assert(has_wpcap && p_pcap_set_rfmon != NULL);
return p_pcap_set_rfmon(a, b);
}
int
pcap_set_timeout(pcap_t *a, int b)
{
- g_assert(has_wpcap && p_pcap_set_timeout != NULL);
+ ws_assert(has_wpcap && p_pcap_set_timeout != NULL);
return p_pcap_set_timeout(a, b);
}
int
pcap_set_buffer_size(pcap_t *a, int b)
{
- g_assert(has_wpcap && p_pcap_set_buffer_size != NULL);
+ ws_assert(has_wpcap && p_pcap_set_buffer_size != NULL);
return p_pcap_set_buffer_size(a, b);
}
int
pcap_activate(pcap_t *a)
{
- g_assert(has_wpcap && p_pcap_activate != NULL);
+ ws_assert(has_wpcap && p_pcap_activate != NULL);
return p_pcap_activate(a);
}
@@ -554,7 +555,7 @@ pcap_statustostr(int a)
{
static char ebuf[15 + 10 + 1];
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_statustostr != NULL) {
return p_pcap_statustostr(a);
}
@@ -569,7 +570,7 @@ pcap_statustostr(int a)
#ifdef HAVE_PCAP_SET_TSTAMP_TYPE
int
pcap_set_tstamp_type(pcap_t *a, int b) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_set_tstamp_type != NULL) {
return p_pcap_set_tstamp_type(a, b);
}
@@ -578,7 +579,7 @@ pcap_set_tstamp_type(pcap_t *a, int b) {
int
pcap_set_tstamp_precision(pcap_t *a, int b) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_set_tstamp_precision != NULL) {
return p_pcap_set_tstamp_precision(a, b);
}
@@ -588,7 +589,7 @@ pcap_set_tstamp_precision(pcap_t *a, int b) {
int
pcap_get_tstamp_precision(pcap_t *a) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_get_tstamp_precision != NULL) {
return p_pcap_get_tstamp_precision(a);
}
@@ -598,7 +599,7 @@ pcap_get_tstamp_precision(pcap_t *a) {
int
pcap_list_tstamp_types(pcap_t *a, int **b) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_list_tstamp_types != NULL) {
return p_pcap_list_tstamp_types(a, b);
}
@@ -607,7 +608,7 @@ pcap_list_tstamp_types(pcap_t *a, int **b) {
void
pcap_free_tstamp_types(int *a) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_free_tstamp_types != NULL) {
p_pcap_free_tstamp_types(a);
}
@@ -615,7 +616,7 @@ pcap_free_tstamp_types(int *a) {
int
pcap_tstamp_type_name_to_val(const char *a) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_tstamp_type_name_to_val != NULL) {
return p_pcap_tstamp_type_name_to_val(a);
}
@@ -624,7 +625,7 @@ pcap_tstamp_type_name_to_val(const char *a) {
const char *
pcap_tstamp_type_val_to_name(int a) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_tstamp_type_val_to_name != NULL) {
return p_pcap_tstamp_type_val_to_name(a);
}
@@ -633,7 +634,7 @@ pcap_tstamp_type_val_to_name(int a) {
const char *
pcap_tstamp_type_val_to_description(int a) {
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
if (p_pcap_tstamp_type_val_to_description != NULL) {
return p_pcap_tstamp_type_val_to_description(a);
}
@@ -663,7 +664,7 @@ pcap_list_datalinks(pcap_t *p, int **ddlt)
void
pcap_free_datalinks(int *ddlt)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
/*
* If we don't have pcap_free_datalinks() in WinPcap,
@@ -703,7 +704,7 @@ void pcap_breakloop(pcap_t *a)
/* setbuff is win32 specific! */
int pcap_setbuff(pcap_t *a, int b)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_setbuff(a, b);
}
@@ -711,7 +712,7 @@ int pcap_setbuff(pcap_t *a, int b)
/* (if you get a declaration warning here, try to update to at least WinPcap 3.1b4 develpack) */
int pcap_next_ex(pcap_t *a, struct pcap_pkthdr **b, const u_char **c)
{
- g_assert(has_wpcap);
+ ws_assert(has_wpcap);
return p_pcap_next_ex(a, b, c);
}
diff --git a/capture/capture_sync.c b/capture/capture_sync.c
index 2ef8cdaf3a..eca30b5e51 100644
--- a/capture/capture_sync.c
+++ b/capture/capture_sync.c
@@ -22,6 +22,7 @@
#include <wsutil/strtoi.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#ifdef _WIN32
#include <wsutil/unicode-utils.h>
@@ -1515,9 +1516,9 @@ sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max) {
/* convert header values (indicator and 3-byte length) */
static void
-pipe_convert_header(const guchar *header, int header_len, char *indicator, int *block_len) {
+pipe_convert_header(const guchar *header, int header_len _U_, char *indicator, int *block_len) {
- g_assert(header_len == 4);
+ ws_assert(header_len == 4);
/* convert header values */
*indicator = header[0];
@@ -1742,7 +1743,7 @@ sync_pipe_input_cb(gint source, gpointer user_data)
break;
}
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return TRUE;
@@ -1772,7 +1773,7 @@ sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp)
start_time = g_get_monotonic_time();
ws_debug("wait till child closed");
- g_assert(fork_child != WS_INVALID_PID);
+ ws_assert(fork_child != WS_INVALID_PID);
*msgp = NULL; /* assume no error */
#ifdef _WIN32
diff --git a/capture_opts.c b/capture_opts.c
index 13eb70c3b3..e4ce3e1bfb 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -29,6 +29,7 @@
#include <ui/exit_codes.h>
#include <wsutil/file_util.h>
#include <wsutil/ws_pipe.h>
+#include <wsutil/ws_assert.h>
#include "capture/capture_ifinfo.h"
#include "capture/capture-pcap-util.h"
@@ -997,7 +998,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
break;
default:
/* the caller is responsible to send us only the right opt's */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return 0;
diff --git a/dumpcap.c b/dumpcap.c
index b3945f841d..539ed003de 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -88,6 +88,7 @@
#include "wsutil/time_util.h"
#include "wsutil/please_report_bug.h"
#include "wsutil/glib-compat.h"
+#include <wsutil/ws_assert.h>
#include "capture/ws80211_utils.h"
@@ -2134,7 +2135,7 @@ pcapng_adjust_block(capture_src *pcap_src, const pcapng_block_header_t *bh, u_ch
for (unsigned i = 0; i < pcap_src->cap_pipe_info.pcapng.src_iface_to_global->len; i++) {
guint32 iface_id = g_array_index(pcap_src->cap_pipe_info.pcapng.src_iface_to_global, guint32, i);
saved_idb_t *idb_source = &g_array_index(global_ld.saved_idbs, saved_idb_t, iface_id);
- g_assert(idb_source->interface_id == pcap_src->interface_id);
+ ws_assert(idb_source->interface_id == pcap_src->interface_id);
g_free(idb_source->idb);
memset(idb_source, 0, sizeof(saved_idb_t));
idb_source->deleted = TRUE;
@@ -3361,7 +3362,7 @@ capture_loop_dispatch(loop_data *ld,
if (inpkts < 0) {
ws_debug("%s: src %u pipe reached EOF or err, rcv: %u drop: %u flush: %u",
G_STRFUNC, pcap_src->interface_id, pcap_src->received, pcap_src->dropped, pcap_src->flushed);
- g_assert(pcap_src->cap_pipe_err != PIPOK);
+ ws_assert(pcap_src->cap_pipe_err != PIPOK);
}
}
}
@@ -4346,7 +4347,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
received = pcap_src->received;
if (pcap_src->pcap_h != NULL) {
- g_assert(!pcap_src->from_cap_pipe);
+ ws_assert(!pcap_src->from_cap_pipe);
/* Get the capture statistics, so we know how many packets were dropped. */
if (pcap_stats(pcap_src->pcap_h, stats) >= 0) {
*stats_known = TRUE;
@@ -4511,7 +4512,7 @@ capture_loop_write_pcapng_cb(capture_src *pcap_src, const pcapng_block_header_t
/*
* This should never be called if we're not writing pcapng.
*/
- g_assert(global_capture_opts.use_pcapng);
+ ws_assert(global_capture_opts.use_pcapng);
/* We may be called multiple times from pcap_dispatch(); if we've set
the "stop capturing" flag, ignore this packet, as we're not
@@ -4523,7 +4524,7 @@ capture_loop_write_pcapng_cb(capture_src *pcap_src, const pcapng_block_header_t
if (!pcapng_adjust_block(pcap_src, bh, pd)) {
ws_info("%s failed to adjust pcapng block.", G_STRFUNC);
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
diff --git a/editcap.c b/editcap.c
index 4f0df54118..90a39e0b1e 100644
--- a/editcap.c
+++ b/editcap.c
@@ -83,6 +83,7 @@
#include <version_info.h>
#include <wsutil/pint.h>
#include <wsutil/strtoi.h>
+#include <wsutil/ws_assert.h>
#include <wiretap/wtap_opttypes.h>
#include "ui/failure_message.h"
@@ -1731,7 +1732,7 @@ main(int argc, char *argv[])
} else {
filename = g_strdup(argv[optind+1]);
}
- g_assert(filename);
+ ws_assert(filename);
/* If we don't have an application name add one */
if (wtap_block_get_string_option_value(g_array_index(params.shb_hdrs, wtap_block_t, 0), OPT_SHB_USERAPPL, &shb_user_appl) != WTAP_OPTTYPE_SUCCESS) {
@@ -1785,7 +1786,7 @@ main(int argc, char *argv[])
nstime_add(&block_next, &secs_per_block); /* reset for next interval */
g_free(filename);
filename = fileset_get_filename_by_pattern(block_cnt++, rec, fprefix, fsuffix);
- g_assert(filename);
+ ws_assert(filename);
if (verbose)
fprintf(stderr, "Continuing writing in file %s\n", filename);
@@ -1817,7 +1818,7 @@ main(int argc, char *argv[])
g_free(filename);
filename = fileset_get_filename_by_pattern(block_cnt++, rec, fprefix, fsuffix);
- g_assert(filename);
+ ws_assert(filename);
if (verbose)
fprintf(stderr, "Continuing writing in file %s\n", filename);
diff --git a/epan/addr_and_mask.c b/epan/addr_and_mask.c
index d40e611643..b776d85a87 100644
--- a/epan/addr_and_mask.c
+++ b/epan/addr_and_mask.c
@@ -17,6 +17,7 @@
#include "tvbuff.h"
#include "ipv6.h"
#include "addr_and_mask.h"
+#include <wsutil/ws_assert.h>
guint32
ip_get_subnet_mask(const guint32 mask_length)
@@ -33,7 +34,7 @@ ip_get_subnet_mask(const guint32 mask_length)
0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff,
};
- g_assert(mask_length <= 32);
+ ws_assert(mask_length <= 32);
return masks[mask_length];
}
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index f460e8445e..b46a7daf51 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <wsutil/strtoi.h>
+#include <wsutil/ws_assert.h>
/*
* Win32 doesn't have SIGALRM (and it's the OS where name lookup calls
@@ -818,7 +819,7 @@ static void
initialize_services(void)
{
gboolean parse_file = TRUE;
- g_assert(serv_port_hashtable == NULL);
+ ws_assert(serv_port_hashtable == NULL);
serv_port_hashtable = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
/* Compute the pathname of the services file. */
@@ -906,7 +907,7 @@ parse_enterprises_file(const char * path)
static void
initialize_enterprises(void)
{
- g_assert(enterprises_hashtable == NULL);
+ ws_assert(enterprises_hashtable == NULL);
enterprises_hashtable = g_hash_table_new_full(NULL, NULL, NULL, g_free);
if (g_enterprises_path == NULL) {
@@ -957,10 +958,10 @@ enterprises_base_custom(char *buf, guint32 value)
static void
enterprises_cleanup(void)
{
- g_assert(enterprises_hashtable);
+ ws_assert(enterprises_hashtable);
g_hash_table_destroy(enterprises_hashtable);
enterprises_hashtable = NULL;
- g_assert(g_enterprises_path);
+ ws_assert(g_enterprises_path);
g_free(g_enterprises_path);
g_enterprises_path = NULL;
g_free(g_penterprises_path);
@@ -1870,7 +1871,7 @@ eth_addr_resolve(hashether_t *tp) {
tp->status = HASHETHER_STATUS_RESOLVED_DUMMY;
return tp;
}
- g_assert_not_reached();
+ ws_assert_not_reached();
} /* eth_addr_resolve */
static hashether_t *
@@ -2208,7 +2209,7 @@ get_vlannamebyid(guint16 id)
static void
initialize_vlans(void)
{
- g_assert(vlan_hash_table == NULL);
+ ws_assert(vlan_hash_table == NULL);
vlan_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
/* Set g_pvlan_path here, but don't actually do anything
@@ -2534,7 +2535,7 @@ subnet_lookup(const guint32 addr)
/* Note that we run from 31 (length 32) to 0 (length 1) */
--i;
- g_assert(i < SUBNETLENGTHSIZE);
+ ws_assert(i < SUBNETLENGTHSIZE);
length_entry = &subnet_length_entries[i];
@@ -2578,7 +2579,7 @@ subnet_entry_set(guint32 subnet_addr, const guint8 mask_length, const gchar* nam
sub_net_hashipv4_t * tp;
gsize hash_idx;
- g_assert(mask_length > 0 && mask_length <= 32);
+ ws_assert(mask_length > 0 && mask_length <= 32);
entry = &subnet_length_entries[mask_length - 1];
@@ -2779,7 +2780,7 @@ ss7pc_name_lookup_init(void)
{
char *ss7pcspath;
- g_assert(ss7pc_hash_table == NULL);
+ ws_assert(ss7pc_hash_table == NULL);
ss7pc_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
@@ -3100,16 +3101,16 @@ host_name_lookup_init(void)
char *hostspath;
guint i;
- g_assert(ipxnet_hash_table == NULL);
+ ws_assert(ipxnet_hash_table == NULL);
ipxnet_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
- g_assert(ipv4_hash_table == NULL);
+ ws_assert(ipv4_hash_table == NULL);
ipv4_hash_table = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal);
- g_assert(ipv6_hash_table == NULL);
+ ws_assert(ipv6_hash_table == NULL);
ipv6_hash_table = wmem_map_new(wmem_epan_scope(), ipv6_oat_hash, ipv6_equal);
- g_assert(async_dns_queue_head == NULL);
+ ws_assert(async_dns_queue_head == NULL);
async_dns_queue_head = wmem_list_new(wmem_epan_scope());
if (manually_resolved_ipv4_list == NULL)
@@ -3266,7 +3267,7 @@ port_with_resolution_to_str(wmem_allocator_t *scope, port_type proto, guint port
return wmem_strdup_printf(scope, "%u", port);
}
port_str = serv_name_lookup(proto, port);
- g_assert(port_str);
+ ws_assert(port_str);
return wmem_strdup_printf(scope, "%s (%u)", port_str, port);
}
@@ -3280,7 +3281,7 @@ port_with_resolution_to_str_buf(gchar *buf, gulong buf_size, port_type proto, gu
return g_snprintf(buf, buf_size, "%u", port);
}
port_str = serv_name_lookup(proto, port);
- g_assert(port_str);
+ ws_assert(port_str);
return g_snprintf(buf, buf_size, "%s (%u)", port_str, port);
}
diff --git a/epan/address.h b/epan/address.h
index 4e3e580393..a162be0e38 100644
--- a/epan/address.h
+++ b/epan/address.h
@@ -16,6 +16,7 @@
#include "tvbuff.h"
#include "wmem/wmem.h"
+#include <wsutil/ws_assert.h>
#ifdef __cplusplus
extern "C" {
@@ -78,12 +79,12 @@ static inline void
set_address(address *addr, int addr_type, int addr_len, const void *addr_data) {
if (addr_len == 0) {
/* Zero length must mean no data */
- g_assert(addr_data == NULL);
+ ws_assert(addr_data == NULL);
} else {
/* Must not be AT_NONE - AT_NONE must have no data */
- g_assert(addr_type != AT_NONE);
+ ws_assert(addr_type != AT_NONE);
/* Make sure we *do* have data */
- g_assert(addr_data != NULL);
+ ws_assert(addr_data != NULL);
}
addr->type = addr_type;
addr->len = addr_len;
@@ -112,7 +113,7 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o
if (addr_len != 0) {
/* Must not be AT_NONE - AT_NONE must have no data */
- g_assert(addr_type != AT_NONE);
+ ws_assert(addr_type != AT_NONE);
p = tvb_get_ptr(tvb, offset, addr_len);
} else
p = NULL;
@@ -132,19 +133,19 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o
static inline void
alloc_address_wmem(wmem_allocator_t *scope, address *addr,
int addr_type, int addr_len, const void *addr_data) {
- g_assert(addr);
+ ws_assert(addr);
clear_address(addr);
addr->type = addr_type;
if (addr_len == 0) {
/* Zero length must mean no data */
- g_assert(addr_data == NULL);
+ ws_assert(addr_data == NULL);
/* Nothing to copy */
return;
}
/* Must not be AT_NONE - AT_NONE must have no data */
- g_assert(addr_type != AT_NONE);
+ ws_assert(addr_type != AT_NONE);
/* Make sure we *do* have data to copy */
- g_assert(addr_data != NULL);
+ ws_assert(addr_data != NULL);
addr->data = addr->priv = wmem_memdup(scope, addr_data, addr_len);
addr->len = addr_len;
}
@@ -287,7 +288,7 @@ free_address_wmem(wmem_allocator_t *scope, address *addr) {
if (addr->type != AT_NONE && addr->len > 0 && addr->priv != NULL) {
/* Make sure API use is correct */
/* if priv is not null then data == priv */
- g_assert(addr->data == addr->priv);
+ ws_assert(addr->data == addr->priv);
wmem_free(scope, addr->priv);
}
clear_address(addr);
diff --git a/epan/address_types.c b/epan/address_types.c
index c58dd9209d..cb807bfeef 100644
--- a/epan/address_types.c
+++ b/epan/address_types.c
@@ -18,6 +18,7 @@
#include "wsutil/pint.h"
#include "wsutil/str_util.h"
#include "wsutil/inet_addr.h"
+#include <wsutil/ws_assert.h>
struct _address_type_t {
int addr_type; /* From address_type enumeration or registered value */
@@ -54,18 +55,18 @@ static address_type_t* type_list[MAX_ADDR_TYPE_VALUE + 1];
static void address_type_register(int addr_type, address_type_t *at)
{
/* Check input */
- g_assert(addr_type < MAX_ADDR_TYPE_VALUE);
- g_assert(addr_type == at->addr_type);
+ ws_assert(addr_type < MAX_ADDR_TYPE_VALUE);
+ ws_assert(addr_type == at->addr_type);
/* Don't re-register. */
- g_assert(type_list[addr_type] == NULL);
+ ws_assert(type_list[addr_type] == NULL);
/* Sanity check */
- g_assert(at->name);
- g_assert(at->pretty_name);
- g_assert(at->addr_to_str);
- g_assert(at->addr_str_len);
- g_assert(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) ||
+ ws_assert(at->name);
+ ws_assert(at->pretty_name);
+ ws_assert(at->addr_to_str);
+ ws_assert(at->addr_str_len);
+ ws_assert(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) ||
((at->addr_name_res_str == NULL) && (at->addr_name_res_len == NULL)));
type_list[addr_type] = at;
@@ -79,16 +80,16 @@ int address_type_dissector_register(const char* name, const char* pretty_name,
int addr_type;
/* Ensure valid data/functions for required fields */
- g_assert(name);
- g_assert(pretty_name);
- g_assert(to_str_func);
- g_assert(str_len_func);
+ ws_assert(name);
+ ws_assert(pretty_name);
+ ws_assert(to_str_func);
+ ws_assert(str_len_func);
/* Either have both or neither */
- g_assert(((name_res_str_func != NULL) && (name_res_len_func != NULL)) ||
+ ws_assert(((name_res_str_func != NULL) && (name_res_len_func != NULL)) ||
((name_res_str_func == NULL) && (name_res_len_func == NULL)));
/* This shouldn't happen, so flag it for fixing */
- g_assert(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE);
+ ws_assert(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE);
addr_type = AT_END_OF_LIST+num_dissector_addr_type;
dissector_type_addresses[num_dissector_addr_type].addr_type = addr_type;
@@ -699,7 +700,7 @@ void address_types_initialize(void)
/* Given an address type id, return an address_type_t* */
#define ADDR_TYPE_LOOKUP(addr_type, result) \
/* Check input */ \
- g_assert(addr_type < MAX_ADDR_TYPE_VALUE); \
+ ws_assert(addr_type < MAX_ADDR_TYPE_VALUE); \
result = type_list[addr_type];
static int address_type_get_length(const address* addr)
@@ -938,7 +939,7 @@ tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int type, const gint
/* For variable length fields, use tvb_address_var_to_str() */
if (at->addr_fixed_len == NULL)
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return NULL;
}
@@ -973,7 +974,7 @@ tvb_address_with_resolution_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int t
/* For variable length fields, use tvb_address_var_with_resolution_to_str() */
if (at->addr_fixed_len == NULL)
{
- g_assert_not_reached();
+ ws_assert_not_reached();
return NULL;
}
diff --git a/epan/capture_dissectors.c b/epan/capture_dissectors.c
index 124efaccf9..406de69ddc 100644
--- a/epan/capture_dissectors.c
+++ b/epan/capture_dissectors.c
@@ -17,6 +17,7 @@
#include "packet.h"
#include "capture_dissectors.h"
+#include <wsutil/ws_assert.h>
#include <wsutil/wslog.h>
@@ -107,7 +108,7 @@ capture_dissector_handle_t register_capture_dissector(const char *name, capture_
capture_dissector_handle_t handle;
/* Make sure the registration is unique */
- g_assert(g_hash_table_lookup(registered_dissectors, name) == NULL);
+ ws_assert(g_hash_table_lookup(registered_dissectors, name) == NULL);
handle = new_capture_dissector_handle(dissector, proto, name);
g_hash_table_insert(registered_dissectors, (gpointer)name, handle);
@@ -131,7 +132,7 @@ void capture_dissector_add_uint(const char *name, const guint32 pattern, capture
}
/* Make sure the registration is unique */
- g_assert(g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern)) == NULL);
+ ws_assert(g_hash_table_lookup(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern)) == NULL);
g_hash_table_insert(sub_dissectors->hash_table, GUINT_TO_POINTER(pattern), (gpointer) handle);
}
diff --git a/epan/color_filters.c b/epan/color_filters.c
index 29ddcb6b62..67c62415dc 100644
--- a/epan/color_filters.c
+++ b/epan/color_filters.c
@@ -23,6 +23,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <epan/packet.h>
#include "color_filters.h"
@@ -84,8 +85,8 @@ color_filters_add_tmp(GSList **cfl)
color_t bg_color, fg_color;
color_filter_t *colorf;
- g_assert(strlen(prefs.gui_colorized_fg)==69);
- g_assert(strlen(prefs.gui_colorized_bg)==69);
+ ws_assert(strlen(prefs.gui_colorized_fg)==69);
+ ws_assert(strlen(prefs.gui_colorized_bg)==69);
fg_colors = g_strsplit(prefs.gui_colorized_fg, ",", -1);
bg_colors = g_strsplit(prefs.gui_colorized_bg, ",", -1);
@@ -406,7 +407,7 @@ color_filter_compile_cb(gpointer filter_arg, gpointer err)
gchar **err_msg = (gchar**)err;
gchar *local_err_msg = NULL;
- g_assert(colorf->c_colorfilter == NULL);
+ ws_assert(colorf->c_colorfilter == NULL);
/* If the filter is disabled it doesn't matter if it compiles or not. */
if (colorf->disabled) return;
@@ -417,7 +418,7 @@ color_filter_compile_cb(gpointer filter_arg, gpointer err)
g_free(local_err_msg);
/* this filter was compilable before, so this should never happen */
/* except if the OK button of the parent window has been clicked */
- /* so don't use g_assert_not_reached() but check the filters again */
+ /* so don't use ws_assert_not_reached() but check the filters again */
}
}
@@ -428,7 +429,7 @@ color_filter_validate_cb(gpointer filter_arg, gpointer err)
gchar **err_msg = (gchar**)err;
gchar *local_err_msg;
- g_assert(colorf->c_colorfilter == NULL);
+ ws_assert(colorf->c_colorfilter == NULL);
/* If the filter is disabled it doesn't matter if it compiles or not. */
if (colorf->disabled) return;
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 385a243913..3dc5568972 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -33,6 +33,7 @@
#include <epan/dfilter/dfilter.h>
#include <wsutil/utf8_entities.h>
+#include <wsutil/ws_assert.h>
#ifdef HAVE_LUA
#include <epan/wslua/wslua.h>
@@ -912,7 +913,7 @@ set_abs_ymd_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -980,7 +981,7 @@ set_abs_ymd_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean
fd->abs_ts.nsecs);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
buf[0] = '\0';
@@ -1046,7 +1047,7 @@ set_abs_ydoy_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolea
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -1108,7 +1109,7 @@ set_abs_ydoy_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolea
fd->abs_ts.nsecs);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
buf[0] = '\0';
@@ -1163,7 +1164,7 @@ set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf)
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -1191,7 +1192,7 @@ set_time_seconds(const frame_data *fd, const nstime_t *ts, gchar *buf)
(gint64) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1235,7 +1236,7 @@ set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf, char
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -1377,7 +1378,7 @@ set_time_hour_min_sec(const frame_data *fd, const nstime_t *ts, gchar *buf, char
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1405,7 +1406,7 @@ col_set_rel_time(const frame_data *fd, column_info *cinfo, const int col)
set_time_seconds(fd, &del_rel_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
}
@@ -1429,7 +1430,7 @@ col_set_delta_time(const frame_data *fd, column_info *cinfo, const int col)
set_time_seconds(fd, &del_cap_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
@@ -1459,7 +1460,7 @@ col_set_delta_time_dis(const frame_data *fd, column_info *cinfo, const int col)
set_time_seconds(fd, &del_dis_ts, cinfo->col_expr.col_expr_val[col]);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
cinfo->columns[col].col_data = cinfo->columns[col].col_buf;
@@ -1504,7 +1505,7 @@ set_abs_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean loc
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -1554,7 +1555,7 @@ set_abs_time(const frame_data *fd, gchar *buf, char *decimal_point, gboolean loc
fd->abs_ts.nsecs);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
@@ -1614,7 +1615,7 @@ set_epoch_time(const frame_data *fd, gchar *buf)
tsprecision = fd->tsprec;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch (tsprecision) {
case WTAP_TSPREC_SEC:
@@ -1642,7 +1643,7 @@ set_epoch_time(const frame_data *fd, gchar *buf)
fd->abs_ts.secs, fd->abs_ts.nsecs, TO_STR_TIME_RES_T_NSECS);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return TRUE;
}
@@ -1688,7 +1689,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf)
set_time_seconds(fd, &del_rel_ts, buf);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
buf[0] = '\0';
@@ -1709,7 +1710,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf)
set_time_hour_min_sec(fd, &del_cap_ts, buf, col_decimal_point);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
buf[0] = '\0';
@@ -1730,7 +1731,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf)
set_time_hour_min_sec(fd, &del_dis_ts, buf, col_decimal_point);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
buf[0] = '\0';
@@ -1755,7 +1756,7 @@ set_fd_time(const epan_t *epan, frame_data *fd, gchar *buf)
case TS_NOT_SET:
/* code is missing for this case, but I don't know which [jmayer20051219] */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -1806,7 +1807,7 @@ col_set_cls_time(const frame_data *fd, column_info *cinfo, const gint col)
case TS_NOT_SET:
/* code is missing for this case, but I don't know which [jmayer20051219] */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -1859,7 +1860,7 @@ col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -1918,7 +1919,7 @@ col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char *
(gint64) ts->secs, ts->nsecs, TO_STR_TIME_RES_T_NSECS);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
col_item->col_data = col_item->col_buf;
cinfo->col_expr.col_expr[col] = fieldname;
@@ -2049,8 +2050,8 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
gboolean
col_based_on_frame_data(column_info *cinfo, const gint col)
{
- g_assert(cinfo);
- g_assert(col < cinfo->num_cols);
+ ws_assert(cinfo);
+ ws_assert(col < cinfo->num_cols);
switch (cinfo->columns[col].col_fmt) {
case COL_NUMBER:
@@ -2236,11 +2237,11 @@ col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fi
break;
case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
default:
if (col_item->col_fmt >= NUM_COL_FMTS) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/*
* Formatting handled by col_custom_set_edt() (COL_CUSTOM), expert.c
@@ -2276,7 +2277,7 @@ col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col
col_item->col_data = "Read error";
} else {
if (col_item->col_fmt >= NUM_COL_FMTS) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/*
* No dissection was done, and these columns are set as the
diff --git a/epan/column.c b/epan/column.c
index e8b91b37d6..e098facecf 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -23,6 +23,7 @@
#include <epan/dfilter/dfilter.h>
#include <epan/column.h>
#include <epan/packet.h>
+#include <wsutil/ws_assert.h>
/* Given a format number (as defined in column-utils.h), returns its equivalent
string */
@@ -171,7 +172,7 @@ col_format_desc(const gint fmt_num) {
};
const gchar *val_str = try_val_to_str(fmt_num, dlist_vals);
- g_assert(val_str != NULL);
+ ws_assert(val_str != NULL);
return val_str;
}
@@ -294,7 +295,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
return "0000-00-00 00:00:00.000000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case(TS_ABSOLUTE_WITH_YDOY):
@@ -320,7 +321,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
return "0000/000 00:00:00.000000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case(TS_ABSOLUTE):
@@ -346,7 +347,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
return "00:00:00.000000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case(TS_RELATIVE): /* fallthrough */
@@ -373,7 +374,7 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
return "0000.000000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case(TS_EPOCH):
@@ -399,14 +400,14 @@ get_timestamp_column_longest_string(const gint type, const gint precision)
return "0000000000000000000.000000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case(TS_NOT_SET):
return "0000.000000";
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* never reached, satisfy compiler */
diff --git a/epan/decode_as.c b/epan/decode_as.c
index 8a52a8f88a..df6457b5ee 100644
--- a/epan/decode_as.c
+++ b/epan/decode_as.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <wsutil/ws_assert.h>
GList *decode_as_list = NULL;
@@ -30,9 +31,9 @@ void register_decode_as(decode_as_t* reg)
dissector_table_t decode_table;
/* Ensure valid functions */
- g_assert(reg->populate_list);
- g_assert(reg->reset_value);
- g_assert(reg->change_value);
+ ws_assert(reg->populate_list);
+ ws_assert(reg->reset_value);
+ ws_assert(reg->change_value);
decode_table = find_dissector_table(reg->table_name);
if (decode_table != NULL)
@@ -368,7 +369,7 @@ decode_as_write_entry (const gchar *table_name, ftenum_t selector_type,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -478,7 +479,7 @@ decode_build_reset_list (const gchar *table_name, ftenum_t selector_type,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
dissector_reset_list = g_slist_prepend(dissector_reset_list, item);
}
@@ -519,7 +520,7 @@ decode_clear_all(void)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
g_free(item->ddi_table_name);
g_free(item);
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c
index e9c80c2a60..641d0ff7ed 100644
--- a/epan/dfilter/dfilter.c
+++ b/epan/dfilter/dfilter.c
@@ -22,6 +22,7 @@
#include "dfilter-macro.h"
#include "scanner_lex.h"
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#define DFILTER_TOKEN_ID_OFFSET 1
@@ -212,7 +213,7 @@ dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg)
/* XXX, GHashTable */
GPtrArray *deprecated;
- g_assert(dfp);
+ ws_assert(dfp);
if (!text) {
*dfp = NULL;
diff --git a/epan/dfilter/dfunctions.c b/epan/dfilter/dfunctions.c
index 076c049f7b..c38727ea73 100644
--- a/epan/dfilter/dfunctions.c
+++ b/epan/dfilter/dfunctions.c
@@ -18,6 +18,7 @@
#include <ftypes/ftypes-int.h>
#include <ftypes/ftypes.h>
#include <epan/exceptions.h>
+#include <wsutil/ws_assert.h>
/* Convert an FT_STRING using a callback function */
static gboolean
@@ -191,7 +192,7 @@ ul_semcheck_params(dfwork_t *dfw, int param_num, stnode_t *st_node)
}
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -213,7 +214,7 @@ ul_semcheck_len_params(dfwork_t *dfw, int param_num, stnode_t *st_node)
}
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -234,7 +235,7 @@ ul_semcheck_field_param(dfwork_t *dfw, int param_num, stnode_t *st_node)
}
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -300,7 +301,7 @@ ul_semcheck_string_param(dfwork_t *dfw, int param_num, stnode_t *st_node)
}
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
diff --git a/epan/dfilter/dfvm.c b/epan/dfilter/dfvm.c
index e944478d3a..42f29e0150 100644
--- a/epan/dfilter/dfvm.c
+++ b/epan/dfilter/dfvm.c
@@ -11,6 +11,7 @@
#include "dfvm.h"
#include <ftypes/ftypes-int.h>
+#include <wsutil/ws_assert.h>
dfvm_insn_t*
dfvm_insn_new(dfvm_opcode_t op)
@@ -133,7 +134,7 @@ dfvm_dump(FILE *f, dfilter_t *df)
case IF_TRUE_GOTO:
case IF_FALSE_GOTO:
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -175,7 +176,7 @@ dfvm_dump(FILE *f, dfilter_t *df)
case PUT_FVALUE:
/* We already dumped these */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
case PUT_PCRE:
@@ -292,7 +293,7 @@ dfvm_dump(FILE *f, dfilter_t *df)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -429,8 +430,8 @@ any_in_range(dfilter_t *df, int reg1, int reg2, int reg3)
* the list length MUST be one. This should have been enforced by
* grammar.lemon.
*/
- g_assert(list_low && !g_list_next(list_low));
- g_assert(list_high && !g_list_next(list_high));
+ ws_assert(list_low && !g_list_next(list_low));
+ ws_assert(list_high && !g_list_next(list_high));
low = (fvalue_t *)list_low->data;
high = (fvalue_t *)list_high->data;
@@ -490,7 +491,7 @@ mk_range(dfilter_t *df, int from_reg, int to_reg, drange_t *d_range)
/* Assert here because semcheck.c should have
* already caught the cases in which a slice
* cannot be made. */
- g_assert(new_fv);
+ ws_assert(new_fv);
to_list = g_list_append(to_list, new_fv);
from_list = g_list_next(from_list);
@@ -516,7 +517,7 @@ dfvm_apply(dfilter_t *df, proto_tree *tree)
GList *param1;
GList *param2;
- g_assert(tree);
+ ws_assert(tree);
length = df->insns->len;
@@ -662,12 +663,12 @@ dfvm_apply(dfilter_t *df, proto_tree *tree)
#endif
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE; /* to appease the compiler */
}
@@ -715,7 +716,7 @@ dfvm_init_const(dfilter_t *df)
case IF_TRUE_GOTO:
case IF_FALSE_GOTO:
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
diff --git a/epan/dfilter/drange.c b/epan/dfilter/drange.c
index 4efae86d7d..15b1ac224e 100644
--- a/epan/dfilter/drange.c
+++ b/epan/dfilter/drange.c
@@ -12,6 +12,7 @@
#include "config.h"
#include "drange.h"
+#include <wsutil/ws_assert.h>
/* drange_node constructor */
drange_node*
@@ -54,28 +55,28 @@ drange_node_free(drange_node* drnode)
gint
drange_node_get_start_offset(drange_node* drnode)
{
- g_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED);
+ ws_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED);
return drnode->start_offset;
}
gint
drange_node_get_length(drange_node* drnode)
{
- g_assert(drnode->ending == DRANGE_NODE_END_T_LENGTH);
+ ws_assert(drnode->ending == DRANGE_NODE_END_T_LENGTH);
return drnode->length;
}
gint
drange_node_get_end_offset(drange_node* drnode)
{
- g_assert(drnode->ending == DRANGE_NODE_END_T_OFFSET);
+ ws_assert(drnode->ending == DRANGE_NODE_END_T_OFFSET);
return drnode->end_offset;
}
drange_node_end_t
drange_node_get_ending(drange_node* drnode)
{
- g_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED);
+ ws_assert(drnode->ending != DRANGE_NODE_END_T_UNINITIALIZED);
return drnode->ending;
}
diff --git a/epan/dfilter/gencode.c b/epan/dfilter/gencode.c
index cfd22c920a..28cb573104 100644
--- a/epan/dfilter/gencode.c
+++ b/epan/dfilter/gencode.c
@@ -17,6 +17,7 @@
#include "sttype-set.h"
#include "sttype-function.h"
#include "ftypes/ftypes.h"
+#include <wsutil/ws_assert.h>
static void
gencode(dfwork_t *dfw, stnode_t *st_node);
@@ -198,7 +199,7 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp)
insn->arg4 = val;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
params = params->next;
@@ -221,7 +222,7 @@ dfw_append_function(dfwork_t *dfw, stnode_t *node, dfvm_value_t **p_jmp)
/* We need another instruction to jump to another exit
* place, if the call() of our function failed for some reaosn */
insn = dfvm_insn_new(IF_FALSE_GOTO);
- g_assert(p_jmp);
+ ws_assert(p_jmp);
*p_jmp = dfvm_value_new(INSN_NUMBER);
insn->arg1 = *p_jmp;
dfw_append_insn(dfw, insn);
@@ -411,7 +412,7 @@ gen_entity(dfwork_t *dfw, stnode_t *st_arg, dfvm_value_t **p_jmp)
reg = dfw_append_read_tree(dfw, hfinfo);
insn = dfvm_insn_new(IF_FALSE_GOTO);
- g_assert(p_jmp);
+ ws_assert(p_jmp);
*p_jmp = dfvm_value_new(INSN_NUMBER);
insn->arg1 = *p_jmp;
dfw_append_insn(dfw, insn);
@@ -430,7 +431,7 @@ gen_entity(dfwork_t *dfw, stnode_t *st_arg, dfvm_value_t **p_jmp)
}
else {
/* printf("sttype_id is %u\n", (unsigned)e_type); */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return reg;
}
@@ -450,7 +451,7 @@ gen_test(dfwork_t *dfw, stnode_t *st_node)
switch (st_op) {
case TEST_OP_UNINITIALIZED:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
case TEST_OP_EXISTS:
@@ -560,7 +561,7 @@ gencode(dfwork_t *dfw, stnode_t *st_node)
gen_test(dfw, st_node);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon
index 4ea3a2b673..13a9ca5e94 100644
--- a/epan/dfilter/grammar.lemon
+++ b/epan/dfilter/grammar.lemon
@@ -119,7 +119,7 @@ any "error" symbols are shifted, if possible. */
case STTYPE_RANGE:
case STTYPE_FVALUE:
case STTYPE_PCRE:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
dfw->syntax_error = TRUE;
@@ -280,7 +280,7 @@ relation_test(T) ::= entity(E) rel_op2(O) relation_test(R).
F = R;
do {
- g_assert(F != NULL && stnode_type_id(F) == STTYPE_TEST);
+ ws_assert(F != NULL && stnode_type_id(F) == STTYPE_TEST);
sttype_test_get(F, NULL, &F, NULL);
} while (stnode_type_id(F) == STTYPE_TEST);
diff --git a/epan/dfilter/scanner.l b/epan/dfilter/scanner.l
index d10204d5eb..672e178c14 100644
--- a/epan/dfilter/scanner.l
+++ b/epan/dfilter/scanner.l
@@ -474,7 +474,7 @@ simple(int token)
case TOKEN_TEST_IN:
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return token;
}
@@ -501,7 +501,7 @@ set_lval(int token, gpointer data)
type_id = STTYPE_FUNCTION;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
stnode_init(df_lval, type_id, data);
return token;
@@ -522,7 +522,7 @@ set_lval_int(dfwork_t *dfw, int token, char *s)
type_id = STTYPE_INTEGER;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
stnode_init_int(df_lval, type_id, val);
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index 6245f7fd1f..bc357cb493 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -21,6 +21,8 @@
#include <epan/exceptions.h>
#include <epan/packet.h>
+#include <wsutil/ws_assert.h>
+
#include <ftypes/ftypes-int.h>
/* Enable debug logging by defining AM_CFLAGS
@@ -130,10 +132,10 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
}
case FT_NUM_TYPES:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
@@ -242,7 +244,7 @@ mk_fvalue_from_val_string(dfwork_t *dfw, header_field_info *hfinfo, char *s)
break;
case FT_NUM_TYPES:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* TRUE/FALSE *always* exist for FT_BOOLEAN. */
@@ -381,10 +383,10 @@ is_bytes_type(enum ftenum type)
return FALSE;
case FT_NUM_TYPES:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
@@ -476,7 +478,7 @@ check_exists(dfwork_t *dfw, stnode_t *st_arg1)
case STTYPE_SET:
case STTYPE_PCRE:
case STTYPE_NUM_TYPES:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -571,7 +573,7 @@ check_drange_node_sanity(gpointer data, gpointer user_data)
case DRANGE_NODE_END_T_UNINITIALIZED:
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -810,7 +812,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string,
GSList *nodelist;
/* A set should only ever appear on RHS of 'in' operation */
if (strcmp(relation_string, "in") != 0) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* Attempt to interpret one element of the set at a time. Each
* element is represented by two items in the list, the element
@@ -827,7 +829,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string,
}
nodelist = g_slist_next(nodelist);
- g_assert(nodelist);
+ ws_assert(nodelist);
stnode_t *node_right = (stnode_t *)nodelist->data;
if (node_right) {
/* range type, check if comparison is possible. */
@@ -849,7 +851,7 @@ check_relation_LHS_FIELD(dfwork_t *dfw, const char *relation_string,
}
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -943,7 +945,7 @@ check_relation_LHS_STRING(dfwork_t *dfw, const char* relation_string,
THROW(TypeError);
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1037,7 +1039,7 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, const char* relation_string,
THROW(TypeError);
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1240,7 +1242,7 @@ check_relation_LHS_RANGE(dfwork_t *dfw, const char *relation_string,
THROW(TypeError);
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1401,7 +1403,7 @@ check_relation_LHS_FUNCTION(dfwork_t *dfw, const char *relation_string,
THROW(TypeError);
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1463,7 +1465,7 @@ header_field_info *hfinfo;
case STTYPE_FVALUE:
case STTYPE_SET:
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -1483,7 +1485,7 @@ check_test(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated)
switch (st_op) {
case TEST_OP_UNINITIALIZED:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
case TEST_OP_EXISTS:
@@ -1550,7 +1552,7 @@ check_test(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
DebugLog((" 3 check_test(stnode_t *st_node = %p) [%u] - End\n", st_node, i++));
}
@@ -1571,7 +1573,7 @@ semcheck(dfwork_t *dfw, stnode_t *st_node, GPtrArray *deprecated)
check_test(dfw, st_node, deprecated);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
diff --git a/epan/dfilter/sttype-function.c b/epan/dfilter/sttype-function.c
index d2d181d5f3..0d0c3ee404 100644
--- a/epan/dfilter/sttype-function.c
+++ b/epan/dfilter/sttype-function.c
@@ -10,6 +10,7 @@
#include "syntax-tree.h"
#include "sttype-function.h"
+#include <wsutil/ws_assert.h>
typedef struct {
guint32 magic;
@@ -24,7 +25,7 @@ function_new(gpointer funcdef)
{
function_t *stfuncrec;
- g_assert(funcdef != NULL);
+ ws_assert(funcdef != NULL);
stfuncrec = g_new(function_t, 1);
@@ -67,7 +68,7 @@ static void
function_free(gpointer value)
{
function_t *stfuncrec = (function_t*)value;
- assert_magic(stfuncrec, FUNCTION_MAGIC);
+ ws_assert_magic(stfuncrec, FUNCTION_MAGIC);
st_funcparams_free(stfuncrec->params);
g_free(stfuncrec);
}
@@ -81,7 +82,7 @@ sttype_function_set_params(stnode_t *node, GSList *params)
function_t *stfuncrec;
stfuncrec = (function_t*)stnode_data(node);
- assert_magic(stfuncrec, FUNCTION_MAGIC);
+ ws_assert_magic(stfuncrec, FUNCTION_MAGIC);
stfuncrec->params = params;
}
@@ -93,7 +94,7 @@ sttype_function_funcdef(stnode_t *node)
function_t *stfuncrec;
stfuncrec = (function_t*)stnode_data(node);
- assert_magic(stfuncrec, FUNCTION_MAGIC);
+ ws_assert_magic(stfuncrec, FUNCTION_MAGIC);
return stfuncrec->funcdef;
}
@@ -104,7 +105,7 @@ sttype_function_params(stnode_t *node)
function_t *stfuncrec;
stfuncrec = (function_t*)stnode_data(node);
- assert_magic(stfuncrec, FUNCTION_MAGIC);
+ ws_assert_magic(stfuncrec, FUNCTION_MAGIC);
return stfuncrec->params;
}
diff --git a/epan/dfilter/sttype-range.c b/epan/dfilter/sttype-range.c
index 6c0eddac44..448eedf2aa 100644
--- a/epan/dfilter/sttype-range.c
+++ b/epan/dfilter/sttype-range.c
@@ -18,6 +18,7 @@
#include <epan/proto.h>
#include "drange.h"
#include "sttype-range.h"
+#include <wsutil/ws_assert.h>
typedef struct {
guint32 magic;
@@ -28,11 +29,11 @@ typedef struct {
#define RANGE_MAGIC 0xec0990ce
static gpointer
-range_new(gpointer junk)
+range_new(gpointer junk _U_)
{
range_t *range;
- g_assert(junk == NULL);
+ ws_assert(junk == NULL);
range = g_new(range_t, 1);
@@ -60,7 +61,7 @@ static void
range_free(gpointer value)
{
range_t *range = (range_t*)value;
- assert_magic(range, RANGE_MAGIC);
+ ws_assert_magic(range, RANGE_MAGIC);
if (range->drange)
drange_free(range->drange);
@@ -77,7 +78,7 @@ sttype_range_remove_drange(stnode_t *node)
range_t *range;
range = (range_t*)stnode_data(node);
- assert_magic(range, RANGE_MAGIC);
+ ws_assert_magic(range, RANGE_MAGIC);
range->drange = NULL;
}
@@ -90,7 +91,7 @@ sttype_range_set(stnode_t *node, stnode_t *entity, GSList* drange_list)
range_t *range;
range = (range_t*)stnode_data(node);
- assert_magic(range, RANGE_MAGIC);
+ ws_assert_magic(range, RANGE_MAGIC);
range->entity = entity;
diff --git a/epan/dfilter/syntax-tree.c b/epan/dfilter/syntax-tree.c
index 8bb69e566f..d9ac1c1fd5 100644
--- a/epan/dfilter/syntax-tree.c
+++ b/epan/dfilter/syntax-tree.c
@@ -9,6 +9,7 @@
#include "config.h"
#include "syntax-tree.h"
+#include <wsutil/ws_assert.h>
/* Keep track of sttype_t's via their sttype_id_t number */
static sttype_t* type_list[STTYPE_NUM_TYPES];
@@ -44,10 +45,10 @@ sttype_register(sttype_t *type)
type_id = type->id;
/* Check input */
- g_assert(type_id < STTYPE_NUM_TYPES);
+ ws_assert(type_id < STTYPE_NUM_TYPES);
/* Don't re-register. */
- g_assert(type_list[type_id] == NULL);
+ ws_assert(type_list[type_id] == NULL);
type_list[type_id] = type;
}
@@ -58,12 +59,12 @@ sttype_lookup(sttype_id_t type_id)
sttype_t *result;
/* Check input */
- g_assert(type_id < STTYPE_NUM_TYPES);
+ ws_assert(type_id < STTYPE_NUM_TYPES);
result = type_list[type_id];
/* Check output. */
- g_assert(result != NULL);
+ ws_assert(result != NULL);
return result;
}
@@ -86,7 +87,7 @@ stnode_new(sttype_id_t type_id, gpointer data)
}
else {
type = sttype_lookup(type_id);
- g_assert(type);
+ ws_assert(type);
node->type = type;
if (type->func_new) {
node->data = type->func_new(data);
@@ -136,12 +137,12 @@ stnode_init(stnode_t *node, sttype_id_t type_id, gpointer data)
{
sttype_t *type;
- assert_magic(node, STNODE_MAGIC);
- g_assert(!node->type);
- g_assert(!node->data);
+ ws_assert_magic(node, STNODE_MAGIC);
+ ws_assert(!node->type);
+ ws_assert(!node->data);
type = sttype_lookup(type_id);
- g_assert(type);
+ ws_assert(type);
node->type = type;
if (type->func_new) {
node->data = type->func_new(data);
@@ -161,14 +162,14 @@ stnode_init_int(stnode_t *node, sttype_id_t type_id, gint32 value)
void
stnode_free(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
if (node->type) {
if (node->type->func_free) {
node->type->func_free(node->data);
}
}
else {
- g_assert(!node->data);
+ ws_assert(!node->data);
}
g_free(node);
}
@@ -176,7 +177,7 @@ stnode_free(stnode_t *node)
const char*
stnode_type_name(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
if (node->type)
return node->type->name;
else
@@ -186,7 +187,7 @@ stnode_type_name(stnode_t *node)
sttype_id_t
stnode_type_id(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
if (node->type)
return node->type->id;
else
@@ -196,16 +197,16 @@ stnode_type_id(stnode_t *node)
gpointer
stnode_data(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
return node->data;
}
gpointer
stnode_steal_data(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
gpointer data = node->data;
- g_assert(data);
+ ws_assert(data);
node->data = NULL;
return data;
}
@@ -213,7 +214,7 @@ stnode_steal_data(stnode_t *node)
gint32
stnode_value(stnode_t *node)
{
- assert_magic(node, STNODE_MAGIC);
+ ws_assert_magic(node, STNODE_MAGIC);
return node->value;
}
diff --git a/epan/dfilter/syntax-tree.h b/epan/dfilter/syntax-tree.h
index 3123b49589..da2c237521 100644
--- a/epan/dfilter/syntax-tree.h
+++ b/epan/dfilter/syntax-tree.h
@@ -113,20 +113,26 @@ const char *
stnode_deprecated(stnode_t *node);
#define assert_magic(obj, mnum) \
- g_assert((obj)); \
+ g_assert_true((obj)); \
if ((obj)->magic != (mnum)) { \
g_print("\nMagic num is 0x%08x, but should be 0x%08x", \
(obj)->magic, (mnum)); \
- g_assert((obj)->magic == (mnum)); \
+ g_assert_true((obj)->magic == (mnum)); \
}
+#ifdef WS_DEBUG
+#define ws_assert_magic(obj, mnum) assert_magic(obj, mnum)
+#else
+#define ws_assert_magic(obj, mnum)
+#endif
+
#define STTYPE_ACCESSOR(ret,type,attr,magicnum) \
ret \
CONCAT(CONCAT(CONCAT(sttype_,type),_),attr) (stnode_t *node) \
{\
CONCAT(type,_t) *value; \
value = (CONCAT(type,_t) *)stnode_data(node);\
- assert_magic(value, magicnum); \
+ ws_assert_magic(value, magicnum); \
return value->attr; \
}
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index 8b0c6eac04..9a306b8a40 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -30,6 +30,7 @@
#include <wsutil/wsgcrypt.h>
#include <wsutil/str_util.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <epan/proto_data.h>
#include <epan/addr_resolv.h>
#include <wmem/wmem.h>
diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc
index a24570fa62..a14cf6e708 100644
--- a/epan/dissectors/packet-ncp2222.inc
+++ b/epan/dissectors/packet-ncp2222.inc
@@ -7079,7 +7079,7 @@ ncp2222_compile_dfilters(void)
g_error("NCP dissector failed to compile dfilter \"%s\": %s\n",
req_conds[i].dfilter_text, err_msg);
g_free(err_msg);
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
}
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index e1c9954e51..602fc10264 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -5767,7 +5767,7 @@ dissect_scsi_rsp(tvbuff_t *tvb, packet_info *pinfo,
cdata->type = SCSI_PDU_TYPE_RSP;
tap_queue_packet(scsi_tap, pinfo, cdata);
- csdata = get_cmdset_data(itlq, itl); /* will g_assert if itlq is null */
+ csdata = get_cmdset_data(itlq, itl);
/* Nothing really to do here, just print some stuff passed to us
*/
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 64ce14c395..d4d8a46258 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -34,6 +34,7 @@
#include <wsutil/str_util.h>
#include <wsutil/wsgcrypt.h>
#include <wsutil/pint.h>
+#include <wsutil/ws_assert.h>
#include "packet-tcp.h"
#include "packet-ip.h"
diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c
index 85161d123f..c34c67b613 100644
--- a/epan/dissectors/packet-tls-utils.c
+++ b/epan/dissectors/packet-tls-utils.c
@@ -40,6 +40,7 @@
#include <wsutil/strtoi.h>
#include <wsutil/wsgcrypt.h>
#include <wsutil/rsa.h>
+#include <wsutil/ws_assert.h>
#include <version_info.h>
#include "packet-ber.h"
#include "packet-x509af.h"
@@ -4715,7 +4716,7 @@ tls_decrypt_aead_record(SslDecryptSession *ssl, SslDecoder *decoder,
/* struct { opaque salt[4]; opaque nonce_explicit[8] } CCMNonce (RFC 6655) */
nonce_with_counter[IMPLICIT_NONCE_LEN + EXPLICIT_NONCE_LEN + 3] = 1;
} else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
#endif
} else if (version == TLSV1DOT3_VERSION || cipher_mode == MODE_POLY1305) {
@@ -5813,7 +5814,7 @@ tls13_load_secret(SslDecryptSession *ssl, ssl_master_key_map_t *mk_map,
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* Transitioning to new keys, mark old ones as unusable. */
diff --git a/epan/dissectors/packet-tls.c b/epan/dissectors/packet-tls.c
index 13ce337589..b53b69b38c 100644
--- a/epan/dissectors/packet-tls.c
+++ b/epan/dissectors/packet-tls.c
@@ -66,6 +66,7 @@
#include <wsutil/str_util.h>
#include <wsutil/strtoi.h>
#include <wsutil/rsa.h>
+#include <wsutil/ws_assert.h>
#include "packet-tcp.h"
#include "packet-x509af.h"
#include "packet-tls.h"
@@ -3872,7 +3873,7 @@ tls13_get_quic_secret(packet_info *pinfo, gboolean is_from_server, int type, gui
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
StringInfo *secret = (StringInfo *)g_hash_table_lookup(key_map, &ssl->client_random);
diff --git a/epan/epan.c b/epan/epan.c
index 20227b39bb..2b8f86e597 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -32,6 +32,7 @@
#include <wsutil/nstime.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include "conversation.h"
#include "except.h"
@@ -519,7 +520,7 @@ epan_set_always_visible(gboolean force)
void
epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_proto_tree, const gboolean proto_tree_visible)
{
- g_assert(edt);
+ ws_assert(edt);
edt->session = session;
@@ -551,7 +552,7 @@ epan_dissect_reset(epan_dissect_t *edt)
/* We have to preserve the pool pointer across the memzeroing */
wmem_allocator_t *tmp;
- g_assert(edt);
+ ws_assert(edt);
g_slist_free(edt->pi.proto_data);
g_slist_free(edt->pi.dependent_frames);
@@ -652,7 +653,7 @@ epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec,
void
epan_dissect_cleanup(epan_dissect_t* edt)
{
- g_assert(edt);
+ ws_assert(edt);
g_slist_foreach(epan_plugins, epan_plugin_dissect_cleanup, edt);
diff --git a/epan/exceptions.h b/epan/exceptions.h
index fc6bb5a7f0..492b985ecd 100644
--- a/epan/exceptions.h
+++ b/epan/exceptions.h
@@ -12,6 +12,7 @@
#define __EXCEPTIONS_H__
#include "except.h"
+#include <wsutil/ws_assert.h>
/* Wireshark has only one exception group, to make these macros simple */
#define XCEPT_GROUP_WIRESHARK 1
@@ -398,7 +399,7 @@
#define RETHROW \
{ \
/* check we're in a catch block */ \
- g_assert(except_state == EXCEPT_CAUGHT); \
+ ws_assert(except_state == EXCEPT_CAUGHT); \
/* we can't use except_rethrow here, as that pops a catch block \
* off the stack, and we don't want to do that, because we want to \
* excecute the FINALLY {} block first. \
diff --git a/epan/frame_data.c b/epan/frame_data.c
index d7f33b1755..047554136c 100644
--- a/epan/frame_data.c
+++ b/epan/frame_data.c
@@ -18,6 +18,7 @@
#include <epan/frame_data.h>
#include <epan/column-utils.h>
#include <epan/timestamp.h>
+#include <wsutil/ws_assert.h>
#define COMPARE_FRAME_NUM() ((fdata1->num < fdata2->num) ? -1 : \
(fdata1->num > fdata2->num) ? 1 : \
@@ -214,7 +215,7 @@ frame_data_init(frame_data *fdata, guint32 num, const wtap_rec *rec,
}
/* To save some memory, we coerce it into 4 bits */
- g_assert(rec->tsprec <= 0xF);
+ ws_assert(rec->tsprec <= 0xF);
fdata->tsprec = (unsigned int)rec->tsprec;
fdata->abs_ts = rec->ts;
fdata->has_phdr_comment = (rec->opt_comment != NULL);
diff --git a/epan/ftypes/ftype-protocol.c b/epan/ftypes/ftype-protocol.c
index f543a58a61..61936ef48e 100644
--- a/epan/ftypes/ftype-protocol.c
+++ b/epan/ftypes/ftype-protocol.c
@@ -15,6 +15,7 @@
#include <wsutil/glib-compat.h>
#include <epan/exceptions.h>
+#include <wsutil/ws_assert.h>
#define CMP_MATCHES cmp_matches
@@ -137,11 +138,11 @@ val_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display _U_)
}
static void
-val_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char * volatile buf, unsigned int size _U_)
+val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display _U_, char * volatile buf, unsigned int size _U_)
{
guint length;
- g_assert(rtype == FTREPR_DFILTER);
+ ws_assert(rtype == FTREPR_DFILTER);
TRY {
length = tvb_captured_length(fv->value.protocol.tvb);
diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c
index 9e37fb8b67..3ab7740cb5 100644
--- a/epan/ftypes/ftype-string.c
+++ b/epan/ftypes/ftype-string.c
@@ -15,6 +15,7 @@
#define CMP_MATCHES cmp_matches
#include <strutil.h>
+#include <wsutil/ws_assert.h>
static void
string_fvalue_new(fvalue_t *fv)
@@ -49,7 +50,7 @@ string_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display _U_)
case FTREPR_DFILTER:
return escape_string_len(fv->value.string);
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return -1;
}
@@ -65,7 +66,7 @@ string_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char *buf, u
escape_string(buf, fv->value.string);
return;
}
- g_assert_not_reached();
+ ws_assert_not_reached();
}
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index a8a4838ffa..52d3217a67 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -12,6 +12,7 @@
#include <glib.h>
#include "ftypes.h"
+#include <wsutil/ws_assert.h>
/* Keep track of ftype_t's via their ftenum number */
static ftype_t* type_list[FT_NUM_TYPES];
@@ -38,11 +39,11 @@ void
ftype_register(enum ftenum ftype, ftype_t *ft)
{
/* Check input */
- g_assert(ftype < FT_NUM_TYPES);
- g_assert(ftype == ft->ftype);
+ ws_assert(ftype < FT_NUM_TYPES);
+ ws_assert(ftype == ft->ftype);
/* Don't re-register. */
- g_assert(type_list[ftype] == NULL);
+ ws_assert(type_list[ftype] == NULL);
type_list[ftype] = ft;
}
@@ -50,7 +51,7 @@ ftype_register(enum ftenum ftype, ftype_t *ft)
/* Given an ftenum number, return an ftype_t* */
#define FTYPE_LOOKUP(ftype, result) \
/* Check input */ \
- g_assert(ftype < FT_NUM_TYPES); \
+ ws_assert(ftype < FT_NUM_TYPES); \
result = type_list[ftype];
@@ -358,7 +359,7 @@ fvalue_length(fvalue_t *fv)
int
fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display)
{
- g_assert(fv->ftype->len_string_repr);
+ ws_assert(fv->ftype->len_string_repr);
return fv->ftype->len_string_repr(fv, rtype, field_display);
}
@@ -451,10 +452,10 @@ slice_func(gpointer data, gpointer user_data)
length = end_offset - start_offset + 1;
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
- g_assert(start_offset >=0 && length > 0);
+ ws_assert(start_offset >=0 && length > 0);
fv->ftype->slice(fv, slice_data->bytes, start_offset, length);
}
@@ -486,64 +487,64 @@ fvalue_slice(fvalue_t *fv, drange_t *d_range)
void
fvalue_set_byte_array(fvalue_t *fv, GByteArray *value)
{
- g_assert(fv->ftype->ftype == FT_BYTES ||
+ ws_assert(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES ||
fv->ftype->ftype == FT_OID ||
fv->ftype->ftype == FT_REL_OID ||
fv->ftype->ftype == FT_SYSTEM_ID);
- g_assert(fv->ftype->set_value.set_value_byte_array);
+ ws_assert(fv->ftype->set_value.set_value_byte_array);
fv->ftype->set_value.set_value_byte_array(fv, value);
}
void
fvalue_set_bytes(fvalue_t *fv, const guint8 *value)
{
- g_assert(fv->ftype->ftype == FT_AX25 ||
+ ws_assert(fv->ftype->ftype == FT_AX25 ||
fv->ftype->ftype == FT_VINES ||
fv->ftype->ftype == FT_ETHER ||
fv->ftype->ftype == FT_FCWWN ||
fv->ftype->ftype == FT_IPv6);
- g_assert(fv->ftype->set_value.set_value_bytes);
+ ws_assert(fv->ftype->set_value.set_value_bytes);
fv->ftype->set_value.set_value_bytes(fv, value);
}
void
fvalue_set_guid(fvalue_t *fv, const e_guid_t *value)
{
- g_assert(fv->ftype->ftype == FT_GUID);
- g_assert(fv->ftype->set_value.set_value_guid);
+ ws_assert(fv->ftype->ftype == FT_GUID);
+ ws_assert(fv->ftype->set_value.set_value_guid);
fv->ftype->set_value.set_value_guid(fv, value);
}
void
fvalue_set_time(fvalue_t *fv, const nstime_t *value)
{
- g_assert(IS_FT_TIME(fv->ftype->ftype));
- g_assert(fv->ftype->set_value.set_value_time);
+ ws_assert(IS_FT_TIME(fv->ftype->ftype));
+ ws_assert(fv->ftype->set_value.set_value_time);
fv->ftype->set_value.set_value_time(fv, value);
}
void
fvalue_set_string(fvalue_t *fv, const gchar *value)
{
- g_assert(IS_FT_STRING(fv->ftype->ftype) ||
+ ws_assert(IS_FT_STRING(fv->ftype->ftype) ||
fv->ftype->ftype == FT_UINT_STRING);
- g_assert(fv->ftype->set_value.set_value_string);
+ ws_assert(fv->ftype->set_value.set_value_string);
fv->ftype->set_value.set_value_string(fv, value);
}
void
fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const gchar *name)
{
- g_assert(fv->ftype->ftype == FT_PROTOCOL);
- g_assert(fv->ftype->set_value.set_value_protocol);
+ ws_assert(fv->ftype->ftype == FT_PROTOCOL);
+ ws_assert(fv->ftype->set_value.set_value_protocol);
fv->ftype->set_value.set_value_protocol(fv, value, name);
}
void
fvalue_set_uinteger(fvalue_t *fv, guint32 value)
{
- g_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||
+ ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||
fv->ftype->ftype == FT_IEEE_11073_FLOAT ||
fv->ftype->ftype == FT_CHAR ||
fv->ftype->ftype == FT_UINT8 ||
@@ -553,51 +554,51 @@ fvalue_set_uinteger(fvalue_t *fv, guint32 value)
fv->ftype->ftype == FT_IPXNET ||
fv->ftype->ftype == FT_FRAMENUM ||
fv->ftype->ftype == FT_IPv4);
- g_assert(fv->ftype->set_value.set_value_uinteger);
+ ws_assert(fv->ftype->set_value.set_value_uinteger);
fv->ftype->set_value.set_value_uinteger(fv, value);
}
void
fvalue_set_sinteger(fvalue_t *fv, gint32 value)
{
- g_assert(fv->ftype->ftype == FT_INT8 ||
+ ws_assert(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 ||
fv->ftype->ftype == FT_INT24 ||
fv->ftype->ftype == FT_INT32);
- g_assert(fv->ftype->set_value.set_value_sinteger);
+ ws_assert(fv->ftype->set_value.set_value_sinteger);
fv->ftype->set_value.set_value_sinteger(fv, value);
}
void
fvalue_set_uinteger64(fvalue_t *fv, guint64 value)
{
- g_assert(fv->ftype->ftype == FT_UINT40 ||
+ ws_assert(fv->ftype->ftype == FT_UINT40 ||
fv->ftype->ftype == FT_UINT48 ||
fv->ftype->ftype == FT_UINT56 ||
fv->ftype->ftype == FT_UINT64 ||
fv->ftype->ftype == FT_BOOLEAN ||
fv->ftype->ftype == FT_EUI64);
- g_assert(fv->ftype->set_value.set_value_uinteger64);
+ ws_assert(fv->ftype->set_value.set_value_uinteger64);
fv->ftype->set_value.set_value_uinteger64(fv, value);
}
void
fvalue_set_sinteger64(fvalue_t *fv, gint64 value)
{
- g_assert(fv->ftype->ftype == FT_INT40 ||
+ ws_assert(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 ||
fv->ftype->ftype == FT_INT56 ||
fv->ftype->ftype == FT_INT64);
- g_assert(fv->ftype->set_value.set_value_sinteger64);
+ ws_assert(fv->ftype->set_value.set_value_sinteger64);
fv->ftype->set_value.set_value_sinteger64(fv, value);
}
void
fvalue_set_floating(fvalue_t *fv, gdouble value)
{
- g_assert(fv->ftype->ftype == FT_FLOAT ||
+ ws_assert(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE);
- g_assert(fv->ftype->set_value.set_value_floating);
+ ws_assert(fv->ftype->set_value.set_value_floating);
fv->ftype->set_value.set_value_floating(fv, value);
}
@@ -605,7 +606,7 @@ fvalue_set_floating(fvalue_t *fv, gdouble value)
gpointer
fvalue_get(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_BYTES ||
+ ws_assert(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES ||
fv->ftype->ftype == FT_AX25 ||
fv->ftype->ftype == FT_VINES ||
@@ -620,14 +621,14 @@ fvalue_get(fvalue_t *fv)
IS_FT_STRING(fv->ftype->ftype) ||
fv->ftype->ftype == FT_UINT_STRING ||
IS_FT_TIME(fv->ftype->ftype));
- g_assert(fv->ftype->get_value.get_value_ptr);
+ ws_assert(fv->ftype->get_value.get_value_ptr);
return fv->ftype->get_value.get_value_ptr(fv);
}
guint32
fvalue_get_uinteger(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||
+ ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||
fv->ftype->ftype == FT_IEEE_11073_FLOAT ||
fv->ftype->ftype == FT_CHAR ||
fv->ftype->ftype == FT_UINT8 ||
@@ -637,51 +638,51 @@ fvalue_get_uinteger(fvalue_t *fv)
fv->ftype->ftype == FT_IPXNET ||
fv->ftype->ftype == FT_FRAMENUM ||
fv->ftype->ftype == FT_IPv4);
- g_assert(fv->ftype->get_value.get_value_uinteger);
+ ws_assert(fv->ftype->get_value.get_value_uinteger);
return fv->ftype->get_value.get_value_uinteger(fv);
}
gint32
fvalue_get_sinteger(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_INT8 ||
+ ws_assert(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 ||
fv->ftype->ftype == FT_INT24 ||
fv->ftype->ftype == FT_INT32);
- g_assert(fv->ftype->get_value.get_value_sinteger);
+ ws_assert(fv->ftype->get_value.get_value_sinteger);
return fv->ftype->get_value.get_value_sinteger(fv);
}
guint64
fvalue_get_uinteger64(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_UINT40 ||
+ ws_assert(fv->ftype->ftype == FT_UINT40 ||
fv->ftype->ftype == FT_UINT48 ||
fv->ftype->ftype == FT_UINT56 ||
fv->ftype->ftype == FT_UINT64 ||
fv->ftype->ftype == FT_BOOLEAN ||
fv->ftype->ftype == FT_EUI64);
- g_assert(fv->ftype->get_value.get_value_uinteger64);
+ ws_assert(fv->ftype->get_value.get_value_uinteger64);
return fv->ftype->get_value.get_value_uinteger64(fv);
}
gint64
fvalue_get_sinteger64(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_INT40 ||
+ ws_assert(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 ||
fv->ftype->ftype == FT_INT56 ||
fv->ftype->ftype == FT_INT64);
- g_assert(fv->ftype->get_value.get_value_sinteger64);
+ ws_assert(fv->ftype->get_value.get_value_sinteger64);
return fv->ftype->get_value.get_value_sinteger64(fv);
}
double
fvalue_get_floating(fvalue_t *fv)
{
- g_assert(fv->ftype->ftype == FT_FLOAT ||
+ ws_assert(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE);
- g_assert(fv->ftype->get_value.get_value_floating);
+ ws_assert(fv->ftype->get_value.get_value_floating);
return fv->ftype->get_value.get_value_floating(fv);
}
@@ -689,7 +690,7 @@ gboolean
fvalue_eq(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_eq);
+ ws_assert(a->ftype->cmp_eq);
return a->ftype->cmp_eq(a, b);
}
@@ -697,7 +698,7 @@ gboolean
fvalue_ne(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_ne);
+ ws_assert(a->ftype->cmp_ne);
return a->ftype->cmp_ne(a, b);
}
@@ -705,7 +706,7 @@ gboolean
fvalue_gt(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_gt);
+ ws_assert(a->ftype->cmp_gt);
return a->ftype->cmp_gt(a, b);
}
@@ -713,7 +714,7 @@ gboolean
fvalue_ge(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_ge);
+ ws_assert(a->ftype->cmp_ge);
return a->ftype->cmp_ge(a, b);
}
@@ -721,7 +722,7 @@ gboolean
fvalue_lt(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_lt);
+ ws_assert(a->ftype->cmp_lt);
return a->ftype->cmp_lt(a, b);
}
@@ -729,7 +730,7 @@ gboolean
fvalue_le(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_le);
+ ws_assert(a->ftype->cmp_le);
return a->ftype->cmp_le(a, b);
}
@@ -737,7 +738,7 @@ gboolean
fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_bitwise_and);
+ ws_assert(a->ftype->cmp_bitwise_and);
return a->ftype->cmp_bitwise_and(a, b);
}
@@ -745,7 +746,7 @@ gboolean
fvalue_contains(const fvalue_t *a, const fvalue_t *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_contains);
+ ws_assert(a->ftype->cmp_contains);
return a->ftype->cmp_contains(a, b);
}
@@ -753,7 +754,7 @@ gboolean
fvalue_matches(const fvalue_t *a, const GRegex *b)
{
/* XXX - check compatibility of a and b */
- g_assert(a->ftype->cmp_matches);
+ ws_assert(a->ftype->cmp_matches);
return a->ftype->cmp_matches(a, b);
}
diff --git a/epan/oids.c b/epan/oids.c
index eef840d2b7..236cbb6b6f 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -25,6 +25,7 @@
#include "packet.h"
#include "wsutil/filesystem.h"
#include "dissectors/packet-ber.h"
+#include <wsutil/ws_assert.h>
#ifdef HAVE_LIBSMI
#include <smi.h>
@@ -152,12 +153,12 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty
c = n;
} while(++i);
- g_assert_not_reached();
+ ws_assert_not_reached();
return NULL;
}
void oid_add(const char* name, guint oid_len, guint32 *subids) {
- g_assert(subids && *subids <= 2);
+ ws_assert(subids && *subids <= 2);
if (oid_len) {
gchar* sub = oid_subid2string(NULL, subids,oid_len);
D(3,("\tOid (from subids): %s %s ",name?name:"NULL", sub));
@@ -1038,7 +1039,7 @@ guint oid_encoded2subid_sub(wmem_allocator_t *scope, const guint8 *oid_bytes, gi
subid = 0;
}
- g_assert(subids == subid_overflow);
+ ws_assert(subids == subid_overflow);
return n;
}
diff --git a/epan/oids_test.c b/epan/oids_test.c
index 99da830aa2..cc27955256 100644
--- a/epan/oids_test.c
+++ b/epan/oids_test.c
@@ -10,6 +10,7 @@
*/
#include "config.h"
+#undef G_DISABLE_ASSERT
#include <stdio.h>
#include <string.h>
diff --git a/epan/packet.c b/epan/packet.c
index 6ab0139db5..369731db60 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -41,6 +41,7 @@
#include <wsutil/str_util.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
static gint proto_malformed = -1;
static dissector_handle_t frame_handle = NULL;
@@ -219,16 +220,16 @@ void
packet_cache_proto_handles(void)
{
frame_handle = find_dissector("frame");
- g_assert(frame_handle != NULL);
+ ws_assert(frame_handle != NULL);
file_handle = find_dissector("file");
- g_assert(file_handle != NULL);
+ ws_assert(file_handle != NULL);
data_handle = find_dissector("data");
- g_assert(data_handle != NULL);
+ ws_assert(data_handle != NULL);
proto_malformed = proto_get_id_by_filter_name("_ws.malformed");
- g_assert(proto_malformed != -1);
+ ws_assert(proto_malformed != -1);
}
/* List of routines that are called before we make a pass through a capture file
@@ -517,7 +518,7 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype,
* least be processed somewhere, we need to somehow
* indicate that to our caller.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -603,7 +604,7 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype,
call_dissector_with_data(frame_handle, edt->tvb, &edt->pi, edt->tree, &frame_dissector_data);
}
CATCH(BoundsError) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
CATCH2(FragmentBoundsError, ReportedBoundsError) {
proto_tree_add_protocol_format(edt->tree, proto_malformed, edt->tvb, 0, 0,
@@ -672,7 +673,7 @@ dissect_file(epan_dissect_t *edt, wtap_rec *rec,
}
CATCH(BoundsError) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
CATCH3(FragmentBoundsError, ContainedBoundsError, ReportedBoundsError) {
proto_tree_add_protocol_format(edt->tree, proto_malformed, edt->tvb, 0, 0,
@@ -732,7 +733,7 @@ call_dissector_through_handle(dissector_handle_t handle, tvbuff_t *tvb,
len = ((dissector_cb_t)handle->dissector_func)(tvb, pinfo, tree, data, handle->dissector_data);
}
else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
pinfo->current_proto = saved_proto;
@@ -1001,7 +1002,7 @@ find_uint_dtbl_entry(dissector_table_t sub_dissectors, const guint32 pattern)
* But you can't do a uint lookup in any other types
* of tables.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/*
@@ -1076,7 +1077,7 @@ dissector_add_uint(const char *name, const guint32 pattern, dissector_handle_t h
* But you can't do a uint lookup in any other types
* of tables.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
}
#if 0
@@ -1212,7 +1213,7 @@ void dissector_add_uint_range_with_preference(const char *name, const char* rang
default:
ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", name, pref_dissector_table->ui_name);
- g_assert_not_reached();
+ ws_assert_not_reached();
}
range_convert_str(wmem_epan_scope(), range, range_str, max_value);
@@ -1238,7 +1239,7 @@ dissector_delete_uint(const char *name, const guint32 pattern,
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* Find the entry.
@@ -1289,7 +1290,7 @@ dissector_delete_all_check (gpointer key _U_, gpointer value, gpointer user_data
void dissector_delete_all(const char *name, dissector_handle_t handle)
{
dissector_table_t sub_dissectors = find_dissector_table(name);
- g_assert (sub_dissectors);
+ ws_assert (sub_dissectors);
g_hash_table_foreach_remove (sub_dissectors->hash_table, dissector_delete_all_check, handle);
}
@@ -1298,7 +1299,7 @@ static void
dissector_delete_from_table(gpointer key _U_, gpointer value, gpointer user_data)
{
dissector_table_t sub_dissectors = (dissector_table_t) value;
- g_assert (sub_dissectors);
+ ws_assert (sub_dissectors);
g_hash_table_foreach_remove(sub_dissectors->hash_table, dissector_delete_all_check, user_data);
sub_dissectors->dissector_handles = g_slist_remove(sub_dissectors->dissector_handles, user_data);
@@ -1320,7 +1321,7 @@ dissector_change_uint(const char *name, const guint32 pattern, dissector_handle_
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* See if the entry already exists. If so, reuse it.
@@ -1356,7 +1357,7 @@ dissector_reset_uint(const char *name, const guint32 pattern)
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* Find the entry.
@@ -1496,7 +1497,7 @@ find_string_dtbl_entry(dissector_table_t const sub_dissectors, const gchar *patt
* But you can't do a string lookup in any other types
* of tables.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (sub_dissectors->param == TRUE) {
@@ -1560,7 +1561,7 @@ dissector_add_string(const char *name, const gchar *pattern,
* But you can't do a string lookup in any other types
* of tables.
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
}
dtbl_entry = g_new(dtbl_entry_t, 1);
@@ -1603,7 +1604,7 @@ dissector_delete_string(const char *name, const gchar *pattern,
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* Find the entry.
@@ -1628,7 +1629,7 @@ dissector_change_string(const char *name, const gchar *pattern,
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* See if the entry already exists. If so, reuse it.
@@ -1664,7 +1665,7 @@ dissector_reset_string(const char *name, const gchar *pattern)
dtbl_entry_t *dtbl_entry;
/* sanity check */
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
/*
* Find the entry.
@@ -1807,7 +1808,7 @@ void dissector_add_custom_table_handle(const char *name, void *pattern, dissecto
return;
}
- g_assert(sub_dissectors->type == FT_BYTES);
+ ws_assert(sub_dissectors->type == FT_BYTES);
dtbl_entry = g_new(dtbl_entry_t, 1);
dtbl_entry->current = handle;
@@ -1864,7 +1865,7 @@ void dissector_add_guid(const char *name, guid_key* guid_val, dissector_handle_t
}
if (sub_dissectors->type != FT_GUID) {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
dtbl_entry = g_new(dtbl_entry_t, 1);
@@ -2230,8 +2231,8 @@ dissector_table_foreach_func (gpointer key, gpointer value, gpointer user_data)
dissector_foreach_info_t *info;
dtbl_entry_t *dtbl_entry;
- g_assert(value);
- g_assert(user_data);
+ ws_assert(value);
+ ws_assert(user_data);
dtbl_entry = (dtbl_entry_t *)value;
if (dtbl_entry->current == NULL ||
@@ -2260,8 +2261,8 @@ dissector_all_tables_foreach_func (gpointer key, gpointer value, gpointer user_d
dissector_table_t sub_dissectors;
dissector_foreach_info_t *info;
- g_assert(value);
- g_assert(user_data);
+ ws_assert(value);
+ ws_assert(user_data);
sub_dissectors = (dissector_table_t)value;
info = (dissector_foreach_info_t *)user_data;
@@ -2331,8 +2332,8 @@ dissector_table_foreach_changed_func (gpointer key, gpointer value, gpointer use
dtbl_entry_t *dtbl_entry;
dissector_foreach_info_t *info;
- g_assert(value);
- g_assert(user_data);
+ ws_assert(value);
+ ws_assert(user_data);
dtbl_entry = (dtbl_entry_t *)value;
if (dtbl_entry->initial == dtbl_entry->current) {
@@ -2506,7 +2507,7 @@ register_dissector_table(const char *name, const char *ui_name, const int proto,
default:
ws_error("The dissector table %s (%s) is registering an unsupported type - are you using a buggy plugin?", name, ui_name);
- g_assert_not_reached();
+ ws_assert_not_reached();
}
sub_dissectors->dissector_handles = NULL;
sub_dissectors->ui_name = ui_name;
@@ -2745,7 +2746,7 @@ heur_dissector_delete(const char *name, heur_dissector_t dissector, const int pr
GSList *found_entry;
/* sanity check */
- g_assert(sub_dissectors != NULL);
+ ws_assert(sub_dissectors != NULL);
hdtbl_entry.dissector = dissector;
hdtbl_entry.protocol = find_protocol_by_id(proto);
@@ -2889,8 +2890,8 @@ heur_dissector_table_foreach_func (gpointer data, gpointer user_data)
{
heur_dissector_foreach_info_t *info;
- g_assert(data);
- g_assert(user_data);
+ ws_assert(data);
+ ws_assert(user_data);
info = (heur_dissector_foreach_info_t *)user_data;
info->caller_func(info->table_name, (heur_dtbl_entry_t *)data,
@@ -3160,7 +3161,7 @@ static dissector_handle_t
register_dissector_handle(const char *name, dissector_handle_t handle)
{
/* Make sure the registration is unique */
- g_assert(g_hash_table_lookup(registered_dissectors, name) == NULL);
+ ws_assert(g_hash_table_lookup(registered_dissectors, name) == NULL);
g_hash_table_insert(registered_dissectors, (gpointer)name, handle);
@@ -3390,7 +3391,7 @@ gboolean deregister_depend_dissector(const char* parent, const char* dependent)
depend_dissector_list_t sub_dissectors = find_depend_dissector_list(parent);
/* sanity check */
- g_assert(sub_dissectors != NULL);
+ ws_assert(sub_dissectors != NULL);
return remove_depend_dissector_from_list(sub_dissectors, dependent);
}
@@ -3424,7 +3425,7 @@ dissector_dump_decodes_display(const gchar *table_name,
gint proto_id;
const gchar *decode_as;
- g_assert(sub_dissectors);
+ ws_assert(sub_dissectors);
switch (sub_dissectors->type) {
case FT_UINT8:
@@ -3432,16 +3433,16 @@ dissector_dump_decodes_display(const gchar *table_name,
case FT_UINT24:
case FT_UINT32:
dtbl_entry = (dtbl_entry_t *)value;
- g_assert(dtbl_entry);
+ ws_assert(dtbl_entry);
handle = dtbl_entry->current;
- g_assert(handle);
+ ws_assert(handle);
proto_id = dissector_handle_get_protocol_index(handle);
if (proto_id != -1) {
decode_as = proto_get_protocol_filter_name(proto_id);
- g_assert(decode_as != NULL);
+ ws_assert(decode_as != NULL);
printf("%s\t%u\t%s\n", table_name, selector, decode_as);
}
break;
diff --git a/epan/plugin_if.c b/epan/plugin_if.c
index 1231c533ef..bb5c552bf1 100644
--- a/epan/plugin_if.c
+++ b/epan/plugin_if.c
@@ -20,6 +20,7 @@
#include <glib.h>
#include <epan/epan.h>
#include <epan/proto.h>
+#include <wsutil/ws_assert.h>
#include "plugin_if.h"
@@ -61,16 +62,16 @@ extern ext_menu_t * ext_menubar_register_menu(int proto_id, const gchar * menula
gchar * name = NULL;
/* A name for the entry must be provided */
- g_assert(menulabel != NULL && strlen ( menulabel ) > 0 );
+ ws_assert(menulabel != NULL && strlen ( menulabel ) > 0 );
/* A protocol must exist for the given id */
- g_assert(find_protocol_by_id(proto_id) != NULL);
+ ws_assert(find_protocol_by_id(proto_id) != NULL);
/* Create unique name, which is used by GTK to provide the menu */
name = g_strconcat(proto_get_protocol_filter_name(proto_id), "Menu", NULL);
/* For now, a protocol may only register one main menu */
- g_assert(g_list_find(menubar_menunames, name) == NULL);
+ ws_assert(g_list_find(menubar_menunames, name) == NULL);
entry = g_new0(ext_menubar_t, 1);
entry->type = EXT_MENUBAR_MENU;
@@ -95,9 +96,9 @@ extern ext_menu_t * ext_menubar_register_menu(int proto_id, const gchar * menula
extern ext_menu_t * ext_menubar_set_parentmenu(ext_menu_t * menu, const gchar * parentmenu)
{
- g_assert(menu != NULL && menu->parent == NULL);
+ ws_assert(menu != NULL && menu->parent == NULL);
- g_assert(parentmenu != 0);
+ ws_assert(parentmenu != 0);
menu->parent_menu = g_strdup(parentmenu);
@@ -109,10 +110,10 @@ extern ext_menu_t * ext_menubar_add_submenu(ext_menu_t * parent, const gchar *me
ext_menubar_t * entry = NULL;
/* A name for the entry must be provided */
- g_assert(menulabel != NULL && strlen ( menulabel ) > 0 );
+ ws_assert(menulabel != NULL && strlen ( menulabel ) > 0 );
/* Parent must be a valid parent */
- g_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU);
+ ws_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU);
parent->submenu_cnt++;
@@ -140,9 +141,9 @@ static void ext_menubar_add_generic_entry (
ext_menubar_t * entry = NULL;
/* A valid parent must exist */
- g_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU);
+ ws_assert(parent != NULL && parent->type == EXT_MENUBAR_MENU);
/* A label for the entry must be provided */
- g_assert(label != NULL && strlen ( label ) > 0 );
+ ws_assert(label != NULL && strlen ( label ) > 0 );
parent->item_cnt++;
@@ -166,7 +167,7 @@ extern void ext_menubar_add_entry(ext_menu_t * parent, const gchar *label,
const gchar *tooltip, ext_menubar_action_cb callback, gpointer user_data)
{
/* A callback must be provided */
- g_assert(callback != NULL);
+ ws_assert(callback != NULL);
ext_menubar_add_generic_entry ( EXT_MENUBAR_ITEM, parent, label, tooltip, callback, user_data );
}
@@ -175,7 +176,7 @@ extern void ext_menubar_add_website(ext_menu_t * parent, const gchar *label,
const gchar *tooltip, const gchar *url)
{
/* An url for the entry must be provided */
- g_assert(url != NULL && strlen ( url ) > 0 );
+ ws_assert(url != NULL && strlen ( url ) > 0 );
ext_menubar_add_generic_entry ( EXT_MENUBAR_URL, parent, label, tooltip, NULL, (gpointer) g_strdup(url) );
}
@@ -199,7 +200,7 @@ ext_toolbar_t * ext_toolbar_register_toolbar(const gchar * toolbarlabel)
ext_toolbar_t * entry = NULL;
/* A name for the entry must be provided */
- g_assert(toolbarlabel != NULL && strlen ( toolbarlabel ) > 0 );
+ ws_assert(toolbarlabel != NULL && strlen ( toolbarlabel ) > 0 );
entry = g_new0(ext_toolbar_t, 1);
entry->type = EXT_TOOLBAR_BAR;
@@ -309,11 +310,11 @@ ext_toolbar_add_entry( ext_toolbar_t * parent, ext_toolbar_item_t type, const gc
ext_toolbar_t * entry = NULL;
/* A valid parent must exist */
- g_assert(parent != NULL && parent->type == EXT_TOOLBAR_BAR);
+ ws_assert(parent != NULL && parent->type == EXT_TOOLBAR_BAR);
/* A label for the entry must be provided */
- g_assert(label != NULL && strlen ( label ) > 0 );
+ ws_assert(label != NULL && strlen ( label ) > 0 );
/* A callback must be provided */
- g_assert(callback != NULL);
+ ws_assert(callback != NULL);
parent->item_cnt++;
diff --git a/epan/prefs.c b/epan/prefs.c
index 7855aa86e9..6936d40988 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -35,6 +35,7 @@
#include <wsutil/file_util.h>
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <epan/prefs-int.h>
#include <epan/uat-int.h>
@@ -1183,7 +1184,7 @@ prefs_register_uint_preference(module_t *module, const char *name,
PREF_UINT);
preference->varp.uint = var;
preference->default_val.uint = *var;
- g_assert(base > 0 && base != 1 && base < 37);
+ ws_assert(base > 0 && base != 1 && base < 37);
preference->info.base = base;
}
@@ -1253,7 +1254,7 @@ unsigned int prefs_set_bool_value(pref_t *pref, gboolean value, pref_source_t so
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1274,7 +1275,7 @@ void prefs_invert_bool_value(pref_t *pref, pref_source_t source)
*pref->varp.boolp = !(*pref->varp.boolp);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -1293,7 +1294,7 @@ gboolean prefs_get_bool_value(pref_t *pref, pref_source_t source)
return *pref->varp.boolp;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1348,7 +1349,7 @@ unsigned int prefs_set_enum_value(pref_t *pref, gint value, pref_source_t source
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1376,7 +1377,7 @@ gint prefs_get_enum_value(pref_t *pref, pref_source_t source)
return *pref->varp.enump;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1439,7 +1440,7 @@ register_string_like_preference(module_t *module, const char *name,
pref->default_val.string = g_strdup(*var);
pref->stashed_val.string = NULL;
if (type == PREF_CUSTOM) {
- g_assert(custom_cbs);
+ ws_assert(custom_cbs);
pref->custom_cbs = *custom_cbs;
}
}
@@ -1499,7 +1500,7 @@ prefs_set_string_value(pref_t *pref, const char* value, pref_source_t source)
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1517,7 +1518,7 @@ char* prefs_get_string_value(pref_t *pref, pref_source_t source)
case pref_current:
return *pref->varp.string;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1686,7 +1687,7 @@ gboolean prefs_set_range_value(pref_t *pref, range_t *value, pref_source_t sourc
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1706,7 +1707,7 @@ range_t* prefs_get_range_value_real(pref_t *pref, pref_source_t source)
return *pref->varp.range;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1825,7 +1826,7 @@ gboolean prefs_set_color_value(pref_t *pref, color_t value, pref_source_t source
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -1845,7 +1846,7 @@ color_t* prefs_get_color_value(pref_t *pref, pref_source_t source)
return pref->varp.colorp;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -2057,7 +2058,7 @@ pref_stash(pref_t *pref, gpointer unused _U_)
break;
case PREF_OBSOLETE:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
return 0;
@@ -2198,7 +2199,7 @@ pref_unstash(pref_t *pref, gpointer unstash_data_p)
break;
case PREF_OBSOLETE:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
return 0;
@@ -2248,7 +2249,7 @@ reset_stashed_pref(pref_t *pref) {
break;
case PREF_OBSOLETE:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -2293,7 +2294,7 @@ pref_clean_stash(pref_t *pref, gpointer unused _U_)
break;
case PREF_OBSOLETE:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
return 0;
@@ -2624,7 +2625,7 @@ column_format_reset_cb(pref_t* pref)
}
col_num_pref = prefs_find_preference(gui_column_module, PRS_COL_NUM);
- g_assert(col_num_pref != NULL); /* Should never happen */
+ ws_assert(col_num_pref != NULL); /* Should never happen */
column_num_reset_cb(col_num_pref);
}
@@ -2675,9 +2676,9 @@ column_format_set_cb(pref_t* pref, const gchar* value, unsigned int* changed_fla
free_col_info(*pref->varp.list);
*pref->varp.list = NULL;
hidden_pref = prefs_find_preference(gui_column_module, PRS_COL_HIDDEN);
- g_assert(hidden_pref != NULL); /* Should never happen */
+ ws_assert(hidden_pref != NULL); /* Should never happen */
col_num_pref = prefs_find_preference(gui_column_module, PRS_COL_NUM);
- g_assert(col_num_pref != NULL); /* Should never happen */
+ ws_assert(col_num_pref != NULL); /* Should never happen */
llen = g_list_length(col_l);
*col_num_pref->varp.uint = llen / 2;
col_l_elt = g_list_first(col_l);
@@ -4765,7 +4766,7 @@ guint prefs_get_uint_value_real(pref_t *pref, pref_source_t source)
return *pref->varp.uint;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -4801,7 +4802,7 @@ unsigned int prefs_set_uint_value(pref_t *pref, guint value, pref_source_t sourc
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -5357,7 +5358,7 @@ deprecated_port_pref(gchar *pref_name, const gchar *value)
default:
ws_error("The dissector table %s (%s) is not an integer type - are you using a buggy plugin?", port_range_prefs[i].table_name, get_dissector_table_ui_name(port_range_prefs[i].table_name));
- g_assert_not_reached();
+ ws_assert_not_reached();
}
module = prefs_find_module(port_range_prefs[i].module_name);
@@ -6342,7 +6343,7 @@ prefs_pref_is_default(pref_t *pref)
case PREF_STATIC_TEXT:
case PREF_UAT:
return FALSE;
- /* g_assert_not_reached(); */
+ /* ws_assert_not_reached(); */
break;
}
return FALSE;
diff --git a/epan/print.c b/epan/print.c
index 08963eabb4..33062389de 100644
--- a/epan/print.c
+++ b/epan/print.c
@@ -31,6 +31,7 @@
#include <wsutil/filesystem.h>
#include <version_info.h>
#include <wsutil/utf8_entities.h>
+#include <wsutil/ws_assert.h>
#include <ftypes/ftypes-int.h>
#define PDML_VERSION "0"
@@ -168,7 +169,7 @@ proto_tree_print_node(proto_node *node, gpointer data)
gchar *label_ptr;
/* dissection with an invisible proto tree? */
- g_assert(fi);
+ ws_assert(fi);
/* Don't print invisible entries. */
if (proto_item_is_hidden(node) && (prefs.display_hidden_proto_items == FALSE))
@@ -233,7 +234,7 @@ proto_tree_print_node(proto_node *node, gpointer data)
/* If we're printing all levels, or if this node is one with a
subtree and its subtree is expanded, recurse into the subtree,
if it exists. */
- g_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types));
+ ws_assert((fi->tree_type >= -1) && (fi->tree_type < num_tree_types));
if ((pdata->print_dissections == print_dissections_expanded) ||
((pdata->print_dissections == print_dissections_as_displayed) &&
(fi->tree_type >= 0) && tree_expanded(fi->tree_type))) {
@@ -304,8 +305,8 @@ write_pdml_proto_tree(output_fields_t* fields, gchar **protocolfilter, pf_flags
write_pdml_data data;
const color_filter_t *cfp;
- g_assert(edt);
- g_assert(fh);
+ ws_assert(edt);
+ ws_assert(fh);
cfp = edt->pi.fd->color_filter;
@@ -347,8 +348,8 @@ write_ek_proto_tree(output_fields_t* fields,
column_info *cinfo,
FILE *fh)
{
- g_assert(edt);
- g_assert(fh);
+ ws_assert(edt);
+ ws_assert(fh);
write_json_data data;
@@ -402,8 +403,8 @@ write_ek_proto_tree(output_fields_t* fields,
void
write_fields_proto_tree(output_fields_t* fields, epan_dissect_t *edt, column_info *cinfo, FILE *fh)
{
- g_assert(edt);
- g_assert(fh);
+ ws_assert(edt);
+ ws_assert(fh);
/* Create the output */
write_specified_fields(FORMAT_CSV, fields, edt, cinfo, fh, NULL);
@@ -445,7 +446,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
gboolean wrap_in_fake_protocol;
/* dissection with an invisible proto tree? */
- g_assert(fi);
+ ws_assert(fi);
/* Will wrap up top-level field items inside a fake protocol wrapper to
preserve the PDML schema */
@@ -608,7 +609,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
fprintf(pdata->fh, "%" G_GINT64_MODIFIER "X", fvalue_get_uinteger64(&fi->value));
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
fputs("\" unmaskedvalue=\"", pdata->fh);
pdml_write_field_hex_value(pdata, fi);
@@ -971,7 +972,7 @@ write_json_proto_node_hex_dump(proto_node *node, write_json_data *pdata)
json_dumper_value_anyf(pdata->dumper, "\"%" G_GINT64_MODIFIER "X\"", fvalue_get_uinteger64(&fi->value));
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
json_write_field_hex_value(pdata, fi);
@@ -1194,7 +1195,7 @@ ek_fill_attr(proto_node *node, GSList **attr_list, GHashTable *attr_table, write
fi_parent = PNODE_FINFO(current_node->parent);
/* dissection with an invisible proto tree? */
- g_assert(fi);
+ ws_assert(fi);
if (fi_parent == NULL) {
node_name = g_strdup(fi->hfinfo->abbrev);
@@ -1294,7 +1295,7 @@ ek_write_hex(field_info *fi, write_json_data *pdata)
json_dumper_value_anyf(pdata->dumper, "\"%" G_GINT64_MODIFIER "X\"", fvalue_get_uinteger64(&fi->value));
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} else {
json_write_field_hex_value(pdata, fi);
@@ -2103,7 +2104,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp,
gsize output_fields_num_fields(output_fields_t* fields)
{
- g_assert(fields);
+ ws_assert(fields);
if (NULL == fields->fields) {
return 0;
@@ -2114,7 +2115,7 @@ gsize output_fields_num_fields(output_fields_t* fields)
void output_fields_free(output_fields_t* fields)
{
- g_assert(fields);
+ ws_assert(fields);
if (NULL != fields->fields) {
gsize i;
@@ -2146,8 +2147,8 @@ void output_fields_add(output_fields_t *fields, const gchar *field)
{
gchar *field_copy;
- g_assert(fields);
- g_assert(field);
+ ws_assert(fields);
+ ws_assert(field);
if (NULL == fields->fields) {
@@ -2197,8 +2198,8 @@ gboolean output_fields_set_option(output_fields_t *info, gchar *option)
const gchar *option_name;
const gchar *option_value;
- g_assert(info);
- g_assert(option);
+ ws_assert(info);
+ ws_assert(option);
if ('\0' == *option) {
return FALSE; /* this happens if we're called from tshark -E '' */
@@ -2321,7 +2322,7 @@ void output_fields_list_options(FILE *fh)
gboolean output_fields_has_cols(output_fields_t* fields)
{
- g_assert(fields);
+ ws_assert(fields);
return fields->includes_col_fields;
}
@@ -2329,9 +2330,9 @@ void write_fields_preamble(output_fields_t* fields, FILE *fh)
{
gsize i;
- g_assert(fields);
- g_assert(fh);
- g_assert(fields->fields);
+ ws_assert(fields);
+ ws_assert(fh);
+ ws_assert(fields->fields);
if (fields->print_bom) {
fputs(UTF8_BOM, fh);
@@ -2409,7 +2410,7 @@ static void format_field_values(output_fields_t* fields, gpointer field_index, g
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -2426,7 +2427,7 @@ static void proto_tree_get_node_field_values(proto_node *node, gpointer data)
fi = PNODE_FINFO(node);
/* dissection with an invisible proto tree? */
- g_assert(fi);
+ ws_assert(fi);
field_index = g_hash_table_lookup(call_data->fields->field_indicies, fi->hfinfo->abbrev);
if (NULL != field_index) {
@@ -2451,14 +2452,14 @@ static void write_specified_fields(fields_format format, output_fields_t *fields
write_field_data_t data;
- g_assert(fields);
- g_assert(fields->fields);
- g_assert(edt);
+ ws_assert(fields);
+ ws_assert(fields->fields);
+ ws_assert(edt);
/* JSON formats must go through json_dumper */
if (format == FORMAT_JSON || format == FORMAT_EK) {
- g_assert(!fh && dumper);
+ ws_assert(!fh && dumper);
} else {
- g_assert(fh && !dumper);
+ ws_assert(fh && !dumper);
}
data.fields = fields;
@@ -2620,7 +2621,7 @@ static void write_specified_fields(fields_format format, output_fields_t *fields
default:
fprintf(stderr, "Unknown fields format %d\n", format);
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
diff --git a/epan/proto.c b/epan/proto.c
index 2b7ad23c63..0c8a7b4877 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -23,6 +23,7 @@
#include <wsutil/utf8_entities.h>
#include <wsutil/json_dumper.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <ftypes/ftypes-int.h>
@@ -144,7 +145,7 @@ struct ptvcursor {
/** See inlined comments.
@param pi the created protocol item we're about to return */
#define TRY_TO_FAKE_THIS_REPR(pi) \
- g_assert(pi); \
+ ws_assert(pi); \
if (!(PTREE_DATA(pi)->visible)) { \
/* If the tree (GUI) isn't visible it's pointless for us to generate the protocol \
* items string representation */ \
@@ -3707,7 +3708,7 @@ proto_tree_add_item_ret_string_and_length(proto_tree *tree, int hfindex,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return pi;
@@ -3802,7 +3803,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
new_fi->flags |= (encoding & ENC_LITTLE_ENDIAN) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN;
@@ -3826,7 +3827,7 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return pi;
@@ -3883,7 +3884,7 @@ proto_tree_add_item_ret_time_string(proto_tree *tree, int hfindex,
proto_tree_set_time(new_fi, &time_stamp);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
new_fi->flags |= (encoding & ENC_LITTLE_ENDIAN) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN;
@@ -6244,7 +6245,7 @@ new_field_info(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
static void
proto_tree_set_representation_value(proto_item *pi, const char *format, va_list ap)
{
- g_assert(pi);
+ ws_assert(pi);
/* If the tree (GUI) or item isn't visible it's pointless for us to generate the protocol
* items string representation */
@@ -6669,7 +6670,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
int field_id;
int ii = 0;
- g_assert(field_ids != NULL);
+ ws_assert(field_ids != NULL);
while ((field_idx = (int *) g_slist_nth_data(field_ids, ii++))) {
field_id = *field_idx;
PROTO_REGISTRAR_GET_NTH((guint)field_id, hfinfo);
@@ -13090,14 +13091,14 @@ tree_expanded(int tree_type)
if (tree_type == -1) {
return FALSE;
}
- g_assert(tree_type >= 0 && tree_type < num_tree_types);
+ ws_assert(tree_type >= 0 && tree_type < num_tree_types);
return tree_is_expanded[tree_type >> 5] & (1U << (tree_type & 31));
}
void
tree_expanded_set(int tree_type, gboolean value)
{
- g_assert(tree_type >= 0 && tree_type < num_tree_types);
+ ws_assert(tree_type >= 0 && tree_type < num_tree_types);
if (value)
tree_is_expanded[tree_type >> 5] |= (1U << (tree_type & 31));
diff --git a/epan/reassemble.c b/epan/reassemble.c
index 0994f22954..c38f994c56 100644
--- a/epan/reassemble.c
+++ b/epan/reassemble.c
@@ -18,6 +18,7 @@
#include <epan/tvbuff-int.h>
#include <wsutil/str_util.h>
+#include <wsutil/ws_assert.h>
/*
* Functions for reassembly tables where the endpoint addresses, and a
@@ -2189,7 +2190,7 @@ fragment_add_seq_single_move(reassembly_table *table, const packet_info *pinfo,
if (fh == NULL) {
/* Shouldn't be called this way.
* Probably wouldn't hurt to just create fh in this case. */
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
if (fh->flags & FD_DATALEN_SET && fh->datalen <= offset) {
diff --git a/epan/reassemble_test.c b/epan/reassemble_test.c
index a803bf230a..89ffafee57 100644
--- a/epan/reassemble_test.c
+++ b/epan/reassemble_test.c
@@ -111,7 +111,7 @@ static void
print_fd(fragment_head *fd, gboolean is_head) {
int i;
- g_assert(fd != NULL);
+ g_assert_true(fd != NULL);
printf(" %16p %16p %3u %3u %3u", fd, fd->next, fd->frame, fd->offset, fd->len);
if (is_head) {
printf(" %3u %3u", fd->datalen, fd->reassembled_in);
@@ -133,7 +133,7 @@ static void
print_fd_chain(fragment_head *fd_head) {
fragment_item *fdp;
- g_assert(fd_head != NULL);
+ g_assert_true(fd_head != NULL);
print_fd(fd_head, TRUE);
for (fdp=fd_head->next; fdp != NULL; fdp=fdp->next) {
print_fd(fdp, FALSE);
diff --git a/epan/show_exception.c b/epan/show_exception.c
index 7d5712c95f..9bf238a786 100644
--- a/epan/show_exception.c
+++ b/epan/show_exception.c
@@ -19,6 +19,7 @@
#include <epan/prefs.h>
#include <epan/prefs-int.h>
#include <epan/show_exception.h>
+#include <wsutil/ws_assert.h>
#include <wsutil/wslog.h>
@@ -166,7 +167,7 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
default:
/* XXX - we want to know, if an unknown exception passed until here, don't we? */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
diff --git a/epan/srt_table.c b/epan/srt_table.c
index 56ce01c149..843cff6715 100644
--- a/epan/srt_table.c
+++ b/epan/srt_table.c
@@ -15,6 +15,7 @@
#include "proto.h"
#include "packet_info.h"
#include "srt_table.h"
+#include <wsutil/ws_assert.h>
struct register_srt {
int proto_id; /* protocol id (0-indexed) */
@@ -250,7 +251,7 @@ add_srt_table_data(srt_stat_table *rst, int indx, const nstime_t *req_time, pack
srt_procedure_t *rp;
nstime_t t, delta;
- g_assert(indx >= 0 && indx < rst->num_procs);
+ ws_assert(indx >= 0 && indx < rst->num_procs);
rp=&rst->procedures[indx];
/* calculate time delta between request and reply */
diff --git a/epan/stat_tap_ui.c b/epan/stat_tap_ui.c
index 10400633e4..69ad4ae3a0 100644
--- a/epan/stat_tap_ui.c
+++ b/epan/stat_tap_ui.c
@@ -17,6 +17,7 @@
#include <glib.h>
#include <epan/stat_tap_ui.h>
+#include <wsutil/ws_assert.h>
/* structure to keep track of what stats have registered command-line
arguments.
@@ -238,11 +239,11 @@ void stat_tap_init_table_row(stat_tap_table *stat_table, guint table_index, guin
stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_table, guint table_index, guint field_index)
{
stat_tap_table_item_type* field_value;
- g_assert(table_index < stat_table->num_elements);
+ ws_assert(table_index < stat_table->num_elements);
field_value = stat_table->elements[table_index];
- g_assert(field_index < stat_table->num_fields);
+ ws_assert(field_index < stat_table->num_fields);
return &field_value[field_index];
}
@@ -250,11 +251,11 @@ stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_tab
void stat_tap_set_field_data(stat_tap_table *stat_table, guint table_index, guint field_index, stat_tap_table_item_type* field_data)
{
stat_tap_table_item_type* field_value;
- g_assert(table_index < stat_table->num_elements);
+ ws_assert(table_index < stat_table->num_elements);
field_value = stat_table->elements[table_index];
- g_assert(field_index < stat_table->num_fields);
+ ws_assert(field_index < stat_table->num_fields);
field_value[field_index] = *field_data;
}
diff --git a/epan/stats_tree.c b/epan/stats_tree.c
index fa8918cc0b..d2b39ea0c9 100644
--- a/epan/stats_tree.c
+++ b/epan/stats_tree.c
@@ -30,6 +30,7 @@
#include "strutil.h"
#include "stats_tree.h"
+#include <wsutil/ws_assert.h>
enum _stat_tree_columns {
COL_NAME,
@@ -273,7 +274,7 @@ stats_tree_register_with_group(const char *tapname, const char *abbr, const char
stats_tree_cfg *cfg = g_new0(stats_tree_cfg, 1);
/* at the very least the abbrev and the packet function should be given */
- g_assert( tapname && abbr && packet );
+ ws_assert( tapname && abbr && packet );
cfg->tapname = g_strdup(tapname);
cfg->abbr = g_strdup(abbr);
@@ -503,7 +504,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id, stat_node_dataty
node->parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
} else {
/* ??? should we set the parent to be root ??? */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (node->parent->children) {
@@ -653,7 +654,7 @@ stats_tree_manip_node_int(manip_node_mode mode, stats_tree *st, const char *name
stat_node *node = NULL;
stat_node *parent = NULL;
- g_assert( parent_id >= 0 && parent_id < (int) st->parents->len );
+ ws_assert( parent_id >= 0 && parent_id < (int) st->parents->len );
parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
@@ -715,7 +716,7 @@ stats_tree_manip_node_float(manip_node_mode mode, stats_tree *st, const char *na
stat_node *node = NULL;
stat_node *parent = NULL;
- g_assert(parent_id >= 0 && parent_id < (int)st->parents->len);
+ ws_assert(parent_id >= 0 && parent_id < (int)st->parents->len);
parent = (stat_node *)g_ptr_array_index(st->parents, parent_id);
@@ -746,7 +747,7 @@ stats_tree_manip_node_float(manip_node_mode mode, stats_tree *st, const char *na
break;
default:
//only average is currently supported
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -763,7 +764,7 @@ stats_tree_get_abbr(const char *opt_arg)
/* XXX: this fails when tshark is given any options
after the -z */
- g_assert(opt_arg != NULL);
+ ws_assert(opt_arg != NULL);
for (i=0; opt_arg[i] && opt_arg[i] != ','; i++);
@@ -922,7 +923,7 @@ stats_tree_tick_range(stats_tree *st, const gchar *name, int parent_id,
if (parent_id >= 0 && parent_id < (int) st->parents->len) {
parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
} else {
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if( parent->hash ) {
@@ -932,7 +933,7 @@ stats_tree_tick_range(stats_tree *st, const gchar *name, int parent_id,
}
if ( node == NULL )
- g_assert_not_reached();
+ ws_assert_not_reached();
/* update stats for container node. counter should already be ticked so we only update total and min/max */
node->total.int_total += value_in_range;
@@ -1259,7 +1260,7 @@ stats_tree_sort_compare (const stat_node *a, const stat_node *b, gint sort_colum
default:
/* no sort comparison found for column - must update this switch statement */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* break tie between items with same primary search result */
diff --git a/epan/stream.c b/epan/stream.c
index 153cd66ea6..5bad6037f7 100644
--- a/epan/stream.c
+++ b/epan/stream.c
@@ -18,6 +18,7 @@
#include <epan/reassemble.h>
#include <epan/stream.h>
#include <epan/tvbuff.h>
+#include <wsutil/ws_assert.h>
typedef struct {
@@ -103,7 +104,7 @@ static void cleanup_stream_hash( void ) {
/* init function, call from stream_init() */
static void init_stream_hash( void ) {
- g_assert(stream_hash==NULL);
+ ws_assert(stream_hash==NULL);
stream_hash = g_hash_table_new(stream_hash_func,
stream_compare_func);
}
@@ -221,7 +222,7 @@ static void cleanup_fragment_hash( void ) {
/* init function, call from stream_init() */
static void init_fragment_hash( void ) {
- g_assert(fragment_hash==NULL);
+ ws_assert(fragment_hash==NULL);
fragment_hash = g_hash_table_new(fragment_hash_func,
fragment_compare_func);
}
diff --git a/epan/tvbparse.c b/epan/tvbparse.c
index b8d645d0b7..d3f2e2e9d3 100644
--- a/epan/tvbparse.c
+++ b/epan/tvbparse.c
@@ -19,6 +19,7 @@
#include <epan/proto.h>
#include <epan/packet_info.h>
#include <epan/tvbparse.h>
+#include <wsutil/ws_assert.h>
#define TVBPARSE_DEBUG_ALL 0xffffffff
@@ -737,7 +738,7 @@ tvbparse_wanted_t* tvbparse_some(const int id,
tvbparse_wanted_t* w = wmem_new0(wmem_epan_scope(), tvbparse_wanted_t);
- g_assert(from <= to);
+ ws_assert(from <= to);
w->condition = cond_some;
w->id = id;
@@ -920,7 +921,7 @@ tvbparse_wanted_t* tvbparse_ft(int id,
return w;
} else {
- g_assert(! "unsupported ftenum" );
+ ws_assert(! "unsupported ftenum" );
return NULL;
}
}
@@ -1153,12 +1154,12 @@ tvbparse_wanted_t* tvbparse_ft_numcmp(int id,
w->control.number.value.i = va_arg(ap,gdouble);
break;
default:
- g_assert(! "comparison unsupported");
+ ws_assert(! "comparison unsupported");
}
w->control.number.extract = extracts[little_endian][ftenum];
- g_assert(w->control.number.extract && "extraction unsupported");
+ ws_assert(w->control.number.extract && "extraction unsupported");
w->id = id;
w->condition = cond_ft_comp;
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index d737fad84f..1caaa3cae0 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -32,6 +32,7 @@
#include "wsutil/unicode-utils.h"
#include "wsutil/nstime.h"
#include "wsutil/time_util.h"
+#include <wsutil/ws_assert.h>
#include "tvbuff.h"
#include "tvbuff-int.h"
#include "strutil.h"
@@ -70,7 +71,7 @@ tvb_new(const struct tvb_ops *ops)
tvbuff_t *tvb;
gsize size = ops->tvb_size;
- g_assert(size >= sizeof(*tvb));
+ ws_assert(size >= sizeof(*tvb));
tvb = (tvbuff_t *) g_slice_alloc(size);
@@ -4433,7 +4434,7 @@ tvb_get_varint(tvbuff_t *tvb, guint offset, guint maxlen, guint64 *value, const
*value = tvb_get_ntoh64(tvb, offset) & G_GUINT64_CONSTANT(0x3FFFFFFFFFFFFFFF);
return 8;
default: /* No Possible */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
diff --git a/epan/uat.c b/epan/uat.c
index ddc4dd258a..6bce2cbc33 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -25,6 +25,7 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
#include <wsutil/report_message.h>
+#include <wsutil/ws_assert.h>
#include <wsutil/filesystem.h>
#include <epan/packet.h>
@@ -64,7 +65,7 @@ uat_t* uat_new(const char* name,
g_ptr_array_add(all_uats,uat);
/* Check params */
- g_assert(name && size && filename && data_ptr && numitems_ptr);
+ ws_assert(name && size && filename && data_ptr && numitems_ptr);
/* Set uat values from inputs */
uat->name = g_strdup(name);
@@ -153,7 +154,7 @@ void uat_update_record(uat_t *uat, const void *record, gboolean valid_rec) {
}
if (pos == uat->raw_data->len) {
/* Data is not within list?! */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
valid = &g_array_index(uat->valid_data, gboolean, pos);
@@ -165,7 +166,7 @@ void uat_swap(uat_t* uat, guint a, guint b) {
void* tmp;
gboolean tmp_bool;
- g_assert( a < uat->raw_data->len && b < uat->raw_data->len );
+ ws_assert( a < uat->raw_data->len && b < uat->raw_data->len );
if (a == b) return;
@@ -184,7 +185,7 @@ void uat_swap(uat_t* uat, guint a, guint b) {
void uat_insert_record_idx(uat_t* uat, guint idx, const void *src_record) {
/* Allow insert before an existing item or append after the last item. */
- g_assert( idx <= uat->raw_data->len );
+ ws_assert( idx <= uat->raw_data->len );
/* Store a copy of the record and invoke copy_cb to clone pointers too. */
g_array_insert_vals(uat->raw_data, idx, src_record, 1);
@@ -203,7 +204,7 @@ void uat_insert_record_idx(uat_t* uat, guint idx, const void *src_record) {
void uat_remove_record_idx(uat_t* uat, guint idx) {
- g_assert( idx < uat->raw_data->len );
+ ws_assert( idx < uat->raw_data->len );
if (uat->free_cb) {
uat->free_cb(UAT_INDEX_PTR(uat,idx));
@@ -295,7 +296,7 @@ char *uat_fld_tostr(void *rec, uat_field_t *f) {
break;
}
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
out = NULL;
break;
}
@@ -350,7 +351,7 @@ static void putfld(FILE* fp, void* rec, uat_field_t* f) {
break;
}
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
g_free(fld_ptr);
diff --git a/epan/value_string.c b/epan/value_string.c
index 237374073e..ab460a64f2 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -18,6 +18,7 @@
#include "proto.h"
#include "to_str.h"
#include "value_string.h"
+#include <wsutil/ws_assert.h>
#include <wsutil/wslog.h>
@@ -370,7 +371,7 @@ _try_val_to_str_index(const guint32 val, value_string_ext *vse)
i = val - vse->_vs_first_value;
if (i < vse->_vs_num_entries) {
- g_assert (val == vse->_vs_p[i].value);
+ ws_assert (val == vse->_vs_p[i].value);
return &(vse->_vs_p[i]);
}
return NULL;
@@ -484,7 +485,7 @@ _try_val_to_str_ext_init(const guint32 val, value_string_ext *vse)
vse->_vs_match2 = _try_val_to_str_index;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -655,7 +656,7 @@ _try_val64_to_str_index(const guint64 val, val64_string_ext *vse)
i = val - vse->_vs_first_value;
if (i < vse->_vs_num_entries) {
- g_assert (val == vse->_vs_p[i].value);
+ ws_assert (val == vse->_vs_p[i].value);
return &(vse->_vs_p[i]);
}
return NULL;
@@ -769,7 +770,7 @@ _try_val64_to_str_ext_init(const guint64 val, val64_string_ext *vse)
vse->_vs_match2 = _try_val64_to_str_index;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
diff --git a/extcap.c b/extcap.c
index bdbf234c06..d955feceef 100644
--- a/extcap.c
+++ b/extcap.c
@@ -42,6 +42,7 @@
#include <wsutil/ws_pipe.h>
#include <wsutil/tempfile.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include "capture_opts.h"
@@ -457,7 +458,7 @@ static gpointer
extcap_run_all(const char *argv[], extcap_run_cb_t output_cb, gsize data_size, guint *count)
{
/* Need enough space for at least 'extcap_path'. */
- g_assert(data_size >= sizeof(char *));
+ ws_assert(data_size >= sizeof(char *));
GSList *paths = extcap_get_extcap_paths();
int i = 0;
diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c
index a8e1795104..7266a24814 100644
--- a/extcap/extcap-base.c
+++ b/extcap/extcap-base.c
@@ -20,6 +20,7 @@
#include <errno.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
/*
* If we have getopt_long() in the system library, include <getopt.h>.
* Otherwise, we're using our own getopt_long() (either because the
@@ -84,9 +85,9 @@ void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename,
{
extcap->exename = g_path_get_basename(exename);
- g_assert(major);
+ ws_assert(major);
if (!minor)
- g_assert(!release);
+ ws_assert(!release);
extcap->version = g_strdup_printf("%s%s%s%s%s",
major,
diff --git a/file.c b/file.c
index b6b31088eb..c8b651a650 100644
--- a/file.c
+++ b/file.c
@@ -23,6 +23,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/json_dumper.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <version_info.h>
#include <wiretap/merge.h>
@@ -153,7 +154,7 @@ cf_callback_invoke(int event, gpointer data)
GList *cb_item = cf_callbacks;
/* there should be at least one interested */
- g_assert(cb_item != NULL);
+ ws_assert(cb_item != NULL);
while (cb_item != NULL) {
cb = (cf_callback_data_t *)cb_item->data;
@@ -191,7 +192,7 @@ cf_callback_remove(cf_callback_t func, gpointer user_data)
cb_item = g_list_next(cb_item);
}
- g_assert_not_reached();
+ ws_assert_not_reached();
}
void
@@ -363,8 +364,8 @@ cf_close(capture_file *cf)
return; /* Nothing to do */
/* Die if we're in the middle of reading a file. */
- g_assert(cf->state != FILE_READ_IN_PROGRESS);
- g_assert(!cf->read_lock);
+ ws_assert(cf->state != FILE_READ_IN_PROGRESS);
+ ws_assert(!cf->read_lock);
cf_callback_invoke(cf_cb_file_closing, cf);
@@ -508,7 +509,7 @@ cf_read(capture_file *cf, gboolean reloading)
column_info *cinfo;
volatile gboolean create_proto_tree;
guint tap_flags;
- gboolean compiled;
+ gboolean compiled _U_;
volatile gboolean is_read_aborted = FALSE;
/* The update_progress_dlg call below might end up accepting a user request to
@@ -528,7 +529,7 @@ cf_read(capture_file *cf, gboolean reloading)
* cf_filter IFF the filter was valid.
*/
compiled = dfilter_compile(cf->dfilter, &dfcode, NULL);
- g_assert(!cf->dfilter || (compiled && dfcode));
+ ws_assert(!cf->dfilter || (compiled && dfcode));
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
@@ -632,7 +633,7 @@ cf_read(capture_file *cf, gboolean reloading)
* session. If that did happen, it could blow up when read_record tries
* to use the destroyed edt.session, so detect it right here.
*/
- g_assert(edt.session == cf->epan);
+ ws_assert(edt.session == cf->epan);
}
if (cf->state == FILE_READ_ABORTED) {
@@ -718,7 +719,7 @@ cf_read(capture_file *cf, gboolean reloading)
}
/* It is safe again to execute redissections. */
- g_assert(cf->read_lock);
+ ws_assert(cf->read_lock);
cf->read_lock = FALSE;
if (is_read_aborted) {
@@ -781,14 +782,14 @@ cf_continue_tail(capture_file *cf, volatile int to_read, wtap_rec *rec,
epan_dissect_t edt;
gboolean create_proto_tree;
guint tap_flags;
- gboolean compiled;
+ gboolean compiled _U_;
/* Compile the current display filter.
* We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
compiled = dfilter_compile(cf->dfilter, &dfcode, NULL);
- g_assert(!cf->dfilter || (compiled && dfcode));
+ ws_assert(!cf->dfilter || (compiled && dfcode));
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
@@ -917,14 +918,14 @@ cf_finish_tail(capture_file *cf, wtap_rec *rec, Buffer *buf, int *err)
epan_dissect_t edt;
gboolean create_proto_tree;
guint tap_flags;
- gboolean compiled;
+ gboolean compiled _U_;
/* Compile the current display filter.
* We assume this will not fail since cf->dfilter is only set in
* cf_filter IFF the filter was valid.
*/
compiled = dfilter_compile(cf->dfilter, &dfcode, NULL);
- g_assert(!cf->dfilter || (compiled && dfcode));
+ ws_assert(!cf->dfilter || (compiled && dfcode));
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
@@ -1316,7 +1317,7 @@ merge_callback(merge_event event, int num _U_,
guint i;
callback_data_t *cb_data = (callback_data_t*) data;
- g_assert(cb_data != NULL);
+ ws_assert(cb_data != NULL);
switch (event) {
@@ -1646,13 +1647,13 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
gboolean create_proto_tree;
guint tap_flags;
gboolean add_to_packet_list = FALSE;
- gboolean compiled;
+ gboolean compiled _U_;
guint32 frames_count;
gboolean queued_rescan_type = RESCAN_NONE;
/* Rescan in progress, clear pending actions. */
cf->redissection_queued = RESCAN_NONE;
- g_assert(!cf->read_lock);
+ ws_assert(!cf->read_lock);
cf->read_lock = TRUE;
wtap_rec_init(&rec);
@@ -1663,7 +1664,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
* cf_filter IFF the filter was valid.
*/
compiled = dfilter_compile(cf->dfilter, &dfcode, NULL);
- g_assert(!cf->dfilter || (compiled && dfcode));
+ ws_assert(!cf->dfilter || (compiled && dfcode));
/* Get the union of the flags for all tap listeners. */
tap_flags = union_of_tap_listener_flags();
@@ -1812,7 +1813,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
/* let's not divide by zero. I should never be started
* with count == 0, so let's assert that
*/
- g_assert(cf->count > 0);
+ ws_assert(cf->count > 0);
progbar_val = (gfloat) count / frames_count;
if (progbar != NULL) {
@@ -1948,9 +1949,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
it's before or after that frame) and make that the current frame.
If the next and previous displayed frames are equidistant from the
selected frame, choose the next one. */
- g_assert(following_frame == NULL ||
+ ws_assert(following_frame == NULL ||
following_frame->num >= selected_frame->num);
- g_assert(preceding_frame == NULL ||
+ ws_assert(preceding_frame == NULL ||
preceding_frame->num <= selected_frame->num);
if (following_frame == NULL) {
/* No frame after the selected frame passed the filter, so we
@@ -2000,7 +2001,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
dfilter_free(dfcode);
/* It is safe again to execute redissections. */
- g_assert(cf->read_lock);
+ ws_assert(cf->read_lock);
cf->read_lock = FALSE;
/* If another rescan (due to dfilter change) or redissection (due to profile
@@ -2167,7 +2168,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
/* let's not divide by zero. I should never be started
* with count == 0, so let's assert that
*/
- g_assert(cf->count > 0);
+ ws_assert(cf->count > 0);
progbar_val = (gfloat) progbar_count / cf->count;
g_snprintf(progbar_status_str, sizeof(progbar_status_str),
@@ -2219,7 +2220,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
destroy_progress_dlg(progbar);
g_timer_destroy(prog_timer);
- g_assert(cf->read_lock);
+ ws_assert(cf->read_lock);
cf->read_lock = FALSE;
wtap_rec_cleanup(&rec);
@@ -2314,7 +2315,7 @@ cf_retap_packets(capture_file *cf)
return CF_READ_ERROR;
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return CF_READ_OK;
}
@@ -3124,7 +3125,7 @@ match_subtree_text(proto_node *node, gpointer data)
size_t c_match = 0;
/* dissection with an invisible proto tree? */
- g_assert(fi);
+ ws_assert(fi);
if (mdata->frame_matched) {
/* We already had a match; don't bother doing any more work. */
@@ -3291,7 +3292,7 @@ cf_find_packet_data(capture_file *cf, const guint8 *string, size_t string_size,
return find_packet(cf, match_wide, &info, dir);
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
} else
@@ -3338,7 +3339,7 @@ match_narrow_and_wide(capture_file *cf, frame_data *fdata,
}
}
else {
- g_assert(i>=c_match);
+ ws_assert(i>=c_match);
i -= (guint32)c_match;
c_match = 0;
}
@@ -3387,7 +3388,7 @@ match_narrow(capture_file *cf, frame_data *fdata,
}
}
else {
- g_assert(i>=c_match);
+ ws_assert(i>=c_match);
i -= (guint32)c_match;
c_match = 0;
}
@@ -3437,7 +3438,7 @@ match_wide(capture_file *cf, frame_data *fdata,
i += 1;
}
else {
- g_assert(i>=(c_match*2));
+ ws_assert(i>=(c_match*2));
i -= (guint32)c_match*2;
c_match = 0;
}
@@ -3481,7 +3482,7 @@ match_binary(capture_file *cf, frame_data *fdata,
}
}
else {
- g_assert(i>=c_match);
+ ws_assert(i>=c_match);
i -= (guint32)c_match;
c_match = 0;
}
@@ -3659,7 +3660,7 @@ find_packet(capture_file *cf, ws_match_function match_function,
/* let's not divide by zero. I should never be started
* with count == 0, so let's assert that
*/
- g_assert(cf->count > 0);
+ ws_assert(cf->count > 0);
progbar_val = (gfloat) count / cf->count;
@@ -3819,7 +3820,7 @@ cf_goto_framenum(capture_file *cf)
if (cf->finfo_selected) {
hfinfo = cf->finfo_selected->hfinfo;
- g_assert(hfinfo);
+ ws_assert(hfinfo);
if (hfinfo->type == FT_FRAMENUM) {
framenum = fvalue_get_uinteger(&cf->finfo_selected->value);
if (framenum != 0)
diff --git a/fileset.c b/fileset.c
index b02810a26d..f8accb3d31 100644
--- a/fileset.c
+++ b/fileset.c
@@ -21,6 +21,7 @@
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
+#include <wsutil/ws_assert.h>
#include <epan/strutil.h>
@@ -124,8 +125,8 @@ fileset_is_file_in_set(const char *fname1, const char *fname2)
/* just to be sure ... */
- g_assert(fileset_filename_match_pattern(fname1));
- g_assert(fileset_filename_match_pattern(fname2));
+ ws_assert(fileset_filename_match_pattern(fname1));
+ ws_assert(fileset_filename_match_pattern(fname2));
dup_f1 = g_strdup(fname1);
dup_f2 = g_strdup(fname2);
diff --git a/mergecap.c b/mergecap.c
index e27c7afdaa..cee3834d69 100644
--- a/mergecap.c
+++ b/mergecap.c
@@ -41,6 +41,7 @@
#include <wsutil/file_util.h>
#include <wsutil/privileges.h>
#include <wsutil/strnatcmp.h>
+#include <wsutil/ws_assert.h>
#include <cli_main.h>
#include <version_info.h>
@@ -388,7 +389,7 @@ main(int argc, char *argv[])
case MERGE_USER_ABORTED:
/* we don't catch SIGINT/SIGTERM (yet?), so we couldn't have aborted */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
case MERGE_ERR_CANT_OPEN_INFILE:
diff --git a/plugins/epan/mate/mate_runtime.c b/plugins/epan/mate/mate_runtime.c
index 30ebe23424..cb19da6e56 100644
--- a/plugins/epan/mate/mate_runtime.c
+++ b/plugins/epan/mate/mate_runtime.c
@@ -11,6 +11,7 @@
*/
#include "mate.h"
+#include <wsutil/ws_assert.h>
typedef struct _mate_range mate_range;
@@ -429,7 +430,7 @@ static void analyze_gop(mate_config* mc, mate_gop* gop) {
}
/** Can't get here because of "breaks" above */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
} /* while */
diff --git a/ringbuffer.c b/ringbuffer.c
index 9526d771a0..21e651a523 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -382,7 +382,6 @@ gboolean ringbuf_is_initialized(void)
const gchar *ringbuf_current_filename(void)
{
- /* g_assert(ringbuf_is_initialized()); */
return rb_data.files[rb_data.curr_file_num % rb_data.num_files].name;
}
diff --git a/sharkd_session.c b/sharkd_session.c
index eb6aa5b603..486e45ffdd 100644
--- a/sharkd_session.c
+++ b/sharkd_session.c
@@ -21,6 +21,7 @@
#include <wsutil/wsjson.h>
#include <wsutil/json_dumper.h>
+#include <wsutil/ws_assert.h>
#include <file.h>
#include <epan/epan_dissect.h>
@@ -2714,7 +2715,7 @@ sharkd_session_process_frame_cb_tree(epan_dissect_t *edt, proto_tree *tree, tvbu
{
const char *severity = try_val_to_str(FI_GET_FLAG(finfo, PI_SEVERITY_MASK), expert_severity_vals);
- g_assert(severity != NULL);
+ ws_assert(severity != NULL);
sharkd_json_value_string("s", severity);
}
diff --git a/sync_pipe_write.c b/sync_pipe_write.c
index b40cd98d91..1400281e5a 100644
--- a/sync_pipe_write.c
+++ b/sync_pipe_write.c
@@ -14,6 +14,7 @@
#include <glib.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
#include "sync_pipe.h"
@@ -28,7 +29,7 @@ pipe_write_header(int pipe_fd, char indicator, int length)
guchar header[1+3]; /* indicator + 3-byte len */
- g_assert(length <= SP_MAX_MSG_LEN);
+ ws_assert(length <= SP_MAX_MSG_LEN);
/* write header (indicator + 3-byte len) */
header[0] = indicator;
diff --git a/tfshark.c b/tfshark.c
index f0bb001da5..fca0122874 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -48,6 +48,7 @@
#include <wsutil/privileges.h>
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <cli_main.h>
#include <version_info.h>
@@ -896,7 +897,7 @@ main(int argc, char *argv[])
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
}
@@ -1239,7 +1240,7 @@ local_wtap_read(capture_file *cf, wtap_rec *file_rec _U_, int *err, gchar **err_
* but the read routine didn't set this packet's
* encapsulation type.
*/
- g_assert(wth->rec.rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
+ ws_assert(wth->rec.rec_header.packet_header.pkt_encap != WTAP_ENCAP_PER_PACKET);
#endif
return TRUE; /* success */
@@ -1647,7 +1648,7 @@ write_preamble(capture_file *cf)
return !ferror(stdout);
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
}
@@ -1947,7 +1948,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
write_psml_columns(edt, stdout, FALSE);
return !ferror(stdout);
case WRITE_FIELDS: /*No non-verbose "fields" format */
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -2009,7 +2010,7 @@ write_finale(void)
return !ferror(stdout);
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
}
diff --git a/tshark.c b/tshark.c
index 73572b4c55..5d72405acd 100644
--- a/tshark.c
+++ b/tshark.c
@@ -59,6 +59,7 @@
#include <wsutil/report_message.h>
#include <wsutil/please_report_bug.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <cli_main.h>
#include <version_info.h>
#include <wiretap/wtap_opttypes.h>
@@ -1974,7 +1975,7 @@ main(int argc, char *argv[])
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
}
@@ -2618,7 +2619,7 @@ capture_input_cfilter_error(capture_session *cap_session, guint i, const char *e
dfilter_t *rfcode = NULL;
interface_options *interface_opts;
- g_assert(i < capture_opts->ifaces->len);
+ ws_assert(i < capture_opts->ifaces->len);
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
if (dfilter_compile(interface_opts->cfilter, &rfcode, NULL) && rfcode != NULL) {
@@ -2659,7 +2660,7 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
}
ws_message("File: \"%s\"", new_file);
- g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
+ ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
/* free the old filename */
if (capture_opts->save_file != NULL) {
@@ -3837,7 +3838,7 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset,
if (print_packet_info) {
/* We're printing packet information; print the information for
this packet. */
- g_assert(edt);
+ ws_assert(edt);
print_packet(cf, edt);
/* If we're doing "line-buffering", flush the standard output
@@ -3895,7 +3896,7 @@ write_preamble(capture_file *cf)
return TRUE;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
}
@@ -4230,7 +4231,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
case WRITE_FIELDS:
if (print_summary) {
/*No non-verbose "fields" format */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (print_details) {
write_fields_proto_tree(output_fields, edt, &cf->cinfo, stdout);
@@ -4241,7 +4242,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
case WRITE_JSON:
if (print_summary)
- g_assert_not_reached();
+ ws_assert_not_reached();
if (print_details) {
write_json_proto_tree(output_fields, print_dissections_expanded,
print_hex, protocolfilter, protocolfilter_flags,
@@ -4252,7 +4253,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
case WRITE_JSON_RAW:
if (print_summary)
- g_assert_not_reached();
+ ws_assert_not_reached();
if (print_details) {
write_json_proto_tree(output_fields, print_dissections_none, TRUE,
protocolfilter, protocolfilter_flags,
@@ -4267,7 +4268,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
return !ferror(stdout);
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (print_hex) {
@@ -4311,7 +4312,7 @@ write_finale(void)
return TRUE;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return FALSE;
}
}
diff --git a/ui/capture.c b/ui/capture.c
index 44e3b02202..b88c86efdd 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -42,6 +42,7 @@
#include "wsutil/str_util.h"
#include <wsutil/filesystem.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
typedef struct if_stat_cache_item_s {
char *name;
@@ -69,7 +70,7 @@ capture_callback_invoke(int event, capture_session *cap_session)
GList *cb_item = capture_callbacks;
/* there should be at least one interested */
- g_assert(cb_item != NULL);
+ ws_assert(cb_item != NULL);
while(cb_item != NULL) {
cb = (capture_callback_data_t *)cb_item->data;
@@ -107,7 +108,7 @@ capture_callback_remove(capture_callback_t func, gpointer user_data)
cb_item = g_list_next(cb_item);
}
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/**
@@ -383,7 +384,7 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
}
ws_message("File: \"%s\"", new_file);
- g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
+ ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
/* free the old filename */
if(capture_opts->save_file != NULL) {
@@ -515,7 +516,7 @@ capture_input_new_packets(capture_session *cap_session, int to_read)
capture_options *capture_opts = cap_session->capture_opts;
int err;
- g_assert(capture_opts->save_file);
+ ws_assert(capture_opts->save_file);
if(capture_opts->real_time_mode) {
/* Read from the capture file the number of records the child told us it added. */
@@ -560,7 +561,7 @@ capture_input_drops(capture_session *cap_session, guint32 dropped, const char* i
ws_info("%u packet%s dropped", dropped, plurality(dropped, "", "s"));
}
- g_assert(cap_session->state == CAPTURE_RUNNING);
+ ws_assert(cap_session->state == CAPTURE_RUNNING);
cf_set_drops_known((capture_file *)cap_session->cf, TRUE);
cf_set_drops((capture_file *)cap_session->cf, dropped);
@@ -574,7 +575,7 @@ capture_input_drops(capture_session *cap_session, guint32 dropped, const char* i
The secondary message might be a null string.
*/
static void
-capture_input_error(capture_session *cap_session, char *error_msg,
+capture_input_error(capture_session *cap_session _U_, char *error_msg,
char *secondary_error_msg)
{
gchar *safe_error_msg;
@@ -582,7 +583,7 @@ capture_input_error(capture_session *cap_session, char *error_msg,
ws_message("Error message from child: \"%s\", \"%s\"", error_msg, secondary_error_msg);
- g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
+ ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
safe_error_msg = simple_dialog_format_message(error_msg);
if (*secondary_error_msg != '\0') {
@@ -619,8 +620,8 @@ capture_input_cfilter_error(capture_session *cap_session, guint i,
ws_message("Capture filter error message from child: \"%s\"", error_message);
- g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
- g_assert(i < capture_opts->ifaces->len);
+ ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
+ ws_assert(i < capture_opts->ifaces->len);
interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
safe_cfilter = simple_dialog_format_message(interface_opts->cfilter);
@@ -665,7 +666,7 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
int err;
ws_message("Capture stopped.");
- g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
+ ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
if (msg != NULL)
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", msg);
@@ -822,7 +823,7 @@ capture_stat_start(capture_options *capture_opts)
device = &g_array_index(capture_opts->all_ifaces, interface_t, i);
if (device->type != IF_PIPE) {
sc_item = g_new0(if_stat_cache_item_t, 1);
- g_assert(device->if_info.name);
+ ws_assert(device->if_info.name);
sc_item->name = g_strdup(device->if_info.name);
sc->cache_list = g_list_prepend(sc->cache_list, sc_item);
}
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c
index 03c4aa744c..47219bd174 100644
--- a/ui/cli/tap-expert.c
+++ b/ui/cli/tap-expert.c
@@ -19,6 +19,7 @@
#include <epan/tap.h>
#include <epan/stat_tap_ui.h>
#include <epan/expert.h>
+#include <wsutil/ws_assert.h>
void register_tap_listener_expert_info(void);
@@ -98,7 +99,7 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U
severity_level = error_level;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return TAP_PACKET_DONT_REDRAW;
}
diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c
index 4f520077d8..beec32bb8a 100644
--- a/ui/cli/tap-follow.c
+++ b/ui/cli/tap-follow.c
@@ -24,6 +24,7 @@
#include <epan/follow.h>
#include <epan/stat_tap_ui.h>
#include <epan/tap.h>
+#include <wsutil/ws_assert.h>
void register_tap_listener_follow(void);
@@ -71,11 +72,11 @@ static const char * follow_str_type(cli_follow_info_t* cli_follow_info)
case SHOW_RAW: return "raw";
case SHOW_YAML: return "yaml";
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
- g_assert_not_reached();
+ ws_assert_not_reached();
return "<unknown-mode>";
}
@@ -245,7 +246,7 @@ static void follow_draw(void *contextp)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* Print data */
@@ -316,7 +317,7 @@ static void follow_draw(void *contextp)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index 16306169fa..e45edcd3e0 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -17,6 +17,7 @@
#include <epan/tap.h>
#include <epan/stat_tap_ui.h>
#include "globals.h"
+#include <wsutil/ws_assert.h>
#define CALC_TYPE_FRAMES 0
#define CALC_TYPE_BYTES 1
@@ -195,7 +196,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* "Can't happen"; see the checks
* in register_io_tap().
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -271,7 +272,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* "Can't happen"; see the checks
* in register_io_tap().
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -340,7 +341,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* "Can't happen"; see the checks
* in register_io_tap().
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -399,7 +400,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* "Can't happen"; see the checks
* in register_io_tap().
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
diff --git a/ui/commandline.c b/ui/commandline.c
index 3972711231..96135f4472 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -35,6 +35,7 @@
#include <ui/cmdarg_err.h>
#include <ui/exit_codes.h>
#include <wsutil/filesystem.h>
+#include <wsutil/ws_assert.h>
#include <epan/ex-opt.h>
#include <epan/packet.h>
@@ -521,7 +522,7 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
exit_application(1);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
case PREFS_SET_OBSOLETE:
@@ -530,7 +531,7 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
exit_application(1);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
}
diff --git a/ui/console.c b/ui/console.c
index 5092f67073..0e495254c7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -15,6 +15,7 @@
#include "epan/prefs.h"
#include "wsutil/time_util.h"
+#include <wsutil/ws_assert.h>
#include "console.h"
diff --git a/ui/decode_as_utils.c b/ui/decode_as_utils.c
index b3a1ddc823..5357b44d52 100644
--- a/ui/decode_as_utils.c
+++ b/ui/decode_as_utils.c
@@ -23,6 +23,7 @@
#include "wsutil/file_util.h"
#include "wsutil/filesystem.h"
+#include <wsutil/ws_assert.h>
#include "ui/cmdarg_err.h"
#include "version_info.h"
@@ -63,8 +64,8 @@ display_dissector_names(const gchar *table _U_, gpointer handle, gpointer output
if (proto_id != -1) {
proto_filter_name = proto_get_protocol_filter_name(proto_id);
proto_ui_name = proto_get_protocol_name(proto_id);
- g_assert(proto_filter_name != NULL);
- g_assert(proto_ui_name != NULL);
+ ws_assert(proto_filter_name != NULL);
+ ws_assert(proto_ui_name != NULL);
if ((prev_display_dissector_name == NULL) ||
(strcmp(prev_display_dissector_name, proto_filter_name) != 0)) {
@@ -141,14 +142,14 @@ find_protocol_name_func(const gchar *table _U_, gpointer handle, gpointer user_d
const gchar *protocol_filter_name;
protocol_name_search_t search_info;
- g_assert(handle);
+ ws_assert(handle);
search_info = (protocol_name_search_t)user_data;
proto_id = dissector_handle_get_protocol_index((dissector_handle_t)handle);
if (proto_id != -1) {
protocol_filter_name = proto_get_protocol_filter_name(proto_id);
- g_assert(protocol_filter_name != NULL);
+ ws_assert(protocol_filter_name != NULL);
if (strcmp(protocol_filter_name, search_info->searched_name) == 0) {
/* Found a match */
if (search_info->nb_match == 0) {
@@ -186,9 +187,9 @@ gboolean decode_as_command_option(const gchar *cl_param)
/* The following code will allocate and copy the command-line options in a string pointed by decoded_param */
- g_assert(cl_param);
+ ws_assert(cl_param);
decoded_param = g_strdup(cl_param);
- g_assert(decoded_param);
+ ws_assert(decoded_param);
/* The lines below will parse this string (modifying it) to extract all
@@ -358,7 +359,7 @@ gboolean decode_as_command_option(const gchar *cl_param)
default:
/* There are currently no dissector tables with any types other
than the ones listed above. */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (remaining_param == NULL) {
@@ -482,7 +483,7 @@ gboolean decode_as_command_option(const gchar *cl_param)
default:
/* There are currently no dissector tables with any types other
than the ones listed above. */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
g_free(decoded_param); /* "Decode As" rule has been successfully added */
return TRUE;
diff --git a/ui/dissect_opts.c b/ui/dissect_opts.c
index 2f6a75f4af..b40e569c16 100644
--- a/ui/dissect_opts.c
+++ b/ui/dissect_opts.c
@@ -33,6 +33,7 @@
#include <ui/clopts_common.h>
#include <ui/cmdarg_err.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
#include "ui/dissect_opts.h"
@@ -146,7 +147,7 @@ dissect_opts_handle_opt(int opt, char *optarg_str_p)
break;
default:
/* the caller is responsible to send us only the right opt's */
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return TRUE;
}
diff --git a/ui/filter_files.c b/ui/filter_files.c
index e3647ac8b4..ed771fab61 100644
--- a/ui/filter_files.c
+++ b/ui/filter_files.c
@@ -21,6 +21,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/report_message.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include "ui/filter_files.h"
@@ -144,7 +145,7 @@ read_filter_list(filter_list_type_t list_type)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
@@ -383,7 +384,7 @@ get_filter_list(filter_list_type_t list_type)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
flpp = NULL;
}
return flpp;
@@ -461,7 +462,7 @@ save_filter_list(filter_list_type_t list_type)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
diff --git a/ui/help_url.c b/ui/help_url.c
index 2d5940df16..aa45343d80 100644
--- a/ui/help_url.c
+++ b/ui/help_url.c
@@ -18,6 +18,7 @@
#include "help_url.h"
#include "urls.h"
#include "wsutil/filesystem.h"
+#include <wsutil/ws_assert.h>
// To do:
// - Automatically generate part or all of this, e.g. by parsing
@@ -303,7 +304,7 @@ topic_action_url(topic_action_e action)
case(TOPIC_ACTION_NONE):
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
url = g_strdup(WS_HOME_PAGE_URL);
}
diff --git a/ui/io_graph_item.c b/ui/io_graph_item.c
index e479d4ff4f..b4047a9832 100644
--- a/ui/io_graph_item.c
+++ b/ui/io_graph_item.c
@@ -40,7 +40,7 @@ GString *check_field_unit(const char *field_name, int *hf_index, io_graph_item_u
if (item_unit >= IOG_ITEM_UNIT_CALC_SUM) {
header_field_info *hfi;
- const char *item_unit_names[NUM_IOG_ITEM_UNITS] = {
+ const char *item_unit_names[NUM_IOG_ITEM_UNITS+1] = {
"Packets",
"Bytes",
"Bits",
@@ -50,7 +50,8 @@ GString *check_field_unit(const char *field_name, int *hf_index, io_graph_item_u
"MAX",
"MIN",
"AVG",
- "LOAD"
+ "LOAD",
+ NULL
};
/* There was no field specified */
@@ -104,7 +105,7 @@ GString *check_field_unit(const char *field_name, int *hf_index, io_graph_item_u
case IOG_ITEM_UNIT_CALC_LOAD:
break;
default:
- g_assert(item_unit < NUM_IOG_ITEM_UNITS);
+ ws_assert(item_unit < NUM_IOG_ITEM_UNITS);
err_str = g_string_new("");
g_string_printf(err_str, "\"%s\" is a relative-time field. %s calculations are not supported on it.",
field_name,
diff --git a/ui/io_graph_item.h b/ui/io_graph_item.h
index f34b8a7ea3..5dd42dcbbe 100644
--- a/ui/io_graph_item.h
+++ b/ui/io_graph_item.h
@@ -14,6 +14,7 @@
#define __IO_GRAPH_ITEM_H__
#include "cfile.h"
+#include <wsutil/ws_assert.h>
#ifdef __cplusplus
extern "C" {
@@ -381,7 +382,7 @@ update_io_graph_item(io_graph_item_t *items, int idx, packet_info *pinfo, epan_d
* type is compatible" check in
* filter_callback().
*/
- g_assert_not_reached();
+ ws_assert_not_reached();
}
break;
}
diff --git a/ui/packet_range.c b/ui/packet_range.c
index ff62215271..7696e87f23 100644
--- a/ui/packet_range.c
+++ b/ui/packet_range.c
@@ -21,6 +21,8 @@
#include "packet_range.h"
+#include <wsutil/ws_assert.h>
+
/* (re-)calculate the packet counts (except the user specified range) */
static void packet_range_calc(packet_range_t *range) {
guint32 framenum;
@@ -54,7 +56,7 @@ static void packet_range_calc(packet_range_t *range) {
range->displayed_ignored_mark_range_cnt = 0;
range->displayed_ignored_user_range_cnt = 0;
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
/* XXX - this doesn't work unless you have a full set of frame_data
* structures for all packets in the capture, which is not,
@@ -160,7 +162,7 @@ static void packet_range_calc_user(packet_range_t *range) {
range->displayed_user_range_cnt = 0;
range->displayed_ignored_user_range_cnt = 0;
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
/* XXX - this doesn't work unless you have a full set of frame_data
* structures for all packets in the capture, which is not,
@@ -210,7 +212,7 @@ static void packet_range_calc_selection(packet_range_t *range) {
range->displayed_selection_range_cnt = 0;
range->displayed_ignored_selection_range_cnt = 0;
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
if (range->cf->provider.frames != NULL) {
for (framenum = 1; framenum <= range->cf->count; framenum++) {
@@ -292,7 +294,7 @@ range_process_e packet_range_process_packet(packet_range_t *range, frame_data *f
return range_process_next;
}
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
switch(range->process) {
case(range_process_all):
@@ -329,7 +331,7 @@ range_process_e packet_range_process_packet(packet_range_t *range, frame_data *f
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* This packet has to pass the display filter but didn't?
@@ -361,7 +363,7 @@ void packet_range_convert_str(packet_range_t *range, const gchar *es)
if (range->user_range != NULL)
wmem_free(NULL, range->user_range);
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
ret = range_convert_str(NULL, &new_range, es, range->cf->count);
if (ret != CVT_NO_ERROR) {
@@ -388,7 +390,7 @@ void packet_range_convert_selection_str(packet_range_t *range, const char *es)
if (range->selection_range != NULL)
wmem_free(NULL, range->selection_range);
- g_assert(range->cf != NULL);
+ ws_assert(range->cf != NULL);
ret = range_convert_str(NULL, &new_range, es, range->cf->count);
if (ret != CVT_NO_ERROR) {
diff --git a/ui/profile.c b/ui/profile.c
index 4fc2c2bccb..e75150e24e 100644
--- a/ui/profile.c
+++ b/ui/profile.c
@@ -24,6 +24,7 @@
#include "ui/recent.h"
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
static GList *current_profiles = NULL;
static GList *edited_profiles = NULL;
@@ -268,7 +269,7 @@ empty_profile_list(gboolean edit_list)
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
}
- g_assert(g_list_length(*flpp) == 0);
+ ws_assert(g_list_length(*flpp) == 0);
if ( ! edited_profiles )
edited_profiles = NULL;
}
@@ -279,7 +280,7 @@ empty_profile_list(gboolean edit_list)
*flpp = remove_profile_entry(*flpp, g_list_first(*flpp));
}
- g_assert(g_list_length(*flpp) == 0);
+ ws_assert(g_list_length(*flpp) == 0);
if ( ! current_profiles )
current_profiles = NULL;
}
diff --git a/ui/proto_hier_stats.c b/ui/proto_hier_stats.c
index ddc6e62ba5..31583b5491 100644
--- a/ui/proto_hier_stats.c
+++ b/ui/proto_hier_stats.c
@@ -18,6 +18,7 @@
#include "ui/progress_dlg.h"
#include "epan/epan_dissect.h"
#include "epan/proto.h"
+#include <wsutil/ws_assert.h>
/* Update the progress bar this many times when scanning the packet list. */
#define N_PROGBAR_UPDATES 100
@@ -88,7 +89,7 @@ process_node(proto_node *ptree_node, GNode *parent_stat_node, ph_stats_t *ps)
finfo = PNODE_FINFO(ptree_node);
/* We don't fake protocol nodes we expect them to have a field_info.
* Dissection with faked proto tree? */
- g_assert(finfo);
+ ws_assert(finfo);
/* If the field info isn't related to a protocol but to a field,
* don't count them, as they don't belong to any protocol.
@@ -255,7 +256,7 @@ ph_stats_new(capture_file *cf)
/* let's not divide by zero. I should never be started
* with count == 0, so let's assert that
*/
- g_assert(cf->count > 0);
+ ws_assert(cf->count > 0);
progbar_val = (gfloat) count / cf->count;
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 0f60ad972f..0cc3af7b74 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -29,6 +29,7 @@
#include "ui/alert_box.h"
#include "ui/simple_dialog.h"
#include <wsutil/utf8_entities.h>
+#include <wsutil/ws_assert.h>
#include "wsutil/file_util.h"
#include "wsutil/str_util.h"
@@ -111,7 +112,7 @@ FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_
follower_ = get_follow_by_name("SIP");
break;
default :
- g_assert_not_reached();
+ ws_assert_not_reached();
}
memset(&follow_info_, 0, sizeof(follow_info_));
@@ -537,7 +538,7 @@ FollowStreamDialog::readStream()
break;
default :
- g_assert_not_reached();
+ ws_assert_not_reached();
ret = (frs_return_t)0;
break;
}
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index df7a539e24..8266c1cb2e 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -17,6 +17,7 @@
#include "epan/uat-int.h"
#include <wsutil/utf8_entities.h>
+#include <wsutil/ws_assert.h>
#include <ui/qt/utils/qt_ui_utils.h>
@@ -2095,7 +2096,7 @@ void IOGraph::reloadValueUnitField()
// Check if a packet is available at the given interval (idx).
bool IOGraph::hasItemToShow(int idx, double value) const
{
- g_assert(idx < max_io_items_);
+ ws_assert(idx < max_io_items_);
bool result = false;
@@ -2141,7 +2142,7 @@ void IOGraph::setInterval(int interval)
// Get the value at the given interval (idx) for the current value unit.
double IOGraph::getItemValue(int idx, const capture_file *cap_file) const
{
- g_assert(idx < max_io_items_);
+ ws_assert(idx < max_io_items_);
return get_io_graph_item(items_, val_units_, idx, hf_index_, cap_file, interval_, cur_idx_);
}
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 119950cb86..4044080979 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -22,6 +22,7 @@ DIAG_ON(frame-larger-than=)
#include <epan/epan_dissect.h>
#include <wsutil/filesystem.h>
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include <version_info.h>
#include <epan/prefs.h>
#include <epan/stats_tree_priv.h>
@@ -1380,7 +1381,7 @@ bool MainWindow::saveCaptureFile(capture_file *cf, bool dont_reopen) {
default:
/* Squelch warnings that discard_comments is being used
uninitialized. */
- g_assert_not_reached();
+ ws_assert_not_reached();
return false;
}
diff --git a/ui/qt/main_window_layout.cpp b/ui/qt/main_window_layout.cpp
index 4722938405..8b770c0f8c 100644
--- a/ui/qt/main_window_layout.cpp
+++ b/ui/qt/main_window_layout.cpp
@@ -29,6 +29,8 @@
#include <ui/qt/packet_diagram.h>
#include <ui/qt/proto_tree.h>
+#include <wsutil/ws_assert.h>
+
/*
* The generated Ui_MainWindow::setupUi() can grow larger than our configured limit,
* so turn off -Wframe-larger-than= for ui_main_window.h.
@@ -60,7 +62,7 @@ QWidget* MainWindow::getLayoutWidget(layout_pane_content_e type) {
case layout_pane_content_pdiagram:
return packet_diagram_;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return NULL;
}
}
@@ -116,7 +118,7 @@ void MainWindow::layoutPanes()
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
switch(prefs.gui_layout_type) {
@@ -139,7 +141,7 @@ void MainWindow::layoutPanes()
parents[2] = &master_split_;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (parents[0] == &extra_split_) {
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 609f7b5673..7ed97620b0 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -45,6 +45,7 @@ DIAG_ON(frame-larger-than=)
#include "wsutil/file_util.h"
#include "wsutil/filesystem.h"
#include <wsutil/wslog.h>
+#include <wsutil/ws_assert.h>
#include "epan/addr_resolv.h"
#include "epan/column.h"
@@ -463,7 +464,7 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
}
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
@@ -492,7 +493,7 @@ void MainWindow::queuedFilterAction(QString action_filter, FilterAction::Action
break;
}
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
}
@@ -960,10 +961,10 @@ void MainWindow::pipeTimeout() {
}
void MainWindow::pipeActivated(int source) {
-#ifdef _WIN32
Q_UNUSED(source)
-#else
- g_assert(source == pipe_source_);
+
+#ifndef _WIN32
+ ws_assert(source == pipe_source_);
pipe_notifier_->setEnabled(false);
if (pipe_input_cb_(pipe_source_, pipe_user_data_)) {
diff --git a/ui/qt/models/decode_as_model.cpp b/ui/qt/models/decode_as_model.cpp
index 695ca48b23..e4508f9338 100644
--- a/ui/qt/models/decode_as_model.cpp
+++ b/ui/qt/models/decode_as_model.cpp
@@ -21,6 +21,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_assert.h>
#include <QVector>
@@ -199,7 +200,7 @@ QVariant DecodeAsModel::headerData(int section, Qt::Orientation orientation, int
case colProtocol:
return tr("Current");
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return QVariant();
@@ -548,7 +549,7 @@ QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value)
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
entry_str = QString("%1").arg(int_to_qstring(num_val, width, 16));
@@ -578,7 +579,7 @@ QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value)
return "0";
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
return entry_str;
diff --git a/ui/qt/models/uat_delegate.cpp b/ui/qt/models/uat_delegate.cpp
index 11eb5fd0ab..20526a0931 100644
--- a/ui/qt/models/uat_delegate.cpp
+++ b/ui/qt/models/uat_delegate.cpp
@@ -12,6 +12,7 @@
#include <ui/qt/models/uat_delegate.h>
#include "epan/value_string.h"
+#include <wsutil/ws_assert.h>
#include <QComboBox>
#include <QEvent>
#include <QFileDialog>
@@ -128,7 +129,7 @@ QWidget *UatDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
break;
}
diff --git a/ui/qt/models/voip_calls_info_model.cpp b/ui/qt/models/voip_calls_info_model.cpp
index 049c38f4a2..262f6a610b 100644
--- a/ui/qt/models/voip_calls_info_model.cpp
+++ b/ui/qt/models/voip_calls_info_model.cpp
@@ -9,6 +9,7 @@
#include "voip_calls_info_model.h"
#include <wsutil/utf8_entities.h>
+#include <wsutil/ws_assert.h>
#include <ui/qt/utils/qt_ui_utils.h>
#include <QDateTime>
@@ -101,7 +102,7 @@ QVariant VoipCallsInfoModel::data(const QModelIndex &index, int role) const
return call_info->call_comment;
}
case ColumnCount:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
return QVariant();
}
@@ -131,7 +132,7 @@ QVariant VoipCallsInfoModel::headerData(int section, Qt::Orientation orientation
case Comments:
return tr("Comments");
case ColumnCount:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
return QVariant();
diff --git a/ui/qt/packet_range_group_box.cpp b/ui/qt/packet_range_group_box.cpp
index 00206af5ee..935de11b28 100644
--- a/ui/qt/packet_range_group_box.cpp
+++ b/ui/qt/packet_range_group_box.cpp
@@ -9,6 +9,7 @@
#include "packet_range_group_box.h"
#include <ui_packet_range_group_box.h>
+#include <wsutil/ws_assert.h>
PacketRangeGroupBox::PacketRangeGroupBox(QWidget *parent) :
QGroupBox(parent),
@@ -211,7 +212,7 @@ void PacketRangeGroupBox::updateCounts() {
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
return;
}
@@ -238,7 +239,7 @@ void PacketRangeGroupBox::updateCounts() {
displayed_ignored_cnt = range_->displayed_ignored_user_range_cnt;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
if (displayed_checked)
diff --git a/ui/qt/service_response_time_dialog.cpp b/ui/qt/service_response_time_dialog.cpp
index 0b23cc803d..4e3b4cbd65 100644
--- a/ui/qt/service_response_time_dialog.cpp
+++ b/ui/qt/service_response_time_dialog.cpp
@@ -12,7 +12,7 @@
#include "file.h"
#include <epan/tap.h>
-
+#include <wsutil/ws_assert.h>
#include <ui/service_response_time.h>
#include "rpc_service_response_time_dialog.h"
@@ -332,7 +332,7 @@ const QString ServiceResponseTimeDialog::filterExpression()
QTreeWidgetItem *ti = statsTreeWidget()->selectedItems()[0];
if (ti->type() == srt_row_type_) {
SrtTableTreeWidgetItem *srtt_ti = static_cast<SrtTableTreeWidgetItem *>(ti->parent());
- g_assert(srtt_ti);
+ ws_assert(srtt_ti);
QString field = srtt_ti->filterField();
QString value = ti->text(SRT_COLUMN_INDEX);
if (!field.isEmpty() && !value.isEmpty()) {
diff --git a/ui/voip_calls.c b/ui/voip_calls.c
index 99738a4111..ed40be24f8 100644
--- a/ui/voip_calls.c
+++ b/ui/voip_calls.c
@@ -55,6 +55,7 @@
#include "ui/voip_calls.h"
#include "wsutil/glib-compat.h"
+#include <wsutil/ws_assert.h>
#define DUMP_PTR1(p) printf("#=> %p\n",(void *)p)
#define DUMP_PTR2(p) printf("==> %p\n",(void *)p)
@@ -2042,7 +2043,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
while (list)
{
tmp_listinfo=(voip_calls_info_t *)list->data;
- g_assert(tmp_listinfo != NULL);
+ ws_assert(tmp_listinfo != NULL);
if (tmp_listinfo->protocol == VOIP_H323) {
tmp_h323info = (h323_calls_info_t *)tmp_listinfo->prot_info;
if (tmp_h323info->requestSeqNum == pi->requestSeqNum) {
@@ -2060,7 +2061,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
tmp_listinfo=(voip_calls_info_t *)list->data;
if (tmp_listinfo->protocol == VOIP_H323) {
tmp_h323info = (h323_calls_info_t *)tmp_listinfo->prot_info;
- g_assert(tmp_h323info != NULL);
+ ws_assert(tmp_h323info != NULL);
if ( (memcmp(tmp_h323info->guid, &guid_allzero, GUID_LEN) != 0) && (memcmp(tmp_h323info->guid, &pi->guid,GUID_LEN)==0) ) {
callsinfo = (voip_calls_info_t*)(list->data);
break;
@@ -2088,7 +2089,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
callsinfo->free_prot_info = free_h225_info;
tmp_h323info = (h323_calls_info_t *)callsinfo->prot_info;
- g_assert(tmp_h323info != NULL);
+ ws_assert(tmp_h323info != NULL);
tmp_h323info->guid = (e_guid_t *)g_memdup2(&pi->guid, sizeof pi->guid);
/* DUMP_PTR1(tmp_h323info->guid); */
@@ -2120,7 +2121,7 @@ h225_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
/* XXX: it is supposed to be initialized isn't it? */
- g_assert(tmp_h323info != NULL);
+ ws_assert(tmp_h323info != NULL);
/* change the status */
if (pi->msg_type == H225_CS) {
@@ -2756,7 +2757,7 @@ mgcp_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
g_queue_push_tail(tapinfo->callsinfos, callsinfo);
}
- g_assert(tmp_mgcpinfo != NULL);
+ ws_assert(tmp_mgcpinfo != NULL);
/* change call state and add to graph */
switch (pi->mgcp_type)
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index f873cba81c..9b03fadf34 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -26,6 +26,7 @@
#include "wsutil/file_util.h"
#include "wsutil/str_util.h"
#include "wsutil/unicode-utils.h"
+#include <wsutil/ws_assert.h>
#include "wsutil/filesystem.h"
#include "epan/prefs.h"
@@ -459,7 +460,7 @@ win32_merge_file (HWND h_wnd, const wchar_t *title, GString *file_name, GString
*merge_type = -1;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
}
@@ -630,7 +631,7 @@ print_update_dynamic(HWND dlg_hwnd, print_args_t *args) {
args->print_dissections = print_dissections_expanded;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
EnableWindow(cur_ctrl, TRUE);
} else {
@@ -684,7 +685,7 @@ format_handle_wm_initdialog(HWND dlg_hwnd, print_args_t *args) {
SendMessage(cur_ctrl, CB_SETCURSEL, 2, 0);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* Set the "Packet bytes" box */
@@ -1510,7 +1511,7 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) {
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
/* RANGE_REMOVE_IGNORED_PACKETS */
@@ -1536,7 +1537,7 @@ range_update_dynamics(HWND dlg_hwnd, packet_range_t *range) {
displayed_ignored_cnt = range->displayed_ignored_user_range_cnt;
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_REMOVE_IGN_CB);
@@ -1597,7 +1598,7 @@ range_handle_wm_initdialog(HWND dlg_hwnd, packet_range_t *range) {
cur_ctrl = GetDlgItem(dlg_hwnd, EWFD_RANGE_BTN);
break;
default:
- g_assert_not_reached();
+ ws_assert_not_reached();
}
SendMessage(cur_ctrl, BM_SETCHECK, TRUE, 0);
}