@@ -33,15 +33,7 @@ struct _DcmVRTable {
3333};
3434
3535struct _DcmVRTable_hash_entry {
36- /* All of VRTable, plus a hash handle.
37- */
38- DcmVR vr ;
39- char * str ;
40- DcmVRClass vr_class ;
41- size_t size ;
42- uint32_t capacity ;
43- int header_length ;
44-
36+ struct _DcmVRTable table ;
4537 UT_hash_handle hh ;
4638};
4739
@@ -175,10 +167,7 @@ struct _DcmAttribute {
175167};
176168
177169struct _DcmAttribute_hash_entry {
178- uint32_t tag ;
179- DcmVRTag vr_tag ;
180- char keyword [63 ];
181-
170+ struct _DcmAttribute attr ;
182171 UT_hash_handle hh ;
183172};
184173
@@ -5102,8 +5091,8 @@ void dcm_init(void)
51025091 }
51035092
51045093 entry = DCM_NEW (NULL , struct _DcmVRTable_hash_entry );
5105- * (( struct _DcmVRTable * ) entry ) = vr_table [i ];
5106- HASH_ADD_STR (vrtable_from_str_dict , str , entry );
5094+ entry -> table = vr_table [i ];
5095+ HASH_ADD_STR (vrtable_from_str_dict , table . str , entry );
51075096 }
51085097 }
51095098
@@ -5120,13 +5109,13 @@ void dcm_init(void)
51205109 "%8X (%s) registered previously as '%s'" ,
51215110 attribute_table [i ].tag ,
51225111 attribute_table [i ].keyword ,
5123- entry -> keyword );
5112+ entry -> attr . keyword );
51245113 return ;
51255114 }
51265115
51275116 entry = DCM_NEW (NULL , struct _DcmAttribute_hash_entry );
5128- * (( struct _DcmAttribute * ) entry ) = attribute_table [i ];
5129- HASH_ADD_INT (attribute_from_tag_dict , tag , entry );
5117+ entry -> attr = attribute_table [i ];
5118+ HASH_ADD_INT (attribute_from_tag_dict , attr . tag , entry );
51305119 }
51315120 }
51325121
@@ -5152,8 +5141,8 @@ void dcm_init(void)
51525141 }
51535142
51545143 entry = DCM_NEW (NULL , struct _DcmAttribute_hash_entry );
5155- * (( struct _DcmAttribute * ) entry ) = attribute_table [i ];
5156- HASH_ADD_STR (attribute_from_keyword_dict , keyword , entry );
5144+ entry -> attr = attribute_table [i ];
5145+ HASH_ADD_STR (attribute_from_keyword_dict , attr . keyword , entry );
51575146 }
51585147 }
51595148
@@ -5171,27 +5160,30 @@ static const struct _DcmVRTable *vrtable_from_vr(const char *vr)
51715160
51725161 HASH_FIND_STR (vrtable_from_str_dict , vr , entry );
51735162
5174- return (const struct _DcmVRTable * )entry ;
5163+ if (entry == NULL ) {
5164+ return NULL ;
5165+ }
5166+ return & entry -> table ;
51755167}
51765168
51775169
51785170bool dcm_is_valid_vr (const char * str )
51795171{
5180- const struct _DcmVRTable * entry ;
5172+ const struct _DcmVRTable * table ;
51815173
51825174 return str &&
5183- (entry = vrtable_from_vr (str )) &&
5184- entry -> vr != DCM_VR_ERROR ;
5175+ (table = vrtable_from_vr (str )) &&
5176+ table -> vr != DCM_VR_ERROR ;
51855177}
51865178
51875179
51885180DcmVR dcm_dict_vr_from_str (const char * str )
51895181{
5190- const struct _DcmVRTable * entry ;
5182+ const struct _DcmVRTable * table ;
51915183
51925184 if (str &&
5193- (entry = vrtable_from_vr (str ))) {
5194- return entry -> vr ;
5185+ (table = vrtable_from_vr (str ))) {
5186+ return table -> vr ;
51955187 }
51965188
51975189 return DCM_VR_ERROR ;
@@ -5264,7 +5256,10 @@ static const struct _DcmAttribute *attribute_from_tag(uint32_t tag)
52645256
52655257 HASH_FIND_INT (attribute_from_tag_dict , & tag , entry );
52665258
5267- return (const struct _DcmAttribute * )entry ;
5259+ if (entry == NULL ) {
5260+ return NULL ;
5261+ }
5262+ return & entry -> attr ;
52685263}
52695264
52705265
@@ -5362,7 +5357,10 @@ static const struct _DcmAttribute *attribute_from_keyword(const char *keyword)
53625357
53635358 HASH_FIND_STR (attribute_from_keyword_dict , keyword , entry );
53645359
5365- return (const struct _DcmAttribute * )entry ;
5360+ if (entry == NULL ) {
5361+ return NULL ;
5362+ }
5363+ return & entry -> attr ;
53665364}
53675365
53685366
0 commit comments