1
0
mirror of synced 2025-04-21 22:25:55 +03:00

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) { inline bool read_content_without_length(Stream &strm, std::string &out) {
char buf[BUFSIZ];
for (;;) { for (;;) {
char byte; auto n = strm.read(buf, BUFSIZ);
auto n = strm.read(&byte, 1);
if (n < 0) { if (n < 0) {
return false; return false;
} else if (n == 0) { } else if (n == 0) {
return true; return true;
} }
out += byte; out.append(buf, n);
} }
return true; return true;