# HG changeset patch # User Teemu Piippo # Date 1437665190 -10800 # Node ID 4f0f0b1b8e0bb1aff4cd0e0607728641027f870d # Parent 2d43f05b284c843f11ccfa2267a44f7189d885cc Use stdint.h types for the bytestream diff -r 2d43f05b284c -r 4f0f0b1b8e0b sources/main.h --- a/sources/main.h Thu Jul 23 18:07:39 2015 +0300 +++ b/sources/main.h Thu Jul 23 18:26:30 2015 +0300 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff -r 2d43f05b284c -r 4f0f0b1b8e0b sources/network/bytestream.cpp --- a/sources/network/bytestream.cpp Thu Jul 23 18:07:39 2015 +0300 +++ b/sources/network/bytestream.cpp Thu Jul 23 18:26:30 2015 +0300 @@ -136,7 +136,7 @@ // ------------------------------------------------------------------------------------------------- // -char Bytestream::read_byte() +int8_t Bytestream::read_byte() { ensure_read_space (1); return *m_cursor++; @@ -144,7 +144,7 @@ // ------------------------------------------------------------------------------------------------- // -short int Bytestream::read_short() +int16_t Bytestream::read_short() { ensure_read_space (2); short int result = 0; @@ -158,7 +158,7 @@ // ------------------------------------------------------------------------------------------------- // -long int Bytestream::read_long() +int32_t Bytestream::read_long() { ensure_read_space (4); long int result = 0; @@ -250,7 +250,7 @@ // ------------------------------------------------------------------------------------------------- // -void Bytestream::write_byte (char val) +void Bytestream::write_byte (int8_t val) { grow_to_fit (1); write (val); @@ -258,7 +258,7 @@ // ------------------------------------------------------------------------------------------------- // -void Bytestream::write_short (short int val) +void Bytestream::write_short (int16_t val) { grow_to_fit (2); @@ -268,7 +268,7 @@ // ------------------------------------------------------------------------------------------------- // -void Bytestream::write_long (long int val) +void Bytestream::write_long (int32_t val) { grow_to_fit (4); diff -r 2d43f05b284c -r 4f0f0b1b8e0b sources/network/bytestream.h --- a/sources/network/bytestream.h Thu Jul 23 18:07:39 2015 +0300 +++ b/sources/network/bytestream.h Thu Jul 23 18:26:30 2015 +0300 @@ -67,20 +67,20 @@ void clear(); void grow_to_fit (unsigned long bytes); void read (unsigned char* buffer, unsigned long length); - char read_byte(); - short int read_short(); - long int read_long(); + int8_t read_byte(); + int32_t read_long(); + int16_t read_short(); String read_string(); float read_float(); void resize (unsigned long length); void write (const unsigned char* val, unsigned int length); void write_buffer (const Bytestream& other); void write_buffer (const Vector& other); - void write_byte (char val); + void write_byte (int8_t val); void write_double (double val); void write_float (float val); - void write_long (long int val); - void write_short (short int val); + void write_long (int32_t val); + void write_short (int16_t val); void write_string (const String& val); Bytestream& operator= (const Bytestream& other);