Make some arguments const, and remove casting-away of constness.
[metze/wireshark/wip.git] / epan / proto.c
index 03f7a95f5f64d4f048f8c7b5abb9e88ff80b3439..21471f08edba5cbb51bfd57c28ce9b9d65fde6d3 100644 (file)
@@ -5965,7 +5965,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
                                                        double d_value = fvalue_get_floating(&finfo->value);
                                                        g_snprintf(result+offset_r, size-offset_r,
                                                                        "%." G_STRINGIFY(FLT_DIG) "g%s", d_value,
-                                                                       unit_name_string_get_double(d_value, (unit_name_string*)hfinfo->strings));
+                                                                       unit_name_string_get_double(d_value, (const unit_name_string*)hfinfo->strings));
                                                } else {
                                                        g_snprintf(result+offset_r, size-offset_r,
                                                                        "%." G_STRINGIFY(FLT_DIG) "g", fvalue_get_floating(&finfo->value));
@@ -5978,7 +5978,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
                                                        double d_value = fvalue_get_floating(&finfo->value);
                                                        g_snprintf(result+offset_r, size-offset_r,
                                                                        "%." G_STRINGIFY(DBL_DIG) "g%s", d_value,
-                                                                       unit_name_string_get_double(d_value, (unit_name_string*)hfinfo->strings));
+                                                                       unit_name_string_get_double(d_value, (const unit_name_string*)hfinfo->strings));
                                                } else {
                                                        g_snprintf(result+offset_r, size-offset_r,
                                                                        "%." G_STRINGIFY(DBL_DIG) "g", fvalue_get_floating(&finfo->value));
@@ -8224,7 +8224,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                                g_snprintf(label_str, ITEM_LABEL_LENGTH,
                                           "%s: %." G_STRINGIFY(FLT_DIG) "g%s",
                                           hfinfo->name, d_value,
-                                          unit_name_string_get_double(d_value, (unit_name_string*)hfinfo->strings));
+                                          unit_name_string_get_double(d_value, (const unit_name_string*)hfinfo->strings));
                        } else {
                                g_snprintf(label_str, ITEM_LABEL_LENGTH,
                                           "%s: %." G_STRINGIFY(FLT_DIG) "g",
@@ -8240,7 +8240,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                                g_snprintf(label_str, ITEM_LABEL_LENGTH,
                                           "%s: %." G_STRINGIFY(DBL_DIG) "g%s",
                                           hfinfo->name, d_value,
-                                          unit_name_string_get_double(d_value, (unit_name_string*)hfinfo->strings));
+                                          unit_name_string_get_double(d_value, (const unit_name_string*)hfinfo->strings));
                        } else {
                                g_snprintf(label_str, ITEM_LABEL_LENGTH,
                                           "%s: %." G_STRINGIFY(DBL_DIG) "g",
@@ -8468,7 +8468,7 @@ hf_try_val_to_str(guint32 value, const header_field_info *hfinfo)
                return try_val64_to_str(value, (const val64_string *) hfinfo->strings);
 
        if (hfinfo->display & BASE_UNIT_STRING)
-               return unit_name_string_get_value(value, (struct unit_name_string*) hfinfo->strings);
+               return unit_name_string_get_value(value, (const struct unit_name_string*) hfinfo->strings);
 
        return try_val_to_str(value, (const value_string *) hfinfo->strings);
 }
@@ -8483,7 +8483,7 @@ hf_try_val64_to_str(guint64 value, const header_field_info *hfinfo)
                return try_rval64_to_str(value, (const range_string *) hfinfo->strings);
 
        if (hfinfo->display & BASE_UNIT_STRING)
-               return unit_name_string_get_value64(value, (struct unit_name_string*) hfinfo->strings);
+               return unit_name_string_get_value64(value, (const struct unit_name_string*) hfinfo->strings);
 
        /* If this is reached somebody registered a 64-bit field with a 32-bit
         * value-string, which isn't right. */
@@ -9799,7 +9799,7 @@ proto_registrar_dump_values(void)
                                if (hfinfo->display & BASE_RANGE_STRING) {
                                        range = (const range_string *)hfinfo->strings;
                                } else if (hfinfo->display & BASE_EXT_STRING) {
-                                       vals = VALUE_STRING_EXT_VS_P((value_string_ext *)hfinfo->strings);
+                                       vals = VALUE_STRING_EXT_VS_P((const value_string_ext *)hfinfo->strings);
                                } else if (hfinfo->display & BASE_VAL64_STRING) {
                                        vals64 = (const val64_string *)hfinfo->strings;
                                } else if (hfinfo->display & BASE_UNIT_STRING) {
@@ -10547,7 +10547,7 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
 
                                out = hfinfo_number_value_format(hf, buf, (guint32) tmpval);
                                if (hf->display & BASE_UNIT_STRING) {
-                                       proto_item_append_text(item, "%s: %s%s", hf->name, out, unit_name_string_get_value((guint32) tmpval, (unit_name_string*)hf->strings));
+                                       proto_item_append_text(item, "%s: %s%s", hf->name, out, unit_name_string_get_value((guint32) tmpval, (const unit_name_string*)hf->strings));
                                } else {
                                        proto_item_append_text(item, "%s: %s", hf->name, out);
                                }
@@ -10590,7 +10590,7 @@ proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
 
                                out = hfinfo_number_value_format(hf, buf, (gint32) integer32);
                                if ((hf->strings) &&(!(hf->display & BASE_UNIT_STRING))) {
-                                       proto_item_append_text(item, "%s: %s%s", hf->name, out, unit_name_string_get_value((guint32) tmpval, (unit_name_string*)hf->strings));
+                                       proto_item_append_text(item, "%s: %s%s", hf->name, out, unit_name_string_get_value((guint32) tmpval, (const unit_name_string*)hf->strings));
                                } else {
                                        proto_item_append_text(item, "%s: %s", hf->name, out);
                                }