aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/float.cpp4
-rw-r--r--src/gatsstream.cpp20
2 files changed, 10 insertions, 14 deletions
diff --git a/src/float.cpp b/src/float.cpp
index e85dff8..879d74b 100644
--- a/src/float.cpp
+++ b/src/float.cpp
@@ -31,16 +31,12 @@ void Gats::Float::write( Bu::Stream &rOut ) const
31 rOut.write( sWriteCache.getStr(), sWriteCache.getSize() ); 31 rOut.write( sWriteCache.getStr(), sWriteCache.getSize() );
32} 32}
33 33
34#include <bu/sio.h>
35using namespace Bu;
36
37void Gats::Float::read( Bu::Stream &rIn, char cType ) 34void Gats::Float::read( Bu::Stream &rIn, char cType )
38{ 35{
39 int iSize; 36 int iSize;
40 Gats::Integer::readPackedInt( rIn, iSize ); 37 Gats::Integer::readPackedInt( rIn, iSize );
41 char buf[50]; 38 char buf[50];
42 buf[rIn.read( buf, iSize )] = '\0'; 39 buf[rIn.read( buf, iSize )] = '\0';
43 sio << "Reading float, iSize = " << iSize << ", str = " << buf << sio.nl;
44 sscanf( buf, "%la", &fVal ); 40 sscanf( buf, "%la", &fVal );
45} 41}
46 42
diff --git a/src/gatsstream.cpp b/src/gatsstream.cpp
index 71372db..3e9b211 100644
--- a/src/gatsstream.cpp
+++ b/src/gatsstream.cpp
@@ -7,9 +7,9 @@
7#include <arpa/inet.h> 7#include <arpa/inet.h>
8#endif 8#endif
9 9
10#include <bu/sio.h> 10// #include <bu/sio.h>
11#include <bu/nullstream.h> 11#include <bu/nullstream.h>
12using namespace Bu; 12// using namespace Bu;
13 13
14Gats::GatsStream::GatsStream( Bu::Stream &rStream ) : 14Gats::GatsStream::GatsStream( Bu::Stream &rStream ) :
15 rStream( rStream ) 15 rStream( rStream )
@@ -40,40 +40,40 @@ Gats::Object *Gats::GatsStream::readObject()
40 40
41 uint8_t uVer; 41 uint8_t uVer;
42 qbRead.peek( &uVer, 1 ); 42 qbRead.peek( &uVer, 1 );
43 sio << "Gats::GatsStream::readObject(): Packet version: " << (int)uVer << sio.nl; 43 // sio << "Gats::GatsStream::readObject(): Packet version: " << (int)uVer << sio.nl;
44 44
45 int32_t iSize; 45 int32_t iSize;
46 qbRead.peek( &iSize, 4, 1 ); 46 qbRead.peek( &iSize, 4, 1 );
47 iSize = ntohl( iSize ); 47 iSize = ntohl( iSize );
48 sio << "Gats::GatsStream::readObject(): Header read, looking for " << iSize << "b, we have " << qbRead.getSize() << "b." << sio.nl; 48 // sio << "Gats::GatsStream::readObject(): Header read, looking for " << iSize << "b, we have " << qbRead.getSize() << "b." << sio.nl;
49 while( qbRead.getSize() < iSize ) 49 while( qbRead.getSize() < iSize )
50 { 50 {
51 int32_t iRead = iSize - qbRead.getSize(); 51 int32_t iRead = iSize - qbRead.getSize();
52 if( iRead > 1500 ) 52 if( iRead > 1500 )
53 iRead = 1500; 53 iRead = 1500;
54 sio << "Gats::GatsStream::readObject(): Attempting to read " << iRead << "b." << sio.nl; 54 // sio << "Gats::GatsStream::readObject(): Attempting to read " << iRead << "b." << sio.nl;
55 int32_t iReal = rStream.read( buf, iRead ); 55 int32_t iReal = rStream.read( buf, iRead );
56 sio << "Gats::GatsStream::readObject(): Read " << iReal << "b." << sio.nl; 56 // sio << "Gats::GatsStream::readObject(): Read " << iReal << "b." << sio.nl;
57 qbRead.write( buf, iReal ); 57 qbRead.write( buf, iReal );
58 if( iReal < iRead ) 58 if( iReal < iRead )
59 { 59 {
60 sio << "Gats::GatsStream::readObject(): Insufficient data read in block, bailing on read." << sio.nl; 60 // sio << "Gats::GatsStream::readObject(): Insufficient data read in block, bailing on read." << sio.nl;
61 return NULL; 61 return NULL;
62 } 62 }
63 } 63 }
64 64
65 if( qbRead.getSize() < iSize ) 65 if( qbRead.getSize() < iSize )
66 { 66 {
67 sio << "Gats::GatsStream::readObject(): Somehow, we still don't have enough data, bailing." << sio.nl; 67 // sio << "Gats::GatsStream::readObject(): Somehow, we still don't have enough data, bailing." << sio.nl;
68 return NULL; 68 return NULL;
69 } 69 }
70 70
71 sio << "Gats::GatsStream::readObject(): We have " << qbRead.getSize() << "b of " << iSize << "b, time to read the object." << sio.nl; 71 // sio << "Gats::GatsStream::readObject(): We have " << qbRead.getSize() << "b of " << iSize << "b, time to read the object." << sio.nl;
72 72
73 qbRead.seek( 5 ); 73 qbRead.seek( 5 );
74 Gats::Object *pObj = Gats::Object::read( qbRead ); 74 Gats::Object *pObj = Gats::Object::read( qbRead );
75 75
76 sio << "Gats::GatsStream::readObject(): Read completed, there are " << qbRead.getSize() << "b left in the buffer." << sio.nl; 76 // sio << "Gats::GatsStream::readObject(): Read completed, there are " << qbRead.getSize() << "b left in the buffer." << sio.nl;
77 return pObj; 77 return pObj;
78} 78}
79 79