summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtCore/typesystem_core.xml26
-rw-r--r--tests/QtCore/qdatastream_test.py12
2 files changed, 35 insertions, 3 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 22c6be3..6da4f64 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -2222,10 +2222,30 @@
</inject-code>
</add-function>
- <modify-function signature="readRawData(char*,int)" remove="all"/>
+ <modify-function signature="readRawData(char*,int)">
+ <modify-argument index="1">
+ <remove-argument />
+ </modify-argument>
+ <inject-code class="target">
+ QByteArray data;
+ data.resize(%2);
+ %CPPSELF.%FUNCTION_NAME(data.data(), data.size());
+ %PYARG_0 = PyString_FromStringAndSize(data.constData(), data.size());
+ </inject-code>
+ </modify-function>
+ <!-- deprecated method -->
<modify-function signature="readBytes(char*&amp;,uint&amp;)" remove="all"/>
- <modify-function signature="writeRawData(const char*,int)" remove="all"/>
- <modify-function signature="writeBytes(const char*,uint)" remove="all"/>
+ <modify-function signature="writeRawData(const char*,int)">
+ <modify-argument index="2">
+ <remove-argument />
+ </modify-argument>
+ <inject-code class="target">
+ int r = %CPPSELF.%FUNCTION_NAME(%1, PyString_Size(%PYARG_1));
+ %PYARG_0 = %CONVERTTOPYTHON[int](r);
+ </inject-code>
+ </modify-function>
+ <!-- deprecated method -->
+ <modify-function signature="writeBytes(const char*,uint)" remove="all" />
<!-- Extra functions for primitive type handling -->
diff --git a/tests/QtCore/qdatastream_test.py b/tests/QtCore/qdatastream_test.py
index b634a7e..1a75f79 100644
--- a/tests/QtCore/qdatastream_test.py
+++ b/tests/QtCore/qdatastream_test.py
@@ -308,6 +308,18 @@ class QDataStreamShiftBitArray(unittest.TestCase):
self._check_bitarray(data)
+class QDataStreamShiftBitArray(unittest.TestCase):
+ def testRawData(self):
+ data = QDataStream()
+ self.assertEqual(data.readRawData(4), '\x00\x00\x00\x00')
+
+ ba = QByteArray()
+ data = QDataStream(ba, QIODevice.WriteOnly)
+ data.writeRawData('ABC')
+ self.assertEqual(ba, 'ABC')
+
+ data = QDataStream(ba)
+ self.assertEqual(data.readRawData(4), 'ABC\x00')
if __name__ == '__main__':
unittest.main()