From 4b0d6a48a6270dded2881294edf6f2adb712055f Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Fri, 16 Aug 2024 05:43:50 +1000 Subject: [PATCH] convrnx: reinitialize the raw state between passes --- src/convrnx.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/convrnx.c b/src/convrnx.c index 61b901677..3ad29c202 100644 --- a/src/convrnx.c +++ b/src/convrnx.c @@ -1312,6 +1312,36 @@ static int convrnx_s(int sess, int format, rnxopt_t *opt, const char *file, /* open stream file */ if (!open_strfile(str,epath[i])) continue; + // Reinitialize the input state. + if (str->format == STRFMT_RTCM2 || str->format == STRFMT_RTCM3) { + free_rtcm(&str->rtcm); + if (!init_rtcm(&str->rtcm)) { + showmsg("init rtcm error"); + for (int i = 0; i < MAXEXFILE; i++) free(epath[i]); + free_strfile(str); + return 0; + } + strcpy(str->rtcm.opt, opt->rcvopt); + } else if (str->format <= MAXRCVFMT) { + free_raw(&str->raw); + if (!init_raw(&str->raw, str->format)) { + showmsg("reinit raw error"); + for (int i = 0; i < MAXEXFILE; i++) free(epath[i]); + free_strfile(str); + return 0; + } + strcpy(str->raw.opt, opt->rcvopt); + } else if (format == STRFMT_RINEX) { + free_rnxctr(&str->rnx); + if (!init_rnxctr(&str->rnx)) { + showmsg("reinit rnx error"); + for (int i = 0; i < MAXEXFILE; i++) free(epath[i]); + free_strfile(str); + return 0; + } + strcpy(str->rnx.opt, opt->rcvopt); + } + /* input message */ for (j=0;(type=input_strfile(str))>=-1;j++) {