debug_logf(4, http_trace, TRACE_JS_DUMP, nullptr,
"tmp buffer[%zu]: %.*s\n", tmp_buf_size, static_cast<int>(tmp_buf_size), tmp_buf);
- in_buf.pubsetbuf(tmp_buf, tmp_buf_size, const_cast<char*>(src), len);
- out_buf.pubsetbuf(dst, dst_len);
+ in_buf.str(tmp_buf, tmp_buf_size, const_cast<char*>(src), len);
+ size_t w_bytes = out.tellp();
JSTokenizer::JSRet ret = static_cast<JSTokenizer::JSRet>(tokenizer.yylex());
+
+ out_buf.sgetn(dst, dst_len);
+
in.clear();
out.clear();
size_t r_bytes = in_buf.glued() ? static_cast<size_t>(in.tellg()) : 0;
- size_t w_bytes = out.tellp();
+ w_bytes = (size_t)out.tellp() - w_bytes;
if (!unlim)
rem_bytes -= r_bytes;
src1(nullptr), len1(0), src2(nullptr), len2(0)
{ }
- std::streambuf* pubsetbuf(char* buf1, std::streamsize buf1_len,
+ std::streambuf* str(char* buf1, std::streamsize buf1_len,
char* buf2, std::streamsize buf2_len)
{
once = !(buf1 && buf1_len);
if (once)
{
- setbuf(buf2, buf2_len);
+ std::stringbuf::str(std::string(buf2, buf2_len));
current_src_len = buf2_len;
}
else
{
- setbuf(buf1, buf1_len);
+ std::stringbuf::str(std::string(buf1, buf1_len));
current_src_len = buf1_len;
}
src1 = buf1;
off += current_src_len;
once = false;
- setbuf(src1, len1);
+ std::stringbuf::str(std::string(src1, len1));
current_src_len = len1;
}
src1, len1, src2, len2);
once = true;
- setbuf(src2, len2);
+ std::stringbuf::str(std::string(src2, len2));
current_src_len = len2;
return sgetc();
}