fix PIFile::readAll(force = true)
This commit is contained in:
@@ -181,7 +181,7 @@ bool PIFile::openTemporary(PIIODevice::DeviceMode mode) {
|
||||
}
|
||||
#else
|
||||
char template_rc[] = "/tmp/pifile_tmp_XXXXXX";
|
||||
int fd = mkstemp(template_rc);
|
||||
int fd = mkstemp(template_rc);
|
||||
if (fd == -1) return false;
|
||||
::close(fd);
|
||||
tp = template_rc;
|
||||
@@ -256,8 +256,11 @@ PIByteArray PIFile::readAll(bool forceRead) {
|
||||
llong cp = pos();
|
||||
if (forceRead) {
|
||||
seekToBegin();
|
||||
while (!isEnd())
|
||||
a.push_back(readChar());
|
||||
for (;;) {
|
||||
uchar byte = static_cast<uchar>(fgetc(PRIVATE->fd));
|
||||
if (feof(PRIVATE->fd) || ferror(PRIVATE->fd)) break;
|
||||
a.push_back(byte);
|
||||
}
|
||||
seek(cp);
|
||||
return a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user