aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-01-29 16:42:48 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 14:42:08 +0200
commit4aba19e287b0105bb47777762ce14b3786d91019 (patch)
tree3ac8984f8b31dfebc3dffde057eb9f23af3d559c /common
parent717c07b9671badeef0c18c91cf17fe9747559787 (diff)
downloadtigervnc-4aba19e287b0105bb47777762ce14b3786d91019.tar.gz
tigervnc-4aba19e287b0105bb47777762ce14b3786d91019.zip
Avoid reader/writer duplication in every encoder/decoder
Diffstat (limited to 'common')
-rw-r--r--common/rfb/Decoder.cxx4
-rw-r--r--common/rfb/Decoder.h3
-rw-r--r--common/rfb/Encoder.cxx5
-rw-r--r--common/rfb/Encoder.h4
-rw-r--r--common/rfb/HextileDecoder.cxx2
-rw-r--r--common/rfb/HextileDecoder.h2
-rw-r--r--common/rfb/HextileEncoder.cxx2
-rw-r--r--common/rfb/HextileEncoder.h2
-rw-r--r--common/rfb/RREDecoder.cxx2
-rw-r--r--common/rfb/RREDecoder.h2
-rw-r--r--common/rfb/RREEncoder.cxx2
-rw-r--r--common/rfb/RREEncoder.h1
-rw-r--r--common/rfb/RawDecoder.cxx2
-rw-r--r--common/rfb/RawDecoder.h2
-rw-r--r--common/rfb/RawEncoder.cxx2
-rw-r--r--common/rfb/RawEncoder.h2
-rw-r--r--common/rfb/TightDecoder.cxx2
-rw-r--r--common/rfb/TightDecoder.h1
-rw-r--r--common/rfb/TightEncoder.cxx2
-rw-r--r--common/rfb/TightEncoder.h1
-rw-r--r--common/rfb/ZRLEDecoder.cxx2
-rw-r--r--common/rfb/ZRLEDecoder.h1
-rw-r--r--common/rfb/ZRLEEncoder.cxx4
-rw-r--r--common/rfb/ZRLEEncoder.h1
24 files changed, 27 insertions, 26 deletions
diff --git a/common/rfb/Decoder.cxx b/common/rfb/Decoder.cxx
index e201821f..9982c932 100644
--- a/common/rfb/Decoder.cxx
+++ b/common/rfb/Decoder.cxx
@@ -27,6 +27,10 @@
using namespace rfb;
+Decoder::Decoder(CMsgReader* reader_) : reader(reader_)
+{
+}
+
Decoder::~Decoder()
{
}
diff --git a/common/rfb/Decoder.h b/common/rfb/Decoder.h
index 025d63f5..842491fb 100644
--- a/common/rfb/Decoder.h
+++ b/common/rfb/Decoder.h
@@ -27,11 +27,14 @@ namespace rfb {
class Decoder {
public:
+ Decoder(CMsgReader* reader);
virtual ~Decoder();
virtual void readRect(const Rect& r, CMsgHandler* handler)=0;
static bool supported(int encoding);
static Decoder* createDecoder(int encoding, CMsgReader* reader);
+ protected:
+ CMsgReader* reader;
};
}
diff --git a/common/rfb/Encoder.cxx b/common/rfb/Encoder.cxx
index 1733c8ec..6b2321c4 100644
--- a/common/rfb/Encoder.cxx
+++ b/common/rfb/Encoder.cxx
@@ -25,9 +25,14 @@
#include <rfb/HextileEncoder.h>
#include <rfb/ZRLEEncoder.h>
#include <rfb/TightEncoder.h>
+#include <rfb/SMsgWriter.h>
using namespace rfb;
+Encoder::Encoder(SMsgWriter* writer_) : writer(writer_)
+{
+}
+
Encoder::~Encoder()
{
}
diff --git a/common/rfb/Encoder.h b/common/rfb/Encoder.h
index 8712c09a..485b850c 100644
--- a/common/rfb/Encoder.h
+++ b/common/rfb/Encoder.h
@@ -29,6 +29,7 @@ namespace rfb {
class Encoder {
public:
+ Encoder(SMsgWriter* writer);
virtual ~Encoder();
virtual void setCompressLevel(int level) {};
@@ -43,6 +44,9 @@ namespace rfb {
static bool supported(int encoding);
static Encoder* createEncoder(int encoding, SMsgWriter* writer);
+
+ protected:
+ SMsgWriter* writer;
};
}
diff --git a/common/rfb/HextileDecoder.cxx b/common/rfb/HextileDecoder.cxx
index ae612676..04ef956b 100644
--- a/common/rfb/HextileDecoder.cxx
+++ b/common/rfb/HextileDecoder.cxx
@@ -34,7 +34,7 @@ using namespace rfb;
#include <rfb/hextileDecode.h>
#undef BPP
-HextileDecoder::HextileDecoder(CMsgReader* reader_) : reader(reader_)
+HextileDecoder::HextileDecoder(CMsgReader* reader) : Decoder(reader)
{
}
diff --git a/common/rfb/HextileDecoder.h b/common/rfb/HextileDecoder.h
index 95a7f8a4..287b49d5 100644
--- a/common/rfb/HextileDecoder.h
+++ b/common/rfb/HextileDecoder.h
@@ -27,8 +27,6 @@ namespace rfb {
HextileDecoder(CMsgReader* reader);
virtual ~HextileDecoder();
virtual void readRect(const Rect& r, CMsgHandler* handler);
- private:
- CMsgReader* reader;
};
}
#endif
diff --git a/common/rfb/HextileEncoder.cxx b/common/rfb/HextileEncoder.cxx
index 19fb1a3e..c31e608c 100644
--- a/common/rfb/HextileEncoder.cxx
+++ b/common/rfb/HextileEncoder.cxx
@@ -45,7 +45,7 @@ BoolParameter improvedHextile("ImprovedHextile",
#include <rfb/hextileEncodeBetter.h>
#undef BPP
-HextileEncoder::HextileEncoder(SMsgWriter* writer_) : writer(writer_)
+HextileEncoder::HextileEncoder(SMsgWriter* writer_) : Encoder(writer_)
{
}
diff --git a/common/rfb/HextileEncoder.h b/common/rfb/HextileEncoder.h
index 5540c642..705cbc6f 100644
--- a/common/rfb/HextileEncoder.h
+++ b/common/rfb/HextileEncoder.h
@@ -27,8 +27,6 @@ namespace rfb {
HextileEncoder(SMsgWriter* writer);
virtual ~HextileEncoder();
virtual void writeRect(const Rect& r, TransImageGetter* ig);
- private:
- SMsgWriter* writer;
};
}
#endif
diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx
index b81a4a82..97d7a71d 100644
--- a/common/rfb/RREDecoder.cxx
+++ b/common/rfb/RREDecoder.cxx
@@ -34,7 +34,7 @@ using namespace rfb;
#include <rfb/rreDecode.h>
#undef BPP
-RREDecoder::RREDecoder(CMsgReader* reader_) : reader(reader_)
+RREDecoder::RREDecoder(CMsgReader* reader) : Decoder(reader)
{
}
diff --git a/common/rfb/RREDecoder.h b/common/rfb/RREDecoder.h
index 98abf982..bee634fb 100644
--- a/common/rfb/RREDecoder.h
+++ b/common/rfb/RREDecoder.h
@@ -27,8 +27,6 @@ namespace rfb {
RREDecoder(CMsgReader* reader);
virtual ~RREDecoder();
virtual void readRect(const Rect& r, CMsgHandler* handler);
- private:
- CMsgReader* reader;
};
}
#endif
diff --git a/common/rfb/RREEncoder.cxx b/common/rfb/RREEncoder.cxx
index 09702cf7..b37b7588 100644
--- a/common/rfb/RREEncoder.cxx
+++ b/common/rfb/RREEncoder.cxx
@@ -33,7 +33,7 @@ using namespace rfb;
#include <rfb/rreEncode.h>
#undef BPP
-RREEncoder::RREEncoder(SMsgWriter* writer_) : writer(writer_)
+RREEncoder::RREEncoder(SMsgWriter* writer) : Encoder(writer)
{
}
diff --git a/common/rfb/RREEncoder.h b/common/rfb/RREEncoder.h
index 4b990f5b..c5e65569 100644
--- a/common/rfb/RREEncoder.h
+++ b/common/rfb/RREEncoder.h
@@ -29,7 +29,6 @@ namespace rfb {
virtual ~RREEncoder();
virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
- SMsgWriter* writer;
rdr::MemOutStream mos;
};
}
diff --git a/common/rfb/RawDecoder.cxx b/common/rfb/RawDecoder.cxx
index 5fd3b7c1..eab92e53 100644
--- a/common/rfb/RawDecoder.cxx
+++ b/common/rfb/RawDecoder.cxx
@@ -22,7 +22,7 @@
using namespace rfb;
-RawDecoder::RawDecoder(CMsgReader* reader_) : reader(reader_)
+RawDecoder::RawDecoder(CMsgReader* reader) : Decoder(reader)
{
}
diff --git a/common/rfb/RawDecoder.h b/common/rfb/RawDecoder.h
index e09cca2d..9d0dc300 100644
--- a/common/rfb/RawDecoder.h
+++ b/common/rfb/RawDecoder.h
@@ -27,8 +27,6 @@ namespace rfb {
RawDecoder(CMsgReader* reader);
virtual ~RawDecoder();
virtual void readRect(const Rect& r, CMsgHandler* handler);
- private:
- CMsgReader* reader;
};
}
#endif
diff --git a/common/rfb/RawEncoder.cxx b/common/rfb/RawEncoder.cxx
index b4e38dbf..2fc5741c 100644
--- a/common/rfb/RawEncoder.cxx
+++ b/common/rfb/RawEncoder.cxx
@@ -23,7 +23,7 @@
using namespace rfb;
-RawEncoder::RawEncoder(SMsgWriter* writer_) : writer(writer_)
+RawEncoder::RawEncoder(SMsgWriter* writer) : Encoder(writer)
{
}
diff --git a/common/rfb/RawEncoder.h b/common/rfb/RawEncoder.h
index 628f32fd..42d38508 100644
--- a/common/rfb/RawEncoder.h
+++ b/common/rfb/RawEncoder.h
@@ -27,8 +27,6 @@ namespace rfb {
RawEncoder(SMsgWriter* writer);
virtual ~RawEncoder();
virtual void writeRect(const Rect& r, TransImageGetter* ig);
- private:
- SMsgWriter* writer;
};
}
#endif
diff --git a/common/rfb/TightDecoder.cxx b/common/rfb/TightDecoder.cxx
index d4ee877f..83e84f70 100644
--- a/common/rfb/TightDecoder.cxx
+++ b/common/rfb/TightDecoder.cxx
@@ -37,7 +37,7 @@ using namespace rfb;
#include <rfb/tightDecode.h>
#undef BPP
-TightDecoder::TightDecoder(CMsgReader* reader_) : reader(reader_)
+TightDecoder::TightDecoder(CMsgReader* reader) : Decoder(reader)
{
}
diff --git a/common/rfb/TightDecoder.h b/common/rfb/TightDecoder.h
index 8200d2b8..0b915f92 100644
--- a/common/rfb/TightDecoder.h
+++ b/common/rfb/TightDecoder.h
@@ -54,7 +54,6 @@ namespace rfb {
void directFillRect16(const Rect& r, Pixel pix);
void directFillRect32(const Rect& r, Pixel pix);
- CMsgReader* reader;
CMsgHandler* handler;
rdr::InStream* is;
rdr::ZlibInStream zis[4];
diff --git a/common/rfb/TightEncoder.cxx b/common/rfb/TightEncoder.cxx
index f4633f88..622dc3d4 100644
--- a/common/rfb/TightEncoder.cxx
+++ b/common/rfb/TightEncoder.cxx
@@ -93,7 +93,7 @@ const int TightEncoder::defaultCompressLevel = 2;
#include <rfb/tightEncode.h>
#undef BPP
-TightEncoder::TightEncoder(SMsgWriter* writer_) : writer(writer_)
+TightEncoder::TightEncoder(SMsgWriter* writer) : Encoder(writer)
{
setCompressLevel(defaultCompressLevel);
setQualityLevel(-1);
diff --git a/common/rfb/TightEncoder.h b/common/rfb/TightEncoder.h
index a499783d..e2fa96e8 100644
--- a/common/rfb/TightEncoder.h
+++ b/common/rfb/TightEncoder.h
@@ -142,7 +142,6 @@ namespace rfb {
void encodeJpegRect32(rdr::U32 *buf, int stride, const Rect& r,
rdr::OutStream *os);
- SMsgWriter* writer;
rdr::MemOutStream mos;
rdr::ZlibOutStream zos[4];
JpegCompressor jc;
diff --git a/common/rfb/ZRLEDecoder.cxx b/common/rfb/ZRLEDecoder.cxx
index 111e2de6..20fe853c 100644
--- a/common/rfb/ZRLEDecoder.cxx
+++ b/common/rfb/ZRLEDecoder.cxx
@@ -40,7 +40,7 @@ using namespace rfb;
#undef CPIXEL
#undef BPP
-ZRLEDecoder::ZRLEDecoder(CMsgReader* reader_) : reader(reader_)
+ZRLEDecoder::ZRLEDecoder(CMsgReader* reader) : Decoder(reader)
{
}
diff --git a/common/rfb/ZRLEDecoder.h b/common/rfb/ZRLEDecoder.h
index 2128ab91..dee20685 100644
--- a/common/rfb/ZRLEDecoder.h
+++ b/common/rfb/ZRLEDecoder.h
@@ -29,7 +29,6 @@ namespace rfb {
virtual ~ZRLEDecoder();
virtual void readRect(const Rect& r, CMsgHandler* handler);
private:
- CMsgReader* reader;
rdr::ZlibInStream zis;
};
}
diff --git a/common/rfb/ZRLEEncoder.cxx b/common/rfb/ZRLEEncoder.cxx
index 7e00fad2..df7cfbdb 100644
--- a/common/rfb/ZRLEEncoder.cxx
+++ b/common/rfb/ZRLEEncoder.cxx
@@ -46,8 +46,8 @@ IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1);
#undef CPIXEL
#undef BPP
-ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer_)
- : writer(writer_), zos(0,0,zlibLevel), mos(129*1024)
+ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer)
+ : Encoder(writer), zos(0,0,zlibLevel), mos(129*1024)
{
}
diff --git a/common/rfb/ZRLEEncoder.h b/common/rfb/ZRLEEncoder.h
index acc6d362..9679887a 100644
--- a/common/rfb/ZRLEEncoder.h
+++ b/common/rfb/ZRLEEncoder.h
@@ -30,7 +30,6 @@ namespace rfb {
virtual ~ZRLEEncoder();
virtual void writeRect(const Rect& r, TransImageGetter* ig);
private:
- SMsgWriter* writer;
rdr::ZlibOutStream zos;
rdr::MemOutStream mos;
};