From 7753352e6210ae69c2a79bdf2387eaca46becc64 Mon Sep 17 00:00:00 2001 From: Jeremie Guichard Date: Mon, 9 Apr 2018 10:09:34 +0200 Subject: Change taglist_get_tagstring to support 'unlimited' tag list size Previous taglist_get_tagstring signature/implementation did not allow handling of cases where inputted buffer could not contain all tags. New implementation allocates buffer based on pre-computed size allowing to insert all tags in the returned string. Added get_taglist_string in qthelper to handle conversion to QString Added TestTagList with tests for taglist_get_tagstring Signed-off-by: Jeremie Guichard --- qt-models/divetripmodel.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'qt-models') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 082d3212e..7df52c94a 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -422,12 +422,7 @@ QString DiveItem::displayWeightWithUnit() const QString DiveItem::displayTags() const { struct dive *dive = get_dive_by_uniq_id(diveId); - if (!dive->tag_list) - return QString(); - - char buf[1024]; - taglist_get_tagstring(dive->tag_list, buf, 1024); - return QString(buf); + return get_taglist_string(dive->tag_list); } int DiveItem::weight() const -- cgit v1.2.3-70-g09d2