fixed strict aliasing warning on gcc

This commit is contained in:
Arvid Norberg 2010-04-02 03:57:06 +00:00
parent 600e280dda
commit ccb808638d
2 changed files with 13 additions and 17 deletions

View File

@ -26,6 +26,7 @@
incoming connection
* added more detailed instrumentation of the disk I/O thread
* fixed strict aliasing warning on gcc
* fixed inconsistency when creating torrents with symlinks
* properly detect windows version to initialize half-open connection limit
* fixed bug in url encoder where $ would not be encoded

View File

@ -169,24 +169,19 @@ namespace libtorrent
// workaround for msvc-bug.
// assumes sizeof(map<string, char>) == sizeof(map<string, entry>)
// and sizeof(list<char>) == sizeof(list<entry>)
union
{
char data[
max4<sizeof(std::list<char>)
, sizeof(std::map<std::string, char>)
, sizeof(string_type)
, sizeof(integer_type)>::value];
integer_type dummy_aligner;
};
integer_type data[
(max4<sizeof(std::list<char>)
, sizeof(std::map<std::string, char>)
, sizeof(string_type)
, sizeof(integer_type)>::value + sizeof(integer_type) - 1)
/ sizeof(integer_type)];
#else
union
{
char data[max4<sizeof(list_type)
, sizeof(dictionary_type)
, sizeof(string_type)
, sizeof(integer_type)>::value];
integer_type dummy_aligner;
};
integer_type data[
(max4<sizeof(list_type)
, sizeof(dictionary_type)
, sizeof(string_type)
, sizeof(integer_type)>::value + sizeof(integer_type) - 1)
/ sizeof(integer_type)];
#endif
#ifdef TORRENT_DEBUG