diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2018-02-11 22:41:06 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-02-11 20:40:23 -0800 |
commit | 08c4a287a4b607306e67ed54d16def7a07c6988b (patch) | |
tree | 24dc6475d6bdd769a41d8ba46ef2bca6de33ee40 | |
parent | 1f80e100bbe54e3ab185f3107debad69f6aceb08 (diff) | |
download | subsurface-08c4a287a4b607306e67ed54d16def7a07c6988b.tar.gz |
smtk-import: Fix error management issue
In commits eccd4b993 to 8f81a22e7 global error buffer and get_error_string()
func, were moved to a call back function.
This patch makes smtk2ssrf suport those changes and build again.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
-rw-r--r-- | smtk-import/smrtk2ssrfc_window.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/smtk-import/smrtk2ssrfc_window.cpp b/smtk-import/smrtk2ssrfc_window.cpp index 15f736a7d..fffa170dc 100644 --- a/smtk-import/smrtk2ssrfc_window.cpp +++ b/smtk-import/smrtk2ssrfc_window.cpp @@ -11,6 +11,14 @@ QStringList inputFiles; QString outputFile; +QString error_buf; + +extern "C" void getErrorFromC(char *buf) +{ + QString error(buf); + free(buf); + error_buf = error; +} Smrtk2ssrfcWindow::Smrtk2ssrfcWindow(QWidget *parent) : QMainWindow(parent), @@ -76,11 +84,12 @@ void Smrtk2ssrfcWindow::on_importButton_clicked() ui->plainTextEdit->setDisabled(false); ui->progressBar->setRange(0, inputFiles.size()); + set_error_cb(&getErrorFromC); for (int i = 0; i < inputFiles.size(); ++i) { ui->progressBar->setValue(i); fileNamePtr = QFile::encodeName(inputFiles.at(i)); smartrak_import(fileNamePtr.data(), &dive_table); - ui->plainTextEdit->appendPlainText(QString(get_error_string())); + ui->plainTextEdit->appendPlainText(error_buf); } ui->progressBar->setValue(inputFiles.size()); save_dives_logic(outputFile.toUtf8().data(), false); |