summaryrefslogtreecommitdiff
path: root/epan/proto.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2016-02-01 21:50:07 +0100
committerAnders Broman <a.broman58@gmail.com>2016-02-02 05:23:13 +0000
commitf3b660dab03b79800d02adbe987e1d8453cd6710 (patch)
tree0bdf4ba5caa6ddab4885587bf8d80695d8ec0e65 /epan/proto.c
parentf80e9df7939be9d88062718d6c15fa2983e5e605 (diff)
downloadwireshark-f3b660dab03b79800d02adbe987e1d8453cd6710.tar.gz
proto.c: fix indent (use tabs)
Change-Id: I1ebd31a694fde845e1ca4e125c1ed31bda7c00a8 Reviewed-on: https://code.wireshark.org/review/13646 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c332
1 files changed, 166 insertions, 166 deletions
diff --git a/epan/proto.c b/epan/proto.c
index d68e480c7f..149d441660 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1723,56 +1723,56 @@ get_time_value(tvbuff_t *tvb, const gint start, const gint length, const guint e
time_stamp->nsecs = 0;
}
break;
- case ENC_TIME_NTP_BASE_ZERO|ENC_BIG_ENDIAN:
- /*
- * DDS NTP time stamp, big-endian.
- */
+ case ENC_TIME_NTP_BASE_ZERO|ENC_BIG_ENDIAN:
+ /*
+ * DDS NTP time stamp, big-endian.
+ */
#define NTP_BASETIME_ZERO G_GUINT64_CONSTANT(0)
- tmpsecs = tvb_get_ntohl(tvb, start);
- if (tmpsecs)
- time_stamp->secs = (time_t)(tmpsecs - (guint32)NTP_BASETIME_ZERO);
- else
- time_stamp->secs = tmpsecs; /* 0 */
-
- if (length == 8) {
- /*
- * We're using nanoseconds here (and we will
- * display nanoseconds), but NTP's timestamps
- * have a precision in microseconds or greater.
- * Round to 1 microsecond.
- */
- time_stamp->nsecs = (int)(1000000*(tvb_get_ntohl(tvb, start+4)/4294967296.0));
- time_stamp->nsecs *= 1000;
- } else {
- time_stamp->nsecs = 0;
- }
- break;
-
- case ENC_TIME_NTP_BASE_ZERO|ENC_LITTLE_ENDIAN:
- /*
- * NTP time stamp, big-endian.
- */
- tmpsecs = tvb_get_letohl(tvb, start);
- if (tmpsecs)
- time_stamp->secs = (time_t)(tmpsecs - (guint32)NTP_BASETIME_ZERO);
- else
- time_stamp->secs = tmpsecs; /* 0 */
- time_stamp->secs = (time_t)tvb_get_letohl(tvb, start);
- if (length == 8) {
- /*
- * We're using nanoseconds here (and we will
- * display nanoseconds), but NTP's timestamps
- * have a precision in microseconds or greater.
- * Round to 1 microsecond.
- */
- time_stamp->nsecs = (int)(1000000*(tvb_get_letohl(tvb, start+4)/4294967296.0));
- time_stamp->nsecs *= 1000;
- } else {
- time_stamp->nsecs = 0;
- }
- break;
+ tmpsecs = tvb_get_ntohl(tvb, start);
+ if (tmpsecs)
+ time_stamp->secs = (time_t)(tmpsecs - (guint32)NTP_BASETIME_ZERO);
+ else
+ time_stamp->secs = tmpsecs; /* 0 */
+
+ if (length == 8) {
+ /*
+ * We're using nanoseconds here (and we will
+ * display nanoseconds), but NTP's timestamps
+ * have a precision in microseconds or greater.
+ * Round to 1 microsecond.
+ */
+ time_stamp->nsecs = (int)(1000000*(tvb_get_ntohl(tvb, start+4)/4294967296.0));
+ time_stamp->nsecs *= 1000;
+ } else {
+ time_stamp->nsecs = 0;
+ }
+ break;
+
+ case ENC_TIME_NTP_BASE_ZERO|ENC_LITTLE_ENDIAN:
+ /*
+ * NTP time stamp, big-endian.
+ */
+ tmpsecs = tvb_get_letohl(tvb, start);
+ if (tmpsecs)
+ time_stamp->secs = (time_t)(tmpsecs - (guint32)NTP_BASETIME_ZERO);
+ else
+ time_stamp->secs = tmpsecs; /* 0 */
+ time_stamp->secs = (time_t)tvb_get_letohl(tvb, start);
+ if (length == 8) {
+ /*
+ * We're using nanoseconds here (and we will
+ * display nanoseconds), but NTP's timestamps
+ * have a precision in microseconds or greater.
+ * Round to 1 microsecond.
+ */
+ time_stamp->nsecs = (int)(1000000*(tvb_get_letohl(tvb, start+4)/4294967296.0));
+ time_stamp->nsecs *= 1000;
+ } else {
+ time_stamp->nsecs = 0;
+ }
+ break;
default:
DISSECTOR_ASSERT_NOT_REACHED();
@@ -4815,27 +4815,27 @@ hfinfo_same_name_get_prev(const header_field_info *hfinfo)
static void
hfinfo_remove_from_gpa_name_map(const header_field_info *hfinfo)
{
- g_free(last_field_name);
- last_field_name = NULL;
+ g_free(last_field_name);
+ last_field_name = NULL;
- if (!hfinfo->same_name_next && hfinfo->same_name_prev_id == -1) {
- /* No hfinfo with the same name */
- g_hash_table_steal(gpa_name_map, hfinfo->abbrev);
- return;
- }
+ if (!hfinfo->same_name_next && hfinfo->same_name_prev_id == -1) {
+ /* No hfinfo with the same name */
+ g_hash_table_steal(gpa_name_map, hfinfo->abbrev);
+ return;
+ }
- if (hfinfo->same_name_next) {
- hfinfo->same_name_next->same_name_prev_id = hfinfo->same_name_prev_id;
- }
+ if (hfinfo->same_name_next) {
+ hfinfo->same_name_next->same_name_prev_id = hfinfo->same_name_prev_id;
+ }
- if (hfinfo->same_name_prev_id != -1) {
- header_field_info *same_name_prev = hfinfo_same_name_get_prev(hfinfo);
- same_name_prev->same_name_next = hfinfo->same_name_next;
- if (!hfinfo->same_name_next) {
- /* It's always the latest added hfinfo which is stored in gpa_name_map */
- g_hash_table_insert(gpa_name_map, (gpointer) (same_name_prev->abbrev), same_name_prev);
- }
- }
+ if (hfinfo->same_name_prev_id != -1) {
+ header_field_info *same_name_prev = hfinfo_same_name_get_prev(hfinfo);
+ same_name_prev->same_name_next = hfinfo->same_name_next;
+ if (!hfinfo->same_name_next) {
+ /* It's always the latest added hfinfo which is stored in gpa_name_map */
+ g_hash_table_insert(gpa_name_map, (gpointer) (same_name_prev->abbrev), same_name_prev);
+ }
+ }
}
/* -------------------------- */
@@ -5213,7 +5213,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
offset_r = (int)strlen(result);
break;
- case FT_IEEE_11073_FLOAT:
+ case FT_IEEE_11073_FLOAT:
{
guint8 buf[240];
fvalue_to_string_repr(&finfo->value, FTREPR_DISPLAY, hfinfo->display, buf);
@@ -5745,42 +5745,42 @@ proto_register_protocol(const char *name, const char *short_name,
gboolean
proto_deregister_protocol(const char *short_name)
{
- protocol_t *protocol;
- header_field_info *hfinfo;
- int proto_id;
- gint key;
- guint i;
+ protocol_t *protocol;
+ header_field_info *hfinfo;
+ int proto_id;
+ gint key;
+ guint i;
- proto_id = proto_get_id_by_short_name(short_name);
- protocol = find_protocol_by_id(proto_id);
- if (protocol == NULL)
- return FALSE;
+ proto_id = proto_get_id_by_short_name(short_name);
+ protocol = find_protocol_by_id(proto_id);
+ if (protocol == NULL)
+ return FALSE;
- key = wrs_str_hash(protocol->name);
- g_hash_table_remove(proto_names, &key);
+ key = wrs_str_hash(protocol->name);
+ g_hash_table_remove(proto_names, &key);
- g_hash_table_remove(proto_short_names, (gpointer)short_name);
- g_hash_table_remove(proto_filter_names, (gpointer)protocol->filter_name);
+ g_hash_table_remove(proto_short_names, (gpointer)short_name);
+ g_hash_table_remove(proto_filter_names, (gpointer)protocol->filter_name);
- for (i = 0; i < protocol->fields->len; i++) {
- hfinfo = (header_field_info *)g_ptr_array_index(protocol->fields, i);
- hfinfo_remove_from_gpa_name_map(hfinfo);
- expert_deregister_expertinfo(hfinfo->abbrev);
- g_ptr_array_add(deregistered_fields, gpa_hfinfo.hfi[hfinfo->id]);
- }
- g_ptr_array_free(protocol->fields, TRUE);
- protocol->fields = NULL;
+ for (i = 0; i < protocol->fields->len; i++) {
+ hfinfo = (header_field_info *)g_ptr_array_index(protocol->fields, i);
+ hfinfo_remove_from_gpa_name_map(hfinfo);
+ expert_deregister_expertinfo(hfinfo->abbrev);
+ g_ptr_array_add(deregistered_fields, gpa_hfinfo.hfi[hfinfo->id]);
+ }
+ g_ptr_array_free(protocol->fields, TRUE);
+ protocol->fields = NULL;
- /* Remove this protocol from the list of known protocols */
- protocols = g_list_remove(protocols, protocol);
+ /* Remove this protocol from the list of known protocols */
+ protocols = g_list_remove(protocols, protocol);
- g_ptr_array_add(deregistered_fields, gpa_hfinfo.hfi[proto_id]);
- g_hash_table_steal(gpa_name_map, protocol->filter_name);
+ g_ptr_array_add(deregistered_fields, gpa_hfinfo.hfi[proto_id]);
+ g_hash_table_steal(gpa_name_map, protocol->filter_name);
- g_free(last_field_name);
- last_field_name = NULL;
+ g_free(last_field_name);
+ last_field_name = NULL;
- return TRUE;
+ return TRUE;
}
/*
@@ -6014,7 +6014,7 @@ proto_get_frame_protocols(const wmem_list_t *layers, gboolean *is_ip,
*is_rtp = TRUE;
} else if (is_lte_rlc && !strcmp(proto_name, "rlc-lte")) {
*is_lte_rlc = TRUE;
- }
+ }
protos = wmem_list_frame_next(protos);
}
@@ -6216,84 +6216,84 @@ proto_deregister_field (const int parent, gint hf_id)
void
proto_add_deregistered_data (void *data)
{
- g_ptr_array_add(deregistered_data, data);
+ g_ptr_array_add(deregistered_data, data);
}
static void
free_deregistered_field (gpointer data, gpointer user_data _U_)
{
- header_field_info *hfi = (header_field_info *) data;
- gint hf_id = hfi->id;
-
- g_free((char *)hfi->name);
- g_free((char *)hfi->abbrev);
- g_free((char *)hfi->blurb);
-
- if (hfi->strings) {
- switch (hfi->type) {
- case FT_FRAMENUM:
- /* This is just an integer represented as a pointer */
- break;
- case FT_PROTOCOL: {
- protocol_t *protocol = (protocol_t *)hfi->strings;
- g_free((gchar *)protocol->short_name);
- break;
- }
- case FT_BOOLEAN: {
- true_false_string *tf = (true_false_string *)hfi->strings;
- g_free ((gchar *)tf->true_string);
- g_free ((gchar *)tf->false_string);
- break;
- }
- case FT_UINT64:
- case FT_INT64: {
- val64_string *vs64 = (val64_string *)hfi->strings;
- while (vs64->strptr) {
- g_free((gchar *)vs64->strptr);
- vs64++;
- }
- break;
- }
- default: {
- /* Other Integer types */
- value_string *vs = (value_string *)hfi->strings;
- while (vs->strptr) {
- g_free((gchar *)vs->strptr);
- vs++;
- }
- break;
- }
- }
- if (hfi->type != FT_FRAMENUM) {
- g_free((void *)hfi->strings);
- }
- }
-
- if (hfi->parent == -1)
- g_slice_free(header_field_info, hfi);
-
- gpa_hfinfo.hfi[hf_id] = NULL; /* Invalidate this hf_id / proto_id */
+ header_field_info *hfi = (header_field_info *) data;
+ gint hf_id = hfi->id;
+
+ g_free((char *)hfi->name);
+ g_free((char *)hfi->abbrev);
+ g_free((char *)hfi->blurb);
+
+ if (hfi->strings) {
+ switch (hfi->type) {
+ case FT_FRAMENUM:
+ /* This is just an integer represented as a pointer */
+ break;
+ case FT_PROTOCOL: {
+ protocol_t *protocol = (protocol_t *)hfi->strings;
+ g_free((gchar *)protocol->short_name);
+ break;
+ }
+ case FT_BOOLEAN: {
+ true_false_string *tf = (true_false_string *)hfi->strings;
+ g_free ((gchar *)tf->true_string);
+ g_free ((gchar *)tf->false_string);
+ break;
+ }
+ case FT_UINT64:
+ case FT_INT64: {
+ val64_string *vs64 = (val64_string *)hfi->strings;
+ while (vs64->strptr) {
+ g_free((gchar *)vs64->strptr);
+ vs64++;
+ }
+ break;
+ }
+ default: {
+ /* Other Integer types */
+ value_string *vs = (value_string *)hfi->strings;
+ while (vs->strptr) {
+ g_free((gchar *)vs->strptr);
+ vs++;
+ }
+ break;
+ }
+ }
+ if (hfi->type != FT_FRAMENUM) {
+ g_free((void *)hfi->strings);
+ }
+ }
+
+ if (hfi->parent == -1)
+ g_slice_free(header_field_info, hfi);
+
+ gpa_hfinfo.hfi[hf_id] = NULL; /* Invalidate this hf_id / proto_id */
}
static void
free_deregistered_data (gpointer data, gpointer user_data _U_)
{
- g_free (data);
+ g_free (data);
}
/* free deregistered fields and data */
void
proto_free_deregistered_fields (void)
{
- expert_free_deregistered_expertinfos();
+ expert_free_deregistered_expertinfos();
- g_ptr_array_foreach(deregistered_fields, free_deregistered_field, NULL);
- g_ptr_array_free(deregistered_fields, TRUE);
- deregistered_fields = g_ptr_array_new();
+ g_ptr_array_foreach(deregistered_fields, free_deregistered_field, NULL);
+ g_ptr_array_free(deregistered_fields, TRUE);
+ deregistered_fields = g_ptr_array_new();
- g_ptr_array_foreach(deregistered_data, free_deregistered_data, NULL);
- g_ptr_array_free(deregistered_data, TRUE);
- deregistered_data = g_ptr_array_new();
+ g_ptr_array_foreach(deregistered_data, free_deregistered_data, NULL);
+ g_ptr_array_free(deregistered_data, TRUE);
+ deregistered_data = g_ptr_array_new();
}
/* chars allowed in field abbrev */
@@ -6411,9 +6411,9 @@ tmp_fld_check_assert(header_field_info *hfinfo)
(hfinfo->type == FT_INT56) ||
(hfinfo->type == FT_INT64) ||
(hfinfo->type == FT_BOOLEAN) ||
- (hfinfo->type == FT_PROTOCOL) ||
- (hfinfo->type == FT_FRAMENUM) ))
- g_error("Field '%s' (%s) has a 'strings' value but is of type %s"
+ (hfinfo->type == FT_PROTOCOL) ||
+ (hfinfo->type == FT_FRAMENUM) ))
+ g_error("Field '%s' (%s) has a 'strings' value but is of type %s"
" (which is not allowed to have strings)\n",
hfinfo->name, hfinfo->abbrev, ftype_name(hfinfo->type));
@@ -6946,10 +6946,10 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
ipv4_addr_and_mask *ipv4;
e_guid_t *guid;
guint32 n_addr; /* network-order IPv4 address */
- gchar *name;
+ gchar *name;
address addr;
char *addr_str;
- char *tmp;
+ char *tmp;
if (!fi) {
if (label_str)
@@ -7550,12 +7550,12 @@ hfinfo_bitshift(const header_field_info *hfinfo)
static int
hfinfo_mask_bitwidth(const header_field_info *hfinfo)
{
- if (!hfinfo->bitmask) {
- return 0;
- }
+ if (!hfinfo->bitmask) {
+ return 0;
+ }
- /* ilog2 = first set bit, ctz = last set bit */
- return ws_ilog2(hfinfo->bitmask) - ws_ctz(hfinfo->bitmask) + 1;
+ /* ilog2 = first set bit, ctz = last set bit */
+ return ws_ilog2(hfinfo->bitmask) - ws_ctz(hfinfo->bitmask) + 1;
}
static int
@@ -8043,7 +8043,7 @@ check_for_offset(proto_node *node, const gpointer data)
offset_search_t *offsearch = (offset_search_t *)data;
/* !fi == the top most container node which holds nothing */
- if (fi && !PROTO_ITEM_IS_HIDDEN(node) && !PROTO_ITEM_IS_GENERATED(node) && fi->ds_tvb && offsearch->tvb == fi->ds_tvb) {
+ if (fi && !PROTO_ITEM_IS_HIDDEN(node) && !PROTO_ITEM_IS_GENERATED(node) && fi->ds_tvb && offsearch->tvb == fi->ds_tvb) {
if (offsearch->offset >= (guint) fi->start &&
offsearch->offset < (guint) (fi->start + fi->length)) {