void append_uint32(string_buffer& buf, uint32_t v) { char *const wp = buf.make_space(64); const int len = snprintf(wp, 64, "%lu", static_cast<unsigned long>(v)); if (len > 0) { buf.space_wrote(len); } }
int hstcpcli::read_more() { const size_t block_size = 4096; // FIXME char *const wp = readbuf.make_space(block_size); const ssize_t rlen = read(fd.get(), wp, block_size); if (rlen <= 0) { if (rlen < 0) { error_str = "read: failed"; } else { error_str = "read: eof"; } return rlen; } readbuf.space_wrote(rlen); return rlen; }
int hstcpcli::read_more() { const size_t block_size = 4096; // FIXME char *const wp = readbuf.make_space(block_size); int rlen; errno = 0; while ((rlen = read(fd.get(), wp, block_size)) <= 0) { errno_buf = errno; if (rlen < 0) { if (errno == EINTR || errno == EAGAIN) { errno = 0; continue; } error_str = String("read: failed", &my_charset_bin); } else { error_str = String("read: eof", &my_charset_bin); } return rlen; } readbuf.space_wrote(rlen); return rlen; }