Index: trunk/rtcm3torinex/rtcm3torinex.c
===================================================================
--- trunk/rtcm3torinex/rtcm3torinex.c	(revision 743)
+++ trunk/rtcm3torinex/rtcm3torinex.c	(revision 744)
@@ -1,6 +1,6 @@
 /*
   Converter for RTCM3 data to RINEX.
-  $Id: rtcm3torinex.c,v 1.25 2007/10/25 09:37:42 stoecker Exp $
-  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@alberding.eu>
+  $Id: rtcm3torinex.c,v 1.26 2007/12/20 10:42:10 stoecker Exp $
+  Copyright (C) 2005-2008 by Dirk Stöcker <stoecker@alberding.eu>
 
   This software is a complete NTRIP-RTCM3 to RINEX converter as well as
@@ -51,5 +51,5 @@
 
 /* CVS revision and version */
-static char revisionstr[] = "$Revision: 1.25 $";
+static char revisionstr[] = "$Revision: 1.26 $";
 
 #ifndef COMPILEDATE
@@ -110,5 +110,5 @@
   if(e-m < 3)
     handle->NeedBytes = 3;
-  
+
   /* copy buffer to front */
   i = m - handle->Message;
@@ -182,5 +182,5 @@
   int year;
   int taicount;
-}; 
+};
 static const int months[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
 static const struct leapseconds leap[] = {
@@ -459,13 +459,9 @@
           }
           GETBITS(l1range, 24);
-          if((l1range&((1<<24)-1)) != 0x80000)
-          {
-            gnss->dataflags[num] |= c;
-            gnss->measdata[num][ce] = l1range*0.02;
-          }
           GETBITSSIGN(i, 20);
           if((i&((1<<20)-1)) != 0x80000)
           {
-            gnss->dataflags[num] |= l;
+            gnss->dataflags[num] |= (c|l);
+            gnss->measdata[num][ce] = l1range*0.02;
             gnss->measdata[num][le] = l1range*0.02+i*0.0005;
           }
@@ -622,13 +618,12 @@
           }
           GETBITS(l1range, 25)
-          if((l1range&((1<<25)-1)) != 0x80000)
-          {
-            gnss->dataflags[num] |= c;
-            gnss->measdata[num][ce] = l1range*0.02;
-          }
           GETBITSSIGN(i, 20)
           if((i&((1<<20)-1)) != 0x80000)
           {
-            gnss->dataflags[num] |= l;
+            /* Handle this like GPS. Actually for GLONASS L1 range is always
+               valid. To be on the save side, we handle it as invalid like we
+               do for GPS and also remove range in case of 0x80000. */
+            gnss->dataflags[num] |= (c|l);
+            gnss->measdata[num][ce] = l1range*0.02;
             gnss->measdata[num][le] = l1range*0.02+i*0.0005;
           }
@@ -898,5 +893,5 @@
   "         .0000         .0000         .0000                  "
   "ANTENNA: DELTA H/E/N";
-  
+
   hdata.data.named.wavelength = Parser->rinex3 ? 0 :
   "     1     1                                                "
@@ -1536,5 +1531,5 @@
 
 #ifndef NO_RTCM3_MAIN
-static char datestr[]     = "$Date: 2007/10/25 09:37:42 $";
+static char datestr[]     = "$Date: 2007/12/20 10:42:10 $";
 
 /* The string, which is send as agent in HTTP request */
@@ -2097,5 +2092,5 @@
       {
         if(numbytes >= 17 && !strncmp(buf, "RTSP/1.0 200 OK\r\n", 17))
-	{
+        {
           int serverport = 0, session = 0;
           const char *portcheck = "server_port=";
@@ -2333,5 +2328,5 @@
             if(numbytes > 17 && (!strncmp(buf, "HTTP/1.1 200 OK\r\n", 17)
             || !strncmp(buf, "HTTP/1.0 200 OK\r\n", 17)))
-	    {
+            {
               const char *datacheck = "Content-Type: gnss/data\r\n";
               const char *chunkycheck = "Transfer-Encoding: chunked\r\n";
