summaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Jeremie Guichard <djebrest@gmail.com>2018-04-09 10:09:34 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-09 07:59:51 -0700
commit7753352e6210ae69c2a79bdf2387eaca46becc64 (patch)
tree88c2594af6ff7c87b7923c7b3625653f3b5d7cfe /core/qthelper.cpp
parentf1830cd44e75ac552e09dfd79f6ec9e0d90f8808 (diff)
downloadsubsurface-7753352e6210ae69c2a79bdf2387eaca46becc64.tar.gz
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 <djebrest@gmail.com>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 1cef38184..d63ee3568 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1282,6 +1282,14 @@ QString get_divepoint_gas_string(struct dive *d, const divedatapoint &p)
return get_gas_string(d->cylinder[idx].gasmix);
}
+QString get_taglist_string(struct tag_entry *tag_list)
+{
+ char *buffer = taglist_get_tagstring(tag_list);
+ QString ret = QString::fromUtf8(buffer);
+ free(buffer);
+ return ret;
+}
+
weight_t string_to_weight(const char *str)
{
const char *end;