Create common base classes for buffered streams

Most streams are backed by a memory buffer. Create common base classes
for this functionality to avoid code duplication.
This commit is contained in:
Pierre Ossman
2020-05-15 20:20:53 +02:00
committed by Lauri Kasanen
parent 7f90205cf2
commit 92c7695981
19 changed files with 414 additions and 398 deletions

View File

@@ -20,7 +20,7 @@
#define __RDR_RANDOMSTREAM_H__
#include <stdio.h>
#include <rdr/InStream.h>
#include <rdr/BufferedInStream.h>
#ifdef WIN32
#include <windows.h>
@@ -32,22 +32,17 @@
namespace rdr {
class RandomStream : public InStream {
class RandomStream : public BufferedInStream {
public:
RandomStream();
virtual ~RandomStream();
size_t pos();
protected:
size_t overrun(size_t itemSize, size_t nItems, bool wait);
private:
virtual bool fillBuffer(size_t maxSize, bool wait);
private:
U8* start;
size_t offset;
static unsigned int seed;
#ifdef RFB_HAVE_WINCRYPT
HCRYPTPROV provider;