From 7e4501b3af82360eb1415f3d5745f1b0c278f504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Fri, 13 Sep 2019 17:17:22 +0800 Subject: rt_ticketlist struct with flexible array members Manage to get tickets info to the app --- librtclient | 2 +- worker.cxx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/librtclient b/librtclient index a752649..2e207d0 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit a7526494614abd16a8871b665704e2bda05440b4 +Subproject commit 2e207d07a6416d7ccb32040c3f9e43c3a48aeed2 diff --git a/worker.cxx b/worker.cxx index d5d3197..e21ef6b 100644 --- a/worker.cxx +++ b/worker.cxx @@ -1,3 +1,6 @@ +#ifdef DEBUG +#include +#endif // DEBUG #include "rtclient.h" #include "worker.hxx" @@ -19,7 +22,18 @@ void Worker::search(QString const& owner) QString query{"Owner='"}; query.append(owner); query.append("'"); - rtclient_search(query.toLatin1().constData()); + rt_ticketlist *tasks = NULL; + rtclient_search(&tasks, query.toLatin1().constData()); + if (tasks) { +#ifdef DEBUG + for (unsigned short i = 0; i < tasks->length; i++) { + auto task = tasks->tickets[i]; + qDebug() << "Task: " << task; + if (task) free(task); + } +#endif // DEBUG + free(tasks); + } } Worker::~Worker() -- cgit v1.2.3