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

View File

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