diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-18 19:27:23 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-13 17:29:47 +0100 |
commit | 51a338178c8a7d69d3c0affe31941473be9fe367 (patch) | |
tree | 37c785f25c2a4441b34a26a3df2ff1b89d9cf5a2 | |
parent | Move the conversion specification from the member onto the type (diff) | |
download | p2pvr-51a338178c8a7d69d3c0affe31941473be9fe367.tar.bz2 p2pvr-51a338178c8a7d69d3c0affe31941473be9fe367.tar.xz p2pvr-51a338178c8a7d69d3c0affe31941473be9fe367.zip |
Refactor decompress into its own function
-rw-r--r-- | p2pvr/devices/mockTuner.cpp | 9 | ||||
-rw-r--r-- | p2pvr/devices/mockTuner.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/p2pvr/devices/mockTuner.cpp b/p2pvr/devices/mockTuner.cpp index c7c51a7..fa21b9a 100644 --- a/p2pvr/devices/mockTuner.cpp +++ b/p2pvr/devices/mockTuner.cpp @@ -39,7 +39,7 @@ int MockTuner::GetStatus(const Ice::Current&) return 0; } -void MockTuner::DecompressAndSendPackets(const Ice::ByteSeq & dataxz, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) const +Ice::ByteSeq MockTuner::Decompress(const Ice::ByteSeq & dataxz) { Logger()->messagebf(LOG_DEBUG, "%s: setup", __PRETTY_FUNCTION__); lzma_stream strm = LZMA_STREAM_INIT; @@ -62,10 +62,13 @@ void MockTuner::DecompressAndSendPackets(const Ice::ByteSeq & dataxz, const P2PV } } while (strm.avail_out == 0); data.shrink_to_fit(); - + return data; +} +void MockTuner::DecompressAndSendPackets(const Ice::ByteSeq & dataxz, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) const +{ Logger()->messagebf(LOG_DEBUG, "%s: deserialize", __PRETTY_FUNCTION__); std::list<Ice::ByteSeq> packets; - auto istrm = Ice::createInputStream(ice.adapter->getCommunicator(), data); + auto istrm = Ice::createInputStream(ice.adapter->getCommunicator(), Decompress(dataxz)); istrm->read(packets); Logger()->messagebf(LOG_DEBUG, "%s: send", __PRETTY_FUNCTION__); diff --git a/p2pvr/devices/mockTuner.h b/p2pvr/devices/mockTuner.h index 31d12cb..8e0c513 100644 --- a/p2pvr/devices/mockTuner.h +++ b/p2pvr/devices/mockTuner.h @@ -26,6 +26,7 @@ class MockTuner : public P2PVR::PrivateTuner { static void SetEventsSet(int n); protected: + static Ice::ByteSeq Decompress(const Ice::ByteSeq &); void DecompressAndSendPackets(const Ice::ByteSeq &, const P2PVR::RawDataClientPrx &, const Ice::Current&) const; static int eventSet; |