summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-26 14:42:25 +0100
committermadmaxoft <github@xoft.cz>2014-01-26 17:56:11 +0100
commita3ac1be7b7ed48dbaadc57650a17161fc18a5e84 (patch)
tree73cb4533be0ec8b16d769a431a8de4657d858a63 /src/StringUtils.cpp
parentAdded SIGABRT to catchers list (diff)
downloadcuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar.gz
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar.bz2
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar.lz
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar.xz
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.tar.zst
cuberite-a3ac1be7b7ed48dbaadc57650a17161fc18a5e84.zip
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 0dbd41c12..3fe75d611 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -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];
}