diff --git a/include/pcp.h b/include/pcp.h index fb0d6c6..8b16eae 100644 --- a/include/pcp.h +++ b/include/pcp.h @@ -8,7 +8,6 @@ extern "C" { #include "pcp/config.h" #include "pcp/base85.h" #include "pcp/buffer.h" -#include "pcp/config.h" #include "pcp/crypto.h" #include "pcp/defines.h" #include "pcp/digital_crc32.h" diff --git a/libpcp/pcpstream.c b/libpcp/pcpstream.c index f09ed58..44b1508 100644 --- a/libpcp/pcpstream.c +++ b/libpcp/pcpstream.c @@ -110,7 +110,7 @@ size_t ps_read_raw(Pcpstream *stream, void *buf, size_t readbytes) { size_t ps_read_cached(Pcpstream *stream, void *buf, size_t readbytes) { if(buffer_left(stream->cache) <= readbytes && buffer_left(stream->cache) > 0 && readbytes <= stream->blocksize) { /* enough left in current cache */ - return buffer_get_chunk(stream->cache, buf, readbytes); + return buffer_get_chunk(stream->cache, buf, buffer_left(stream->cache)); } else { /* request for chunk larger than what we've got in the cache */