aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pres.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-02-06 12:28:16 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-02-06 13:27:59 +0000
commit47fc7ffcb0eb69f22ec54d698b6a7269c55035c6 (patch)
tree40343a5be5a25a2e7eab1d5fcab489e9911249c5 /epan/dissectors/packet-pres.c
parenta86e2107221024745fd8b2a3a0ed5e0fe9ba67f1 (diff)
asn1: Cleanup space usage
Fix space issues in some ASN.1 dissectors. Change-Id: I4ceccfbe9a13c93fc91821d1bfe4b7d6bb39c435 Reviewed-on: https://code.wireshark.org/review/13791 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-pres.c')
-rw-r--r--epan/dissectors/packet-pres.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c
index 994491fb79..f84dea5fa6 100644
--- a/epan/dissectors/packet-pres.c
+++ b/epan/dissectors/packet-pres.c
@@ -266,7 +266,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pres_ctx_oid_t *pco, *tmppco;
conversation_t *conversation;
- if(!oid){
+ if (!oid) {
/* we did not get any oid name, malformed packet? */
return;
}
@@ -276,8 +276,7 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
pco->oid=wmem_strdup(wmem_file_scope(), oid);
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
- }
- else {
+ } else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@@ -289,9 +288,8 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid)
/* if this ctx already exists, remove the old one first */
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco);
- if(tmppco){
+ if (tmppco) {
g_hash_table_remove(pres_ctx_oid_table, tmppco);
-
}
g_hash_table_insert(pres_ctx_oid_table, pco, pco);
}
@@ -323,7 +321,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
pco.ctx_id=idx;
if (pinfo->ptype == PT_TCP) {
conversation = find_conversation_ext_from_pinfo(pinfo);
- }else{
+ } else {
conversation = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst,
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
@@ -334,7 +332,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx)
}
tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco);
- if(tmppco){
+ if (tmppco) {
return tmppco->oid;
}
@@ -1369,7 +1367,7 @@ static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
/*--- End of included file: packet-pres-fn.c ---*/
-#line 234 "../../asn1/pres/packet-pres-template.c"
+#line 232 "../../asn1/pres/packet-pres-template.c"
/*
@@ -1385,13 +1383,13 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* do we have spdu type from the session dissector? */
- if( local_session == NULL ){
+ if (local_session == NULL) {
proto_tree_add_expert(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1);
return 0;
}
session = local_session;
- if(session->spdu_type == 0 ){
+ if (session->spdu_type == 0) {
proto_tree_add_expert_format(tree, pinfo, &ei_pres_wrong_spdu_type, tvb, offset, -1,
"Internal error:wrong spdu type %x from session dissector.",session->spdu_type);
return 0;
@@ -1406,7 +1404,7 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, st
ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA);
pres_tree = proto_item_add_subtree(ti, ett_pres);
- switch(session->spdu_type){
+ switch (session->spdu_type) {
case SES_CONNECTION_REQUEST:
offset = dissect_pres_CP_type(FALSE, tvb, offset, &asn1_ctx, pres_tree, hf_pres_CP_type);
break;
@@ -1450,7 +1448,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* first, try to check length */
/* do we have at least 4 bytes */
- if (!tvb_bytes_exist(tvb, 0, 4)){
+ if (!tvb_bytes_exist(tvb, 0, 4)) {
if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) {
proto_tree_add_item(parent_tree, hf_pres_user_data, tvb, offset,
tvb_reported_length_remaining(tvb,offset), ENC_NA);
@@ -1464,16 +1462,14 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
/* if the session unit-data packet then we process it */
/* as a connectionless presentation protocol unit data */
- if(session && session->spdu_type == CLSES_UNIT_DATA)
- {
+ if (session && session->spdu_type == CLSES_UNIT_DATA) {
proto_tree * clpres_tree = NULL;
proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-PRES");
col_clear(pinfo->cinfo, COL_INFO);
- if (parent_tree)
- {
+ if (parent_tree) {
ti = proto_tree_add_item(parent_tree, proto_clpres, tvb, offset, -1, ENC_NA);
clpres_tree = proto_item_add_subtree(ti, ett_pres);
}
@@ -1501,12 +1497,12 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d
return tvb_captured_length(tvb);
}
- while (tvb_reported_length_remaining(tvb, offset) > 0){
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
old_offset = offset;
offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session);
- if(offset <= old_offset){
- proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
- break;
+ if (offset <= old_offset) {
+ proto_tree_add_expert(parent_tree, pinfo, &ei_pres_invalid_offset, tvb, offset, -1);
+ break;
}
}
@@ -1853,7 +1849,7 @@ void proto_register_pres(void) {
NULL, HFILL }},
/*--- End of included file: packet-pres-hfarr.c ---*/
-#line 405 "../../asn1/pres/packet-pres-template.c"
+#line 401 "../../asn1/pres/packet-pres-template.c"
};
/* List of subtrees */
@@ -1900,7 +1896,7 @@ void proto_register_pres(void) {
&ett_pres_UD_type,
/*--- End of included file: packet-pres-ettarr.c ---*/
-#line 411 "../../asn1/pres/packet-pres-template.c"
+#line 407 "../../asn1/pres/packet-pres-template.c"
};
static ei_register_info ei[] = {