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.
This commit is contained in:
Martchus 2023-02-28 21:04:00 +01:00
parent 140d2e1782
commit 34e7fb123a
1 changed files with 4 additions and 1 deletions

View File

@ -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);