Fix other QIODevice read functions stopping at null bytes.
This commit is contained in:
parent
7ee30db078
commit
8e43e10f4e
2 changed files with 5 additions and 1 deletions
|
|
@ -2066,7 +2066,7 @@
|
||||||
%out = -1;
|
%out = -1;
|
||||||
} else {
|
} else {
|
||||||
%out = PyString_GET_SIZE((PyObject*)%PYARG_0);
|
%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>
|
</conversion-rule>
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ class MyIODevice (QIODevice):
|
||||||
def readData(self, amount):
|
def readData(self, amount):
|
||||||
return "\0a" * (amount/2)
|
return "\0a" * (amount/2)
|
||||||
|
|
||||||
|
def readLineData(self, maxSize):
|
||||||
|
return "\0b" * 4
|
||||||
|
|
||||||
def atEnd(self):
|
def atEnd(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -15,6 +18,7 @@ class TestBug944 (unittest.TestCase):
|
||||||
device.open(QIODevice.ReadOnly)
|
device.open(QIODevice.ReadOnly)
|
||||||
s = QTextStream(device)
|
s = QTextStream(device)
|
||||||
self.assertEqual(s.read(4), "\0a\0a")
|
self.assertEqual(s.read(4), "\0a\0a")
|
||||||
|
self.assertEqual(device.readLine(), "\0b\0b\0b\0b")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue