From c510683d2a64e75a667134ef0b63e9638c474c28 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 2 Jan 2014 17:33:18 +0100 Subject: Fixed unaligned memory access in FastNBT. This should fix #420. --- src/StringUtils.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/StringUtils.h') diff --git a/src/StringUtils.h b/src/StringUtils.h index 3917cc4ec..471e843e4 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -81,6 +81,15 @@ extern AString ReplaceAllCharOccurrences(const AString & a_String, char a_From, /// Decodes a Base64-encoded string into the raw data extern AString Base64Decode(const AString & a_Base64String); +/// Reads two bytes from the specified memory location and interprets them as BigEndian short +extern short GetBEShort(const char * a_Mem); + +/// Reads four bytes from the specified memory location and interprets them as BigEndian int +extern int GetBEInt(const char * a_Mem); + +/// Writes four bytes to the specified memory location so that they interpret as BigEndian int +extern void SetBEInt(char * a_Mem, Int32 a_Value); + // If you have any other string helper functions, declare them here -- cgit v1.2.3 From e3bb82d95a0bf270f9d43d0504bf155b52dc516b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 7 Jan 2014 12:36:36 +0100 Subject: Added Base64Encode(). --- src/StringUtils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/StringUtils.h') diff --git a/src/StringUtils.h b/src/StringUtils.h index 471e843e4..2373f3843 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -81,6 +81,9 @@ extern AString ReplaceAllCharOccurrences(const AString & a_String, char a_From, /// Decodes a Base64-encoded string into the raw data extern AString Base64Decode(const AString & a_Base64String); +/// Encodes a string into Base64 +extern AString Base64Encode(const AString & a_Input); + /// Reads two bytes from the specified memory location and interprets them as BigEndian short extern short GetBEShort(const char * a_Mem); -- cgit v1.2.3