Disable the experimental code, oops KKona

This commit is contained in:
Rasmus Karlsson 2018-04-14 22:39:35 +02:00
parent 5fcec26a5c
commit b68b0845c1

View file

@ -104,7 +104,9 @@ void runNativeMessagingHost()
auto &nmm = chatterino::singletons::NativeMessagingManager::getInstance(); auto &nmm = chatterino::singletons::NativeMessagingManager::getInstance();
#if 0
bool bigEndian = isBigEndian(); bool bigEndian = isBigEndian();
#endif
while (true) { while (true) {
char size_c[4]; char size_c[4];
@ -114,6 +116,9 @@ void runNativeMessagingHost()
break; break;
} }
uint32_t size = *reinterpret_cast<uint32_t *>(size_c);
#if 0
// To avoid breaking strict-aliasing rules and potentially inducing undefined behaviour, the following code can be run instead
uint32_t size = 0; uint32_t size = 0;
if (bigEndian) { if (bigEndian) {
size = size_c[3] | static_cast<uint32_t>(size_c[2]) << 8 | size = size_c[3] | static_cast<uint32_t>(size_c[2]) << 8 |
@ -122,6 +127,7 @@ void runNativeMessagingHost()
size = size_c[0] | static_cast<uint32_t>(size_c[1]) << 8 | size = size_c[0] | static_cast<uint32_t>(size_c[1]) << 8 |
static_cast<uint32_t>(size_c[2]) << 16 | static_cast<uint32_t>(size_c[3]) << 24; static_cast<uint32_t>(size_c[2]) << 16 | static_cast<uint32_t>(size_c[3]) << 24;
} }
#endif
char *b = (char *)malloc(size + 1); char *b = (char *)malloc(size + 1);
std::cin.read(b, size); std::cin.read(b, size);