David Reiss | 9e7ba8c | 2010-10-05 16:39:27 +0000 | [diff] [blame] | 1 | #include "t_type.h" |
David Reiss | 41d3058 | 2010-10-05 16:39:29 +0000 | [diff] [blame] | 2 | #include "t_typedef.h" |
David Reiss | 9e7ba8c | 2010-10-05 16:39:27 +0000 | [diff] [blame] | 3 | |
| 4 | #include "md5.h" |
Jens Geyer | 83767a7 | 2013-09-23 22:09:12 +0200 | [diff] [blame] | 5 | #include "main.h" |
David Reiss | 9e7ba8c | 2010-10-05 16:39:27 +0000 | [diff] [blame] | 6 | |
| 7 | void t_type::generate_fingerprint() { |
Jens Geyer | 83767a7 | 2013-09-23 22:09:12 +0200 | [diff] [blame] | 8 | if (! has_fingerprint()) { |
| 9 | pdebug("generating fingerprint for %s", get_name().c_str()); |
| 10 | std::string material = get_fingerprint_material(); |
| 11 | md5_state_t ctx; |
| 12 | md5_init(&ctx); |
| 13 | md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size()); |
| 14 | md5_finish(&ctx, (md5_byte_t*)fingerprint_); |
| 15 | } |
David Reiss | 9e7ba8c | 2010-10-05 16:39:27 +0000 | [diff] [blame] | 16 | } |
David Reiss | 41d3058 | 2010-10-05 16:39:29 +0000 | [diff] [blame] | 17 | |
| 18 | t_type* t_type::get_true_type() { |
| 19 | t_type* type = this; |
| 20 | while (type->is_typedef()) { |
| 21 | type = ((t_typedef*)type)->get_type(); |
| 22 | } |
| 23 | return type; |
| 24 | } |