Index: trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 2675)
+++ trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 2676)
@@ -126,8 +126,8 @@
         if (_rawFile) {
           _staID_corrections = _rawFile->staID();
-	}
-	else {
+        }
+        else {
           _mode = corrections;
-	}
+        }
       }
     }
@@ -153,6 +153,6 @@
   // -----------------------
   if (newParser) {
+    memset(&parser, 0, sizeof(parser));
     parser.rinex3 = 0;
-    memset(&parser, 0, sizeof(parser));
     double secGPS;
     currentGPSWeeks(parser.GPSWeek, secGPS);
@@ -162,5 +162,6 @@
   // Remaining part decodes the Observations
   // ---------------------------------------
-  if (_mode == unknown || _mode == observations || _checkMountPoint == _staID || _checkMountPoint == "ALL") {
+  if (_mode == unknown || _mode == observations || 
+      _checkMountPoint == _staID || _checkMountPoint == "ALL") {
 
     for (int ii = 0; ii < bufLen; ii++) {
@@ -169,5 +170,5 @@
       if (parser.MessageSize >= parser.NeedBytes) {
 
-        while(int rr = RTCM3Parser(&parser)) {
+        while (int rr = RTCM3Parser(&parser)) {
 
           // RTCMv3 message types
@@ -177,43 +178,40 @@
           // RTCMv3 antenna descriptor
           // -------------------------
-          if(rr == 1007 || rr == 1008 || rr == 1033)
-          {
-            _antType.push_back(parser.antenna); /* correct ? */
+          if (rr == 1007 || rr == 1008 || rr == 1033) {
+            _antType.push_back(parser.antenna);
           }
 
           // RTCMv3 antenna XYZ
           // ------------------
-          else if(rr == 1005)
-          {
-	    _antList.push_back(t_antInfo());
-	    _antList.back().type     = t_antInfo::ARP;
-	    _antList.back().xx       = parser.antX * 1e-4;
-	    _antList.back().yy       = parser.antY * 1e-4;
-	    _antList.back().zz       = parser.antZ * 1e-4;
-	    _antList.back().message  = rr;
-
-	    // Remember station position for 1003 message decoding
-	    _antXYZ[0] = parser.antX * 1e-4;
-	    _antXYZ[1] = parser.antY * 1e-4;
-	    _antXYZ[2] = parser.antZ * 1e-4;
+          else if (rr == 1005) {
+            _antList.push_back(t_antInfo());
+            _antList.back().type     = t_antInfo::ARP;
+            _antList.back().xx       = parser.antX * 1e-4;
+            _antList.back().yy       = parser.antY * 1e-4;
+            _antList.back().zz       = parser.antZ * 1e-4;
+            _antList.back().message  = rr;
+
+            // Remember station position for 1003 message decoding
+            _antXYZ[0] = parser.antX * 1e-4;
+            _antXYZ[1] = parser.antY * 1e-4;
+            _antXYZ[2] = parser.antZ * 1e-4;
           }
 
           // RTCMv3 antenna XYZ-H
           // --------------------
-          else if(rr == 1006)
-          {
-	    _antList.push_back(t_antInfo());
-	    _antList.back().type     = t_antInfo::ARP;
-	    _antList.back().xx       = parser.antX * 1e-4;
-	    _antList.back().yy       = parser.antY * 1e-4;
-	    _antList.back().zz       = parser.antZ * 1e-4;
-	    _antList.back().height   = parser.antH * 1e-4;
-	    _antList.back().height_f = true;
-	    _antList.back().message  = rr;
-
-	    // Remember station position for 1003 message decoding
-	    _antXYZ[0] = parser.antX * 1e-4;
-	    _antXYZ[1] = parser.antY * 1e-4;
-	    _antXYZ[2] = parser.antZ * 1e-4;
+          else if(rr == 1006) {
+            _antList.push_back(t_antInfo());
+            _antList.back().type     = t_antInfo::ARP;
+            _antList.back().xx       = parser.antX * 1e-4;
+            _antList.back().yy       = parser.antY * 1e-4;
+            _antList.back().zz       = parser.antZ * 1e-4;
+            _antList.back().height   = parser.antH * 1e-4;
+            _antList.back().height_f = true;
+            _antList.back().message  = rr;
+
+            // Remember station position for 1003 message decoding
+            _antXYZ[0] = parser.antX * 1e-4;
+            _antXYZ[1] = parser.antY * 1e-4;
+            _antXYZ[2] = parser.antZ * 1e-4;
           }
 
@@ -228,12 +226,8 @@
             }
             
-	    // apply "GPS Integer L1 Pseudorange Modulus Ambiguity"
-	    bool applyModulusAmb = false;
-            ///if (rr == 2) {
-	    ///  applyModulusAmb = true;
-            ///}
-
             if (rr == 2) {
-              emit(newMessage( (_staID + ": No valid RINEX! All values are modulo 299792.458!").toAscii(), true));
+              emit(newMessage( (_staID + 
+               ": No valid RINEX! All values are modulo 299792.458!").toAscii(),
+               true));
             }
             
@@ -269,5 +263,5 @@
                 obs->_o.satSys = 'E';
                 obs->_o.satNum = satID - PRN_GALILEO_START + 1;
-	      }
+              }
 
               // WAAS
@@ -282,6 +276,6 @@
               else if (satID >= PRN_GIOVE_START && satID <= PRN_GIOVE_END) {
                 obs->_o.satSys = 'E';
-		obs->_o.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET;
-	      }
+                obs->_o.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET;
+              }
 
               // Unknown System
@@ -290,5 +284,5 @@
                 delete obs;
                 obs = 0;
-	      }
+              }
 
               if (obs) {
@@ -302,41 +296,6 @@
               obs->_o.GPSWeeks = parser.Data.timeofweek / 1000.0;
 
-	      // Estimate "GPS Integer L1 Pseudorange Modulus Ambiguity"
-	      // -------------------------------------------------------
-	      double modulusAmb = 0;
-	      if (applyModulusAmb) {
-		// Missing antenna coordinates: skip all data
-		if ( !_antXYZ[0] && !_antXYZ[1] && !_antXYZ[2] ) {
-		  continue;
-		}
-		
-		ostringstream prns;
-		prns << obs->_o.satSys << setfill('0') << setw(2) << obs->_o.satNum;
-
-		string prn = prns.str();
-
-		// Missing ephemerides, skip satellite
-		if (_ephList.find(prn) == _ephList.end()) {
-		  continue;
-		}
-		
-		const t_eph* eph = &(_ephList.find(prn)->second);
-		  
-		double rho, xSat, ySat, zSat, clkSat, GPSWeeks_tot;
-		int    GPSWeek_tot;
-		cmpRho(eph, _antXYZ[0], _antXYZ[1], _antXYZ[2], 
-		       obs->_o.GPSWeek, obs->_o.GPSWeeks,
-		       rho, GPSWeek_tot, GPSWeeks_tot,
-		       xSat, ySat, zSat, clkSat);
-
-		const double CC = 299792458.0;
-
-		int nn = static_cast<int>(rho / (CC * 0.001));
-
-		modulusAmb = nn * CC * 0.001;
-	      }
-            
-	      // Loop over all data types
-	      // ------------------------
+              // Loop over all data types
+              // ------------------------
               for (int jj = 0; jj < parser.numdatatypesGPS; jj++) {
                 int v = 0;
@@ -371,22 +330,22 @@
                   // variables df and pos are used consequently. Perlt
                   if      (df & GNSSDF_C1DATA) {
-                    obs->_o.C1 = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.C1 = parser.Data.measdata[ii][pos];
                   }
                   else if (df & GNSSDF_C2DATA) {
-                    obs->_o.C2 = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.C2 = parser.Data.measdata[ii][pos];
                   }
                   else if (df & GNSSDF_P1DATA) {
-                    obs->_o.P1 = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.P1 = parser.Data.measdata[ii][pos];
                   }
                   else if (df & GNSSDF_P2DATA) {
-                    obs->_o.P2 = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.P2 = parser.Data.measdata[ii][pos];
                   }
                   else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
-                    obs->_o.L1            = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.L1            = parser.Data.measdata[ii][pos];
                     obs->_o.SNR1          = parser.Data.snrL1[ii];
                     obs->_o.lock_timei_L1 = parser.lastlockGPSl1[isat];
                   }
                   else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
-                    obs->_o.L2            = parser.Data.measdata[ii][pos] + modulusAmb;
+                    obs->_o.L2            = parser.Data.measdata[ii][pos];
                     obs->_o.SNR2          = parser.Data.snrL2[ii];
                     obs->_o.lock_timei_L2 = parser.lastlockGPSl2[isat];
@@ -407,6 +366,5 @@
           else if (rr == 1019) {
             decoded = true;
-            gpsephemeris* ep = new gpsephemeris(parser.ephemerisGPS);
-            emit newGPSEph(ep);
+            emit newGPSEph(new gpsephemeris(parser.ephemerisGPS));
           }
     
@@ -415,6 +373,5 @@
           else if (rr == 1020) {
             decoded = true;
-            glonassephemeris* ep = new glonassephemeris(parser.ephemerisGLONASS);
-            emit newGlonassEph(ep);
+            emit newGlonassEph(new glonassephemeris(parser.ephemerisGLONASS));
           }
         }
@@ -436,5 +393,5 @@
 
 // Store ephemerides
-////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
 bool RTCM3Decoder::storeEph(const gpsephemeris& gpseph) {
   t_ephGPS eph; eph.set(&gpseph);
