diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 117a1b26f..379e75b75 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -186,18 +186,15 @@ const int MAXPRNGAL = 36; //!< max satellite PRN numbe const int NSATGAL = (MAXPRNGAL - MINPRNGAL + 1); //!< number of Galileo satellites const int NSYSGAL = 1; +const int MAXPRNQZS = 199; //!< max satellite PRN number of QZSS +const int MINPRNQZS = 193; //!< min satellite PRN number of QZSS #ifdef ENAQZS -const int MINPRNQZS = 193; //!< min satellite PRN number of QZSS -const int MAXPRNQZS = 199; //!< max satellite PRN number of QZSS const int MINPRNQZS_S = 183; //!< min satellite PRN number of QZSS SAIF const int MAXPRNQZS_S = 189; //!< max satellite PRN number of QZSS SAIF const int NSATQZS = (MAXPRNQZS - MINPRNQZS + 1); //!< number of QZSS satellites const int NSYSQZS = 1; #else -const int MINPRNQZS = 0; -const int MAXPRNQZS = 0; const int MINPRNQZS_S = 0; -const int MAXPRNQZS_S = 0; const int NSATQZS = 0; const int NSYSQZS = 0; #endif @@ -215,26 +212,22 @@ const int NSATBDS = 0; const int NSYSBDS = 0; #endif +const int MINPRNIRN = 1; //!< min satellite sat number of IRNSS +const int MAXPRNIRN = 7; //!< max satellite sat number of IRNSS #ifdef ENAIRN -const int MINPRNIRN = 1; //!< min satellite sat number of IRNSS -const int MAXPRNIRN = 7; //!< max satellite sat number of IRNSS const int NSATIRN = (MAXPRNIRN - MINPRNIRN + 1); //!< number of IRNSS satellites const int NSYSIRN = 1; #else -const int MINPRNIRN = 0; -const int MAXPRNIRN = 0; const int NSATIRN = 0; const int NSYSIRN = 0; #endif +const int MINPRNLEO = 1; //!< min satellite sat number of LEO +const int MAXPRNLEO = 10; //!< max satellite sat number of LEO */ #ifdef ENALEO -const int MINPRNLEO = 1; //!< min satellite sat number of LEO -const int NSATLEO = 10; //!< max satellite sat number of LEO const int NSATLEO = (MAXPRNLEO - MINPRNLEO + 1); //!< number of LEO satellites const int NSYSLEO = 1; #else -const int MINPRNLEO = 0; -const int MAXPRNLEO = 0; const int NSATLEO = 0; const int NSYSLEO = 0; #endif diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 3385d6c92..b5304dcdb 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -274,19 +274,19 @@ int satno(int sys, int prn) } return NSATGPS + NSATGLO + NSATGAL + prn - MINPRNQZS + 1; case SYS_BDS: - if (prn < MINPRNBDS || MAXPRNBDS < prn) + if (MAXPRNBDS < prn) { return 0; } return NSATGPS + NSATGLO + NSATGAL + NSATQZS + prn - MINPRNBDS + 1; case SYS_IRN: - if (prn < MINPRNIRN || MAXPRNIRN < prn) + if (MAXPRNIRN < prn) { return 0; } return NSATGPS + NSATGLO + NSATGAL + NSATQZS + NSATBDS + prn - MINPRNIRN + 1; case SYS_LEO: - if (prn < MINPRNLEO || MAXPRNLEO < prn) + if (MAXPRNLEO < prn) { return 0; } @@ -378,7 +378,7 @@ int satsys(int sat, int *prn) int satid2no(const char *id) { int sys; - int prn = 0; + int prn; char code; if (sscanf(id, "%d", &prn) == 1) @@ -443,6 +443,11 @@ int satid2no(const char *id) default: return 0; } + if (prn <= 0 || prn > MAXSAT) + { + return 0; + } + return satno(sys, prn); }