1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added a missing 'const' to cReceiver::Receive(), to protect the given Data from being modified

This commit is contained in:
Klaus Schmidinger 2015-09-05 11:49:56 +02:00
parent 3cd5294d8a
commit 50d268538e
8 changed files with 23 additions and 21 deletions

View File

@ -8596,7 +8596,7 @@ Video Disk Recorder Revision History
- Bumped all version numbers to 2.2.0. - Bumped all version numbers to 2.2.0.
- Official release. - Official release.
2015-09-01: Version 2.3.1 2015-09-05: Version 2.3.1
- The new function cOsd::MaxPixmapSize() can be called to determine the maximum size - The new function cOsd::MaxPixmapSize() can be called to determine the maximum size
a cPixmap may have on the current OSD. The 'osddemo' example has been modified a cPixmap may have on the current OSD. The 'osddemo' example has been modified
@ -8782,3 +8782,5 @@ Video Disk Recorder Revision History
connections to trigger fetching remote timers. connections to trigger fetching remote timers.
- You can now set DumpSVDRPDataTransfer in svdrp.c to true to have all SVDRP - You can now set DumpSVDRPDataTransfer in svdrp.c to true to have all SVDRP
communication printed to the console for debugging. communication printed to the console for debugging.
- Added a missing 'const' to cReceiver::Receive(), to protect the given Data from
being modified.

