From 0099f080adf351bef132cf89be9517c0ab541c29 Mon Sep 17 00:00:00 2001 From: Alexander Chernyakhovsky Date: Wed, 20 Jun 2012 01:24:08 -0400 Subject: [PATCH] Fix FTBFS on ARM on GCC 4.7.0 GCC v4.7.0, as found in Fedora 17 and newer, fails to build mosh on ARM because of a narrowing warning, which is then promoted to an error by -Werror. This error message is new, and did not occur under previous versions of GCC. This patch corrects this error by explicitly casting to the desired datatype the return value of the offending code, the result of a macro from glibc to implement htobe16(). --- src/network/network.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/network.cc b/src/network/network.cc index e28be3c..a1235a1 100644 --- a/src/network/network.cc +++ b/src/network/network.cc @@ -73,7 +73,8 @@ string Packet::tostring( Session *session ) { uint64_t direction_seq = (uint64_t( direction == TO_CLIENT ) << 63) | (seq & SEQUENCE_MASK); - uint16_t ts_net[ 2 ] = { htobe16( timestamp ), htobe16( timestamp_reply ) }; + uint16_t ts_net[ 2 ] = { static_cast( htobe16( timestamp ) ), + static_cast( htobe16( timestamp_reply ) ) }; string timestamps = string( (char *)ts_net, 2 * sizeof( uint16_t ) );