]> git.mxchange.org Git - flightgear.git/blobdiff - utils/GPSsmooth/UGear.cxx
Replace the NOAA METAR URL with the new, updated one
[flightgear.git] / utils / GPSsmooth / UGear.cxx
index 2a570e1e9070a9ea8c659463fffc0053f67223d3..604926c19dbd9b917a4a2214d7ab714dac53d205 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
-#endif 
+#endif
 
 #include <iostream>
 #include <cstdio>
@@ -261,8 +261,10 @@ bool UGTrack::load_flight( const string &path ) {
 
     // open the gps file
     file = path; file.append( "gps.dat.gz" );
-    if ( (fgps = gzopen( file.c_str(), "r" )) == NULL ) {
-        printf("Cannot open %s\n", file.c_str());
+    std::string fdata = file.local8BitStr();
+
+    if ( (fgps = gzopen( fdata.c_str(), "r" )) == NULL ) {
+        printf("Cannot open %s\n", fdata.c_str());
         return false;
     }
 
@@ -274,8 +276,9 @@ bool UGTrack::load_flight( const string &path ) {
 
     // open the imu file
     file = path; file.append( "imu.dat.gz" );
-    if ( (fimu = gzopen( file.c_str(), "r" )) == NULL ) {
-        printf("Cannot open %s\n", file.c_str());
+    fdata = file.local8BitStr();
+    if ( (fimu = gzopen( fdata.c_str(), "r" )) == NULL ) {
+        printf("Cannot open %s\n", fdata.c_str());
         return false;
     }
 
@@ -287,8 +290,10 @@ bool UGTrack::load_flight( const string &path ) {
 
     // open the nav file
     file = path; file.append( "nav.dat.gz" );
-    if ( (fnav = gzopen( file.c_str(), "r" )) == NULL ) {
-        printf("Cannot open %s\n", file.c_str());
+    fdata = file.local8BitStr();
+
+    if ( (fnav = gzopen( fdata.c_str(), "r" )) == NULL ) {
+        printf("Cannot open %s\n", fdata.c_str());
         return false;
     }
 
@@ -301,8 +306,10 @@ bool UGTrack::load_flight( const string &path ) {
 
     // open the servo file
     file = path; file.append( "servo.dat.gz" );
-    if ( (fservo = gzopen( file.c_str(), "r" )) == NULL ) {
-        printf("Cannot open %s\n", file.c_str());
+    fdata = file.local8BitStr();
+
+    if ( (fservo = gzopen( fdata.c_str(), "r" )) == NULL ) {
+        printf("Cannot open %s\n", fdata.c_str());
         return false;
     }
 
@@ -314,8 +321,10 @@ bool UGTrack::load_flight( const string &path ) {
 
     // open the health file
     file = path; file.append( "health.dat.gz" );
-    if ( (fhealth = gzopen( file.c_str(), "r" )) == NULL ) {
-        printf("Cannot open %s\n", file.c_str());
+    fdata = file.local8BitStr();
+
+    if ( (fhealth = gzopen( fdata.c_str(), "r" )) == NULL ) {
+        printf("Cannot open %s\n", fdata.c_str());
         return false;
     }
 
@@ -430,7 +439,7 @@ int UGTrack::next_message( SGIOChannel *ch, SGIOChannel *log,
     myread( ch, log, tmpbuf, 2 );
     uint8_t cksum0 = (unsigned char)tmpbuf[0];
     uint8_t cksum1 = (unsigned char)tmpbuf[1];
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
     {
         parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@@ -451,7 +460,6 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
 {
     char tmpbuf[256];
     char savebuf[256];
-    int result = 0;
 
     // cout << "in next_message()" << endl;
 
@@ -460,7 +468,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     // scan for sync characters
     int scan_count = 0;
     uint8_t sync0, sync1;
-    result = serial_read( serial, log, tmpbuf, 2 );
+    serial_read( serial, log, tmpbuf, 2 );
     sync0 = (unsigned char)tmpbuf[0];
     sync1 = (unsigned char)tmpbuf[1];
     while ( (sync0 != START_OF_MSG0 || sync1 != START_OF_MSG1) && !myeof ) {
@@ -493,7 +501,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     uint8_t cksum1 = (unsigned char)tmpbuf[1];
     // cout << "cksum0 = " << (int)cksum0 << " cksum1 = " << (int)cksum1
     //      << endl;
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
     {
         parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@@ -505,7 +513,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     cout << "Check sum failure!" << endl;
     return -1;
 
-    
+
 }