diff options
author | Adrian Kummerlaender | 2017-10-06 14:37:53 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-10-06 14:43:00 +0200 |
commit | d951a22faf35aabe526de2588006c9381904b137 (patch) | |
tree | 3d02269647d0d8490f5d105c50c49295d688af72 /src/istream | |
parent | 538236772ce6edde390079c32533c1e70cf8bdca (diff) | |
download | DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.gz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.bz2 DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.lz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.xz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.zst DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.zip |
Provide definition reader primitive
Diffstat (limited to 'src/istream')
-rw-r--r-- | src/istream/buffer.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/istream/buffer.cc b/src/istream/buffer.cc index aaa93ff..26697f4 100644 --- a/src/istream/buffer.cc +++ b/src/istream/buffer.cc @@ -168,27 +168,27 @@ int IstreamBuf::underflow() { // From C++ annotations 8.1.0~pre1, chapter 23. std::streamsize IstreamBuf::xsgetn(char *dest, std::streamsize n) { int nread = 0; - + while ( n ) { if ( !this->in_avail() ) { if ( this->underflow() == EOF ) { break; } } - + int avail = this->in_avail(); - + if (avail > n) { avail = n; } - + std::memcpy(dest + nread, gptr(), avail); this->gbump(avail); - + nread += avail; n -= avail; } - + return nread; } |