Skip to content

Commit

Permalink
correct deinitialize ms_read_msr
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyDurachenko committed Feb 8, 2017
1 parent 4f2c270 commit 0358431
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/miniseedutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bool miniseed_validate(const QString &fileName, QString *reason)
MSRecord *msr = NULL;
int retcode = ms_readmsr(&msr, fileName.toLocal8Bit().data(), -1, NULL, NULL, 1, 1, 0);
if (retcode != MS_NOERROR) {
ms_readmsr(&msr, NULL, 0, NULL, NULL, 0, 0, 0);
throw QString(ms_errorstr(retcode));
}

Expand All @@ -33,6 +34,7 @@ bool miniseed_validate(const QString &fileName, QString *reason)
break;
case 'a':
default:
ms_readmsr(&msr, NULL, 0, NULL, NULL, 0, 0, 0);
throw QObject::tr("unsupported miniseed datatype");
}

Expand All @@ -56,6 +58,7 @@ bool miniseed_samplerate(const QString &fileName, double *samplerate, QString *r
MSRecord *msr = NULL;
int retcode = ms_readmsr(&msr, fileName.toLocal8Bit().data(), -1, NULL, NULL, 1, 1, 0);
if (retcode != MS_NOERROR) {
ms_readmsr(&msr, NULL, 0, NULL, NULL, 0, 0, 0);
throw QString(ms_errorstr(retcode));
}

Expand Down Expand Up @@ -96,7 +99,8 @@ qint64 miniseed_samplecount(const QString &fileName, QString *reason)
break;
case 'a':
default:
throw QObject::tr("unsupported miniseed datatype");
// skip unsupported sampletype
break;
}
}

Expand Down Expand Up @@ -214,7 +218,8 @@ bool miniseed_to_datasamples_skip_gap(const QString &fileName,
}

if (msr->sampletype == 'a') {
throw QObject::tr("unsupported miniseed datatype");
// skip unsupported sampletype
continue;
}
else if (msr->sampletype == 'i') {
for (qint64 i = 0; i < msr->numsamples && sampleIndex < samplecnt; ++i) {
Expand Down

0 comments on commit 0358431

Please sign in to comment.