changeset: 6397:cc7903944687 user: Kevin McCarthy <ke...@8t8.us> date: Sat Jan 17 14:42:28 2015 -0800 link: http://dev.mutt.org/hg/mutt/rev/cc7903944687
Fix the hcache type punning warning. This patch fixes the type punning warning by switching from (safe but perhaps not elegant) casting to using a union. Thanks to Vincent Lefevre for his input and suggestion to use the union as a better solution to the problem! diffs (26 lines): diff -r d732298789f2 -r cc7903944687 hcache.c --- a/hcache.c Thu Jan 15 13:19:14 2015 +0100 +++ b/hcache.c Sat Jan 17 14:42:28 2015 -0800 @@ -1135,7 +1135,10 @@ /* Calculate the current hcache version from dynamic configuration */ if (hcachever == 0x0) { - unsigned char digest[16]; + union { + unsigned char charval[16]; + unsigned int intval; + } digest; struct md5_ctx ctx; SPAM_LIST *spam; RX_LIST *nospam; @@ -1161,8 +1164,8 @@ } /* Get a hash and take its bytes as an (unsigned int) hash version */ - md5_finish_ctx(&ctx, digest); - hcachever = *((unsigned int *)digest); + md5_finish_ctx(&ctx, digest.charval); + hcachever = digest.intval; } h->db = NULL;