MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Get

Method Get

engine/Poseidon/Network/NetworkMsgContext.cpp:895–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893 break;
894 }
895}
896
897bool NetworkMessageRaw::Get(bool& value, NetworkCompressionType compression)
898{
899 switch (compression)
900 {
901 case NCTNone:
902 case NCTDefault:
903 {
904 // Read into a byte and normalize: a tampered wire byte (e.g. 136)
905 // memcpy'd straight into a bool's storage is an out-of-range bool,
906 // and any later load of it is undefined behaviour.
907 unsigned char raw = 0;
908 if (!Read(&raw, sizeof(raw)))
909 return false;
910 value = (raw != 0);
911 return true;
912 }
913 default:
914 LOG_ERROR(Network, "Unsupported compression method {}", (int)compression);
915 return false;
916 }
917}
918

Callers 4

DecodeMessageMethod · 0.45
DecodeMsgItemMethod · 0.45
StartEnumHostsMethod · 0.45

Calls 5

ReadFunction · 0.85
GetFunction · 0.50
TimeClass · 0.50
GetStringMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected