Constification, to remove some compiler warnings.

Change-Id: I24f0bdc72109a6ef3d801dc28cb9b523ff4e5fe7
Reviewed-on: https://code.wireshark.org/review/32458
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-03-17 12:56:27 -07:00
parent 7d8cb0ab4f
commit cced5fb949
6 changed files with 15 additions and 15 deletions

View File

@ -147,9 +147,9 @@ gboolean decode_as_default_reset(const gchar *name, gconstpointer pattern)
return TRUE;
}
gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gpointer handle, gchar *list_name _U_)
gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gconstpointer handle, const gchar *list_name _U_)
{
dissector_handle_t* dissector = (dissector_handle_t*)handle;
const dissector_handle_t* dissector = (const dissector_handle_t*)handle;
if (dissector != NULL) {
switch (get_dissector_table_selector_type(name)) {
case FT_UINT8:

View File

@ -46,7 +46,7 @@ typedef void (*decode_as_free_func)(gpointer value);
/** callback function definition: Clear value from dissector table */
typedef gboolean (*decode_as_reset_func)(const gchar *name, gconstpointer pattern);
/** callback function definition: Apply value to dissector table */
typedef gboolean (*decode_as_change_func)(const gchar *name, gconstpointer pattern, gpointer handle, gchar *list_name);
typedef gboolean (*decode_as_change_func)(const gchar *name, gconstpointer pattern, gconstpointer handle, const gchar *list_name);
typedef struct decode_as_value_s {
build_label_func label_func;
@ -98,7 +98,7 @@ WS_DLL_PUBLIC void decode_as_default_populate_list(const gchar *table_name, deco
/* Clear a FT_UINT32 value from dissector table list */
WS_DLL_PUBLIC gboolean decode_as_default_reset(const gchar *name, gconstpointer pattern);
/* Add a FT_UINT32 value to dissector table list */
WS_DLL_PUBLIC gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gpointer handle, gchar *list_name);
WS_DLL_PUBLIC gboolean decode_as_default_change(const gchar *name, gconstpointer pattern, gconstpointer handle, const gchar *list_name);
/** List of registered decode_as_t structs.
* For UI code only. Should not be directly accessed by dissectors.

View File

@ -407,7 +407,7 @@ static gboolean ber_decode_as_reset(const char *name _U_, gconstpointer pattern
return FALSE;
}
static gboolean ber_decode_as_change(const char *name _U_, gconstpointer pattern _U_, gpointer handle _U_, gchar* list_name)
static gboolean ber_decode_as_change(const char *name _U_, gconstpointer pattern _U_, gconstpointer handle _U_, const gchar* list_name)
{
ber_decode_as(list_name);
return FALSE;

View File

@ -974,11 +974,11 @@ decode_dcerpc_binding_reset(const char *name _U_, gconstpointer pattern)
}
static gboolean
dcerpc_decode_as_change(const char *name, gconstpointer pattern, gpointer handle, gchar* list_name)
dcerpc_decode_as_change(const char *name, gconstpointer pattern, gconstpointer handle, const gchar* list_name)
{
const decode_dcerpc_bind_values_t *binding = (const decode_dcerpc_bind_values_t*)pattern;
decode_dcerpc_bind_values_t *stored_binding;
guid_key *key = *((guid_key**)handle);
guid_key *key = *((guid_key *const *)handle);
/* remove a probably existing old binding */
decode_dcerpc_binding_reset(name, binding);

View File

@ -115,7 +115,7 @@ QVariant DecodeAsModel::data(const QModelIndex &index, int role) const
if (IS_FT_UINT(selector_type)) {
return entryString(item->tableName_, GUINT_TO_POINTER(item->selectorUint_));
} else if (IS_FT_STRING(selector_type)) {
return entryString(item->tableName_, (gpointer)item->selectorString_.toUtf8().constData());
return entryString(item->tableName_, (gconstpointer)item->selectorString_.toUtf8().constData());
} else if (selector_type == FT_GUID) {
if (item->selectorDCERPC_ != NULL) {
return item->selectorDCERPC_->ctx_id;
@ -426,7 +426,7 @@ bool DecodeAsModel::copyRow(int dst_row, int src_row)
return true;
}
QString DecodeAsModel::entryString(const gchar *table_name, gpointer value)
QString DecodeAsModel::entryString(const gchar *table_name, gconstpointer value)
{
QString entry_str;
ftenum_t selector_type = get_dissector_table_selector_type(table_name);
@ -479,7 +479,7 @@ QString DecodeAsModel::entryString(const gchar *table_name, gpointer value)
case FT_STRINGZ:
case FT_UINT_STRING:
case FT_STRINGZPAD:
entry_str = (char *)value;
entry_str = (const char *)value;
break;
case FT_GUID:
@ -666,7 +666,7 @@ void DecodeAsModel::applyChanges()
if (!g_strcmp0(decode_as_entry->table_name, item->tableName_)) {
ftenum_t selector_type = get_dissector_table_selector_type(item->tableName_);
gpointer selector_value;
gconstpointer selector_value;
QByteArray byteArray;
switch (selector_type) {
@ -681,7 +681,7 @@ void DecodeAsModel::applyChanges()
case FT_UINT_STRING:
case FT_STRINGZPAD:
byteArray = item->selectorString_.toUtf8();
selector_value = (gpointer) byteArray.constData();
selector_value = (gconstpointer) byteArray.constData();
break;
case FT_NONE:
//selector value is ignored, but dissector table needs to happen
@ -689,7 +689,7 @@ void DecodeAsModel::applyChanges()
break;
case FT_GUID:
if (item->selectorDCERPC_ != NULL) {
selector_value = (gpointer)item->selectorDCERPC_;
selector_value = (gconstpointer)item->selectorDCERPC_;
} else {
//TODO: Support normal GUID dissector tables
selector_value = NULL;
@ -716,7 +716,7 @@ void DecodeAsModel::applyChanges()
}
break;
} else {
decode_as_entry->change_value(decode_as_entry->table_name, selector_value, &item->dissector_handle_, (char *) item->current_proto_.toUtf8().constData());
decode_as_entry->change_value(decode_as_entry->table_name, selector_value, &item->dissector_handle_, item->current_proto_.toUtf8().constData());
sub_dissectors = find_dissector_table(decode_as_entry->table_name);
/* For now, only numeric dissector tables can use preferences */

View File

@ -75,7 +75,7 @@ public:
void clearAll();
bool copyRow(int dst_row, int src_row);
static QString entryString(const gchar *table_name, gpointer value);
static QString entryString(const gchar *table_name, gconstpointer value);
void applyChanges();