Date: Tuesday, November 15, 2005 @ 17:19:12
Author: marc
Path: /cvsroot/carob/carob/src
Modified: JavaSocket.cpp (1.10 -> 1.11)
Comments, formatting and cosmetics.
----------------+
JavaSocket.cpp | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.10 carob/src/JavaSocket.cpp:1.11
--- carob/src/JavaSocket.cpp:1.10 Thu Nov 10 12:12:42 2005
+++ carob/src/JavaSocket.cpp Tue Nov 15 17:19:12 2005
@@ -180,6 +180,7 @@
// Convert size to net format
uint16_t strlenPlusOne = (str.length()+1)*sizeof(wchar_t);
+ // FIXME: we don't support inline zeros. We should get rid of c_str
const wchar_t* oriStr = str.c_str();
byte* utfStr = new byte[strlenPlusOne];
@@ -238,6 +239,7 @@
memset(utfStr, 0, lenRec+1);
if (receiveFromSocket(fctName, L"UTF string", utfStr, lenRec, 0))
{
+ // FIXME: we don't support inline zeros. We should get rid of c_str
string received((const char*)utfStr);
if (!stringToWString(s, received))
{
@@ -305,11 +307,7 @@
UnexpectedException)
{
wstring fctName(L"JavaSocket::WriteBoolean");
- byte byteToSend = 1;
- if (!b)
- {
- byteToSend = 0;
- }
+ byte byteToSend = b ? 1 : 0 ;
//No byte order problem here: the only value read is '0' for false
//all other values are true
sendToSocket(fctName, L"Boolean", &byteToSend, sizeof(byteToSend),
MSG_NOSIGNAL);
@@ -322,16 +320,7 @@
byte rec;
if (receiveFromSocket(fctName, L"Boolean", &rec, sizeof(rec), 0))
- {
- if (rec == 0)
- {
- b = false;
- }
- else
- {
- b = true;
- }
- }
+ b = (rec != 0 ? true : false);
}
int JavaSocket::recvFully(void *buf, const int len, const int flags)
@@ -380,7 +369,7 @@
throw SocketIOException(fctName + L"Could not read int from socket.");
return false;
}
- else if (status == 0)
+ else if (status == 0) // FIXME: recvFully currently does not return 0
{
throw SocketIOException(fctName + L"Peer reset connection while reading
integer.");
return false;
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits