aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-09-12 14:51:55 +0000
committerMike Buland <eichlan@xagasoft.com>2012-09-12 14:51:55 +0000
commitbbe919853f24a2589b83e5d44e3ecf03f9a312e3 (patch)
tree8391b030be687a9b239d14e5ffcd655038e2d6c4
parentf6a541b050951377dd309ac4a99cd639378ac8bd (diff)
downloadlibgats-bbe919853f24a2589b83e5d44e3ecf03f9a312e3.tar.gz
libgats-bbe919853f24a2589b83e5d44e3ecf03f9a312e3.tar.bz2
libgats-bbe919853f24a2589b83e5d44e3ecf03f9a312e3.tar.xz
libgats-bbe919853f24a2589b83e5d44e3ecf03f9a312e3.zip
libbu++ version now uses libbu++ endian conversion macros and does not rely on
winsock in windows.
-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 );