Mercurial > hg > freeDiameter
comparison include/freeDiameter/libfdproto.h @ 1414:f6f12521c2aa
Fix strict-aliasing warnings with gcc 4.8
Rewrite IN6_ADDR_V4MAP() to not rely upon aliasing rules.
Add test for IN6_ADDR_V4MAP() and IN6_ADDR_V4UNMAP().
Rewrite MD5Final() to not rely upon aliasing rules. (Not tested)
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Tue, 18 Feb 2020 19:01:49 +1100 |
parents | d4a4ab5239c7 |
children | b1e8c5281d29 |
comparison
equal
deleted
inserted
replaced
1413:1979715b744f | 1414:f6f12521c2aa |
---|---|
687 (((long int) (a)->s_addr) == 0x00000000) | 687 (((long int) (a)->s_addr) == 0x00000000) |
688 #endif /* IN_IS_ADDR_UNSPECIFIED */ | 688 #endif /* IN_IS_ADDR_UNSPECIFIED */ |
689 | 689 |
690 /* create a V4MAPPED address */ | 690 /* create a V4MAPPED address */ |
691 #define IN6_ADDR_V4MAP( a6, a4 ) { \ | 691 #define IN6_ADDR_V4MAP( a6, a4 ) { \ |
692 ((uint32_t *)(a6))[0] = 0; \ | 692 memset(&(*a6)[0], 0, 10); \ |
693 ((uint32_t *)(a6))[1] = 0; \ | 693 (*a6)[10] = 0xff; \ |
694 ((uint32_t *)(a6))[2] = htonl(0xffff); \ | 694 (*a6)[11] = 0xff; \ |
695 ((uint32_t *)(a6))[3] = (uint32_t)(a4); \ | 695 memcpy(&(*a6)[12], &a4, 4); \ |
696 } | 696 } |
697 | 697 |
698 /* Retrieve a v4 value from V4MAPPED address ( takes a s6_addr as param) */ | 698 /* Retrieve a v4 value from V4MAPPED address ( takes a s6_addr as param) */ |
699 #define IN6_ADDR_V4UNMAP( a6 ) \ | 699 #define IN6_ADDR_V4UNMAP( a6 ) \ |
700 (((in_addr_t *)(a6))[3]) | 700 (((in_addr_t *)(a6))[3]) |