summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-09-01 11:38:14 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-09-01 15:51:02 -0300
commitabadd5078f7ee4257838b321286220fb27cdd17b (patch)
tree326fb15f6eef6a68ace1127b546e4774eb284e34
parent5c39c42bfbc0dcb19f372646c972e4595e301d4f (diff)
downloadpyside-abadd5078f7ee4257838b321286220fb27cdd17b.tar.gz
pyside-abadd5078f7ee4257838b321286220fb27cdd17b.tar.xz
pyside-abadd5078f7ee4257838b321286220fb27cdd17b.zip
Fix other QIODevice read functions stopping at null bytes.
-rw-r--r--PySide/QtCore/typesystem_core.xml2
-rw-r--r--tests/QtCore/bug_994.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 9d40578..55dbd08 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -2074,7 +2074,7 @@
%out = -1;
} else {
%out = PyString_GET_SIZE((PyObject*)%PYARG_0);
- qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1);
+ memcpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out);
}
</conversion-rule>
</modify-argument>
diff --git a/tests/QtCore/bug_994.py b/tests/QtCore/bug_994.py
index 74e352c..5f12a96 100644
--- a/tests/QtCore/bug_994.py
+++ b/tests/QtCore/bug_994.py
@@ -5,6 +5,9 @@ class MyIODevice (QIODevice):
def readData(self, amount):
return "\0a" * (amount/2)
+ def readLineData(self, maxSize):
+ return "\0b" * 4
+
def atEnd(self):
return False
@@ -15,6 +18,7 @@ class TestBug944 (unittest.TestCase):
device.open(QIODevice.ReadOnly)
s = QTextStream(device)
self.assertEqual(s.read(4), "\0a\0a")
+ self.assertEqual(device.readLine(), "\0b\0b\0b\0b")
if __name__ == "__main__":
unittest.main()