more precise using PIIODevice::reading_now flag, Warning! one should use it manually now

small enum fix for pip_cmg
This commit is contained in:
2022-10-27 20:58:43 +03:00
parent 609ff8e9c8
commit e46cfdc4bd
11 changed files with 51 additions and 18 deletions

View File

@@ -270,9 +270,7 @@ void PIIODevice::stop() {
ssize_t PIIODevice::read(void * read_to, ssize_t max_size) {
reading_now = true;
ssize_t ret = readDevice(read_to, max_size);
reading_now = false;
return ret;
}
@@ -285,9 +283,7 @@ ssize_t PIIODevice::read(PIMemoryBlock mb) {
PIByteArray PIIODevice::read(ssize_t max_size) {
if (max_size <= 0) return PIByteArray();
buffer_in.resize(max_size);
reading_now = true;
ssize_t ret = readDevice(buffer_in.data(), max_size);
reading_now = false;
if (ret < 0) return PIByteArray();
return buffer_in.resized(ret);
}