Improved performance of read_content_without_length
This commit is contained in:
parent
2aa35d5f53
commit
bde3fd9f78
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user