summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-11 14:04:06 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-11 14:16:46 -0200
commit7013bd760e1ad46b31c019e0a11df504d6e2563e (patch)
tree133d4942b58deeaae1fcb2057604e72763d75c51
parent2a4ee1675dd798d5a50363fb073e6801d45a8d17 (diff)
downloadpyside-7013bd760e1ad46b31c019e0a11df504d6e2563e.tar.gz
pyside-7013bd760e1ad46b31c019e0a11df504d6e2563e.tar.xz
pyside-7013bd760e1ad46b31c019e0a11df504d6e2563e.zip
Fix bug#455 - "QByteArray.data() cuts data to first '\x00' char"
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtCore/typesystem_core.xml6
-rw-r--r--tests/QtCore/qbytearray_test.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index f521607..e542ea6 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1437,6 +1437,12 @@
#endif
</inject-code>
+ <modify-function signature="data()const">
+ <inject-code class="target" position="beginning">
+ %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size());
+ </inject-code>
+ </modify-function>
+
<!-- removed functions -->
<modify-function signature="begin()" remove="all"/>
<modify-function signature="begin()const" remove="all"/>
diff --git a/tests/QtCore/qbytearray_test.py b/tests/QtCore/qbytearray_test.py
index 1c425b8..2c0ee87 100644
--- a/tests/QtCore/qbytearray_test.py
+++ b/tests/QtCore/qbytearray_test.py
@@ -42,6 +42,12 @@ class QByteArrayData(unittest.TestCase):
url = QByteArray("http://web.openbossa.org/")
self.assertEqual(url.data(), "http://web.openbossa.org/")
+ def testDataWithZeros(self):
+ s1 = "123\000321"
+ ba = QByteArray(s1)
+ s2 = ba.data()
+ self.assertEqual(s1, s2)
+
class QByteArrayOperatorAtSetter(unittest.TestCase):
'''Test case for operator QByteArray[] - __setitem__'''