Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/qtapp/rtknavi_qt/mondlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ void MonitorDialog::setObservations()
//---------------------------------------------------------------------------
void MonitorDialog::showObservations()
{
char tstr[40], id[8], *code;
char tstr[40], id[8];
int i, k, n = 0, nex = ui->cBSelectObservation->currentIndex() ? NEXOBS : 0;
int sys = sys_tbl[ui->cBSelectNavigationSystems->currentIndex()];
int std = ui->cBSelectObservation->currentIndex();
Expand Down Expand Up @@ -1107,7 +1107,7 @@ void MonitorDialog::showObservations()
ui->tWConsole->item(i, j++)->setText(id);
ui->tWConsole->item(i, j++)->setText(QString("(%1)").arg(obs[i].rcv));
for (k = 0; k < NFREQ + nex; k++) {
code = code2obs(obs[i].code[k]);
const char *code = code2obs(obs[i].code[k]);
if (*code) ui->tWConsole->item(i, j++)->setText(code);
else ui->tWConsole->item(i, j++)->setText("-");
}
Expand Down
5 changes: 3 additions & 2 deletions app/qtapp/rtkplot_qt/plotinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ static int _strcmp(const void *str1, const void *str2)
// update observation type pull-down menu --------------------------------------
void Plot::updateObservationType()
{
char *codes[MAXCODE + 1], *obs;
int i, j, n = 0, codeMask[MAXCODE + 1] = { 0 };

trace(3, "updateObservationType\n");
Expand All @@ -393,9 +392,11 @@ void Plot::updateObservationType()
codeMask[observation.data[i].code[j]] = 1;

// count codes
const char *codes[MAXCODE + 1];
for (uint8_t c = 1; c <= MAXCODE; c++) {
if (!codeMask[c]) continue;
if (!*(obs = code2obs(c))) continue;
const char *obs = code2obs(c);
if (!*obs) continue;
codes[n++] = obs;
}
qsort(codes, n, sizeof(char *), _strcmp);
Expand Down
4 changes: 2 additions & 2 deletions app/winapp/rtknavi/mondlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ void __fastcall TMonitorDialog::SetObs(void)
void __fastcall TMonitorDialog::ShowObs(void)
{
AnsiString s;
char tstr[40],id[8],*code;
char tstr[40],id[8];
int i,j,k,n=0,nex=ObsMode?NEXOBS:0,sys=sys_tbl[SelSys->ItemIndex];

obsd_t *obs = static_cast<obsd_t *>(calloc(MAXOBS * 2, sizeof(obsd_t)));
Expand Down Expand Up @@ -1023,7 +1023,7 @@ void __fastcall TMonitorDialog::ShowObs(void)
Tbl->Cells[j++][i+1]=id;
Tbl->Cells[j++][i+1]=s.sprintf("(%d)",obs[i].rcv);
for (k=0;k<NFREQ+nex;k++) {
code=code2obs(obs[i].code[k]);
const char *code=code2obs(obs[i].code[k]);
if (*code) Tbl->Cells[j++][i+1]=s.sprintf("%s",code);
else Tbl->Cells[j++][i+1]="-";
}
Expand Down
5 changes: 3 additions & 2 deletions app/winapp/rtkplot/plotinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ static int _strcmp(const void *str1, const void *str2)
void __fastcall TPlot::UpdateObsType(void)
{
UTF8String s;
char *obs,*codes[MAXCODE+1];
int i,j,n=0,cmask[MAXCODE+1]={0},fmask[10]={0};
const char *obstypes[] = {"L1/LC","L2/E5b","L5/E5a","L6","L7","L8"};

Expand All @@ -342,9 +341,11 @@ void __fastcall TPlot::UpdateObsType(void)
for (i=0;i<Obs.n;i++) for (j=0;j<NFREQ+NEXOBS;j++) {
cmask[Obs.data[i].code[j]]=1;
}
const char *codes[MAXCODE+1];
for (i=1;i<=MAXCODE;i++) {
if (!cmask[i]) continue;
if (!*(obs=code2obs((uint8_t)i))) continue;
const char *obs = code2obs((uint8_t)i);
if (!*obs) continue;
codes[n++]=obs;
}
qsort(codes,n,sizeof(char *),_strcmp);
Expand Down
3 changes: 2 additions & 1 deletion src/convrnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ static void setopt_obstype(const uint8_t *codes, const uint8_t *types, int sys,
rnxopt_t *opt)
{
const char type_str[]="CLDS";
char type[16],*id,ver;
const char *id;
char type[16],ver;
int i,j,k,idx;

trace(3,"setopt_obstype: sys=%d\n",sys);
Expand Down
2 changes: 1 addition & 1 deletion src/rinex.c
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ static void outrnxobsf(FILE *fp, double obs, int lli, int std)
static int obsindex(int rnxver, int sys, const uint8_t *code, const char *tobs,
const char *mask)
{
char *id;
const char *id;
int i;

for (i=0;i<NFREQ+NEXOBS;i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/rtcm3e.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ static int to_satid(int sys, int sat)
static int to_sigid(int sys, uint8_t code)
{
const char **msm_sig;
char *sig;
const char *sig;
int i;

/* signal conversion for undefined signal by rtcm */
Expand Down
24 changes: 12 additions & 12 deletions src/rtkcmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ const char *formatstrs[32]={ /* stream format strings */
NULL
};

static char *obscodes[MAXCODE + 1]={ /* observation code strings */

// Observation code strings.
static const char *obscodes[MAXCODE + 1]={
"" ,"1C","1P","1W","1Y", "1M","1N","1S","1L","1E", /* 0- 9 */
"1A","1B","1X","1Z","2C", "2D","2S","2L","2X","2P", /* 10-19 */
"2W","2Y","2M","2N","5I", "5Q","5X","7I","7Q","7X", /* 20-29 */
Expand Down Expand Up @@ -602,15 +602,15 @@ extern uint8_t obs2code(const char *obs)
* return : obs code string ("1C","1P","1P",...)
* notes : obs codes are based on RINEX 3.04
*-----------------------------------------------------------------------------*/
extern char *code2obs(uint8_t code)
extern const char *code2obs(uint8_t code)
{
if (code<=CODE_NONE||MAXCODE<code) return "";
return obscodes[code];
}
/* GPS obs code to frequency -------------------------------------------------*/
static int code2freq_GPS(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '1': *freq=FREQL1; return 0; /* L1 */
Expand All @@ -622,7 +622,7 @@ static int code2freq_GPS(uint8_t code, double *freq)
/* GLONASS obs code to frequency ---------------------------------------------*/
static int code2freq_GLO(uint8_t code, int fcn, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '1': /* G1 */
Expand All @@ -642,7 +642,7 @@ static int code2freq_GLO(uint8_t code, int fcn, double *freq)
/* Galileo obs code to frequency ---------------------------------------------*/
static int code2freq_GAL(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '1': *freq=FREQL1; return 0; /* E1 */
Expand All @@ -656,7 +656,7 @@ static int code2freq_GAL(uint8_t code, double *freq)
/* QZSS obs code to frequency ------------------------------------------------*/
static int code2freq_QZS(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '1': *freq=FREQL1; return 0; /* L1 */
Expand All @@ -669,7 +669,7 @@ static int code2freq_QZS(uint8_t code, double *freq)
/* SBAS obs code to frequency ------------------------------------------------*/
static int code2freq_SBS(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '1': *freq=FREQL1; return 0; /* L1 */
Expand All @@ -680,7 +680,7 @@ static int code2freq_SBS(uint8_t code, double *freq)
/* BDS obs code to frequency -------------------------------------------------*/
static int code2freq_BDS(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '2': *freq=FREQ1_CMP; return 0; /* B1I */
Expand All @@ -695,7 +695,7 @@ static int code2freq_BDS(uint8_t code, double *freq)
/* NavIC obs code to frequency -----------------------------------------------*/
static int code2freq_IRN(uint8_t code, double *freq)
{
char *obs=code2obs(code);
const char *obs=code2obs(code);

switch (obs[0]) {
case '5': *freq=FREQL5; return 0; /* L5 */
Expand Down Expand Up @@ -813,8 +813,8 @@ extern void setcodepri(int sys, int idx, const char *pri)
*-----------------------------------------------------------------------------*/
extern int getcodepri(int sys, uint8_t code, const char *opt)
{
const char *p,*optstr;
char *obs,str[8]="";
const char *p,*optstr, *obs;
char str[8]="";
int i,j;

switch (sys) {
Expand Down
2 changes: 1 addition & 1 deletion src/rtklib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ EXPORT int satsys (int sat, int *prn);
EXPORT int satid2no(const char *id);
EXPORT void satno2id(int sat, char id[8]);
EXPORT uint8_t obs2code(const char *obs);
EXPORT char *code2obs(uint8_t code);
EXPORT const char *code2obs(uint8_t code);
EXPORT double code2freq(int sys, uint8_t code, int fcn);
EXPORT double sat2freq(int sat, uint8_t code, const nav_t *nav);
EXPORT int code2idx(int sys, uint8_t code);
Expand Down