aboutsummaryrefslogtreecommitdiff
path: root/web/apache/stream
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-05-04 21:22:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-05-04 21:22:14 +0200
commit63229f465aaea8dd5553814535220817319a64f5 (patch)
tree326ce5cbf4afd118b34ad74d8698a30a23860a42 /web/apache/stream
parent73eb44142be85f964a32be00e8ce655f61063d08 (diff)
Cleanup the code
Diffstat (limited to 'web/apache/stream')
-rw-r--r--web/apache/stream23
1 files changed, 10 insertions, 13 deletions
diff --git a/web/apache/stream b/web/apache/stream
index 5f76347..2aa674d 100644
--- a/web/apache/stream
+++ b/web/apache/stream
@@ -9,7 +9,7 @@
#include <httpd/http_protocol.h>
#include <ios> // streamsize
-#include <memory> // unique_ptr
+#include <vector>
#include <cstring> // memmove()
#include <streambuf>
#include <algorithm> // min(), max()
@@ -52,7 +52,7 @@ namespace web
{
ws_.set_write_state ();
- char chr = c;
+ char chr (c);
// Throwing allows to distinguish comm failure from other IO error
// conditions.
@@ -89,7 +89,6 @@ namespace web
}
private:
-
request_rec* rec_;
write_state& ws_;
};
@@ -105,17 +104,17 @@ namespace web
ws_ (ws),
bufsize_ (std::max (bufsize, (size_t)1)),
putback_ (std::min (putback, bufsize_ - 1)),
- buf_ (new char[bufsize_])
+ buf_ (bufsize_)
{
if (ws_.get_write_state ())
{
throw sequence_error ("::web::apache::istreambuf::istreambuf");
}
- char* p = buf_.get () + putback_;
+ char* p (buf_.data () + putback_);
setg (p, p, p);
- int status = ap_setup_client_block (rec_, REQUEST_CHUNKED_DECHUNK);
+ int status (ap_setup_client_block (rec_, REQUEST_CHUNKED_DECHUNK));
if (status != OK)
{
@@ -135,11 +134,11 @@ namespace web
if (gptr () < egptr ())
return traits_type::to_int_type (*gptr ());
- size_t pb = std::min ((size_t)(gptr () - eback ()), putback_);
- std::memmove (buf_.get () + putback_ - pb, gptr () - pb, pb);
+ size_t pb (std::min ((size_t)(gptr () - eback ()), putback_));
+ std::memmove (buf_.data () + putback_ - pb, gptr () - pb, pb);
- char* p = buf_.get () + putback_;
- int rb = ap_get_client_block (rec_, p, bufsize_ - putback_);
+ char* p (buf_.data () + putback_);
+ int rb (ap_get_client_block (rec_, p, bufsize_ - putback_));
if (rb == 0)
{
@@ -156,14 +155,12 @@ namespace web
}
private:
-
request_rec* rec_;
write_state& ws_;
size_t bufsize_;
size_t putback_;
- std::unique_ptr<char[]> buf_;
+ std::vector<char> buf_;
};
-
}
}