14
ci.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: ci.c 4.1 2015/07/18 09:57:42 kls Exp $ * $Id: ci.c 4.2 2015/09/05 11:45:19 kls Exp $
*/ */
#include "ci.h" #include "ci.h"
@ -125,8 +125,8 @@ protected:
public: public:
cCaPidReceiver(void); cCaPidReceiver(void);
virtual ~cCaPidReceiver() { Detach(); } virtual ~cCaPidReceiver() { Detach(); }
virtual void Receive(uchar *Data, int Length); virtual void Receive(const uchar *Data, int Length);
bool HasCaPids(void) { return NumPids() - emmPids.Size() - 1 > 0; } bool HasCaPids(void) const { return NumPids() - emmPids.Size() - 1 > 0; }
void Reset(void) { DelEmmPids(); catVersion = -1; } void Reset(void) { DelEmmPids(); catVersion = -1; }
}; };
@ -160,10 +160,10 @@ void cCaPidReceiver::Activate(bool On)
catVersion = -1; // can be done independent of 'On' catVersion = -1; // can be done independent of 'On'
} }
void cCaPidReceiver::Receive(uchar *Data, int Length) void cCaPidReceiver::Receive(const uchar *Data, int Length)
{ {
if (TsPid(Data) == CATPID) { if (TsPid(Data) == CATPID) {
uchar *p = NULL; const uchar *p = NULL;
if (TsPayloadStart(Data)) { if (TsPayloadStart(Data)) {
if (Data[5] == SI::TableIdCAT) { if (Data[5] == SI::TableIdCAT) {
length = (int(Data[6] & 0x03) << 8) | Data[7]; // section length length = (int(Data[6] & 0x03) << 8) | Data[7]; // section length
@ -251,7 +251,7 @@ private:
time_t lastScrambledTime; time_t lastScrambledTime;
int numTsPackets; int numTsPackets;
protected: protected:
virtual void Receive(uchar *Data, int Length); virtual void Receive(const uchar *Data, int Length);
public: public:
cCaActivationReceiver(const cChannel *Channel, cCamSlot *CamSlot); cCaActivationReceiver(const cChannel *Channel, cCamSlot *CamSlot);
virtual ~cCaActivationReceiver(); virtual ~cCaActivationReceiver();
@ -270,7 +270,7 @@ cCaActivationReceiver::~cCaActivationReceiver()
Detach(); Detach();
} }
void cCaActivationReceiver::Receive(uchar *Data, int Length) void cCaActivationReceiver::Receive(const uchar *Data, int Length)
{ {
if (numTsPackets++ % TS_PACKET_FACTOR == 0) { if (numTsPackets++ % TS_PACKET_FACTOR == 0) {
time_t Now = time(NULL); time_t Now = time(NULL);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 4.1 2015/08/29 12:41:08 kls Exp $ * $Id: device.c 4.2 2015/09/05 11:42:17 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -24,7 +24,7 @@
class cLiveSubtitle : public cReceiver { class cLiveSubtitle : public cReceiver {
protected: protected:
virtual void Receive(uchar *Data, int Length); virtual void Receive(const uchar *Data, int Length);
public: public:
cLiveSubtitle(int SPid); cLiveSubtitle(int SPid);
virtual ~cLiveSubtitle(); virtual ~cLiveSubtitle();
@ -40,7 +40,7 @@ cLiveSubtitle::~cLiveSubtitle()
cReceiver::Detach(); cReceiver::Detach();
} }
void cLiveSubtitle::Receive(uchar *Data, int Length) void cLiveSubtitle::Receive(const uchar *Data, int Length)
{ {
if (cDevice::PrimaryDevice()) if (cDevice::PrimaryDevice())
cDevice::PrimaryDevice()->PlayTs(Data, Length); cDevice::PrimaryDevice()->PlayTs(Data, Length);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: receiver.h 3.3 2015/01/12 14:03:22 kls Exp $ * $Id: receiver.h 4.1 2015/09/05 11:42:47 kls Exp $
*/ */
#ifndef __RECEIVER_H #ifndef __RECEIVER_H
@ -31,7 +31,7 @@ protected:
///< (On == true) and right after it gets detached from (On == false) a cDevice. It can be used ///< (On == true) and right after it gets detached from (On == false) a cDevice. It can be used
///< to do things like starting/stopping a thread. ///< to do things like starting/stopping a thread.
///< It is guaranteed that Receive() will not be called before Activate(true). ///< It is guaranteed that Receive() will not be called before Activate(true).
virtual void Receive(uchar *Data, int Length) = 0; virtual void Receive(const uchar *Data, int Length) = 0;
///< This function is called from the cDevice we are attached to, and ///< This function is called from the cDevice we are attached to, and
///< delivers one TS packet from the set of PIDs the cReceiver has requested. ///< delivers one TS packet from the set of PIDs the cReceiver has requested.
///< The data packet must be accepted immediately, and the call must return ///< The data packet must be accepted immediately, and the call must return

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recorder.c 4.1 2015/08/03 10:23:35 kls Exp $ * $Id: recorder.c 4.2 2015/09/05 11:43:51 kls Exp $
*/ */
#include "recorder.h" #include "recorder.h"
@ -106,7 +106,7 @@ void cRecorder::Activate(bool On)
Cancel(3); Cancel(3);
} }
void cRecorder::Receive(uchar *Data, int Length) void cRecorder::Receive(const uchar *Data, int Length)
{ {
if (Running()) { if (Running()) {
int p = ringBuffer->Put(Data, Length); int p = ringBuffer->Put(Data, Length);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recorder.h 3.1 2015/01/15 14:27:02 kls Exp $ * $Id: recorder.h 4.1 2015/09/05 11:46:23 kls Exp $
*/ */
#ifndef __RECORDER_H #ifndef __RECORDER_H
@ -35,7 +35,7 @@ protected:
///< member of the cReceiver class) from your own destructor in order ///< member of the cReceiver class) from your own destructor in order
///< to properly get a call to Activate(false) when your object is ///< to properly get a call to Activate(false) when your object is
///< destroyed. ///< destroyed.
virtual void Receive(uchar *Data, int Length); virtual void Receive(const uchar *Data, int Length);
virtual void Action(void); virtual void Action(void);
public: public:
cRecorder(const char *FileName, const cChannel *Channel, int Priority); cRecorder(const char *FileName, const cChannel *Channel, int Priority);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: transfer.c 3.1 2013/08/22 12:33:02 kls Exp $ * $Id: transfer.c 4.1 2015/09/05 11:43:58 kls Exp $
*/ */
#include "transfer.h" #include "transfer.h"
@ -38,7 +38,7 @@ void cTransfer::Activate(bool On)
#define MAXRETRIES 20 // max. number of retries for a single TS packet #define MAXRETRIES 20 // max. number of retries for a single TS packet
#define RETRYWAIT 5 // time (in ms) between two retries #define RETRYWAIT 5 // time (in ms) between two retries
void cTransfer::Receive(uchar *Data, int Length) void cTransfer::Receive(const uchar *Data, int Length)
{ {
if (cPlayer::IsAttached()) { if (cPlayer::IsAttached()) {
// Transfer Mode means "live tv", so there's no point in doing any additional // Transfer Mode means "live tv", so there's no point in doing any additional

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: transfer.h 2.4 2013/03/01 09:49:46 kls Exp $ * $Id: transfer.h 4.1 2015/09/05 11:43:08 kls Exp $
*/ */
#ifndef __TRANSFER_H #ifndef __TRANSFER_H
@ -19,7 +19,7 @@ private:
cPatPmtGenerator patPmtGenerator; cPatPmtGenerator patPmtGenerator;
protected: protected:
virtual void Activate(bool On); virtual void Activate(bool On);
virtual void Receive(uchar *Data, int Length); virtual void Receive(const uchar *Data, int Length);
public: public:
cTransfer(const cChannel *Channel); cTransfer(const cChannel *Channel);
virtual ~cTransfer(); virtual ~cTransfer();