1
0
Fork 0

change back unsigned byte count to signed (multiplaymgr)

Also, small fixes to generic protocol from AndersG
This commit is contained in:
Tim Moore 2009-08-27 00:12:44 +02:00
parent acbcf94bde
commit be4b46b894
2 changed files with 4 additions and 3 deletions

View file

@ -716,7 +716,7 @@ FGMultiplayMgr::Update(void)
//////////////////////////////////////////////////
// Read the receive socket and process any data
//////////////////////////////////////////////////
size_t bytes;
ssize_t bytes;
do {
MsgBuf msgBuf;
//////////////////////////////////////////////////
@ -736,7 +736,7 @@ FGMultiplayMgr::Update(void)
perror("FGMultiplayMgr::MP_ProcessData");
break;
}
if (bytes <= sizeof(T_MsgHdr)) {
if (bytes <= static_cast<ssize_t>(sizeof(T_MsgHdr))) {
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
<< "received message with insufficient data" );
break;

View file

@ -143,7 +143,7 @@ bool FGGeneric::gen_message_binary() {
if (binary_byte_order == BYTE_ORDER_MATCHES_NETWORK_ORDER) {
*((int32_t*)&buf[length]) = (int32_t)fixed;
} else {
*((uint32_t*)&buf[length]) = sg_bswap_32((uint32_t)val);
*((uint32_t*)&buf[length]) = sg_bswap_32((uint32_t)fixed);
}
length += sizeof(int32_t);
break;
@ -399,6 +399,7 @@ bool FGGeneric::parse_message_ascii() {
break;
case FG_FIXED:
case FG_FLOAT:
case FG_DOUBLE:
val = _in_message[i].offset + strtod(p1, 0) * _in_message[i].factor;
_in_message[i].prop->setFloatValue((float)val);