Mercurial > hg > orthanc
diff Core/Toolbox.cpp @ 3489:e7723a39adf8
Fixed alignment issue in Toolbox::DetectEndianness() + made the internal logger
use an std::stringstream so that manipulators like "std::hex" are supported
(when using ORTHANC_ENABLE_LOGGING_PLUGIN or ORTHANC_ENABLE_LOGGING_STDIO)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 10 Aug 2019 13:40:08 +0200 |
parents | 7d72e43f4a2d |
children | 7ae553d9c366 94f4a18a79cc |
line wrap: on
line diff
--- a/Core/Toolbox.cpp Mon Aug 05 13:57:54 2019 +0200 +++ b/Core/Toolbox.cpp Sat Aug 10 13:40:08 2019 +0200 @@ -923,14 +923,16 @@ { // http://sourceforge.net/p/predef/wiki/Endianness/ - uint8_t buffer[4]; + uint32_t bufferView; + + uint8_t* buffer = reinterpret_cast<uint8_t*>(&bufferView); buffer[0] = 0x00; buffer[1] = 0x01; buffer[2] = 0x02; buffer[3] = 0x03; - switch (*((uint32_t *)buffer)) + switch (bufferView) { case 0x00010203: return Endianness_Big; @@ -943,7 +945,6 @@ } } - std::string Toolbox::WildcardToRegularExpression(const std::string& source) { // TODO - Speed up this with a regular expression