diff -r 53c2aecb9704 -r 08ccaf26cffd sources/network/bytestream.cpp --- a/sources/network/bytestream.cpp Thu Jul 23 00:16:47 2015 +0300 +++ b/sources/network/bytestream.cpp Thu Jul 23 01:52:04 2015 +0300 @@ -30,6 +30,7 @@ #include "bytestream.h" #include +BEGIN_ZFC_NAMESPACE // ------------------------------------------------------------------------------------------------- // @@ -72,8 +73,7 @@ } // ------------------------------------------------------------------------------------------------- -METHOD -Bytestream::operator= (const Bytestream& other) -> Bytestream& +Bytestream& Bytestream::operator= (const Bytestream& other) { init (other.data(), other.written_length()); return *this; @@ -81,8 +81,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::resize (unsigned long newsize) -> void +void Bytestream::resize (unsigned long newsize) { Vector olddata; unsigned long oldsize = 0L; @@ -104,8 +103,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::init (const unsigned char* data, unsigned long length) -> void +void Bytestream::init (const unsigned char* data, unsigned long length) { resize (length); memcpy (m_data, data, length); @@ -115,8 +113,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::clear() -> void +void Bytestream::clear() { m_cursor = &m_data[0]; m_writtenLength = 0; @@ -124,8 +121,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::ensure_read_space (unsigned int bytes) -> void +void Bytestream::ensure_read_space (unsigned int bytes) { if (bytes_left() < bytes) { @@ -140,8 +136,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read_byte() -> char +char Bytestream::read_byte() { ensure_read_space (1); return *m_cursor++; @@ -149,8 +144,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read_short() -> short int +short int Bytestream::read_short() { ensure_read_space (2); short int result = 0; @@ -164,8 +158,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read_long() -> long int +long int Bytestream::read_long() { ensure_read_space (4); long int result = 0; @@ -179,8 +172,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read_float() -> float +float Bytestream::read_float() { float value; int intvalue = read_long(); @@ -190,8 +182,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read_string() -> String +String Bytestream::read_string() { // Zandronum sends strings of maximum 2048 characters, though it only // reads 2047-character long ones so I guess we can follow up and do @@ -224,8 +215,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::read (unsigned char* buffer, unsigned long length) -> void +void Bytestream::read (unsigned char* buffer, unsigned long length) { ensure_read_space (length); memcpy (buffer, m_cursor, length); @@ -234,8 +224,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write (unsigned char val) -> void +void Bytestream::write (unsigned char val) { *m_cursor++ = val; m_writtenLength++; @@ -243,8 +232,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write (const unsigned char* val, unsigned int length) -> void +void Bytestream::write (const unsigned char* val, unsigned int length) { grow_to_fit (length); memcpy (m_cursor, val, length); @@ -254,8 +242,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::grow_to_fit (unsigned long bytes) -> void +void Bytestream::grow_to_fit (unsigned long bytes) { if (space_left() < bytes) resize (allocated_size() + bytes + 128); @@ -263,8 +250,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_byte (char val) -> void +void Bytestream::write_byte (char val) { grow_to_fit (1); write (val); @@ -272,8 +258,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_short (short int val) -> void +void Bytestream::write_short (short int val) { grow_to_fit (2); @@ -283,8 +268,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_long (long int val) -> void +void Bytestream::write_long (long int val) { grow_to_fit (4); @@ -294,8 +278,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_float (float val) -> void +void Bytestream::write_float (float val) { // I know this is probably dangerous but this is what Zandronum does so yeah int intvalue; @@ -305,8 +288,7 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_string (const String& val) -> void +void Bytestream::write_string (const String& val) { grow_to_fit (val.length() + 1); write (reinterpret_cast (val.chars()), val.length()); @@ -315,8 +297,9 @@ // ------------------------------------------------------------------------------------------------- // -METHOD -Bytestream::write_buffer (const Bytestream& other) -> void +void Bytestream::write_buffer (const Bytestream& other) { write (other.data(), other.written_length()); } + +END_ZFC_NAMESPACE \ No newline at end of file