mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
better fix for irix istream
This commit is contained in:
parent
6ed0fe3017
commit
8d7a27547f
@ -148,7 +148,7 @@ read_prc(istream &in) {
|
|||||||
|
|
||||||
in.read(buffer, buffer_size);
|
in.read(buffer, buffer_size);
|
||||||
size_t count = in.gcount();
|
size_t count = in.gcount();
|
||||||
while (count != 0 && !in.fail() && !in.eof()) {
|
while (count != 0) {
|
||||||
char *buffer_end = buffer + count;
|
char *buffer_end = buffer + count;
|
||||||
|
|
||||||
// Look for the first line in the buffer..
|
// Look for the first line in the buffer..
|
||||||
@ -178,8 +178,16 @@ read_prc(istream &in) {
|
|||||||
prev_line = string(start, length);
|
prev_line = string(start, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
in.read(buffer, buffer_size);
|
if (in.fail() || in.eof()) {
|
||||||
count = in.gcount();
|
// If we got a failure reading the buffer last time, don't keep
|
||||||
|
// reading again. Irix seems to require this test; otherwise,
|
||||||
|
// it repeatedly returns the same text at the end of the file.
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
in.read(buffer, buffer_size);
|
||||||
|
count = in.gcount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prev_line.empty()) {
|
if (!prev_line.empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user