Make wxFile::ReadAll() work for unseekable files too

Calling this function with an unseekable file, such as any file under
/sys on Linux systems, would previously just hang as the loop condition
was never satisfied when length was -1.

Fix this by checking for this case and using a different approach by
extending the buffer we read the data into as we go instead of
preallocating it all at once.

See #9965.
This commit is contained in:
Vadim Zeitlin
2017-12-15 18:34:43 +01:00
parent ebcba7a385
commit a30bee473e
4 changed files with 86 additions and 12 deletions

View File

@@ -377,6 +377,8 @@ public:
/**
Reads the entire contents of the file into a string.
Since wxWidgets 3.1.1 this method also works for unseekable files.
@param str
Non-@NULL pointer to a string to read data into.
@param conv