From 0358431624ed1ae0ca52c8ee62f8c89d17e177a9 Mon Sep 17 00:00:00 2001 From: Aleksey Durachenko Date: Wed, 8 Feb 2017 14:47:31 +0700 Subject: [PATCH] correct deinitialize ms_read_msr --- src/miniseedutils.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/miniseedutils.cpp b/src/miniseedutils.cpp index 36de6a0..a1007f6 100644 --- a/src/miniseedutils.cpp +++ b/src/miniseedutils.cpp @@ -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)); } @@ -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"); } @@ -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)); } @@ -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; } } @@ -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) {