aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-02-27 03:38:15 +0000
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-05-24 01:13:19 +0000
commit9ba97d12d6b1b2e6e06311375c07ce975fc08205 (patch)
tree33343e07bc84b8d930546c4e91a987712edb021b /epan
parentde00cdd5129c30fdd138fe49da2003a5d3f74d8f (diff)
Add ws_debug() and use it
Replace most instances of ws_debug_printf() except in epan/dissectors and dissector plugins. Some replacements use printf(), some use ws_debug(), and some were removed because they were dead or judged to be temporary.
Diffstat (limited to 'epan')
-rw-r--r--epan/asn1.c7
-rw-r--r--epan/column.c5
-rw-r--r--epan/dfilter/dfilter-macro.c61
-rw-r--r--epan/dfilter/dfilter.c7
-rw-r--r--epan/dfilter/semcheck.c8
-rw-r--r--epan/dissectors/packet-beep.c2
-rw-r--r--epan/dissectors/packet-ber.c2
-rw-r--r--epan/dissectors/packet-epl-profile-parser.c2
-rw-r--r--epan/dissectors/packet-giop.c2
-rw-r--r--epan/dissectors/packet-protobuf.c2
-rw-r--r--epan/dissectors/packet-tacacs.c2
-rw-r--r--epan/dissectors/packet-tibia.c2
-rw-r--r--epan/dissectors/packet-vpp.c2
-rw-r--r--epan/except.c17
-rw-r--r--epan/oids.c3
-rw-r--r--epan/packet.c27
-rw-r--r--epan/proto.c43
-rw-r--r--epan/reedsolomon.c19
-rw-r--r--epan/tvbuff_zlib.c22
-rw-r--r--epan/wmem/wmem_interval_tree.c3
-rw-r--r--epan/wmem/wmem_tree.c11
-rw-r--r--epan/ws_printf.h22
-rw-r--r--epan/wslua/init_wslua.c4
-rw-r--r--epan/wslua/wslua_internals.c6
24 files changed, 140 insertions, 141 deletions
diff --git a/epan/asn1.c b/epan/asn1.c
index 26ee0cd82e..0b06da9761 100644
--- a/epan/asn1.c
+++ b/epan/asn1.c
@@ -16,10 +16,6 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
-#ifdef DEBUG
-#include <stdio.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
-#endif
#include <epan/packet.h>
@@ -260,9 +256,6 @@ double asn1_get_real(const guint8 *real_ptr, gint len) {
p++;
}
val = (double) S * N * pow(2, F) * pow(B, E);
-#ifdef DEBUG
- ws_debug_printf("S = %d, N = %lu, F = %u, B = %u, E = %d -> %f\n", S, N, F, B, E, val);
-#endif
} else if (octet & 0x40) { /* SpecialRealValue */
switch (octet & 0x3F) {
case 0x00: val = HUGE_VAL; break;
diff --git a/epan/column.c b/epan/column.c
index 922f03daea..e8b91b37d6 100644
--- a/epan/column.c
+++ b/epan/column.c
@@ -23,7 +23,6 @@
#include <epan/dfilter/dfilter.h>
#include <epan/column.h>
#include <epan/packet.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
/* Given a format number (as defined in column-utils.h), returns its equivalent
string */
@@ -182,10 +181,10 @@ column_dump_column_formats(void)
gint fmt;
for (fmt = 0; fmt < NUM_COL_FMTS; fmt++) {
- ws_debug_printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
+ printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
}
- ws_debug_printf("\nFor example, to print Wireshark's default columns with tshark:\n\n"
+ printf("\nFor example, to print Wireshark's default columns with tshark:\n\n"
#ifdef _WIN32
"tshark.exe -o \"gui.column.format:"
"\\\"No.\\\",\\\"%%m\\\","
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c
index 2b654b85bf..2229080db1 100644
--- a/epan/dfilter/dfilter-macro.c
+++ b/epan/dfilter/dfilter-macro.c
@@ -12,7 +12,6 @@
#ifdef DUMP_DFILTER_MACRO
#include <stdio.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#endif
#include <string.h>
@@ -608,70 +607,70 @@ void dfilter_macro_get_uat(uat_t **dfmu_ptr_ptr) {
void dump_dfilter_macro_t(const dfilter_macro_t *m, const char *function, const char *file, int line)
{
- ws_debug_printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
+ printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
if(m == NULL) {
- ws_debug_printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line);
- ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
+ printf(" dfilter_macro_t * == NULL! (via: %s(): %s:%d)\n", function, file, line);
+ printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
return;
}
- ws_debug_printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line);
+ printf("DUMP of dfilter_macro_t: %p (via: %s(): %s:%d)\n", m, function, file, line);
- ws_debug_printf(" &dfilter_macro->name == %p\n", &m->name);
+ printf(" &dfilter_macro->name == %p\n", &m->name);
if(m->name == NULL) {
- ws_debug_printf(" ->name == NULL\n");
+ printf(" ->name == NULL\n");
} else {
- ws_debug_printf(" ->name == %p\n", m->name);
- ws_debug_printf(" ->name == <%s>\n", m->name);
+ printf(" ->name == %p\n", m->name);
+ printf(" ->name == <%s>\n", m->name);
}
- ws_debug_printf(" &dfilter_macro->text == %p\n", &m->text);
+ printf(" &dfilter_macro->text == %p\n", &m->text);
if(m->text == NULL) {
- ws_debug_printf(" ->text == NULL\n");
+ printf(" ->text == NULL\n");
} else {
- ws_debug_printf(" ->text == %p\n", m->text);
- ws_debug_printf(" ->text == <%s>\n", m->text);
+ printf(" ->text == %p\n", m->text);
+ printf(" ->text == <%s>\n", m->text);
}
- ws_debug_printf(" &dfilter_macro->usable == %p\n", &m->usable);
- ws_debug_printf(" ->usable == %u\n", m->usable);
+ printf(" &dfilter_macro->usable == %p\n", &m->usable);
+ printf(" ->usable == %u\n", m->usable);
- ws_debug_printf(" &dfilter_macro->parts == %p\n", &m->parts);
+ printf(" &dfilter_macro->parts == %p\n", &m->parts);
if(m->parts == NULL) {
- ws_debug_printf(" ->parts == NULL\n");
+ printf(" ->parts == NULL\n");
} else {
int i = 0;
while (m->parts[i]) {
- ws_debug_printf(" ->parts[%d] == %p\n", i, m->parts[i]);
- ws_debug_printf(" ->parts[%d] == <%s>\n", i, m->parts[i]);
+ printf(" ->parts[%d] == %p\n", i, m->parts[i]);
+ printf(" ->parts[%d] == <%s>\n", i, m->parts[i]);
i++;
}
- ws_debug_printf(" ->parts[%d] == NULL\n", i);
+ printf(" ->parts[%d] == NULL\n", i);
}
- ws_debug_printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos);
+ printf(" &dfilter_macro->args_pos == %p\n", &m->args_pos);
if(m->args_pos == NULL) {
- ws_debug_printf(" ->args_pos == NULL\n");
+ printf(" ->args_pos == NULL\n");
} else {
- ws_debug_printf(" ->args_pos == %p\n", m->args_pos);
- /*ws_debug_printf(" ->args_pos == <%?>\n", m->args_pos);*/
+ printf(" ->args_pos == %p\n", m->args_pos);
+ /*printf(" ->args_pos == <%?>\n", m->args_pos);*/
}
- ws_debug_printf(" &dfilter_macro->argc == %p\n", &m->argc);
- ws_debug_printf(" ->argc == %d\n", m->argc);
+ printf(" &dfilter_macro->argc == %p\n", &m->argc);
+ printf(" ->argc == %d\n", m->argc);
- ws_debug_printf(" &dfilter_macro->priv == %p\n", &m->priv);
+ printf(" &dfilter_macro->priv == %p\n", &m->priv);
if(m->priv == NULL) {
- ws_debug_printf(" ->priv == NULL\n");
+ printf(" ->priv == NULL\n");
} else {
- ws_debug_printf(" ->priv == %p\n", m->priv);
- ws_debug_printf(" ->priv == <%s>\n", (char *)m->priv);
+ printf(" ->priv == %p\n", m->priv);
+ printf(" ->priv == <%s>\n", (char *)m->priv);
}
- ws_debug_printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
+ printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
}
#endif
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c
index 8362122c2e..850c27bdc0 100644
--- a/epan/dfilter/dfilter.c
+++ b/epan/dfilter/dfilter.c
@@ -20,7 +20,6 @@
#include "dfilter.h"
#include "dfilter-macro.h"
#include "scanner_lex.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#define DFILTER_TOKEN_ID_OFFSET 1
@@ -444,12 +443,12 @@ dfilter_dump(dfilter_t *df)
dfvm_dump(stdout, df);
if (df->deprecated && df->deprecated->len) {
- ws_debug_printf("\nDeprecated tokens: ");
+ printf("\nDeprecated tokens: ");
for (i = 0; i < df->deprecated->len; i++) {
- ws_debug_printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i));
+ printf("%s\"%s\"", sep, (char *) g_ptr_array_index(df->deprecated, i));
sep = ", ";
}
- ws_debug_printf("\n");
+ printf("\n");
}
}
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index c1be5f3a56..dc3a947f9d 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -21,10 +21,6 @@
#include <epan/exceptions.h>
#include <epan/packet.h>
-#ifdef DEBUG_dfilter
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
-#endif
-
#include <ftypes/ftypes-int.h>
/* Enable debug logging by defining AM_CFLAGS
@@ -33,8 +29,8 @@
#ifdef DEBUG_dfilter
#define DebugLog(x) \
- ws_debug_printf("%s:%u: ", __FILE__, (unsigned int)__LINE__); \
- ws_debug_printf x; \
+ printf("%s:%u: ", __FILE__, (unsigned int)__LINE__); \
+ printf x; \
fflush(stdout)
#else
#define DebugLog(x) ;
diff --git a/epan/dissectors/packet-beep.c b/epan/dissectors/packet-beep.c
index 14b531b477..f35097a0ba 100644
--- a/epan/dissectors/packet-beep.c
+++ b/epan/dissectors/packet-beep.c
@@ -24,7 +24,7 @@
#include <epan/expert.h>
#include <epan/proto_data.h>
#if defined(DEBUG_BEEP_HASH)
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <epan/ws_printf.h>
#endif
#define TCP_PORT_BEEP 10288 /* Don't think this is IANA registered */
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 07c2b4b7bf..893e60a869 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -56,7 +56,7 @@
#include <epan/decode_as.h>
#include <wiretap/wtap.h>
#ifdef DEBUG_BER
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <epan/ws_printf.h>
#endif
#include "packet-ber.h"
diff --git a/epan/dissectors/packet-epl-profile-parser.c b/epan/dissectors/packet-epl-profile-parser.c
index 06e34858e4..108516aba0 100644
--- a/epan/dissectors/packet-epl-profile-parser.c
+++ b/epan/dissectors/packet-epl-profile-parser.c
@@ -21,7 +21,7 @@
#include "packet-epl.h"
#include "ws_attributes.h"
-#include <wsutil/ws_printf.h>
+#include <epan/ws_printf.h>
#include <epan/range.h>
#include <string.h>
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index 65f93c7067..86c371bb29 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -282,7 +282,7 @@
#include <wsutil/str_util.h>
#include <wsutil/pint.h>
#include <wsutil/report_message.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <epan/ws_printf.h>
#include "packet-giop.h"
#include "packet-ziop.h"
diff --git a/epan/dissectors/packet-protobuf.c b/epan/dissectors/packet-protobuf.c
index 457e2f6ff8..4b75287fce 100644
--- a/epan/dissectors/packet-protobuf.c
+++ b/epan/dissectors/packet-protobuf.c
@@ -39,7 +39,7 @@
#include <wsutil/filesystem.h>
#include <wsutil/file_util.h>
#include <wsutil/pint.h>
-#include <wsutil/ws_printf.h>
+#include <epan/ws_printf.h>
#include <wsutil/report_message.h>
#include "protobuf-helper.h"
diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c
index fdd6e98c13..b3b7e15d52 100644
--- a/epan/dissectors/packet-tacacs.c
+++ b/epan/dissectors/packet-tacacs.c
@@ -27,7 +27,7 @@
#include <epan/expert.h>
#include <epan/addr_resolv.h>
#include <wsutil/wsgcrypt.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <epan/ws_printf.h>
#include "packet-tcp.h"
#include "packet-tacacs.h"
diff --git a/epan/dissectors/packet-tibia.c b/epan/dissectors/packet-tibia.c
index ad2d9aaa71..1dc192850c 100644
--- a/epan/dissectors/packet-tibia.c
+++ b/epan/dissectors/packet-tibia.c
@@ -104,7 +104,7 @@
#include <wsutil/strtoi.h>
#include <wsutil/rsa.h>
#include <errno.h>
-#include <wsutil/ws_printf.h>
+#include <epan/ws_printf.h>
#include <epan/ptvcursor.h>
void proto_register_tibia(void);
diff --git a/epan/dissectors/packet-vpp.c b/epan/dissectors/packet-vpp.c
index 1d512ef3c5..51f3644028 100644
--- a/epan/dissectors/packet-vpp.c
+++ b/epan/dissectors/packet-vpp.c
@@ -20,7 +20,7 @@
#include <epan/nlpid.h>
#include <epan/etypes.h>
#include <stdio.h>
-#include <wsutil/ws_printf.h>
+#include <epan/ws_printf.h>
void proto_register_vpp(void);
void proto_reg_handoff_vpp(void);
diff --git a/epan/except.c b/epan/except.c
index f8c5fa6536..71956635ad 100644
--- a/epan/except.c
+++ b/epan/except.c
@@ -35,9 +35,6 @@
#include <glib.h>
#include "except.h"
-#ifdef KAZLIB_TEST_MAIN
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
-#endif
#ifdef _WIN32
#include <windows.h>
@@ -392,13 +389,13 @@ void except_free(void *ptr)
static void cleanup(void *arg)
{
- ws_debug_printf("cleanup(\"%s\") called\n", (char *) arg);
+ printf("cleanup(\"%s\") called\n", (char *) arg);
}
static void bottom_level(void)
{
char buf[256];
- ws_debug_printf("throw exception? "); fflush(stdout);
+ printf("throw exception? "); fflush(stdout);
fgets(buf, sizeof buf, stdin);
if (buf[0] >= 0 && (buf[0] == 'Y' || buf[0] == 'y'))
@@ -433,10 +430,10 @@ int main(int argc, char **argv)
/* inner catch */
msg = except_message(ex);
if (msg == NULL) {
- ws_debug_printf("caught exception (inner): s=%lu, c=%lu\n",
+ printf("caught exception (inner): s=%lu, c=%lu\n",
except_group(ex), except_code(ex));
} else {
- ws_debug_printf("caught exception (inner): \"%s\", s=%lu, c=%lu\n",
+ printf("caught exception (inner): \"%s\", s=%lu, c=%lu\n",
msg, except_group(ex), except_code(ex));
}
except_rethrow(ex);
@@ -446,10 +443,10 @@ int main(int argc, char **argv)
/* outer catch */
msg = except_message(ex);
if (msg == NULL) {
- ws_debug_printf("caught exception (outer): s=%lu, c=%lu\n",
+ printf("caught exception (outer): s=%lu, c=%lu\n",
except_group(ex), except_code(ex));
} else {
- ws_debug_printf("caught exception (outer): \"%s\", s=%lu, c=%lu\n",
+ printf("caught exception (outer): \"%s\", s=%lu, c=%lu\n",
except_message(ex), except_group(ex), except_code(ex));
}
}
@@ -459,7 +456,7 @@ int main(int argc, char **argv)
}
-#endif
+#endif /* KAZLIB_TEST_MAIN */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
diff --git a/epan/oids.c b/epan/oids.c
index edbb194ce0..eef840d2b7 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -25,7 +25,6 @@
#include "packet.h"
#include "wsutil/filesystem.h"
#include "dissectors/packet-ber.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#ifdef HAVE_LIBSMI
#include <smi.h>
@@ -36,7 +35,7 @@ static gboolean load_smi_modules = FALSE;
static gboolean suppress_smi_errors = FALSE;
#endif
-#define D(level,args) do if (debuglevel >= level) { ws_debug_printf args; ws_debug_printf("\n"); fflush(stdout); } while(0)
+#define D(level,args) do if (debuglevel >= level) { printf args; printf("\n"); fflush(stdout); } while(0)
#include "oids.h"
diff --git a/epan/packet.c b/epan/packet.c
index e14fce8ec1..0171d5c3a1 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -39,7 +39,6 @@
#include <epan/range.h>
#include <wsutil/str_util.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
static gint proto_malformed = -1;
static dissector_handle_t frame_handle = NULL;
@@ -2975,7 +2974,7 @@ display_heur_dissector_table_entries(const char *table_name,
heur_dtbl_entry_t *hdtbl_entry, gpointer user_data _U_)
{
if (hdtbl_entry->protocol != NULL) {
- ws_debug_printf("%s\t%s\t%c\n",
+ printf("%s\t%s\t%c\n",
table_name,
proto_get_protocol_filter_name(proto_get_id(hdtbl_entry->protocol)),
(proto_is_protocol_enabled(hdtbl_entry->protocol) && hdtbl_entry->enabled) ? 'T' : 'F');
@@ -3433,7 +3432,7 @@ dissector_dump_decodes_display(const gchar *table_name,
if (proto_id != -1) {
decode_as = proto_get_protocol_filter_name(proto_id);
g_assert(decode_as != NULL);
- ws_debug_printf("%s\t%u\t%s\n", table_name, selector, decode_as);
+ printf("%s\t%u\t%s\n", table_name, selector, decode_as);
}
break;
@@ -3467,7 +3466,7 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
dissector_table_t table;
table = (dissector_table_t)g_hash_table_lookup(dissector_tables, key);
- ws_debug_printf("%s\t%s\t%s", table_name, table->ui_name, ftype_name(table->type));
+ printf("%s\t%s\t%s", table_name, table->ui_name, ftype_name(table->type));
switch (table->type) {
case FT_UINT8:
@@ -3477,27 +3476,27 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
switch(table->param) {
case BASE_NONE:
- ws_debug_printf("\tBASE_NONE");
+ printf("\tBASE_NONE");
break;
case BASE_DEC:
- ws_debug_printf("\tBASE_DEC");
+ printf("\tBASE_DEC");
break;
case BASE_HEX:
- ws_debug_printf("\tBASE_HEX");
+ printf("\tBASE_HEX");
break;
case BASE_DEC_HEX:
- ws_debug_printf("\tBASE_DEC_HEX");
+ printf("\tBASE_DEC_HEX");
break;
case BASE_HEX_DEC:
- ws_debug_printf("\tBASE_HEX_DEC");
+ printf("\tBASE_HEX_DEC");
break;
default:
- ws_debug_printf("\t%d", table->param);
+ printf("\t%d", table->param);
break;
}
break;
@@ -3506,13 +3505,13 @@ dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
break;
}
if (table->protocol != NULL) {
- ws_debug_printf("\t%s",
+ printf("\t%s",
proto_get_protocol_short_name(table->protocol));
} else
- ws_debug_printf("\t(no protocol)");
- ws_debug_printf("\tDecode As %ssupported",
+ printf("\t(no protocol)");
+ printf("\tDecode As %ssupported",
table->supports_decode_as ? "" : "not ");
- ws_debug_printf("\n");
+ printf("\n");
}
static gint
diff --git a/epan/proto.c b/epan/proto.c
index 2698d9b9af..34cd1b7c32 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -45,7 +45,6 @@
#include "in_cksum.h"
#include "register-int.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#include <wsutil/crash_info.h>
#include <wsutil/epochs.h>
@@ -1418,7 +1417,7 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format, ...)
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
- ws_debug_printf("\n");
+ printf("\n");
return pi;
}
@@ -10636,7 +10635,7 @@ proto_registrar_dump_protocols(void)
i = proto_get_first_protocol(&cookie);
while (i != -1) {
protocol = find_protocol_by_id(i);
- ws_debug_printf("%s\t%s\t%s\n", protocol->name, protocol->short_name,
+ printf("%s\t%s\t%s\n", protocol->name, protocol->short_name,
protocol->filter_name);
i = proto_get_next_protocol(&cookie);
}
@@ -10785,7 +10784,7 @@ proto_registrar_dump_values(void)
continue;
}
try_val64_to_str_ext(0, vse_p); /* "prime" the extended val64_string */
- ws_debug_printf("E\t%s\t%u\t%s\t%s\n",
+ printf("E\t%s\t%u\t%s\t%s\n",
hfinfo->abbrev,
VAL64_STRING_EXT_VS_NUM_ENTRIES(vse_p),
VAL64_STRING_EXT_VS_NAME(vse_p),
@@ -10797,7 +10796,7 @@ proto_registrar_dump_values(void)
continue;
}
try_val_to_str_ext(0, vse_p); /* "prime" the extended value_string */
- ws_debug_printf("E\t%s\t%u\t%s\t%s\n",
+ printf("E\t%s\t%u\t%s\t%s\n",
hfinfo->abbrev,
VALUE_STRING_EXT_VS_NUM_ENTRIES(vse_p),
VALUE_STRING_EXT_VS_NAME(vse_p),
@@ -10809,19 +10808,19 @@ proto_registrar_dump_values(void)
/* Print in the proper base */
if (hfinfo->type == FT_CHAR) {
if (g_ascii_isprint(vals[vi].value)) {
- ws_debug_printf("V\t%s\t'%c'\t%s\n",
+ printf("V\t%s\t'%c'\t%s\n",
hfinfo->abbrev,
vals[vi].value,
vals[vi].strptr);
} else {
if (hfinfo->display == BASE_HEX) {
- ws_debug_printf("V\t%s\t'\\x%02x'\t%s\n",
+ printf("V\t%s\t'\\x%02x'\t%s\n",
hfinfo->abbrev,
vals[vi].value,
vals[vi].strptr);
}
else {
- ws_debug_printf("V\t%s\t'\\%03o'\t%s\n",
+ printf("V\t%s\t'\\%03o'\t%s\n",
hfinfo->abbrev,
vals[vi].value,
vals[vi].strptr);
@@ -10829,13 +10828,13 @@ proto_registrar_dump_values(void)
}
} else {
if (hfinfo->display == BASE_HEX) {
- ws_debug_printf("V\t%s\t0x%x\t%s\n",
+ printf("V\t%s\t0x%x\t%s\n",
hfinfo->abbrev,
vals[vi].value,
vals[vi].strptr);
}
else {
- ws_debug_printf("V\t%s\t%u\t%s\n",
+ printf("V\t%s\t%u\t%s\n",
hfinfo->abbrev,
vals[vi].value,
vals[vi].strptr);
@@ -10847,7 +10846,7 @@ proto_registrar_dump_values(void)
else if (vals64) {
vi = 0;
while (vals64[vi].strptr) {
- ws_debug_printf("V64\t%s\t%" G_GINT64_MODIFIER "u\t%s\n",
+ printf("V64\t%s\t%" G_GINT64_MODIFIER "u\t%s\n",
hfinfo->abbrev,
vals64[vi].value,
vals64[vi].strptr);
@@ -10861,14 +10860,14 @@ proto_registrar_dump_values(void)
while (range[vi].strptr) {
/* Print in the proper base */
if (FIELD_DISPLAY(hfinfo->display) == BASE_HEX) {
- ws_debug_printf("R\t%s\t0x%x\t0x%x\t%s\n",
+ printf("R\t%s\t0x%x\t0x%x\t%s\n",
hfinfo->abbrev,
range[vi].value_min,
range[vi].value_max,
range[vi].strptr);
}
else {
- ws_debug_printf("R\t%s\t%u\t%u\t%s\n",
+ printf("R\t%s\t%u\t%u\t%s\n",
hfinfo->abbrev,
range[vi].value_min,
range[vi].value_max,
@@ -10880,12 +10879,12 @@ proto_registrar_dump_values(void)
/* Print true/false strings? */
else if (tfs) {
- ws_debug_printf("T\t%s\t%s\t%s\n", hfinfo->abbrev,
+ printf("T\t%s\t%s\t%s\n", hfinfo->abbrev,
tfs->true_string, tfs->false_string);
}
/* Print unit strings? */
else if (units) {
- ws_debug_printf("U\t%s\t%s\t%s\n", hfinfo->abbrev,
+ printf("U\t%s\t%s\t%s\n", hfinfo->abbrev,
units->singular, units->plural ? units->plural : "(no plural)");
}
}
@@ -10922,21 +10921,21 @@ proto_registrar_dump_fieldcount(void)
same_name_count++;
}
- ws_debug_printf("There are %u header fields registered, of which:\n"
+ printf("There are %u header fields registered, of which:\n"
"\t%u are deregistered\n"
"\t%u are protocols\n"
"\t%u have the same name as another field\n\n",
gpa_hfinfo.len, deregistered_count, protocol_count,
same_name_count);
- ws_debug_printf("%d fields were pre-allocated.\n%s", PROTO_PRE_ALLOC_HF_FIELDS_MEM,
+ printf("%d fields were pre-allocated.\n%s", PROTO_PRE_ALLOC_HF_FIELDS_MEM,
(gpa_hfinfo.allocated_len > PROTO_PRE_ALLOC_HF_FIELDS_MEM) ?
"* * Please increase PROTO_PRE_ALLOC_HF_FIELDS_MEM (in epan/proto.c)! * *\n\n" :
"\n");
- ws_debug_printf("The header field table consumes %u KiB of memory.\n",
+ printf("The header field table consumes %u KiB of memory.\n",
(unsigned int)(gpa_hfinfo.allocated_len * sizeof(header_field_info *) / 1024));
- ws_debug_printf("The fields themselves consume %u KiB of memory.\n",
+ printf("The fields themselves consume %u KiB of memory.\n",
(unsigned int)(gpa_hfinfo.len * sizeof(header_field_info) / 1024));
return (gpa_hfinfo.allocated_len > PROTO_PRE_ALLOC_HF_FIELDS_MEM);
@@ -11194,7 +11193,7 @@ proto_registrar_dump_fields(void)
/* format for protocols */
if (proto_registrar_is_protocol(i)) {
- ws_debug_printf("P\t%s\t%s\n", hfinfo->name, hfinfo->abbrev);
+ printf("P\t%s\t%s\n", hfinfo->name, hfinfo->abbrev);
}
/* format for header fields */
else {
@@ -11267,7 +11266,7 @@ proto_registrar_dump_fields(void)
else if (strlen(blurb) == 0)
blurb = "\"\"";
- ws_debug_printf("F\t%s\t%s\t%s\t%s\t%s\t0x%" G_GINT64_MODIFIER "x\t%s\n",
+ printf("F\t%s\t%s\t%s\t%s\t%s\t0x%" G_GINT64_MODIFIER "x\t%s\n",
hfinfo->name, hfinfo->abbrev, enum_name,
parent_hfinfo->abbrev, base_name,
hfinfo->bitmask, blurb);
@@ -11290,7 +11289,7 @@ proto_registrar_dump_ftypes(void)
int fte;
for (fte = 0; fte < FT_NUM_TYPES; fte++) {
- ws_debug_printf("%s\t%s\n", ftype_name((ftenum_t)fte), ftype_pretty_name((ftenum_t)fte));
+ printf("%s\t%s\n", ftype_name((ftenum_t)fte), ftype_pretty_name((ftenum_t)fte));
}
}
diff --git a/epan/reedsolomon.c b/epan/reedsolomon.c
index 1eba6e8e53..0250c00495 100644
--- a/epan/reedsolomon.c
+++ b/epan/reedsolomon.c
@@ -16,9 +16,14 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+
+#include "config.h"
+
+#define G_LOG_DOMAIN "epan"
+
#include <stdio.h>
#include "reedsolomon.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <wsutil/wslog.h>
#ifdef CCSDS
/* CCSDS field generator polynomial: 1+x+x^2+x^7+x^8 */
@@ -451,7 +456,7 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
syn_error = 0;
for(i=1;i<=NN-KK;i++){
syn_error |= s[i];
- /*ws_debug_printf("syndrome %d = %x\n",i,s[i]);*/
+ /*ws_debug("syndrome %d = %x\n",i,s[i]);*/
s[i] = Index_of[s[i]];
}
@@ -499,15 +504,15 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
count++;
}
if (count != no_eras) {
- ws_debug_printf("\n lambda(x) is WRONG\n");
+ ws_debug("\n lambda(x) is WRONG\n");
count = -1;
goto finish;
}
#if DEBUG >= 2
- ws_debug_printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
+ printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
for (i = 0; i < count; i++)
- ws_debug_printf("%d ", loc[i]);
- ws_debug_printf("\n");
+ printf("%d ", loc[i]);
+ printf("\n");
#endif
#endif
}
@@ -637,7 +642,7 @@ eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
}
if (den == 0) {
#if DEBUG >= 1
- ws_debug_printf("\n ERROR: denominator = 0\n");
+ ws_debug("\n ERROR: denominator = 0\n");
#endif
/* Convert to dual- basis */
count = -1;
diff --git a/epan/tvbuff_zlib.c b/epan/tvbuff_zlib.c
index d8b917d5c5..2f33acefe7 100644
--- a/epan/tvbuff_zlib.c
+++ b/epan/tvbuff_zlib.c
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
+#define G_LOG_DOMAIN "epan"
+
#include <config.h>
#include <glib.h>
@@ -22,9 +24,7 @@
#endif
#include "tvbuff.h"
-#ifdef TVB_Z_DEBUG
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
-#endif
+#include <wsutil/wslog.h>
#ifdef HAVE_ZLIB
/*
@@ -34,8 +34,6 @@
*/
#define TVB_Z_MIN_BUFSIZ 32768
#define TVB_Z_MAX_BUFSIZ 1048576 * 10
-/* #define TVB_Z_DEBUG 1 */
-#undef TVB_Z_DEBUG
tvbuff_t *
tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
@@ -51,7 +49,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
gint wbits = MAX_WBITS;
guint8 *next;
guint bufsiz;
-#ifdef TVB_Z_DEBUG
+#ifdef WS_DEBUG
guint inflate_passes = 0;
guint bytes_in = tvb_captured_length_remaining(tvb, offset);
#endif
@@ -72,9 +70,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
bufsiz = tvb_captured_length_remaining(tvb, offset) * 2;
bufsiz = CLAMP(bufsiz, TVB_Z_MIN_BUFSIZ, TVB_Z_MAX_BUFSIZ);
-#ifdef TVB_Z_DEBUG
- ws_debug_printf("bufsiz: %u bytes\n", bufsiz);
-#endif
+ ws_debug("bufsiz: %u bytes\n", bufsiz);
next = compr;
@@ -106,7 +102,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
if (err == Z_OK || err == Z_STREAM_END) {
guint bytes_pass = bufsiz - strm->avail_out;
-#ifdef TVB_Z_DEBUG
+#ifdef WS_DEBUG
++inflate_passes;
#endif
@@ -305,10 +301,8 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
}
}
-#ifdef TVB_Z_DEBUG
- ws_debug_printf("inflate() total passes: %u\n", inflate_passes);
- ws_debug_printf("bytes in: %u\nbytes out: %u\n\n", bytes_in, bytes_out);
-#endif
+ ws_debug("inflate() total passes: %u\n", inflate_passes);
+ ws_debug("bytes in: %u\nbytes out: %u\n\n", bytes_in, bytes_out);
if (uncompr != NULL) {
uncompr_tvb = tvb_new_real_data(uncompr, bytes_out, bytes_out);
diff --git a/epan/wmem/wmem_interval_tree.c b/epan/wmem/wmem_interval_tree.c
index d40e9f1b61..7ea0820968 100644
--- a/epan/wmem/wmem_interval_tree.c
+++ b/epan/wmem/wmem_interval_tree.c
@@ -22,7 +22,6 @@
#include "wmem_interval_tree.h"
#include "wmem_user_cb.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#include <wsutil/ws_assert.h>
@@ -33,7 +32,7 @@ print_range(const void *value)
if(!value) {
return;
}
- ws_debug_printf("Range: low=%" G_GUINT64_FORMAT " high=%" G_GUINT64_FORMAT " max_edge=%" G_GUINT64_FORMAT "\n", range->low, range->high, range->max_edge);
+ printf("Range: low=%" G_GUINT64_FORMAT " high=%" G_GUINT64_FORMAT " max_edge=%" G_GUINT64_FORMAT "\n", range->low, range->high, range->max_edge);
}
/**
diff --git a/epan/wmem/wmem_tree.c b/epan/wmem/wmem_tree.c
index 1cdcdfc517..81b2589aab 100644
--- a/epan/wmem/wmem_tree.c
+++ b/epan/wmem/wmem_tree.c
@@ -22,7 +22,6 @@
#include "wmem_tree-int.h"
#include "wmem_user_cb.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
#include <wsutil/ws_assert.h>
@@ -768,7 +767,7 @@ static void
wmem_print_indent(guint32 level) {
guint32 i;
for (i=0; i<level; i++) {
- ws_debug_printf(" ");
+ printf(" ");
}
}
@@ -781,7 +780,7 @@ wmem_tree_print_nodes(const char *prefix, wmem_tree_node_t *node, guint32 level,
wmem_print_indent(level);
- ws_debug_printf("%sNODE:%p parent:%p left:%p right:%p colour:%s key:%p %s:%p\n",
+ printf("%sNODE:%p parent:%p left:%p right:%p colour:%s key:%p %s:%p\n",
prefix,
(void *)node, (void *)node->parent,
(void *)node->left, (void *)node->right,
@@ -790,12 +789,12 @@ wmem_tree_print_nodes(const char *prefix, wmem_tree_node_t *node, guint32 level,
if (key_printer) {
wmem_print_indent(level);
key_printer(node->key);
- ws_debug_printf("\n");
+ printf("\n");
}
if (data_printer && !node->is_subtree) {
wmem_print_indent(level);
data_printer(node->data);
- ws_debug_printf("\n");
+ printf("\n");
}
if (node->left)
@@ -816,7 +815,7 @@ wmem_print_subtree(wmem_tree_t *tree, guint32 level, wmem_printer_func key_print
wmem_print_indent(level);
- ws_debug_printf("WMEM tree:%p root:%p\n", (void *)tree, (void *)tree->root);
+ printf("WMEM tree:%p root:%p\n", (void *)tree, (void *)tree->root);
if (tree->root) {
wmem_tree_print_nodes("Root-", tree->root, level, key_printer, data_printer);
}
diff --git a/epan/ws_printf.h b/epan/ws_printf.h
new file mode 100644
index 0000000000..d84df646b5
--- /dev/null
+++ b/epan/ws_printf.h
@@ -0,0 +1,22 @@
+/*
+ * Wrappers for printf like functions.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 2007 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef __WS_PRINTF_H__
+#define __WS_PRINTF_H__
+
+/* This is intended to fool checkAPIs.pl for places that have "debugging"
+(using printf) usually wrapped in an #ifdef, but checkAPIs.pl isn't smart
+enough to figure that out.
+Dissectors should still try to use proto_tree_add_debug_text when the
+debugging context has a protocol tree.
+*/
+#define ws_debug_printf printf
+
+#endif /* __WS_PRINTF_H__ */
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 8474c74be1..403670fd1b 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -18,11 +18,11 @@
#include "init_wslua.h"
#include <epan/dissectors/packet-frame.h>
#include <math.h>
+#include <stdio.h>
#include <epan/expert.h>
#include <epan/ex-opt.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
/* linked list of Lua plugins */
typedef struct _wslua_plugin {
@@ -775,7 +775,7 @@ print_wslua_plugin_description(const char *name, const char *version,
const char *description, const char *filename,
void *user_data _U_)
{
- ws_debug_printf("%s\t%s\t%s\t%s\n", name, version, description, filename);
+ printf("%s\t%s\t%s\t%s\n", name, version, description, filename);
}
void
diff --git a/epan/wslua/wslua_internals.c b/epan/wslua/wslua_internals.c
index 2688aea2e0..a00d37d2c2 100644
--- a/epan/wslua/wslua_internals.c
+++ b/epan/wslua/wslua_internals.c
@@ -16,7 +16,7 @@
#include "config.h"
#include "wslua.h"
-#include <wsutil/ws_printf.h> /* ws_debug_printf */
+#include <stdio.h>
/* Several implementation details (__getters, __setters, __methods) were exposed
* to Lua code. These are normally not used by dissectors, just for debugging
@@ -177,9 +177,9 @@ WSLUA_API void wslua_print_stack(char* s, lua_State* L) {
int i;
for (i=1;i<=lua_gettop(L);i++) {
- ws_debug_printf("%s-%i: %s\n",s,i,lua_typename (L,lua_type(L, i)));
+ printf("%s-%i: %s\n",s,i,lua_typename (L,lua_type(L, i)));
}
- ws_debug_printf("\n");
+ printf("\n");
}
/* C-code function equivalent of the typeof() function we created in Lua.