1
0

Fixed Byte-order reading.

The functions would fail on bytes that were above 127.
This commit is contained in:
madmaxoft 2014-01-26 14:42:25 +01:00
parent ea9de4bbb7
commit a3ac1be7b7

View File

@ -833,7 +833,8 @@ AString Base64Encode(const AString & a_Input)
short GetBEShort(const char * a_Mem)
{
return (((short)a_Mem[0]) << 8) | a_Mem[1];
const Byte * Bytes = (const Byte *)a_Mem;
return (Bytes[0] << 8) | Bytes[1];
}
@ -842,7 +843,8 @@ short GetBEShort(const char * a_Mem)
int GetBEInt(const char * a_Mem)
{
return (((int)a_Mem[0]) << 24) | (((int)a_Mem[1]) << 16) | (((int)a_Mem[2]) << 8) | a_Mem[3];
const Byte * Bytes = (const Byte *)a_Mem;
return (Bytes[0] << 24) | (Bytes[1] << 16) | (Bytes[2] << 8) | Bytes[3];
}