diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2013-07-23 14:34:46 +0000 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2013-07-23 14:34:46 +0000 |
commit | 802e7bed77f5f42cc4104598dc995dca5495ade2 (patch) | |
tree | 2a9c66e48e9d775db1c21c4ca3ceeb35726321ca /epan | |
parent | a74c3538fcc2dee12d657c295a0a7a49435cff77 (diff) | |
download | wireshark-802e7bed77f5f42cc4104598dc995dca5495ade2.tar.gz |
Try to differentiate a non filled private_data (pointer set to NULL) from an enum with value = 0
svn path=/trunk/; revision=50837
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-lte-rrc.c | 54 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.c | 18 |
2 files changed, 32 insertions, 40 deletions
diff --git a/epan/dissectors/packet-lte-rrc.c b/epan/dissectors/packet-lte-rrc.c index 35714b5279..3a31f06e2f 100644 --- a/epan/dissectors/packet-lte-rrc.c +++ b/epan/dissectors/packet-lte-rrc.c @@ -9216,7 +9216,7 @@ dissect_lte_rrc_T_serialNumber_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t if (serial_nb_tvb) { proto_tree *subtree; - actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0)); + actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0)); subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber); proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); @@ -9253,13 +9253,11 @@ dissect_lte_rrc_T_warningMessageSegment(tvbuff_t *tvb _U_, int offset _U_, asn1_ - if (actx->private_data) { - p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data); - if (warning_msg_seg_tvb && p_dcs) { - proto_tree *subtree; - subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); - dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); - } + p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data); + if (warning_msg_seg_tvb && p_dcs) { + proto_tree *subtree; + subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); + dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); } return offset; @@ -9280,10 +9278,8 @@ dissect_lte_rrc_T_dataCodingScheme(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t guint32 dataCodingScheme; subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme); dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0); - if (actx->private_data) { - g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data, - GUINT_TO_POINTER(dataCodingScheme)); - } + g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data, + GUINT_TO_POINTER(dataCodingScheme)); } return offset; @@ -9342,7 +9338,7 @@ dissect_lte_rrc_T_serialNumber_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t if (serial_nb_tvb) { proto_tree *subtree; - actx->private_data = GUINT_TO_POINTER((actx->private_data ? GPOINTER_TO_UINT(actx->private_data) : 0) | tvb_get_ntohs(serial_nb_tvb, 0)); + actx->private_data = GUINT_TO_POINTER(GPOINTER_TO_UINT(actx->private_data) | tvb_get_ntohs(serial_nb_tvb, 0)); subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_serialNumber); proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_gs, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_lte_rrc_serialNumber_msg_code, serial_nb_tvb, 0, 2, ENC_BIG_ENDIAN); @@ -9379,13 +9375,11 @@ dissect_lte_rrc_T_warningMessageSegment_r9(tvbuff_t *tvb _U_, int offset _U_, as - if (actx->private_data) { - p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data); - if (warning_msg_seg_tvb && p_dcs) { - proto_tree *subtree; - subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); - dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); - } + p_dcs = g_hash_table_lookup(lte_rrc_etws_cmas_dcs_hash, actx->private_data); + if (warning_msg_seg_tvb && p_dcs) { + proto_tree *subtree; + subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_warningMessageSegment); + dissect_lte_rrc_warningMessageSegment(warning_msg_seg_tvb, subtree, actx->pinfo, GPOINTER_TO_UINT(p_dcs)); } return offset; @@ -9406,10 +9400,8 @@ dissect_lte_rrc_T_dataCodingScheme_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ct guint32 dataCodingScheme; subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_dataCodingScheme); dataCodingScheme = dissect_cbs_data_coding_scheme(data_coding_scheme_tvb, actx->pinfo, subtree, 0); - if (actx->private_data) { - g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data, - GUINT_TO_POINTER(dataCodingScheme)); - } + g_hash_table_insert(lte_rrc_etws_cmas_dcs_hash, actx->private_data, + GUINT_TO_POINTER(dataCodingScheme)); } return offset; @@ -18866,7 +18858,7 @@ dissect_lte_rrc_T_targetRAT_Type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t * offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 8, &target_rat_type, TRUE, 0, NULL); - actx->private_data = GUINT_TO_POINTER(target_rat_type); + actx->private_data = GUINT_TO_POINTER(target_rat_type+1); return offset; @@ -18885,7 +18877,7 @@ dissect_lte_rrc_T_targetRAT_MessageContainer(tvbuff_t *tvb _U_, int offset _U_, proto_tree *subtree; subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_targetRAT_MessageContainer); if (actx->private_data) { - switch(GPOINTER_TO_UINT(actx->private_data)){ + switch(GPOINTER_TO_UINT(actx->private_data)-1){ case T_targetRAT_Type_utra: /* utra */ if (rrc_irat_ho_to_utran_cmd_handle) @@ -18954,7 +18946,7 @@ dissect_lte_rrc_SystemInfoListGERAN_item(tvbuff_t *tvb _U_, int offset _U_, asn1 if (sys_info_list_tvb) { subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_siPsiSibContainer); if (actx->private_data) { - switch (GPOINTER_TO_UINT(actx->private_data)) { + switch (GPOINTER_TO_UINT(actx->private_data)-1) { case SI_OrPSI_GERAN_si: /* SI message */ if (gsm_a_dtap_handle) { @@ -19012,7 +19004,7 @@ dissect_lte_rrc_SI_OrPSI_GERAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac ett_lte_rrc_SI_OrPSI_GERAN, SI_OrPSI_GERAN_choice, &si_or_psi_geran); - actx->private_data = GUINT_TO_POINTER(si_or_psi_geran); + actx->private_data = GUINT_TO_POINTER(si_or_psi_geran+1); return offset; @@ -23227,7 +23219,7 @@ static const per_sequence_t CellInfoGERAN_r9_sequence[] = { static int dissect_lte_rrc_CellInfoGERAN_r9(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si); /* SI message */ + actx->private_data = GUINT_TO_POINTER(SI_OrPSI_GERAN_si+1); /* SI message */ offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_lte_rrc_CellInfoGERAN_r9, CellInfoGERAN_r9_sequence); @@ -23741,7 +23733,7 @@ dissect_lte_rrc_RAT_Type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 8, &rat_type, TRUE, 0, NULL); - actx->private_data = GUINT_TO_POINTER(rat_type); + actx->private_data = GUINT_TO_POINTER(rat_type+1); @@ -27359,7 +27351,7 @@ if(ue_cap_tvb){ guint8 byte; subtree = proto_item_add_subtree(actx->created_item, ett_lte_rrc_UE_CapabilityRAT_Container); if (actx->private_data) { - switch(GPOINTER_TO_UINT(actx->private_data)){ + switch(GPOINTER_TO_UINT(actx->private_data)-1){ case RAT_Type_eutra: /* eutra */ dissect_lte_rrc_UE_EUTRA_Capability_PDU(ue_cap_tvb, actx->pinfo, subtree, NULL); diff --git a/epan/dissectors/packet-rrc.c b/epan/dissectors/packet-rrc.c index 1c23d801ae..8fd0da8c3e 100644 --- a/epan/dissectors/packet-rrc.c +++ b/epan/dissectors/packet-rrc.c @@ -16566,7 +16566,7 @@ dissect_rrc_NAS_SystemInformationGSM_MAP(tvbuff_t *tvb _U_, int offset _U_, asn1 length = tvb_length(nas_sys_info_gsm_map_tvb); if (length) { if (actx->private_data) { - switch (GPOINTER_TO_UINT(actx->private_data)) { + switch (GPOINTER_TO_UINT(actx->private_data)-1) { case RRC_NAS_SYS_INFO_CN_COMMON: item = proto_tree_add_text(tree, nas_sys_info_gsm_map_tvb, 0, length, "CN Common GSM-MAP NAS system information"); subtree = proto_item_add_subtree(item, ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo); @@ -16600,7 +16600,7 @@ dissect_rrc_NAS_SystemInformationGSM_MAP(tvbuff_t *tvb _U_, int offset _U_, asn1 static int dissect_rrc_T_cn_CommonGSM_MAP_NAS_SysInfo(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 663 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1); offset = dissect_rrc_NAS_SystemInformationGSM_MAP(tvb, offset, actx, tree, hf_index); @@ -16624,7 +16624,7 @@ dissect_rrc_CN_DomainIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 2, &nas_sys_info_gsm_map, FALSE, 0, NULL); - actx->private_data = GUINT_TO_POINTER(nas_sys_info_gsm_map); + actx->private_data = GUINT_TO_POINTER(nas_sys_info_gsm_map+1); @@ -20522,7 +20522,7 @@ dissect_rrc_E_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, prot static int dissect_rrc_T_cn_CommonGSM_MAP_NAS_SysInfo_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 667 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1); offset = dissect_rrc_NAS_SystemInformationGSM_MAP(tvb, offset, actx, tree, hf_index); @@ -84167,7 +84167,7 @@ dissect_rrc_UE_ConnTimersAndConstants(tvbuff_t *tvb _U_, int offset _U_, asn1_ct static int dissect_rrc_T_cn_CommonGSM_MAP_NAS_SysInfo_02(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 671 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1); offset = dissect_rrc_NAS_SystemInformationGSM_MAP(tvb, offset, actx, tree, hf_index); @@ -87509,7 +87509,7 @@ dissect_rrc_START_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, } /*Retrieve the start value for the two ciphering domains*/ if (actx->private_data) { - switch(GPOINTER_TO_UINT(actx->private_data)){ + switch(GPOINTER_TO_UINT(actx->private_data)-1){ case RRC_NAS_SYS_INFO_CS: /* g_warning("Not implemented"); @@ -114326,7 +114326,7 @@ static const per_sequence_t UE_SecurityInformation_sequence[] = { static int dissect_rrc_UE_SecurityInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 898 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CS); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CS+1); offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_UE_SecurityInformation, UE_SecurityInformation_sequence); @@ -114729,7 +114729,7 @@ static const per_sequence_t UE_SecurityInformation2_sequence[] = { static int dissect_rrc_UE_SecurityInformation2(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 902 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_PS); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_PS+1); offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_UE_SecurityInformation2, UE_SecurityInformation2_sequence); @@ -133140,7 +133140,7 @@ dissect_rrc_SIB_ReferenceList(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act static int dissect_rrc_T_cn_CommonGSM_MAP_NAS_SysInfo_03(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 675 "../../asn1/rrc/rrc.cnf" - actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON); + actx->private_data = GUINT_TO_POINTER(RRC_NAS_SYS_INFO_CN_COMMON+1); offset = dissect_rrc_NAS_SystemInformationGSM_MAP(tvb, offset, actx, tree, hf_index); |