| 148 | } |
| 149 | |
| 150 | ifhbuf::int_type ifhbuf::underflow () |
| 151 | { |
| 152 | if (gptr() >= egptr()) { // A true underflow (no bytes in buffer left to read) |
| 153 | |
| 154 | // Move the putback_size most-recently-read characters into the putback area |
| 155 | size_t nputback = std::min<size_t>(gptr() - eback(), putback_size); |
| 156 | std::memmove(buffer + (putback_size - nputback), gptr() - nputback, nputback); |
| 157 | |
| 158 | // Now read new characters from the file descriptor |
| 159 | const size_t nread = read_fun(handle, buffer + putback_size, buffer_size); |
| 160 | if (nread == 0) { |
| 161 | // EOF |
| 162 | return traits_type::eof(); |
| 163 | } |
| 164 | |
| 165 | // Reset the buffer |
| 166 | reset_buffer(nputback, nread); |
| 167 | } |
| 168 | |
| 169 | // Return the next character |
| 170 | return traits_type::to_int_type(*gptr()); |
| 171 | } |
| 172 | |
| 173 | std::streamsize ifhbuf::xsgetn (char* s, std::streamsize n) |
| 174 | { |
nothing calls this directly
no outgoing calls
no test coverage detected