diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-04-12 15:54:33 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:09 -0300 |
commit | 958394f5ec5dc38f12314db07222fb6f598bcd42 (patch) | |
tree | 799c1aa723465a25981ca7a347ee62ea2ba135fb /PySide | |
parent | c2c04ddd5107f0743441c9cf77c481254d168aae (diff) |
Fix code injection of QIODevice to support returning an error.
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index cdaf97cbc..6aaded3af 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1846,11 +1846,15 @@ <remove-argument /> </modify-argument> <modify-argument index="return"> - <replace-type modified-type="QByteArray"/> + <replace-type modified-type="PyObject"/> <conversion-rule class="native"> - const QByteArray ba(%CONVERTTOCPP[QByteArray](%PYARG_0)); - memcpy(%1, ba.data(), ba.size()); - long long %out = ba.size(); + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } </conversion-rule> </modify-argument> </modify-function> @@ -1865,11 +1869,15 @@ <remove-argument /> </modify-argument> <modify-argument index="return"> - <replace-type modified-type="QByteArray"/> + <replace-type modified-type="PyObject"/> <conversion-rule class="native"> - const QByteArray ba(%CONVERTTOCPP[QByteArray](%PYARG_0)); - memcpy(data, ba.data(), ba.size()); - long long %out = ba.size(); + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } </conversion-rule> </modify-argument> </modify-function> |