From 34e7fb123a0d2a04c4baebae8759bbefe1b15267 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 28 Feb 2023 21:04:00 +0100 Subject: [PATCH] Use `pubsetbuf` only with `libstdc++` This usage of the function seems only to work as intended with that standard lib. With `libc++` and the MSVC standard lib the call has no effect. --- model/entrymodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model/entrymodel.cpp b/model/entrymodel.cpp index b7cbc38..a5988a2 100644 --- a/model/entrymodel.cpp +++ b/model/entrymodel.cpp @@ -301,8 +301,11 @@ bool EntryModel::setData(const QModelIndex &index, const QVariant &value, int ro try { stringstream ss(stringstream::in | stringstream::out | stringstream::binary); ss.exceptions(std::stringstream::failbit | std::stringstream::badbit); +#if defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION) ss.rdbuf()->pubsetbuf(array.data(), array.size()); - +#else + ss.write(array.data(), array.size()); +#endif Entry *const newEntry = Entry::parse(ss); const int row = entry->index(); beginRemoveRows(parentIndex, row, row);