diff --git a/epan/color_filters.h b/epan/color_filters.h index f3d9fbf4bd..f5a03a4a2d 100644 --- a/epan/color_filters.h +++ b/epan/color_filters.h @@ -10,6 +10,8 @@ #ifndef __COLOR_FILTERS_H__ #define __COLOR_FILTERS_H__ +#include + #include "ws_symbol_export.h" #include diff --git a/epan/uat-int.h b/epan/uat-int.h index 22a8ebd07d..a3dcd2327a 100644 --- a/epan/uat-int.h +++ b/epan/uat-int.h @@ -16,6 +16,8 @@ #ifndef __UAT_INT_H__ #define __UAT_INT_H__ +#include + #include "uat.h" #include "ws_symbol_export.h" diff --git a/fileset.c b/fileset.c index 593d7d9f8a..28e7f0d9dd 100644 --- a/fileset.c +++ b/fileset.c @@ -166,7 +166,7 @@ fileset_filename_match_pattern(const char *fname, char **prefix, char **suffix, /* test if both files could be in the same file set */ /* (fname2 must already be in correct shape) */ -static gboolean +static bool fileset_is_file_in_set(const char *fname1, const char *fname2) { char *pfx1; @@ -175,18 +175,18 @@ fileset_is_file_in_set(const char *fname1, const char *fname2) char *sfx2; fileset_match_t match1; fileset_match_t match2; - gboolean ret = FALSE; + bool ret = false; match1 = fileset_filename_match_pattern(fname1, &pfx1, &sfx1, NULL); if (match1 == FILESET_NO_MATCH) { - return FALSE; + return false; } match2 = fileset_filename_match_pattern(fname2, &pfx2, &sfx2, NULL); /* just to be sure ... */ ws_assert(match2 != FILESET_NO_MATCH); if (match1 == match2 && g_strcmp0(pfx1, pfx2) == 0 && g_strcmp0(sfx1, sfx2) == 0) { - ret = TRUE; + ret = true; } g_free(pfx1); @@ -198,7 +198,7 @@ fileset_is_file_in_set(const char *fname1, const char *fname2) } /* GCompareFunc helper for g_list_find_custom() */ -static gint +static int fileset_find_by_path(gconstpointer a, gconstpointer b) { const fileset_entry *entry; @@ -244,7 +244,7 @@ fileset_update_file(const char *path) /* we know this file is part of the set, so add it */ static fileset_entry * -fileset_add_file(const char *dirname, const char *fname, gboolean current) +fileset_add_file(const char *dirname, const char *fname, bool current) { int fh, result; ws_statb64 buf; @@ -284,7 +284,7 @@ fileset_add_file(const char *dirname, const char *fname, gboolean current) /* compare two list entries by creation date/time (through filename) */ -static gint +static int fileset_sort_compare(gconstpointer a, gconstpointer b) { const fileset_entry *entry_a = (const fileset_entry *)a; @@ -318,7 +318,7 @@ fileset_add_dir(const char *fname, void *window) WS_DIRENT *file; /* current file */ const char *name; GString *dirname; - gchar *fname_dup; + char *fname_dup; /* get (convert) directory name, but don't touch the given string */ @@ -345,11 +345,11 @@ fileset_add_dir(const char *fname, void *window) } /* if */ } else { /* no, this is a "standalone file", just add this one */ - fileset_add_file(dirname->str, get_basename(fname), TRUE /* current */); + fileset_add_file(dirname->str, get_basename(fname), true /* current */); /* don't add the file to the dialog here, this will be done in fileset_update_dlg() below */ } - g_string_free(dirname, TRUE /* free_segment */); + g_string_free(dirname, true /* free_segment */); /* sort entries by creation time */ set.entries = g_list_sort(set.entries, fileset_sort_compare); @@ -431,13 +431,13 @@ fileset_get_previous(void) /* delete a single entry */ -static void fileset_entry_delete(gpointer data, gpointer user_data _U_) +static void fileset_entry_delete(void *data, void *user_data _U_) { fileset_entry *entry = (fileset_entry *)data; - g_free( (gpointer) entry->fullname); + g_free( (void *) entry->fullname); entry->fullname = NULL; - g_free( (gpointer) entry->name); + g_free( (void *) entry->name); entry->name = NULL; g_free(entry); } @@ -455,7 +455,7 @@ void fileset_delete(void) /* free the rest */ if(set.dirname) { - g_free( (gpointer) set.dirname); + g_free( (void *) set.dirname); set.dirname = NULL; } } diff --git a/fileset.h b/fileset.h index 84c075d206..06680bfc99 100644 --- a/fileset.h +++ b/fileset.h @@ -12,6 +12,9 @@ #ifndef __FILESET_H__ #define __FILESET_H__ +#include +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -21,8 +24,8 @@ typedef struct _fileset_entry { char *name; /* File name without path (g_strdup'ed) */ time_t ctime; /* create time */ time_t mtime; /* last modified time */ - gint64 size; /* size of file in bytes */ - gboolean current; /* is this the currently loaded file? */ + int64_t size; /* size of file in bytes */ + bool current; /* is this the currently loaded file? */ } fileset_entry; typedef enum { diff --git a/ui/profile.h b/ui/profile.h index 771e0c4e8b..dc3edfa959 100644 --- a/ui/profile.h +++ b/ui/profile.h @@ -13,6 +13,8 @@ #ifndef __PROFILE_H__ #define __PROFILE_H__ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/ui/qt/models/atap_data_model.cpp b/ui/qt/models/atap_data_model.cpp index 9e8b281750..e08528c7eb 100644 --- a/ui/qt/models/atap_data_model.cpp +++ b/ui/qt/models/atap_data_model.cpp @@ -7,8 +7,6 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#include - #include #include #include @@ -116,14 +114,14 @@ bool ATapDataModel::enableTap() GString * errorString = register_tap_listener(tap().toUtf8().constData(), hash(), _filter.toUtf8().constData(), TL_IGNORE_DISPLAY_FILTER, &ATapDataModel::tapReset, conversationPacketHandler(), &ATapDataModel::tapDraw, nullptr); if (errorString && errorString->len > 0) { - g_string_free(errorString, TRUE); + g_string_free(errorString, true); _disableTap = true; emit tapListenerChanged(false); return false; } if (errorString) - g_string_free(errorString, TRUE); + g_string_free(errorString, true); emit tapListenerChanged(true); @@ -297,7 +295,7 @@ void ATapDataModel::setFilter(QString filter) } if (errorString) - g_string_free(errorString, TRUE); + g_string_free(errorString, true); } QString ATapDataModel::filter() const diff --git a/ui/qt/models/atap_data_model.h b/ui/qt/models/atap_data_model.h index 38bdbd2fa7..733edc3c9c 100644 --- a/ui/qt/models/atap_data_model.h +++ b/ui/qt/models/atap_data_model.h @@ -12,8 +12,6 @@ #include "config.h" -#include "glib.h" - #include #include #include diff --git a/ui/qt/models/coloring_rules_delegate.cpp b/ui/qt/models/coloring_rules_delegate.cpp index b86ffa97ff..58524be154 100644 --- a/ui/qt/models/coloring_rules_delegate.cpp +++ b/ui/qt/models/coloring_rules_delegate.cpp @@ -32,7 +32,7 @@ QWidget* ColoringRulesDelegate::createEditor(QWidget *parent, const QStyleOption return new DisplayFilterEdit(parent); default: - Q_ASSERT(FALSE); + Q_ASSERT(false); return 0; } diff --git a/ui/qt/models/coloring_rules_model.cpp b/ui/qt/models/coloring_rules_model.cpp index dced9c3774..29bb7dcf7f 100644 --- a/ui/qt/models/coloring_rules_model.cpp +++ b/ui/qt/models/coloring_rules_model.cpp @@ -72,7 +72,7 @@ ColoringRuleItem& ColoringRuleItem::operator=(ColoringRuleItem& rhs) // Callback for color_filters_clone. void -color_filter_add_cb(color_filter_t *colorf, gpointer user_data) +color_filter_add_cb(color_filter_t *colorf, void *user_data) { ColoringRulesModel *model = (ColoringRulesModel*)user_data; @@ -149,7 +149,7 @@ void ColoringRulesModel::addColor(bool disabled, QString filter, QColor foregrou bool ColoringRulesModel::importColors(QString filename, QString& err) { bool success = true; - gchar* err_msg = NULL; + char* err_msg = NULL; if (!color_filters_import(filename.toUtf8().constData(), this, &err_msg, color_filter_add_cb)) { err = gchar_free_to_qstring(err_msg); success = false; @@ -162,8 +162,8 @@ bool ColoringRulesModel::exportColors(QString filename, QString& err) { GSList *cfl = createColorFilterList(); bool success = true; - gchar* err_msg = NULL; - if (!color_filters_export(filename.toUtf8().constData(), cfl, FALSE, &err_msg)) { + char* err_msg = NULL; + if (!color_filters_export(filename.toUtf8().constData(), cfl, false, &err_msg)) { err = gchar_free_to_qstring(err_msg); success = false; } @@ -176,7 +176,7 @@ bool ColoringRulesModel::writeColors(QString& err) { GSList *cfl = createColorFilterList(); bool success = true; - gchar* err_msg = NULL; + char* err_msg = NULL; if (!color_filters_apply(conversation_colors_, cfl, &err_msg)) { err = gchar_free_to_qstring(err_msg); success = false; diff --git a/ui/qt/models/coloring_rules_model.h b/ui/qt/models/coloring_rules_model.h index f51a1a3083..0df532ef64 100644 --- a/ui/qt/models/coloring_rules_model.h +++ b/ui/qt/models/coloring_rules_model.h @@ -14,7 +14,6 @@ #include -#include #include #include diff --git a/ui/qt/models/column_list_model.cpp b/ui/qt/models/column_list_model.cpp index 681a60c0e7..4cbd752e2c 100644 --- a/ui/qt/models/column_list_model.cpp +++ b/ui/qt/models/column_list_model.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -547,7 +546,7 @@ void ColumnListModel::saveColumns() cfmt->title = qstring_strdup(elem.title); cfmt->visible = elem.displayed; cfmt->fmt = elem.type; - cfmt->resolved = TRUE; + cfmt->resolved = true; if (cfmt->fmt == COL_CUSTOM) { cfmt->custom_fields = qstring_strdup(elem.customFields); diff --git a/ui/qt/models/decode_as_delegate.cpp b/ui/qt/models/decode_as_delegate.cpp index 3c300a79fc..c3917928bb 100644 --- a/ui/qt/models/decode_as_delegate.cpp +++ b/ui/qt/models/decode_as_delegate.cpp @@ -46,11 +46,11 @@ void DecodeAsDelegate::cachePacketProtocols() if (cap_file_ && cap_file_->edt) { wmem_list_frame_t * protos = wmem_list_head(cap_file_->edt->pi.layers); - guint8 curr_layer_num = 1; + uint8_t curr_layer_num = 1; while (protos != NULL) { int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos)); - const gchar * proto_name = proto_get_protocol_filter_name(proto_id); + const char * proto_name = proto_get_protocol_filter_name(proto_id); for (GList *cur = decode_as_list; cur; cur = cur->next) { decode_as_t *entry = (decode_as_t *) cur->data; if (g_strcmp0(proto_name, entry->name) == 0) { @@ -95,7 +95,7 @@ void DecodeAsDelegate::collectDAProtocols(QSet& all_protocols, QList* proto_list = (QList*)user_data; @@ -178,10 +178,10 @@ QWidget* DecodeAsDelegate::createEditor(QWidget *parentWidget, const QStyleOptio case DecodeAsModel::colSelector: { QComboBox *cb_editor = NULL; - const gchar *proto_name = NULL; + const char *proto_name = NULL; bool edt_present = cap_file_ && cap_file_->edt; - gint8 curr_layer_num_saved = edt_present ? cap_file_->edt->pi.curr_layer_num : 0; - QList proto_layers; + int8_t curr_layer_num_saved = edt_present ? cap_file_->edt->pi.curr_layer_num : 0; + QList proto_layers; foreach(packet_proto_data_t proto, packet_proto_list_) { @@ -212,7 +212,7 @@ QWidget* DecodeAsDelegate::createEditor(QWidget *parentWidget, const QStyleOptio cb_editor->addItem(current_value); //get the value(s) from the packet - foreach(guint8 current_layer, proto_layers) { + foreach(uint8_t current_layer, proto_layers) { cap_file_->edt->pi.curr_layer_num = current_layer; for (uint ni = 0; ni < entry->num_items; ni++) { if (entry->values[ni].num_values == 1) { // Skip over multi-value ("both") entries diff --git a/ui/qt/models/decode_as_delegate.h b/ui/qt/models/decode_as_delegate.h index d045776462..d793a85ae0 100644 --- a/ui/qt/models/decode_as_delegate.h +++ b/ui/qt/models/decode_as_delegate.h @@ -13,7 +13,6 @@ #define DECODE_AS_DELEGATE_H #include -#include #include "cfile.h" @@ -23,9 +22,9 @@ #include typedef struct _packet_proto_data_t { - const gchar* proto_name; - const gchar* table_ui_name; - guint8 curr_layer_num; + const char* proto_name; + const char* table_ui_name; + uint8_t curr_layer_num; } packet_proto_data_t; class DecodeAsDelegate : public QStyledItemDelegate @@ -51,7 +50,7 @@ private: void cachePacketProtocols(); bool isSelectorCombo(DecodeAsItem* item) const; - static void decodeAddProtocol(const gchar *table_name, const gchar *proto_name, gpointer value, gpointer user_data); + static void decodeAddProtocol(const char *table_name, const char *proto_name, void *value, void *user_data); capture_file *cap_file_; QList packet_proto_list_; diff --git a/ui/qt/models/decode_as_model.cpp b/ui/qt/models/decode_as_model.cpp index e906903632..c6a071f170 100644 --- a/ui/qt/models/decode_as_model.cpp +++ b/ui/qt/models/decode_as_model.cpp @@ -74,7 +74,7 @@ void DecodeAsItem::init(const char* table_name, gconstpointer selector) ftenum_t selector_type = get_dissector_table_selector_type(tableName_); if (FT_IS_STRING(selector_type)) { if (selector != NULL) { - default_handle = dissector_get_default_string_handle(tableName_, (const gchar*)selector); + default_handle = dissector_get_default_string_handle(tableName_, (const char*)selector); selectorString_ = QString((const char*)selector); } } else if (FT_IS_UINT(selector_type)) { @@ -410,12 +410,12 @@ bool DecodeAsModel::insertRows(int row, int count, const QModelIndex &/*parent*/ // the fields for the tables not being present at all. wmem_list_frame_t * protos = wmem_list_tail(cap_file_->edt->pi.layers); - gint8 curr_layer_num_saved = cap_file_->edt->pi.curr_layer_num; - guint8 curr_layer_num = wmem_list_count(cap_file_->edt->pi.layers); + int8_t curr_layer_num_saved = cap_file_->edt->pi.curr_layer_num; + uint8_t curr_layer_num = wmem_list_count(cap_file_->edt->pi.layers); while (protos != NULL && item == nullptr) { int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(protos)); - const gchar * proto_name = proto_get_protocol_filter_name(proto_id); + const char * proto_name = proto_get_protocol_filter_name(proto_id); for (GList *cur = decode_as_list; cur; cur = cur->next) { decode_as_t *entry = (decode_as_t *) cur->data; if (g_strcmp0(proto_name, entry->name) == 0) { @@ -428,7 +428,7 @@ bool DecodeAsModel::insertRows(int row, int count, const QModelIndex &/*parent*/ // XXX: What if the Decode As table supports multiple // values, but the first possible one is 0/NULL? cap_file_->edt->pi.curr_layer_num = curr_layer_num; - gpointer selector = entry->values[0].build_values[0](&cap_file_->edt->pi); + void *selector = entry->values[0].build_values[0](&cap_file_->edt->pi); // FT_NONE tables don't need a value if (selector != NULL || selector_type == FT_NONE) { item = new DecodeAsItem(entry, selector); @@ -499,7 +499,7 @@ bool DecodeAsModel::copyRow(int dst_row, int src_row) return true; } -prefs_set_pref_e DecodeAsModel::readDecodeAsEntry(gchar *key, const gchar *value, void *private_data, bool) +prefs_set_pref_e DecodeAsModel::readDecodeAsEntry(char *key, const char *value, void *private_data, bool) { DecodeAsModel *model = (DecodeAsModel*)private_data; if (model == NULL) @@ -510,7 +510,7 @@ prefs_set_pref_e DecodeAsModel::readDecodeAsEntry(gchar *key, const gchar *value } /* Parse into table, selector, initial, current */ - gchar **values = g_strsplit_set(value, ",", 4); + char **values = g_strsplit_set(value, ",", 4); DecodeAsItem *item = nullptr; dissector_table_t dissector_table = find_dissector_table(values[0]); @@ -546,7 +546,7 @@ prefs_set_pref_e DecodeAsModel::readDecodeAsEntry(gchar *key, const gchar *value return PREFS_SET_OK; } -bool DecodeAsModel::copyFromProfile(QString filename, const gchar **err) +bool DecodeAsModel::copyFromProfile(QString filename, const char **err) { FILE *fp = ws_fopen(filename.toUtf8().constData(), "r"); @@ -564,7 +564,7 @@ bool DecodeAsModel::copyFromProfile(QString filename, const gchar **err) return true; } -QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value) +QString DecodeAsModel::entryString(const char *table_name, gconstpointer value) { QString entry_str; ftenum_t selector_type = get_dissector_table_selector_type(table_name); @@ -654,7 +654,7 @@ void DecodeAsModel::setDissectorHandle(const QModelIndex &index, dissector_handl item->setDissectorHandle(dissector_handle); } -void DecodeAsModel::buildChangedList(const gchar *table_name, ftenum_t, gpointer key, gpointer value, gpointer user_data) +void DecodeAsModel::buildChangedList(const char *table_name, ftenum_t, void *key, void *value, void *user_data) { DecodeAsModel *model = (DecodeAsModel*)user_data; if (model == NULL) @@ -669,7 +669,7 @@ void DecodeAsModel::buildChangedList(const gchar *table_name, ftenum_t, gpointer model->decode_as_items_ << item; } -void DecodeAsModel::buildDceRpcChangedList(gpointer data, gpointer user_data) +void DecodeAsModel::buildDceRpcChangedList(void *data, void *user_data) { dissector_table_t sub_dissectors; guid_key guid_val; @@ -690,11 +690,11 @@ void DecodeAsModel::buildDceRpcChangedList(gpointer data, gpointer user_data) model->decode_as_items_ << item; } -typedef QPair UintPair; +typedef QPair UintPair; typedef QPair CharPtrPair; -void DecodeAsModel::gatherChangedEntries(const gchar *table_name, - ftenum_t selector_type, gpointer key, gpointer, gpointer user_data) +void DecodeAsModel::gatherChangedEntries(const char *table_name, + ftenum_t selector_type, void *key, void *, void *user_data) { DecodeAsModel *model = qobject_cast((DecodeAsModel*)user_data); if (model == NULL) @@ -820,7 +820,7 @@ void DecodeAsModel::applyChanges() pref_value = prefs_find_preference(module, decode_as_entry->table_name); if (pref_value != NULL) { module->prefs_changed_flags |= prefs_get_effect_flags(pref_value); - prefs_remove_decode_as_value(pref_value, item->selectorUint(), TRUE); + prefs_remove_decode_as_value(pref_value, item->selectorUint(), true); } } } @@ -836,7 +836,7 @@ void DecodeAsModel::applyChanges() pref_value = prefs_find_preference(module, decode_as_entry->table_name); if (pref_value != NULL) { module->prefs_changed_flags |= prefs_get_effect_flags(pref_value); - prefs_add_decode_as_value(pref_value, item->selectorUint(), FALSE); + prefs_add_decode_as_value(pref_value, item->selectorUint(), false); } } } diff --git a/ui/qt/models/decode_as_model.h b/ui/qt/models/decode_as_model.h index d4de50ae1a..767284148f 100644 --- a/ui/qt/models/decode_as_model.h +++ b/ui/qt/models/decode_as_model.h @@ -13,7 +13,6 @@ #define DECODE_AS_MODEL_H #include -#include #include #include @@ -31,8 +30,8 @@ public: DecodeAsItem(const decode_as_t *entry, gconstpointer selector = NULL); virtual ~DecodeAsItem(); - const gchar* tableName() const { return tableName_; } - const gchar* tableUIName() const { return tableUIName_; } + const char* tableName() const { return tableName_; } + const char* tableUIName() const { return tableUIName_; } uint selectorUint() const { return selectorUint_; } QString selectorString() const { return selectorString_; } decode_dcerpc_bind_values_t* selectorDCERPC() const { return selectorDCERPC_; } @@ -48,8 +47,8 @@ public: private: void init(const char *table_name, gconstpointer selector = NULL); - const gchar* tableName_; - const gchar* tableUIName_; + const char* tableName_; + const char* tableUIName_; //save our sanity and not have to worry about memory management //between (lack of) persistent data in GUI and underlying data @@ -95,25 +94,25 @@ public: bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); void clearAll(); bool copyRow(int dst_row, int src_row); - bool copyFromProfile(QString filename, const gchar **err); + bool copyFromProfile(QString filename, const char **err); - static QString entryString(const gchar *table_name, gconstpointer value); + static QString entryString(const char *table_name, gconstpointer value); void applyChanges(); protected: - static void buildChangedList(const gchar *table_name, ftenum_t selector_type, - gpointer key, gpointer value, gpointer user_data); - static void buildDceRpcChangedList(gpointer data, gpointer user_data); - static void gatherChangedEntries(const gchar *table_name, ftenum_t selector_type, - gpointer key, gpointer value, gpointer user_data); - static prefs_set_pref_e readDecodeAsEntry(gchar *key, const gchar *value, + static void buildChangedList(const char *table_name, ftenum_t selector_type, + void *key, void *value, void *user_data); + static void buildDceRpcChangedList(void *data, void *user_data); + static void gatherChangedEntries(const char *table_name, ftenum_t selector_type, + void *key, void *value, void *user_data); + static prefs_set_pref_e readDecodeAsEntry(char *key, const char *value, void *user_data, bool); private: capture_file *cap_file_; QList decode_as_items_; - QList > changed_uint_entries_; + QList > changed_uint_entries_; QList > changed_string_entries_; }; diff --git a/ui/qt/models/dissector_tables_model.cpp b/ui/qt/models/dissector_tables_model.cpp index e50dcbeb14..dcf3dc7259 100644 --- a/ui/qt/models/dissector_tables_model.cpp +++ b/ui/qt/models/dissector_tables_model.cpp @@ -179,7 +179,7 @@ QVariant DissectorTablesModel::data(const QModelIndex &index, int role) const return QVariant(); } -static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer key, gpointer value, gpointer item_ptr) +static void gatherProtocolDecodes(const char *, ftenum_t selector_type, void *key, void *value, void *item_ptr) { DissectorTablesItem* pdl_ptr = (DissectorTablesItem*)item_ptr; if (pdl_ptr == NULL) @@ -225,7 +225,7 @@ struct tables_root DissectorTablesItem* string_table; }; -static void gatherTableNames(const char *short_name, const char *table_name, gpointer model_ptr) +static void gatherTableNames(const char *short_name, const char *table_name, void *model_ptr) { struct tables_root* tables = (struct tables_root*)model_ptr; if (model_ptr == NULL) @@ -262,7 +262,7 @@ static void gatherTableNames(const char *short_name, const char *table_name, gpo dissector_table_foreach(short_name, gatherProtocolDecodes, dt_ti); } -static void gatherHeurProtocolDecodes(const char *, struct heur_dtbl_entry *dtbl_entry, gpointer list_ptr) +static void gatherHeurProtocolDecodes(const char *, struct heur_dtbl_entry *dtbl_entry, void *list_ptr) { DissectorTablesItem* hdl_ptr = (DissectorTablesItem*)list_ptr; if (hdl_ptr == NULL) @@ -279,7 +279,7 @@ static void gatherHeurProtocolDecodes(const char *, struct heur_dtbl_entry *dtbl } } -static void gatherHeurTableNames(const char *table_name, heur_dissector_list *list, gpointer heur_tables) +static void gatherHeurTableNames(const char *table_name, heur_dissector_list *list, void *heur_tables) { DissectorTablesItem* table = (DissectorTablesItem*)heur_tables; if (table == NULL) diff --git a/ui/qt/models/enabled_protocols_model.cpp b/ui/qt/models/enabled_protocols_model.cpp index ecbc47a9ed..b040587b1b 100644 --- a/ui/qt/models/enabled_protocols_model.cpp +++ b/ui/qt/models/enabled_protocols_model.cpp @@ -31,7 +31,7 @@ public: virtual ~ProtocolTreeItem() {} protected: - virtual void applyValuePrivate(gboolean value) + virtual void applyValuePrivate(bool value) { if (! proto_can_toggle_protocol(proto_get_id(proto_))) { return; @@ -56,7 +56,7 @@ public: virtual ~HeuristicTreeItem() {} protected: - virtual void applyValuePrivate(gboolean value) + virtual void applyValuePrivate(bool value) { heuristic_table_->enabled = value; } @@ -270,7 +270,7 @@ bool EnabledProtocolsModel::setData(const QModelIndex &index, const QVariant &va return true; } -static void addHeuristicItem(gpointer data, gpointer user_data) +static void addHeuristicItem(void *data, void *user_data) { heur_dtbl_entry_t* heur = (heur_dtbl_entry_t*)data; ProtocolTreeItem* protocol_item = (ProtocolTreeItem*)user_data; diff --git a/ui/qt/models/enabled_protocols_model.h b/ui/qt/models/enabled_protocols_model.h index 23b2c1bb2d..fe6caeabdb 100644 --- a/ui/qt/models/enabled_protocols_model.h +++ b/ui/qt/models/enabled_protocols_model.h @@ -43,7 +43,7 @@ public: bool applyValue(); protected: - virtual void applyValuePrivate(gboolean value) = 0; + virtual void applyValuePrivate(bool value) = 0; QString name_; QString description_; diff --git a/ui/qt/models/expert_info_model.cpp b/ui/qt/models/expert_info_model.cpp index 017dba3de5..2420461200 100644 --- a/ui/qt/models/expert_info_model.cpp +++ b/ui/qt/models/expert_info_model.cpp @@ -118,7 +118,7 @@ ExpertPacketItem* ExpertInfoModel::createRootItem() { static const char* rootName = "ROOT"; DIAG_OFF_CAST_AWAY_CONST - static expert_info_t root_expert = { 0, -1, -1, -1, rootName, (gchar*)rootName, NULL }; + static expert_info_t root_expert = { 0, -1, -1, -1, rootName, (char*)rootName, NULL }; DIAG_ON_CAST_AWAY_CONST return new ExpertPacketItem(root_expert, NULL, NULL); @@ -355,8 +355,8 @@ int ExpertInfoModel::columnCount(const QModelIndex&) const void ExpertInfoModel::addExpertInfo(const struct expert_info_s& expert_info) { - QString groupKey = ExpertPacketItem::groupKey(FALSE, expert_info.severity, expert_info.group, QString(expert_info.protocol), expert_info.hf_index); - QString summaryKey = ExpertPacketItem::groupKey(TRUE, expert_info.severity, expert_info.group, QString(expert_info.protocol), expert_info.hf_index); + QString groupKey = ExpertPacketItem::groupKey(false, expert_info.severity, expert_info.group, QString(expert_info.protocol), expert_info.hf_index); + QString summaryKey = ExpertPacketItem::groupKey(true, expert_info.severity, expert_info.group, QString(expert_info.protocol), expert_info.hf_index); ExpertPacketItem* expert_root = root_->child(groupKey); if (expert_root == NULL) { diff --git a/ui/qt/models/export_objects_model.cpp b/ui/qt/models/export_objects_model.cpp index 3cf9ec63a9..f79edd398a 100644 --- a/ui/qt/models/export_objects_model.cpp +++ b/ui/qt/models/export_objects_model.cpp @@ -176,7 +176,7 @@ void ExportObjectModel::saveAllEntries(QString path) if (entry == NULL) continue; - guint count = 0; + unsigned count = 0; QString filename; do { @@ -196,7 +196,7 @@ void ExportObjectModel::saveAllEntries(QString path) EXPORT_OBJECT_MAXFILELEN, count); } filename = QString::fromUtf8(safe_filename->str); - g_string_free(safe_filename, TRUE); + g_string_free(safe_filename, true); } while (save_dir.exists(filename) && ++count < prefs.gui_max_export_objects); write_file_binary_mode(qUtf8Printable(save_dir.filePath(filename)), entry->payload_data, entry->payload_len); diff --git a/ui/qt/models/fileset_entry_model.h b/ui/qt/models/fileset_entry_model.h index aa812b0cf7..40e6796f4e 100644 --- a/ui/qt/models/fileset_entry_model.h +++ b/ui/qt/models/fileset_entry_model.h @@ -12,8 +12,6 @@ #include -#include - #include #include diff --git a/ui/qt/models/filter_list_model.cpp b/ui/qt/models/filter_list_model.cpp index 4116246d56..c257d6af32 100644 --- a/ui/qt/models/filter_list_model.cpp +++ b/ui/qt/models/filter_list_model.cpp @@ -8,8 +8,6 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#include - #include #include @@ -66,7 +64,7 @@ void FilterListModel::reload() } /* Try personal config file first */ - QString fileName = gchar_free_to_qstring(get_persconffile_path(cfile, TRUE)); + QString fileName = gchar_free_to_qstring(get_persconffile_path(cfile, true)); if (fileName.length() <= 0 || ! QFileInfo::exists(fileName)) fileName = gchar_free_to_qstring(get_datafile_path(cfile)); if (fileName.length() <= 0 || ! QFileInfo::exists(fileName)) diff --git a/ui/qt/models/interface_sort_filter_model.cpp b/ui/qt/models/interface_sort_filter_model.cpp index 6e511151ad..f5d62074b2 100644 --- a/ui/qt/models/interface_sort_filter_model.cpp +++ b/ui/qt/models/interface_sort_filter_model.cpp @@ -12,8 +12,6 @@ #include #include -#include - #include #include #include diff --git a/ui/qt/models/interface_sort_filter_model.h b/ui/qt/models/interface_sort_filter_model.h index 5bf69d9d52..e3609a81e0 100644 --- a/ui/qt/models/interface_sort_filter_model.h +++ b/ui/qt/models/interface_sort_filter_model.h @@ -16,8 +16,6 @@ #include -#include - #include class InterfaceSortFilterModel : public QSortFilterProxyModel diff --git a/ui/qt/models/interface_tree_model.cpp b/ui/qt/models/interface_tree_model.cpp index f3c8f98be5..696937a204 100644 --- a/ui/qt/models/interface_tree_model.cpp +++ b/ui/qt/models/interface_tree_model.cpp @@ -370,7 +370,7 @@ void InterfaceTreeModel::interfaceListChanged() QVariant InterfaceTreeModel::toolTipForInterface(int idx) const { #ifdef HAVE_LIBPCAP - if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx) + if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (unsigned) idx) return QVariant(); interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx); @@ -434,7 +434,7 @@ void InterfaceTreeModel::stopStatistic() void InterfaceTreeModel::updateStatistic(unsigned int idx) { #ifdef HAVE_LIBPCAP - if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (guint) idx) + if (! global_capture_opts.all_ifaces || global_capture_opts.all_ifaces->len <= (unsigned) idx) return; interface_t *device = &g_array_index(global_capture_opts.all_ifaces, interface_t, idx); @@ -540,12 +540,12 @@ bool InterfaceTreeModel::updateSelectedDevices(QItemSelection sourceSelection) { if (! device->selected) selectionHasChanged = true; - device->selected = TRUE; + device->selected = true; global_capture_opts.num_selected++; } else { if (device->selected) selectionHasChanged = true; - device->selected = FALSE; + device->selected = false; } } #else diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp index 9736cee1a4..9461ebcfed 100644 --- a/ui/qt/models/packet_list_model.cpp +++ b/ui/qt/models/packet_list_model.cpp @@ -8,7 +8,6 @@ */ #include -#include #include #include @@ -55,7 +54,7 @@ class SortAbort : public std::runtime_error static PacketListModel * glbl_plist_model = Q_NULLPTR; static const int reserved_packets_ = 100000; -guint +unsigned packet_list_append(column_info *, frame_data *fdata) { if (!glbl_plist_model) @@ -143,7 +142,7 @@ int PacketListModel::packetNumberToRow(int packet_num) const return number_to_row_.value(packet_num) - 1; } -guint PacketListModel::recreateVisibleRows() +unsigned PacketListModel::recreateVisibleRows() { beginResetModel(); visible_rows_.resize(0); @@ -155,7 +154,7 @@ guint PacketListModel::recreateVisibleRows() if (fdata->passed_dfilter || fdata->ref_time) { visible_rows_ << record; - if (static_cast(number_to_row_.size()) <= fdata->num) { + if (static_cast(number_to_row_.size()) <= fdata->num) { number_to_row_.resize(fdata->num + 10000); } number_to_row_[fdata->num] = static_cast(visible_rows_.count()); @@ -166,7 +165,7 @@ guint PacketListModel::recreateVisibleRows() endInsertRows(); } idle_dissection_row_ = 0; - return static_cast(visible_rows_.count()); + return static_cast(visible_rows_.count()); } void PacketListModel::clear() { @@ -237,7 +236,7 @@ void PacketListModel::toggleFrameMark(const QModelIndexList &indeces) } } -void PacketListModel::setDisplayedFrameMark(gboolean set) +void PacketListModel::setDisplayedFrameMark(bool set) { foreach (PacketListRecord *record, visible_rows_) { if (set) { @@ -279,7 +278,7 @@ void PacketListModel::toggleFrameIgnore(const QModelIndexList &indeces) } } -void PacketListModel::setDisplayedFrameIgnore(gboolean set) +void PacketListModel::setDisplayedFrameIgnore(bool set) { foreach (PacketListRecord *record, visible_rows_) { if (set) { @@ -378,7 +377,7 @@ void PacketListModel::addFrameComment(const QModelIndexList &indices, const QByt } } -void PacketListModel::setFrameComment(const QModelIndex &index, const QByteArray &comment, guint c_number) +void PacketListModel::setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number) { int sectionMax = columnCount() - 1; frame_data *fdata; @@ -423,10 +422,10 @@ void PacketListModel::deleteFrameComments(const QModelIndexList &indices) fdata = record->frameData(); wtap_block_t pkt_block = cf_get_packet_block(cap_file_, fdata); - guint n_comments = wtap_block_count_option(pkt_block, OPT_COMMENT); + unsigned n_comments = wtap_block_count_option(pkt_block, OPT_COMMENT); if (n_comments) { - for (guint i = 0; i < n_comments; i++) { + for (unsigned i = 0; i < n_comments; i++) { wtap_block_remove_nth_option_instance(pkt_block, OPT_COMMENT, 0); } if (!cf_set_modified_block(cap_file_, fdata, pkt_block)) { @@ -453,10 +452,10 @@ void PacketListModel::deleteAllFrameComments() foreach (PacketListRecord *record, physical_rows_) { frame_data *fdata = record->frameData(); wtap_block_t pkt_block = cf_get_packet_block(cap_file_, fdata); - guint n_comments = wtap_block_count_option(pkt_block, OPT_COMMENT); + unsigned n_comments = wtap_block_count_option(pkt_block, OPT_COMMENT); if (n_comments) { - for (guint i = 0; i < n_comments; i++) { + for (unsigned i = 0; i < n_comments; i++) { wtap_block_remove_nth_option_instance(pkt_block, OPT_COMMENT, 0); } cf_set_modified_block(cap_file_, fdata, pkt_block); @@ -510,7 +509,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order) QString col_title = get_column_title(column); - if (text_sort_column_ >= 0 && (guint)visible_rows_.count() > prefs.gui_packet_list_cached_rows_max) { + if (text_sort_column_ >= 0 && (unsigned)visible_rows_.count() > prefs.gui_packet_list_cached_rows_max) { /* Column not based on frame data but by column text that requires * dissection, so to sort in a reasonable amount of time the column * text needs to be cached. @@ -545,7 +544,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order) */ return; } - sort_cap_file_->read_lock = TRUE; + sort_cap_file_->read_lock = true; QString busy_msg; if (!col_title.isEmpty()) { @@ -553,7 +552,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order) } else { busy_msg = tr("Sorting …"); } - stop_flag_ = FALSE; + stop_flag_ = false; comps_ = 0; /* XXX: The expected number of comparisons is O(N log N), but this could * be a pretty significant overestimate of the amount of time it takes, @@ -603,7 +602,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order) disconnect(progress_frame_, &ProgressFrame::stopLoading, this, &PacketListModel::stopSorting); } - sort_cap_file_->read_lock = FALSE; + sort_cap_file_->read_lock = false; if (cap_file_->current_frame) { emit goToPacket(cap_file_->current_frame->num); @@ -612,7 +611,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order) void PacketListModel::stopSorting() { - stop_flag_ = TRUE; + stop_flag_ = true; } bool PacketListModel::isNumericColumn(int column) @@ -654,9 +653,9 @@ bool PacketListModel::isNumericColumn(int column) return false; } - guint num_fields = g_slist_length(sort_cap_file_->cinfo.columns[column].col_custom_fields_ids); + unsigned num_fields = g_slist_length(sort_cap_file_->cinfo.columns[column].col_custom_fields_ids); col_custom_t *col_custom; - for (guint i = 0; i < num_fields; i++) { + for (unsigned i = 0; i < num_fields; i++) { col_custom = (col_custom_t *) g_slist_nth_data(sort_cap_file_->cinfo.columns[column].col_custom_fields_ids, i); if (col_custom->field_id == 0) { /* XXX - We need some way to check the compiled dfilter's expected @@ -767,7 +766,7 @@ double PacketListModel::parseNumericColumn(const QString &val, bool *ok) { QByteArray ba = val.toUtf8(); const char *strval = ba.constData(); - gchar *end = NULL; + char *end = NULL; double num = g_ascii_strtod(strval, &end); *ok = strval != end; return num; @@ -958,7 +957,7 @@ void PacketListModel::dissectIdle(bool reset) // XXX Pass in cinfo from packet_list_append so that we can fill in // line counts? -gint PacketListModel::appendPacket(frame_data *fdata) +int PacketListModel::appendPacket(frame_data *fdata) { PacketListRecord *record = new PacketListRecord(fdata); qsizetype pos = -1; @@ -981,7 +980,7 @@ gint PacketListModel::appendPacket(frame_data *fdata) pos = static_cast( visible_rows_.count() + new_visible_rows_.count() ) - 1; } - return static_cast(pos); + return static_cast(pos); } frame_data *PacketListModel::getRowFdata(QModelIndex idx) const diff --git a/ui/qt/models/packet_list_model.h b/ui/qt/models/packet_list_model.h index 3f95ebad63..81177c34cf 100644 --- a/ui/qt/models/packet_list_model.h +++ b/ui/qt/models/packet_list_model.h @@ -14,8 +14,6 @@ #include -#include - #include #include @@ -46,7 +44,7 @@ public: const QModelIndex & = QModelIndex()) const; QModelIndex parent(const QModelIndex &) const; int packetNumberToRow(int packet_num) const; - guint recreateVisibleRows(); + unsigned recreateVisibleRows(); void clear(); int rowCount(const QModelIndex &parent = QModelIndex()) const; @@ -54,7 +52,7 @@ public: QVariant data(const QModelIndex &d_index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - gint appendPacket(frame_data *fdata); + int appendPacket(frame_data *fdata); frame_data *getRowFdata(QModelIndex idx) const; frame_data *getRowFdata(int row) const; void ensureRowColorized(int row); @@ -69,13 +67,13 @@ public: void resetColumns(); void resetColorized(); void toggleFrameMark(const QModelIndexList &indeces); - void setDisplayedFrameMark(gboolean set); + void setDisplayedFrameMark(bool set); void toggleFrameIgnore(const QModelIndexList &indeces); - void setDisplayedFrameIgnore(gboolean set); + void setDisplayedFrameIgnore(bool set); void toggleFrameRefTime(const QModelIndex &rt_index); void unsetAllFrameRefTime(); void addFrameComment(const QModelIndexList &indices, const QByteArray &comment); - void setFrameComment(const QModelIndex &index, const QByteArray &comment, guint c_number); + void setFrameComment(const QModelIndex &index, const QByteArray &comment, unsigned c_number); void deleteFrameComments(const QModelIndexList &indices); void deleteAllFrameComments(); diff --git a/ui/qt/models/packet_list_record.cpp b/ui/qt/models/packet_list_record.cpp index 9c2c66d134..156db16a45 100644 --- a/ui/qt/models/packet_list_record.cpp +++ b/ui/qt/models/packet_list_record.cpp @@ -24,7 +24,7 @@ #include -QCache PacketListRecord::col_text_cache_(500); +QCache PacketListRecord::col_text_cache_(500); QMap PacketListRecord::cinfo_column_; unsigned PacketListRecord::rows_color_ver_ = 1; @@ -112,7 +112,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_columns, boo // packet_list_store.c:packet_list_dissect_and_cache_record epan_dissect_t edt; column_info *cinfo = NULL; - gboolean create_proto_tree; + bool create_proto_tree; wtap_rec rec; /* Record metadata */ Buffer buf; /* Record data */ @@ -144,7 +144,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_columns, boo * error message. */ if (dissect_columns) { - col_fill_in_error(cinfo, fdata_, FALSE, FALSE /* fill_fd_columns */); + col_fill_in_error(cinfo, fdata_, false, false /* fill_fd_columns */); cacheColumnStrings(cinfo); } @@ -175,7 +175,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_columns, boo epan_dissect_init(&edt, cap_file->epan, create_proto_tree, - FALSE /* proto_tree_visible */); + false /* proto_tree_visible */); /* Re-color when the coloring rules are changed via the UI. */ if (dissect_color) { @@ -195,7 +195,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_columns, boo if (dissect_columns) { /* "Stringify" non frame_data vals */ - epan_dissect_fill_in_columns(&edt, FALSE, FALSE /* fill_fd_columns */); + epan_dissect_fill_in_columns(&edt, false, false /* fill_fd_columns */); cacheColumnStrings(cinfo); } @@ -214,7 +214,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_columns, boo void PacketListRecord::cacheColumnStrings(column_info *cinfo) { - // packet_list_store.c:packet_list_change_record(PacketList *packet_list, PacketListRecord *record, gint col, column_info *cinfo) + // packet_list_store.c:packet_list_change_record(PacketList *packet_list, PacketListRecord *record, int col, column_info *cinfo) if (!cinfo) { return; } @@ -230,7 +230,7 @@ void PacketListRecord::cacheColumnStrings(column_info *cinfo) QString col_str; int text_col = cinfo_column_.value(column, -1); if (text_col < 0) { - col_fill_in_frame_data(fdata_, cinfo, column, FALSE); + col_fill_in_frame_data(fdata_, cinfo, column, false); } col_str = QString(get_column_text(cinfo, column)); diff --git a/ui/qt/models/packet_list_record.h b/ui/qt/models/packet_list_record.h index 47aa5621d1..7bb582fa9b 100644 --- a/ui/qt/models/packet_list_record.h +++ b/ui/qt/models/packet_list_record.h @@ -12,8 +12,6 @@ #include -#include - #include "cfile.h" #include @@ -60,7 +58,7 @@ public: private: /** The column text for some columns */ - static QCache col_text_cache_; + static QCache col_text_cache_; frame_data *fdata_; int lines_; diff --git a/ui/qt/models/pref_delegate.cpp b/ui/qt/models/pref_delegate.cpp index e33bb13f23..313c17dc3a 100644 --- a/ui/qt/models/pref_delegate.cpp +++ b/ui/qt/models/pref_delegate.cpp @@ -66,7 +66,7 @@ void AdvancedPrefDelegate::setEditorData(QWidget *editor, const QModelIndex &ind return; } - Q_ASSERT(FALSE); + Q_ASSERT(false); } void AdvancedPrefDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, @@ -81,5 +81,5 @@ void AdvancedPrefDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod return; } - Q_ASSERT(FALSE); + Q_ASSERT(false); } diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp index 883114be78..6f6a60ef08 100644 --- a/ui/qt/models/pref_models.cpp +++ b/ui/qt/models/pref_models.cpp @@ -26,7 +26,7 @@ static GHashTable * pref_ptr_to_pref_ = NULL; pref_t *prefFromPrefPtr(void *pref_ptr) { - return (pref_t *)g_hash_table_lookup(pref_ptr_to_pref_, (gpointer) pref_ptr); + return (pref_t *)g_hash_table_lookup(pref_ptr_to_pref_, (void *) pref_ptr); } static void prefInsertPrefPtr(void * pref_ptr, pref_t * pref) @@ -34,8 +34,8 @@ static void prefInsertPrefPtr(void * pref_ptr, pref_t * pref) if (! pref_ptr_to_pref_) pref_ptr_to_pref_ = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); - gpointer key = (gpointer) pref_ptr; - gpointer val = (gpointer) pref; + void *key = (void *) pref_ptr; + void *val = (void *) pref; /* Already existing entries will be ignored */ if ((void *)g_hash_table_lookup(pref_ptr_to_pref_, key) == NULL) @@ -232,8 +232,8 @@ QVariant PrefsModel::data(const QModelIndex &index, int role) const return QVariant(); } -static guint -fill_prefs(module_t *module, gpointer root_ptr) +static unsigned +fill_prefs(module_t *module, void *root_ptr) { PrefsItem* root_item = static_cast(root_ptr); @@ -275,7 +275,7 @@ fill_prefs(module_t *module, gpointer root_ptr) void PrefsModel::populate() { - prefs_modules_foreach_submodules(NULL, fill_prefs, (gpointer)root_); + prefs_modules_foreach_submodules(NULL, fill_prefs, (void *)root_); //Add the "specially handled" preferences PrefsItem *appearance_item, *appearance_subitem, *special_item; @@ -473,7 +473,7 @@ bool AdvancedPrefsModel::setData(const QModelIndex &dataindex, const QVariant &v case PREF_UINT: { bool ok; - guint new_val = value.toString().toUInt(&ok, prefs_get_uint_base(item->getPref())); + unsigned new_val = value.toString().toUInt(&ok, prefs_get_uint_base(item->getPref())); if (ok) prefs_set_uint_value(item->getPref(), new_val, pref_stashed); diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp index 206ef38930..1625eed2ca 100644 --- a/ui/qt/models/profile_model.cpp +++ b/ui/qt/models/profile_model.cpp @@ -11,7 +11,6 @@ #include -#include "glib.h" #include "ui/profile.h" #include "ui/recent.h" #include "wsutil/filesystem.h" @@ -492,7 +491,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const { case PROF_STAT_DEFAULT: if (!reset_default_) - return gchar_free_to_qstring(get_persconffile_path("", FALSE)); + return gchar_free_to_qstring(get_persconffile_path("", false)); else return tr("Resetting to default"); case PROF_STAT_EXISTS: @@ -537,7 +536,7 @@ QVariant ProfileModel::dataPath(const QModelIndex &index) const QString appendix; /* A global profile is neither deleted or removed, only system provided is allowed as appendix */ - if (profile_exists(prof->reference, TRUE) && prof->from_global) + if (profile_exists(prof->reference, true) && prof->from_global) appendix = tr("system provided"); /* A default model as reference can neither be deleted or renamed, so skip if the reference was one */ else if (! index.data(ProfileModel::DATA_IS_DEFAULT).toBool()) @@ -722,7 +721,7 @@ QModelIndex ProfileModel::addNewProfile(QString name) cnt++; } - add_to_profile_list(newName.toUtf8().constData(), newName.toUtf8().constData(), PROF_STAT_NEW, FALSE, FALSE, FALSE); + add_to_profile_list(newName.toUtf8().constData(), newName.toUtf8().constData(), PROF_STAT_NEW, false, false, false); loadProfiles(); return index(findByName(newName), COL_NAME); @@ -794,7 +793,7 @@ QModelIndex ProfileModel::duplicateEntry(QModelIndex idx, int new_status) new_status = PROF_STAT_NEW; /* add element */ - add_to_profile_list(new_name.toUtf8().constData(), parent.toUtf8().constData(), new_status, FALSE, prof->from_global ? prof->from_global : prof->is_global, FALSE); + add_to_profile_list(new_name.toUtf8().constData(), parent.toUtf8().constData(), new_status, false, prof->from_global ? prof->from_global : prof->is_global, false); /* reload profile list in model */ loadProfiles(); @@ -1163,7 +1162,7 @@ int ProfileModel::importProfilesFromDir(QString dirname, int * skippedCnt, bool if (success) { count++; - add_to_profile_list(fentry.fileName().toUtf8().constData(), fentry.fileName().toUtf8().constData(), PROF_STAT_NEW, FALSE, FALSE, TRUE); + add_to_profile_list(fentry.fileName().toUtf8().constData(), fentry.fileName().toUtf8().constData(), PROF_STAT_NEW, false, false, true); } else if (! wasEmpty && QFile::exists(profilePath)) { diff --git a/ui/qt/models/profile_model.h b/ui/qt/models/profile_model.h index 16febd70cf..30c3dec1e6 100644 --- a/ui/qt/models/profile_model.h +++ b/ui/qt/models/profile_model.h @@ -11,7 +11,6 @@ #define PROFILE_MODEL_H #include "config.h" -#include "glib.h" #include diff --git a/ui/qt/models/proto_tree_model.cpp b/ui/qt/models/proto_tree_model.cpp index 66d8489cbf..fe6f7f957e 100644 --- a/ui/qt/models/proto_tree_model.cpp +++ b/ui/qt/models/proto_tree_model.cpp @@ -189,7 +189,7 @@ struct find_hfid_ { }; // NOLINTNEXTLINE(misc-no-recursion) -bool ProtoTreeModel::foreachFindHfid(ProtoNode *node, gpointer find_hfid_ptr) +bool ProtoTreeModel::foreachFindHfid(ProtoNode *node, void *find_hfid_ptr) { struct find_hfid_ *find_hfid = (struct find_hfid_ *) find_hfid_ptr; if (PNODE_FINFO(node->protoNode()) && PNODE_FINFO(node->protoNode())->hfinfo->id == find_hfid->hfid) { @@ -224,7 +224,7 @@ struct find_field_info_ { }; // NOLINTNEXTLINE(misc-no-recursion) -bool ProtoTreeModel::foreachFindField(ProtoNode *node, gpointer find_finfo_ptr) +bool ProtoTreeModel::foreachFindField(ProtoNode *node, void *find_finfo_ptr) { struct find_field_info_ *find_finfo = (struct find_field_info_ *) find_finfo_ptr; if (PNODE_FINFO(node->protoNode()) == find_finfo->fi) { diff --git a/ui/qt/models/proto_tree_model.h b/ui/qt/models/proto_tree_model.h index df7cbba872..12d08fc0cc 100644 --- a/ui/qt/models/proto_tree_model.h +++ b/ui/qt/models/proto_tree_model.h @@ -41,8 +41,8 @@ public: private: ProtoNode *root_node_; - static bool foreachFindHfid(ProtoNode *node, gpointer find_hfid_ptr); - static bool foreachFindField(ProtoNode *node, gpointer find_finfo_ptr); + static bool foreachFindHfid(ProtoNode *node, void *find_hfid_ptr); + static bool foreachFindField(ProtoNode *node, void *find_finfo_ptr); }; #endif // PROTO_TREE_MODEL_H diff --git a/ui/qt/models/related_packet_delegate.cpp b/ui/qt/models/related_packet_delegate.cpp index 885160f4e4..bb001adce4 100644 --- a/ui/qt/models/related_packet_delegate.cpp +++ b/ui/qt/models/related_packet_delegate.cpp @@ -73,7 +73,7 @@ void RelatedPacketDelegate::paint(QPainter *painter, const QStyleOptionViewItem option_vi.decorationSize.setWidth(em_w); QStyledItemDelegate::paint(painter, option_vi, index); - guint32 setup_frame = 0, last_frame = 0; + uint32_t setup_frame = 0, last_frame = 0; if (conv_) { setup_frame = (int) conv_->setup_frame; last_frame = (int) conv_->last_frame; @@ -339,7 +339,7 @@ void RelatedPacketDelegate::clear() conv_ = NULL; } -void RelatedPacketDelegate::setCurrentFrame(guint32 current_frame) +void RelatedPacketDelegate::setCurrentFrame(uint32_t current_frame) { current_frame_ = current_frame; foreach (ft_framenum_type_t framenum_type, related_frames_) { diff --git a/ui/qt/models/related_packet_delegate.h b/ui/qt/models/related_packet_delegate.h index 927129a045..6825011910 100644 --- a/ui/qt/models/related_packet_delegate.h +++ b/ui/qt/models/related_packet_delegate.h @@ -26,7 +26,7 @@ class RelatedPacketDelegate : public QStyledItemDelegate public: RelatedPacketDelegate(QWidget *parent = 0); void clear(); - void setCurrentFrame(guint32 current_frame); + void setCurrentFrame(uint32_t current_frame); void setConversation(struct conversation *conv); public slots: @@ -41,7 +41,7 @@ protected: private: QHash related_frames_; struct conversation *conv_; - guint32 current_frame_; + uint32_t current_frame_; void drawArrow(QPainter *painter, const QPoint tail, const QPoint head, int head_size) const; void drawChevrons(QPainter *painter, const QPoint tail, const QPoint head, int head_size) const; diff --git a/ui/qt/models/resolved_addresses_models.cpp b/ui/qt/models/resolved_addresses_models.cpp index 4f4245b44f..d35d87b290 100644 --- a/ui/qt/models/resolved_addresses_models.cpp +++ b/ui/qt/models/resolved_addresses_models.cpp @@ -9,8 +9,6 @@ #include -#include - #include "file.h" #include "epan/addr_resolv.h" @@ -20,11 +18,11 @@ extern "C" { static void -serv_port_hash_to_qstringlist(gpointer key, gpointer value, gpointer member_ptr) +serv_port_hash_to_qstringlist(void *key, void *value, void *member_ptr) { PortsModel *model = static_cast(member_ptr); serv_port_t *serv_port = (serv_port_t *)value; - guint port = GPOINTER_TO_UINT(key); + unsigned port = GPOINTER_TO_UINT(key); if (serv_port->tcp_name) { QStringList entries; @@ -61,7 +59,7 @@ serv_port_hash_to_qstringlist(gpointer key, gpointer value, gpointer member_ptr) } static void -ipv4_hash_table_resolved_to_list(gpointer, gpointer value, gpointer sl_ptr) +ipv4_hash_table_resolved_to_list(void *, void *value, void *sl_ptr) { QList *hosts = (QList *) sl_ptr; hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *) value; @@ -72,7 +70,7 @@ ipv4_hash_table_resolved_to_list(gpointer, gpointer value, gpointer sl_ptr) } static void -ipv6_hash_table_resolved_to_list(gpointer, gpointer value, gpointer sl_ptr) +ipv6_hash_table_resolved_to_list(void *, void *value, void *sl_ptr) { QList *hosts = (QList *) sl_ptr; hashipv6_t *ipv6_hash_table_entry = (hashipv6_t *) value; @@ -83,7 +81,7 @@ ipv6_hash_table_resolved_to_list(gpointer, gpointer value, gpointer sl_ptr) } static void -eth_hash_to_qstringlist(gpointer, gpointer value, gpointer sl_ptr) +eth_hash_to_qstringlist(void *, void *value, void *sl_ptr) { QList *values = (QList *) sl_ptr; hashether_t* tp = (hashether_t*)value; @@ -94,11 +92,11 @@ eth_hash_to_qstringlist(gpointer, gpointer value, gpointer sl_ptr) } static void -manuf_hash_to_qstringlist(gpointer key, gpointer value, gpointer sl_ptr) +manuf_hash_to_qstringlist(void *key, void *value, void *sl_ptr) { QList *values = (QList *) sl_ptr; hashmanuf_t *manuf = (hashmanuf_t*)value; - guint eth_as_guint = GPOINTER_TO_UINT(key); + unsigned eth_as_guint = GPOINTER_TO_UINT(key); if (get_hash_manuf_used(manuf)) { QString entry = QString("%1:%2:%3") @@ -111,11 +109,11 @@ manuf_hash_to_qstringlist(gpointer key, gpointer value, gpointer sl_ptr) } static void -wka_hash_to_qstringlist(gpointer key, gpointer value, gpointer sl_ptr) +wka_hash_to_qstringlist(void *key, void *value, void *sl_ptr) { QList *values = (QList *) sl_ptr; hashwka_t *wkahash = (hashwka_t *)value; - guint8 *eth_addr = (guint8*)key; + uint8_t *eth_addr = (uint8_t*)key; if (get_hash_wka_used(wkahash)) { QString entry = QString("%1:%2:%3:%4:%5:%6") diff --git a/ui/qt/models/uat_delegate.h b/ui/qt/models/uat_delegate.h index e57e533da9..f9cfa92d38 100644 --- a/ui/qt/models/uat_delegate.h +++ b/ui/qt/models/uat_delegate.h @@ -15,7 +15,6 @@ #define UAT_DELEGATE_H #include -#include #include #include diff --git a/ui/qt/models/uat_model.cpp b/ui/qt/models/uat_model.cpp index 0f2a1cca53..0f1195e2d4 100644 --- a/ui/qt/models/uat_model.cpp +++ b/ui/qt/models/uat_model.cpp @@ -55,7 +55,7 @@ void UatModel::reloadUat() bool UatModel::applyChanges(QString &error) { if (uat_->changed) { - gchar *err = NULL; + char *err = NULL; if (!uat_save(uat_, &err)) { error = QString("Error while saving %1: %2").arg(uat_->name).arg(err); @@ -77,7 +77,7 @@ bool UatModel::revertChanges(QString &error) // to avoid calling post_update_cb. Calling uat_clear + uat_load is a lazy // option and might fail (e.g. when the UAT file is removed). if (uat_->changed) { - gchar *err = NULL; + char *err = NULL; uat_clear(uat_); if (!uat_load(uat_, NULL, &err)) { error = QString("Error while loading %1: %2").arg(uat_->name).arg(err); @@ -115,13 +115,13 @@ QVariant UatModel::data(const QModelIndex &index, int role) const uat_field_t *field = &uat_->fields[index.column()]; if (role == Qt::DisplayRole || role == Qt::EditRole) { char *str = NULL; - guint length = 0; + unsigned length = 0; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); switch (field->mode) { case PT_TXTMOD_HEXBYTES: { - char* temp_str = bytes_to_str(NULL, (const guint8 *) str, length); + char* temp_str = bytes_to_str(NULL, (const uint8_t *) str, length); g_free(str); QString qstr(temp_str); wmem_free(NULL, temp_str); @@ -139,10 +139,10 @@ QVariant UatModel::data(const QModelIndex &index, int role) const if ((role == Qt::CheckStateRole) && (field->mode == PT_TXTMOD_BOOL)) { char *str = NULL; - guint length = 0; + unsigned length = 0; enum Qt::CheckState state = Qt::Unchecked; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); - if ((g_strcmp0(str, "TRUE") == 0) || + if ((g_strcmp0(str, "true") == 0) || (g_strcmp0(str, "Enabled") == 0)) state = Qt::Checked; @@ -166,7 +166,7 @@ QVariant UatModel::data(const QModelIndex &index, int role) const if ((role == Qt::DecorationRole) && (field->mode == PT_TXTMOD_COLOR)) { char *str = NULL; - guint length = 0; + unsigned length = 0; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); return QColor(gchar_free_to_qstring(str)); @@ -257,9 +257,9 @@ QModelIndex UatModel::appendEntry(QVariantList rowData) data = rowData[col].toString(); } else { if (rowData[col].toInt() == Qt::Checked) { - data = QString("TRUE"); + data = QString("true"); } else { - data = QString("FALSE"); + data = QString("false"); } } } @@ -279,7 +279,7 @@ QModelIndex UatModel::appendEntry(QVariantList rowData) // postponed until the row (in the view) is not selected anymore checkRow(row); dirty_records.insert(row, true); - uat_->changed = TRUE; + uat_->changed = true; emit endInsertRows(); @@ -314,9 +314,9 @@ bool UatModel::setData(const QModelIndex &index, const QVariant &value, int role field->cb.set(rec, bytes.constData(), (unsigned) bytes.size(), field->cbdata.set, field->fld_data); } else { if (value.toInt() == Qt::Checked) { - field->cb.set(rec, "TRUE", 4, field->cbdata.set, field->fld_data); + field->cb.set(rec, "true", 4, field->cbdata.set, field->fld_data); } else { - field->cb.set(rec, "FALSE", 5, field->cbdata.set, field->fld_data); + field->cb.set(rec, "false", 5, field->cbdata.set, field->fld_data); } } @@ -346,7 +346,7 @@ bool UatModel::setData(const QModelIndex &index, const QVariant &value, int role } uat_update_record(uat_, rec, record_errors[row].isEmpty()); dirty_records[row] = true; - uat_->changed = TRUE; + uat_->changed = true; if (updated_cols.size() > updated_cols.count(index.column())) { // The validation status for other columns were also affected by @@ -386,7 +386,7 @@ bool UatModel::insertRows(int row, int count, const QModelIndex &/*parent*/) // postponed until the row (in the view) is not selected anymore checkRow(row); dirty_records.insert(row, true); - uat_->changed = TRUE; + uat_->changed = true; endInsertRows(); return true; } @@ -400,7 +400,7 @@ bool UatModel::removeRows(int row, int count, const QModelIndex &/*parent*/) uat_remove_record_idx(uat_, row); record_errors.removeAt(row); dirty_records.removeAt(row); - uat_->changed = TRUE; + uat_->changed = true; endRemoveRows(); return true; } @@ -414,7 +414,7 @@ void UatModel::clearAll() uat_clear(uat_); record_errors.clear(); dirty_records.clear(); - uat_->changed = TRUE; + uat_->changed = true; endResetModel(); } @@ -460,12 +460,12 @@ QModelIndex UatModel::copyRow(QModelIndex original) /* According to documentation of uat_copy_cb_t memcpy should be used if uat_->copy_cb is NULL */ memcpy(dst_record, src_record, uat_->record_size); } - gboolean src_valid = g_array_index(uat_->valid_data, gboolean, original.row()); + bool src_valid = g_array_index(uat_->valid_data, bool, original.row()); uat_update_record(uat_, dst_record, src_valid); record_errors[newRow] = record_errors[original.row()]; dirty_records[newRow] = true; - uat_->changed = TRUE; + uat_->changed = true; endInsertRows(); @@ -483,7 +483,7 @@ bool UatModel::moveRow(int src_row, int dst_row) uat_move_index(uat_, src_row, dst_row); record_errors.move(src_row, dst_row); dirty_records.move(src_row, dst_row); - uat_->changed = TRUE; + uat_->changed = true; endMoveRows(); return true; @@ -511,7 +511,7 @@ bool UatModel::checkField(int row, int col, char **error) const } char *str = NULL; - guint length; + unsigned length; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); bool ok = field->cb.chk(rec, str, length, field->cbdata.chk, field->fld_data, error); diff --git a/ui/qt/models/uat_model.h b/ui/qt/models/uat_model.h index 5da647a519..f735b23472 100644 --- a/ui/qt/models/uat_model.h +++ b/ui/qt/models/uat_model.h @@ -15,7 +15,6 @@ #define UAT_MODEL_H #include -#include #include #include diff --git a/ui/qt/models/voip_calls_info_model.cpp b/ui/qt/models/voip_calls_info_model.cpp index 23ba46f1bf..2f6d4f181b 100644 --- a/ui/qt/models/voip_calls_info_model.cpp +++ b/ui/qt/models/voip_calls_info_model.cpp @@ -58,7 +58,7 @@ QVariant VoipCallsInfoModel::data(const QModelIndex &index, int role) const call_info->protocol_name : voip_protocol_name[call_info->protocol]; case Duration: { - guint callDuration = nstime_to_sec(&(call_info->stop_fd->abs_ts)) - nstime_to_sec(&(call_info->start_fd->abs_ts)); + unsigned callDuration = nstime_to_sec(&(call_info->stop_fd->abs_ts)) - nstime_to_sec(&(call_info->start_fd->abs_ts)); return QString("%1:%2:%3").arg(callDuration / 3600, 2, 10, QChar('0')).arg((callDuration % 3600) / 60, 2, 10, QChar('0')).arg(callDuration % 60, 2, 10, QChar('0')); } case Packets: @@ -82,14 +82,14 @@ QVariant VoipCallsInfoModel::data(const QModelIndex &index, int role) const case VOIP_H323: { h323_calls_info_t *h323_info = (h323_calls_info_t *)call_info->prot_info; - gboolean flag = FALSE; + bool flag = false; static const QString on_str = tr("On"); static const QString off_str = tr("Off"); if (call_info->call_state == VOIP_CALL_SETUP) { flag = h323_info->is_faststart_Setup; } else { if ((h323_info->is_faststart_Setup) && (h323_info->is_faststart_Proc)) { - flag = TRUE; + flag = true; } } return tr("Tunneling: %1 Fast Start: %2") @@ -202,7 +202,7 @@ void VoipCallsInfoModel::updateCalls(GQueue *callsinfos) // Add new rows cur_call = g_queue_peek_nth_link(callsinfos, rowCount()); - guint extra = g_list_length(cur_call); + unsigned extra = g_list_length(cur_call); if (extra > 0) { beginInsertRows(QModelIndex(), rowCount(), rowCount() + extra - 1); while (cur_call && cur_call->data) { diff --git a/ui/qt/models/voip_calls_info_model.h b/ui/qt/models/voip_calls_info_model.h index 2f8d400788..afb7ebe310 100644 --- a/ui/qt/models/voip_calls_info_model.h +++ b/ui/qt/models/voip_calls_info_model.h @@ -11,7 +11,6 @@ #define VOIP_CALLS_INFO_MODEL_H #include -#include #include "ui/voip_calls.h" #include