aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gatsstream.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/gatsstream.cpp b/src/gatsstream.cpp
index 3e9b211..d5e3f82 100644
--- a/src/gatsstream.cpp
+++ b/src/gatsstream.cpp
@@ -1,12 +1,6 @@
1#include "gats/gatsstream.h" 1#include "gats/gatsstream.h"
2#include "gats/object.h" 2#include "gats/object.h"
3 3
4#ifdef WIN32
5#include <winsock2.h>
6#else
7#include <arpa/inet.h>
8#endif
9
10// #include <bu/sio.h> 4// #include <bu/sio.h>
11#include <bu/nullstream.h> 5#include <bu/nullstream.h>
12// using namespace Bu; 6// using namespace Bu;
@@ -44,7 +38,7 @@ Gats::Object *Gats::GatsStream::readObject()
44 38
45 int32_t iSize; 39 int32_t iSize;
46 qbRead.peek( &iSize, 4, 1 ); 40 qbRead.peek( &iSize, 4, 1 );
47 iSize = ntohl( iSize ); 41 iSize = be32toh( iSize );
48 // sio << "Gats::GatsStream::readObject(): Header read, looking for " << iSize << "b, we have " << qbRead.getSize() << "b." << sio.nl; 42 // sio << "Gats::GatsStream::readObject(): Header read, looking for " << iSize << "b, we have " << qbRead.getSize() << "b." << sio.nl;
49 while( qbRead.getSize() < iSize ) 43 while( qbRead.getSize() < iSize )
50 { 44 {
@@ -83,7 +77,7 @@ void Gats::GatsStream::writeObject( Gats::Object *pObject )
83 pObject->write( ns ); 77 pObject->write( ns );
84 78
85 uint8_t uBuf = 1; 79 uint8_t uBuf = 1;
86 int32_t iSize = htonl( ns.tell()+5 ); 80 int32_t iSize = htobe32( ns.tell()+5 );
87 rStream.write( &uBuf, 1 ); 81 rStream.write( &uBuf, 1 );
88 rStream.write( &iSize, 4 ); 82 rStream.write( &iSize, 4 );
89 pObject->write( rStream ); 83 pObject->write( rStream );