aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-03-27 19:20:57 +0000
committerMike Buland <eichlan@xagasoft.com>2007-03-27 19:20:57 +0000
commit57191021fe365eb8d448a9f2a66002a59e2ab065 (patch)
treedb9dd25ea5908bc2517a58ba31882a7cba157270
parent58d5ac863b8f94f74b20edee7604f33cca186b2f (diff)
downloadlibbu++-57191021fe365eb8d448a9f2a66002a59e2ab065.tar.gz
libbu++-57191021fe365eb8d448a9f2a66002a59e2ab065.tar.bz2
libbu++-57191021fe365eb8d448a9f2a66002a59e2ab065.tar.xz
libbu++-57191021fe365eb8d448a9f2a66002a59e2ab065.zip
Fixed a const issue in the fstring.
-rw-r--r--src/connection.cpp15
-rw-r--r--src/fstring.h2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index f382d82..a5fac5b 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -13,6 +13,9 @@
13#include <errno.h> 13#include <errno.h>
14#include "exceptions.h" 14#include "exceptions.h"
15 15
16// Read buffer size...maybe fix wierd issues...
17#define RBS (1024*10)
18
16Connection::Connection() 19Connection::Connection()
17{ 20{
18 nSocket = -1; 21 nSocket = -1;
@@ -201,15 +204,15 @@ bool Connection::open( const char *sAddr, int nPort )
201 204
202int Connection::readInput() 205int Connection::readInput()
203{ 206{
204 char buffer[2048]; 207 char buffer[RBS];
205 int nbytes; 208 int nbytes;
206 int nTotalRead=0; 209 int nTotalRead=0;
207 210
208 for(;;) 211 for(;;)
209 { 212 {
210 //memset( buffer, 0, 2048 ); 213 //memset( buffer, 0, RBS );
211 214
212 nbytes = read( nSocket, buffer, 2048 ); 215 nbytes = read( nSocket, buffer, RBS );
213 if( nbytes < 0 && errno != 0 && errno != EAGAIN ) 216 if( nbytes < 0 && errno != 0 && errno != EAGAIN )
214 { 217 {
215 printf("errno: %d, %s\n", errno, strerror( errno ) ); 218 printf("errno: %d, %s\n", errno, strerror( errno ) );
@@ -224,12 +227,12 @@ int Connection::readInput()
224 nTotalRead += nbytes; 227 nTotalRead += nbytes;
225 appendInput( buffer, nbytes ); 228 appendInput( buffer, nbytes );
226 /* Data read. */ 229 /* Data read. */
227 if( nbytes < 2048 ) 230 if( nbytes < RBS )
228 { 231 {
229 break; 232 break;
230 } 233 }
231 234
232 /* New test, if data is divisible by 2048 bytes on some libs the 235 /* New test, if data is divisible by RBS bytes on some libs the
233 * read could block, this keeps it from happening. 236 * read could block, this keeps it from happening.
234 */ 237 */
235 { 238 {
@@ -358,7 +361,7 @@ bool Connection::clearInput()
358 361
359bool Connection::writeOutput() 362bool Connection::writeOutput()
360{ 363{
361 //int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), min( 2048, xOutputBuf.getLength() ) ) ); 364 //int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), min( RBS, xOutputBuf.getLength() ) ) );
362 int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), xOutputBuf.getLength() ) ); 365 int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), xOutputBuf.getLength() ) );
363 if( nBytes < 0 ) 366 if( nBytes < 0 )
364 { 367 {
diff --git a/src/fstring.h b/src/fstring.h
index f0462cb..c5397cc 100644
--- a/src/fstring.h
+++ b/src/fstring.h
@@ -170,7 +170,7 @@ public:
170 nLength = nNewSize; 170 nLength = nNewSize;
171 } 171 }
172 172
173 long getSize() 173 long getSize() const
174 { 174 {
175 return nLength; 175 return nLength;
176 } 176 }