Improved performance of read_content_without_length

This commit is contained in:
yhirose 2019-06-29 20:25:16 -04:00
parent 2aa35d5f53
commit bde3fd9f78

View file

@ -896,15 +896,15 @@ inline void skip_content_with_length(Stream &strm, size_t len) {
}
inline bool read_content_without_length(Stream &strm, std::string &out) {
char buf[BUFSIZ];
for (;;) {
char byte;
auto n = strm.read(&byte, 1);
auto n = strm.read(buf, BUFSIZ);
if (n < 0) {
return false;
} else if (n == 0) {
return true;
}
out += byte;
out.append(buf, n);
}
return true;