From 5b29cd4cc0dafc110320af4993cf14eacb7966f0 Mon Sep 17 00:00:00 2001
From: Tim Moore <timoore@redhat.com>
Date: Mon, 24 Aug 2009 18:07:19 +0200
Subject: [PATCH] fix warnings in Multiplayer, Scripting, and Time

---
 src/MultiPlayer/multiplaymgr.cxx | 12 +++++-------
 src/Scripting/nasal-props.cxx    |  5 +++--
 src/Time/light.cxx               |  2 --
 src/Time/sunsolver.cxx           |  2 +-
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx
index 4c7a1792f..b1318f64c 100644
--- a/src/MultiPlayer/multiplaymgr.cxx
+++ b/src/MultiPlayer/multiplaymgr.cxx
@@ -716,7 +716,7 @@ FGMultiplayMgr::Update(void)
   //////////////////////////////////////////////////
   //  Read the receive socket and process any data
   //////////////////////////////////////////////////
-  int bytes;
+  size_t bytes;
   do {
     MsgBuf msgBuf;
     //////////////////////////////////////////////////
@@ -863,7 +863,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
   }
   while (xdr < Msg.propsRecvdEnd()) {
     FGPropertyData* pData = new FGPropertyData;
-    simgear::props::Type type = simgear::props::UNSPECIFIED;
+    // simgear::props::Type type = simgear::props::UNSPECIFIED;
     
     // First element is always the ID
     pData->id = XDR_decode_uint32(*xdr);
@@ -969,14 +969,12 @@ FGMultiplayMgr::ProcessChatMsg(const MsgBuf& Msg,
   }
   
   char *chatStr = new char[MsgHdr->MsgLen - sizeof(T_MsgHdr)];
-  strncpy(chatStr,
-          (reinterpret_cast<const T_ChatMsg *>(Msg.Msg + sizeof(T_MsgHdr)))
-          ->Text,
+  const T_ChatMsg* ChatMsg
+      = reinterpret_cast<const T_ChatMsg *>(Msg.Msg + sizeof(T_MsgHdr));
+  strncpy(chatStr, ChatMsg->Text,
           MsgHdr->MsgLen - sizeof(T_MsgHdr));
   chatStr[MsgHdr->MsgLen - sizeof(T_MsgHdr) - 1] = '\0';
   
-  const T_ChatMsg* ChatMsg
-      = reinterpret_cast<const T_ChatMsg *>(Msg.Msg + sizeof(T_MsgHdr));
   SG_LOG (SG_NETWORK, SG_WARN, "Chat [" << MsgHdr->Callsign << "]"
            << " " << chatStr);
 
diff --git a/src/Scripting/nasal-props.cxx b/src/Scripting/nasal-props.cxx
index 83f90ab0f..4ffc4d601 100644
--- a/src/Scripting/nasal-props.cxx
+++ b/src/Scripting/nasal-props.cxx
@@ -73,6 +73,7 @@ static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
     case props::UNSPECIFIED: t = "UNSPECIFIED"; break;
     case props::VEC3D:  t = "VEC3D";  break;
     case props::VEC4D:  t = "VEC4D";  break;
+    case props::EXTENDED: t = "EXTENDED";  break; // shouldn't happen
     }
     return NASTR(t);
 }
@@ -146,7 +147,7 @@ static naRef f_getIndex(naContext c, naRef me, int argc, naRef* args)
 template<typename T>
 naRef makeVectorFromVec(naContext c, const T& vec)
 {
-    const unsigned num_components
+    const int num_components
         = sizeof(vec.data()) / sizeof(typename T::value_type);
     naRef vector = naNewVector(c);
     naVec_setsize(vector, num_components);
@@ -180,7 +181,7 @@ template<typename T>
 T makeVecFromVector(naRef vector)
 {
     T vec;
-    const unsigned num_components
+    const int num_components
         = sizeof(vec.data()) / sizeof(typename T::value_type);
     int size = naVec_size(vector);
 
diff --git a/src/Time/light.cxx b/src/Time/light.cxx
index 062cbd641..c1d204ac3 100644
--- a/src/Time/light.cxx
+++ b/src/Time/light.cxx
@@ -261,8 +261,6 @@ void FGLight::update_sky_color () {
     gamma_correct_rgb( _scene_ambient.data() );
 
     SGVec4f color = thesky->get_scene_color();
-    float ndiff = (ambient + specular) / 2;
-    float idiff = 1.0 - ndiff;
     _scene_diffuse[0] = color[0] * diffuse;
     _scene_diffuse[1] = color[1] * diffuse;
     _scene_diffuse[2] = color[2] * diffuse;
diff --git a/src/Time/sunsolver.cxx b/src/Time/sunsolver.cxx
index a6d69e597..504de9081 100644
--- a/src/Time/sunsolver.cxx
+++ b/src/Time/sunsolver.cxx
@@ -57,7 +57,7 @@ void fgSunPositionGST(double gst, double *lon, double *lat) {
     double tmp;
 
     double beta = globals->get_ephem()->get_sun()->getLat();
-    double r = globals->get_ephem()->get_sun()->getDistance();
+    // double r = globals->get_ephem()->get_sun()->getDistance();
     double xs = globals->get_ephem()->get_sun()->getxs();
     double ys = globals->get_ephem()->get_sun()->getys();
     double ye = globals->get_ephem()->get_sun()->getye();