From 400c9d6a2dede85c42abb256b08c52274e7aad48 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 22 Apr 2001 14:57:08 +0000 Subject: [PATCH] Fix various compiler warnings contributed by Norman Princeton. --- Doxyfile | 2 +- SimGear.dsp | 390 --------------------------------- acconfig.h | 3 + configure.in | 8 +- simgear/config.h.in | 6 + simgear/magvar/coremag.cxx | 9 +- simgear/metar/Antoi.cpp | 18 +- simgear/metar/Local.h | 12 +- simgear/metar/MetarReport.cpp | 22 +- simgear/metar/MetarStation.cpp | 4 +- simgear/screen/screen-dump.cxx | 10 +- simgear/sky/cloud.cxx | 2 +- 12 files changed, 65 insertions(+), 421 deletions(-) diff --git a/Doxyfile b/Doxyfile index 74fa7e5f..ec122dd9 100644 --- a/Doxyfile +++ b/Doxyfile @@ -313,8 +313,8 @@ INPUT = \ simgear/sg_inlines.h \ simgear/sg_traits.hxx \ simgear/sg_zlib.h \ - simgear/threads \ simgear/sky \ + simgear/threads \ simgear/timing \ simgear/xml diff --git a/SimGear.dsp b/SimGear.dsp index 612af646..87264772 100644 --- a/SimGear.dsp +++ b/SimGear.dsp @@ -243,21 +243,6 @@ SOURCE=.\simgear\ephemeris\neptune.cxx # End Source File # Begin Source File -SOURCE=.\simgear\ephemeris\pluto.hxx - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgephem" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgephem" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\ephemeris\saturn.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -431,21 +416,6 @@ SOURCE=.\simgear\io\sg_socket.cxx # PROP Default_Filter "" # Begin Source File -SOURCE=.\simgear\magvar\coremag.hxx - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmagvar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmagvar" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\magvar\coremag.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -664,36 +634,6 @@ SOURCE=.\simgear\metar\Fracpart.cpp # End Source File # Begin Source File -SOURCE=.\simgear\metar\Local.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmetar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmetar" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\metar\Metar.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmetar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmetar" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\metar\MetarReport.cpp !IF "$(CFG)" == "SimGear - Win32 Release" @@ -931,21 +871,6 @@ SOURCE=.\simgear\screen\GLBitmaps.cxx # End Source File # Begin Source File -SOURCE=.\simgear\screen\GLBitmaps.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgscreen" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgscreen" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\screen\screen-dump.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -958,21 +883,6 @@ SOURCE=.\simgear\screen\screen-dump.cxx !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\screen\win32-printer.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgscreen" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgscreen" - -!ENDIF - # End Source File # End Group # Begin Group "Lib_sgserial" @@ -1225,21 +1135,6 @@ SOURCE=.\simgear\xgl\xglUtils.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\simgear\xml\asciitab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\easyxml.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1255,21 +1150,6 @@ SOURCE=.\simgear\xml\easyxml.cxx # End Source File # Begin Source File -SOURCE=.\simgear\xml\hashtable.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\hashtable.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1285,96 +1165,6 @@ SOURCE=.\simgear\xml\hashtable.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\iasciitab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\latin1tab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\nametab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\utf8tab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmldef.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmlparse.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmlparse.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1390,21 +1180,6 @@ SOURCE=.\simgear\xml\xmlparse.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\xmlrole.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmlrole.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1420,21 +1195,6 @@ SOURCE=.\simgear\xml\xmlrole.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\xmltok.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmltok.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1447,21 +1207,6 @@ SOURCE=.\simgear\xml\xmltok.c !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmltok_impl.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - # End Source File # End Group # Begin Group "Lib_z" @@ -1529,21 +1274,6 @@ SOURCE=.\simgear\zlib\deflate.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\deflate.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\gzio.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1574,21 +1304,6 @@ SOURCE=.\simgear\zlib\infblock.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infblock.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\infcodes.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1604,21 +1319,6 @@ SOURCE=.\simgear\zlib\infcodes.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infcodes.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\inffast.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1634,36 +1334,6 @@ SOURCE=.\simgear\zlib\inffast.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\inffast.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\zlib\inffixed.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\inflate.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1694,21 +1364,6 @@ SOURCE=.\simgear\zlib\inftrees.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\inftrees.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\infutil.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1724,21 +1379,6 @@ SOURCE=.\simgear\zlib\infutil.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infutil.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\trees.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1754,21 +1394,6 @@ SOURCE=.\simgear\zlib\trees.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\trees.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\uncompr.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1796,21 +1421,6 @@ SOURCE=.\simgear\zlib\zutil.c !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\zlib\zutil.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - # End Source File # End Group # End Target diff --git a/acconfig.h b/acconfig.h index e2caadfc..05781277 100644 --- a/acconfig.h +++ b/acconfig.h @@ -141,6 +141,9 @@ /* Define if your struct stat has st_rdev. */ #undef HAVE_ST_RDEV +/* Define if you have the stdint.h include. */ +#undef HAVE_STDINT_H + /* Define if you have the strftime function. */ #undef HAVE_STRFTIME diff --git a/configure.in b/configure.in index 4f955310..bf4b516c 100644 --- a/configure.in +++ b/configure.in @@ -267,8 +267,12 @@ AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" ) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS( \ - fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \ - sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h ) + fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \ + sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h ) + +if test "x$ac_cv_header_stdint_h" = "xyes"; then + AC_DEFINE( HAVE_STDINT_H ) +fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/simgear/config.h.in b/simgear/config.h.in index 5dee430e..4d73832d 100644 --- a/simgear/config.h.in +++ b/simgear/config.h.in @@ -44,6 +44,9 @@ /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT +/* Define if you have the stdint.h include. */ +#undef HAVE_STDINT_H + /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF @@ -128,6 +131,9 @@ /* Define if you have the header file. */ #undef HAVE_MEMORY_H +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + /* Define if you have the header file. */ #undef HAVE_STDLIB_H diff --git a/simgear/magvar/coremag.cxx b/simgear/magvar/coremag.cxx index b29634a2..cccf753a 100644 --- a/simgear/magvar/coremag.cxx +++ b/simgear/magvar/coremag.cxx @@ -70,12 +70,11 @@ #include #include +#include #include "coremag.hxx" -#define max(a,b) (((a) > (b)) ? (a) : (b)) - static const double pi = 3.14159265358979; static const double a = 6378.16; /* major radius (km) IAU66 ellipsoid */ static const double f = 1.0 / 298.25; /* inverse flattening IAU66 ellipsoid */ @@ -243,7 +242,7 @@ double calc_magvar( double lat, double lon, double h, long dat, double* field ) for ( m = 0; m <= nmax; m++ ) { double mm = m*m; - for ( n = max(m + 1, 2); n <= nmax; n++ ) { + for ( n = SG_MAX2(m + 1, 2); n <= nmax; n++ ) { roots[m][n][0] = sqrt((n-1)*(n-1) - mm); roots[m][n][1] = 1.0 / sqrt( n*n - mm); } @@ -261,7 +260,7 @@ double calc_magvar( double lat, double lon, double h, long dat, double* field ) /* lower triangle */ for ( m = 0; m <= nmax; m++ ) { // double mm = m*m; - for ( n = max(m + 1, 2); n <= nmax; n++ ) { + for ( n = SG_MAX2(m + 1, 2); n <= nmax; n++ ) { // double root1 = sqrt((n-1)*(n-1) - mm); // double root2 = 1.0 / sqrt( n*n - mm); P[n][m] = (P[n-1][m] * c * (2.0*n-1) - @@ -387,7 +386,7 @@ double SGMagVarOrig( double lat, double lon, double h, long dat, double* field ) /* lower triangle */ for ( m = 0; m <= nmax; m++ ) { - for ( n = max(m + 1, 2); n <= nmax; n++ ) { + for ( n = SG_MAX2(m + 1, 2); n <= nmax; n++ ) { P[n][m] = (P[n-1][m] * c * (2.0*n-1) - P[n-2][m] * sqrt(1.0*(n-1)*(n-1) - m * m)) / sqrt(1.0* n * n - m * m); diff --git a/simgear/metar/Antoi.cpp b/simgear/metar/Antoi.cpp index 8b471ae5..fabb31c2 100644 --- a/simgear/metar/Antoi.cpp +++ b/simgear/metar/Antoi.cpp @@ -29,14 +29,26 @@ /* in the conversion. */ /* */ /* Output:- An integer corresponding to the value in the character */ -/* array or MAXNEG (-2147483648) if the function is */ +/* array or INT32_MIN (-2147483647-1) if the function is */ /* unable to acquire system storage. */ /* */ /* Modification History: */ /* None */ /* */ /********************************************************************/ - + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_STDINT_H +# include +#endif + +#ifndef INT32_MIN +# define INT32_MIN (-2147483647-1) +#endif + int antoi(char * string, int len) { @@ -55,7 +67,7 @@ int antoi(char * string, int len) tmpstr = (char *)malloc((len+1) * sizeof(char)); - if (tmpstr == NULL) return (-2147483648); + if (tmpstr == NULL) return INT32_MIN; for (i = 0; i < len; i++) tmpstr[i] = string[i]; diff --git a/simgear/metar/Local.h b/simgear/metar/Local.h index 47bec5de..d0e26fae 100644 --- a/simgear/metar/Local.h +++ b/simgear/metar/Local.h @@ -65,13 +65,17 @@ #define IMOD(i, j) (((i) % (j)) < 0 ? ((i) % (j))+(j) : ((i) % (j))) #define IN_RANGE(n, lo, hi) ((lo) <= (n) && (n) <= (hi)) #define LOOPDN(r, n) for ((r) = (n)+1; --(r) > 0;) -#define MAX(x, y) (((x) < (y)) ? (y) : (x)) +#ifndef MAX +# define MAX(x, y) (((x) < (y)) ? (y) : (x)) +#endif #ifndef max -#define max(x, y) (((x) < (y)) ? (y) : (x)) +# define max(x, y) (((x) < (y)) ? (y) : (x)) +#endif +#ifndef MIN +# define MIN(x, y) (((x) < (y)) ? (x) : (y)) #endif -#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #ifndef min -#define min(x, y) (((x) < (y)) ? (x) : (y)) +# define min(x, y) (((x) < (y)) ? (x) : (y)) #endif #define STREQ(s, t) (strcmp(s, t) == 0) #define STRGT(s, t) (strcmp(s, t) > 0) diff --git a/simgear/metar/MetarReport.cpp b/simgear/metar/MetarReport.cpp index a1227e88..2987feea 100644 --- a/simgear/metar/MetarReport.cpp +++ b/simgear/metar/MetarReport.cpp @@ -40,7 +40,7 @@ static int DecodeDirChars( char* c ) if ( c[1] == 'E' ) r = 45; else if ( c[1] == 'W' ) r = 315; } - else if ( r = 180 ) + else if ( r == 180 ) { if ( c[1] == 'E' ) r = 135; else if ( c[1] == 'W' ) r = 225; @@ -216,17 +216,22 @@ int CMetarReport::VerticalVisibility() // Meters int CMetarReport::Ceiling() { - return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Ceiling; + return + (int)(SG_FEET_TO_METER*((Decoded_METAR *)m_DecodedReport)->Ceiling); } int CMetarReport::EstimatedCeiling() { - return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling; + return + (int)(SG_FEET_TO_METER + * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling); } int CMetarReport::VariableSkyLayerHeight() { - return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt; + return + (int)(SG_FEET_TO_METER + * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt); } int CMetarReport::SnowDepthInches() @@ -277,9 +282,9 @@ operator << ( ostream& out, CMetarReport& p ) } -double CMetarReport::AirPressure() +double CMetarReport::AirPressure() { - return ((Decoded_METAR *)m_DecodedReport)->inches_altstng; + return ((Decoded_METAR *)m_DecodedReport)->inches_altstng; } void CMetarReport::dump() @@ -287,12 +292,13 @@ void CMetarReport::dump() prtDMETR( (Decoded_METAR *)m_DecodedReport ); } -double CMetarReport::PrevailVisibility() { +double CMetarReport::PrevailVisibility() +{ //Values from each visibility field converted to meters. double smiles; double km; double meters; - smiles = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbySM * 621 ; + smiles = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbySM * 1609.34; km = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyKM * 1000; meters = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyM; diff --git a/simgear/metar/MetarStation.cpp b/simgear/metar/MetarStation.cpp index b13a3aa8..9000ae5c 100644 --- a/simgear/metar/MetarStation.cpp +++ b/simgear/metar/MetarStation.cpp @@ -81,7 +81,7 @@ CMetarStation::CMetarStation( double ulongitude = decodeDMS( s ); s = t; t = strchr( s, ';' ); *t = 0; t++; double altitude = atoi( s ) * SG_FEET_TO_METER; - m_altitude = altitude; + m_altitude = (int)altitude; s = t; t = strchr( s, ';' ); *t = 0; t++; double ualtitude = atoi( s ) * SG_FEET_TO_METER; Point3D p( longitude, latitude, altitude+SG_EQUATORIAL_RADIUS_M ); @@ -173,7 +173,7 @@ CMetarStation * CMetarStationDB::find( Point3D locationCart ) { std::map::iterator itr; double bestDist = 99999999; - CMetarStation * bestStation; + CMetarStation *bestStation = NULL; Point3D curLocation = locationCart; itr = METAR_Stations.begin(); while(itr != METAR_Stations.end()) diff --git a/simgear/screen/screen-dump.cxx b/simgear/screen/screen-dump.cxx index e986d61b..ebde34ca 100644 --- a/simgear/screen/screen-dump.cxx +++ b/simgear/screen/screen-dump.cxx @@ -38,7 +38,7 @@ #include "screen-dump.hxx" -#define RGB 3 // 3 bytes of color info per pixel +#define RGB3 3 // 3 bytes of color info per pixel #define RGBA 4 // 4 bytes of color+alpha info void my_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int win_height, int mode) @@ -48,7 +48,7 @@ void my_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int FILE *fp; int pixelSize = mode==GL_RGBA?4:3; - ibuffer = (unsigned char *) malloc(win_width*win_height*RGB); + ibuffer = (unsigned char *) malloc(win_width*win_height*RGB3); if ( (fp = fopen(filename, "wb")) == NULL ) { printf("Warning: cannot open %s\n", filename); @@ -60,15 +60,15 @@ void my_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int q = 0; for (i = 0; i < win_height; i++) for (j = 0; j < win_width; j++) - for (k = 0; k < RGB; k++) + for (k = 0; k < RGB3; k++) ibuffer[q++] = (unsigned char) *(buffer + (pixelSize*((win_height-1-i)*win_width+j)+k)); - fwrite(ibuffer, sizeof(unsigned char), RGB*win_width*win_height, fp); + fwrite(ibuffer, sizeof(unsigned char), RGB3*win_width*win_height, fp); fclose(fp); free(ibuffer); printf("wrote file (%d x %d pixels, %d bytes)\n", - win_width, win_height, RGB*win_width*win_height); + win_width, win_height, RGB3*win_width*win_height); } diff --git a/simgear/sky/cloud.cxx b/simgear/sky/cloud.cxx index 78bde43c..31997dd6 100644 --- a/simgear/sky/cloud.cxx +++ b/simgear/sky/cloud.cxx @@ -45,7 +45,7 @@ SGCloudLayer::~SGCloudLayer( void ) { } -// build the moon object +// build the cloud object void SGCloudLayer::build( double s, double asl, double thickness, double transition, ssgSimpleState *state ) { -- 2.39.5