aboutsummaryrefslogtreecommitdiff
path: root/odb/qt/basic/pgsql/qbyte-array-traits.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-28 09:09:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-28 09:09:52 +0200
commitdfb1e0a293eb73dca115b6cef8edff8e802c9cb7 (patch)
treefd67d72b0077b289bb25d4c2a4a8956b2c6e535a /odb/qt/basic/pgsql/qbyte-array-traits.hxx
parent7100bf740c62df84e25afc60c5f5b8b34c441362 (diff)
Don't use QByteArray replace() overload that was only added in Qt 4.7
The bad thing is that another overload, added in Qt 4.5, was silently used in the 4.5-4.6 versions which predictably did the wrong thing.
Diffstat (limited to 'odb/qt/basic/pgsql/qbyte-array-traits.hxx')
-rw-r--r--odb/qt/basic/pgsql/qbyte-array-traits.hxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/odb/qt/basic/pgsql/qbyte-array-traits.hxx b/odb/qt/basic/pgsql/qbyte-array-traits.hxx
index cf0477e..8491794 100644
--- a/odb/qt/basic/pgsql/qbyte-array-traits.hxx
+++ b/odb/qt/basic/pgsql/qbyte-array-traits.hxx
@@ -36,7 +36,13 @@ namespace odb
if (is_null)
v = QByteArray ();
else
- v.replace (0, v.size (), b.data (), static_cast<int> (n));
+ {
+ // Note that we cannot use replace() here since a suitable
+ // overload was only added in Qt 4.7.
+ //
+ v.resize (static_cast<int> (n));
+ std::memcpy (v.data (), b.data (), n);
+ }
}
static void