There appears to be a bug in jsclient code that causes it to fail on linux 64 bit since a "long" is 64 bit long.
In any case i think it is safer to use fixed width typedefs when the code depends on the size of the datatype. Patch attached. -- Cheers! Kishore
diff --git a/src/Network/jsclient.cxx b/src/Network/jsclient.cxx index 1fff200..23ce067 100644 --- a/src/Network/jsclient.cxx +++ b/src/Network/jsclient.cxx @@ -91,11 +91,11 @@ bool FGJsClient::process() { if ( io->get_type() == sgFileType ) { if ( io->read( (char *)(& buf), length ) == length ) { SG_LOG( SG_IO, SG_DEBUG, "Success reading data." ); - long int *msg; - msg = (long int *)buf; + int32_t *msg; + msg = (int32_t *)buf; for( int i = 0; i < 4; ++i ) { - axis[i] = ((double)msg[i] / 2147483647.0); + axis[i] = (msg[i] / 2147483647.0); if ( fabs(axis[i]) < 0.05 ) axis[i] = 0.0; if( axisdefstr[i].length() != 0 ) @@ -105,13 +105,13 @@ bool FGJsClient::process() { } else { while ( io->read( (char *)(& buf), length ) == length ) { SG_LOG( SG_IO, SG_DEBUG, "Success reading data." ); - long int *msg; - msg = (long int *)buf; + int32_t *msg; + msg = (int32_t *)buf; SG_LOG( SG_IO, SG_DEBUG, "ax0 = " << msg[0] << " ax1 = " << msg[1] << "ax2 = " << msg[2] << "ax3 = " << msg[3]); for( int i = 0; i < 4; ++i ) { - axis[i] = ((double)msg[i] / 2147483647.0); + axis[i] = (msg[i] / 2147483647.0); if ( fabs(axis[i]) < 0.05 ) axis[i] = 0.0; if( axisdefstr[i].length() != 0 ) diff --git a/src/Network/jsclient.hxx b/src/Network/jsclient.hxx index a25c623..9c54a88 100644 --- a/src/Network/jsclient.hxx +++ b/src/Network/jsclient.hxx @@ -41,7 +41,7 @@ class FGJsClient : public FGProtocol { char buf[256]; int length; - double axis[4]; + float axis[4]; SGPropertyNode_ptr axisdef[4]; string axisdefstr[4]; bool active;
------------------------------------------------------------------------------
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel