PIIODevice::bytesAvailible()

fix pistringlist pibinarystream write
pibinarystream::binaryStreamSize()
PIByteArray pibinarystream read with more size fix
pistring pibinarystream read optimization
fix bug in PIIOBinaryStream read and write if failed
workaround in PIIOString::readDevice
PISPI readDevice bug Fixed
This commit is contained in:
Бычков Андрей
2022-07-27 15:43:04 +03:00
parent d13e68c206
commit 3873f0b03b
50 changed files with 323 additions and 253 deletions

View File

@@ -56,9 +56,9 @@ bool PIIOString::open(const PIString & string) {
PIString PIIOString::readLine() {
if (!canRead() || !str) return PIString();
int np = pos;
while (++np < str->size_s())
if ((*str)[np] == '\n')
break;
while (++np < str->size_s()) {
if ((*str)[np] == '\n') break;
}
PIString ret = str->mid(pos, np - pos);
pos = piMini(np + 1, str->size_s());
return ret;
@@ -66,7 +66,7 @@ PIString PIIOString::readLine() {
int PIIOString::readDevice(void * read_to, int max_size) {
if (!canRead() || !str) return -1;
if (!canRead() || !str || max_size <= 0) return -1;
PIString rs = str->mid(pos, max_size);
pos += max_size;
if (pos > str->size_s()) pos = str->size_s();