]> git.mxchange.org Git - flightgear.git/commitdiff
change back unsigned byte count to signed (multiplaymgr)
authorTim Moore <timoore@redhat.com>
Wed, 26 Aug 2009 22:12:44 +0000 (00:12 +0200)
committerTim Moore <timoore@redhat.com>
Wed, 26 Aug 2009 22:12:44 +0000 (00:12 +0200)
Also, small fixes to generic protocol from AndersG

src/MultiPlayer/multiplaymgr.cxx
src/Network/generic.cxx

index b1318f64c4869fba90215fe6e08626202d86d49d..16c0a6e5f53024ea20f1351fac970a22f71419af 100644 (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;
index 178103e5c7c0a3f9a20d7167c2b9e81a6bd720ab..ad362e258005c0c730ba52e905e8f519b06e0fb9 100644 (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);