From d1c2d48a6b5f72211e87b702988655c49e7e4a2f Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 21 Mar 2009 00:56:37 +0200 Subject: [PATCH] Fixed remaining lint warnings. --- device.c | 8 ++++---- device.h | 2 +- sectionfilter.h | 12 +----------- setup.c | 10 +++------- sidscanner.h | 4 +++- statistics.c | 8 ++++---- streamer.c | 3 ++- streamer.h | 4 +++- 8 files changed, 21 insertions(+), 30 deletions(-) diff --git a/device.c b/device.c index 5960edb..4dacd58 100644 --- a/device.c +++ b/device.c @@ -10,7 +10,7 @@ #define IPTV_MAX_DEVICES MAXDEVICES -cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL }; +static cIptvDevice * IptvDevices[IPTV_MAX_DEVICES] = { NULL }; unsigned int cIptvDevice::deviceCount = 0; @@ -304,7 +304,7 @@ bool cIptvDevice::DeleteFilter(unsigned int Index) return false; } -bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask) +bool cIptvDevice::IsBlackListed(u_short Pid, u_char Tid, u_char Mask) const { //debug("cIptvDevice::IsBlackListed(%d) Pid=%d Tid=%02X Mask=%02X\n", deviceIndex, Pid, Tid, Mask); // loop through section filter table @@ -366,7 +366,7 @@ bool cIptvDevice::OpenDvr(void) if (pIptvStreamer) pIptvStreamer->Open(); if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) - pSidScanner->SetStatus(true); + pSidScanner->Open(); isOpenDvr = true; return true; } @@ -375,7 +375,7 @@ void cIptvDevice::CloseDvr(void) { debug("cIptvDevice::CloseDvr(%d)\n", deviceIndex); if (sidScanEnabled && pSidScanner && IptvConfig.GetSectionFiltering()) - pSidScanner->SetStatus(false); + pSidScanner->Close(); if (pIptvStreamer) pIptvStreamer->Close(); isOpenDvr = false; diff --git a/device.h b/device.h index 81f6871..ab6a018 100644 --- a/device.h +++ b/device.h @@ -74,7 +74,7 @@ private: void ResetBuffering(void); bool IsBuffering(void); bool DeleteFilter(unsigned int Index); - bool IsBlackListed(u_short Pid, u_char Tid, u_char Mask); + bool IsBlackListed(u_short Pid, u_char Tid, u_char Mask) const; // for channel selection public: diff --git a/sectionfilter.h b/sectionfilter.h index 24c1188..7d505b1 100644 --- a/sectionfilter.h +++ b/sectionfilter.h @@ -15,16 +15,6 @@ class cIptvSectionFilter : public cIptvSectionStatistics { private: - enum dmx_success { - DMX_OK = 0, // Received OK - DMX_LENGTH_ERROR, // Incorrect length - DMX_OVERRUN_ERROR, // Receiver ring buffer overrun - DMX_CRC_ERROR, // Incorrect CRC - DMX_FRAME_ERROR, // Frame alignment error - DMX_FIFO_ERROR, // Receiver FIFO overrun - DMX_MISSED_ERROR // Receiver missed packet - }; - enum dmx_limits { DMX_MAX_FILTER_SIZE = 18, DMX_MAX_SECTION_SIZE = 4096, @@ -69,7 +59,7 @@ public: virtual ~cIptvSectionFilter(); void Process(const uint8_t* Data); int GetReadDesc(void); - uint16_t GetPid(void) { return pid; } + uint16_t GetPid(void) const { return pid; } }; #endif // __IPTV_SECTIONFILTER_H diff --git a/setup.c b/setup.c index bcbbdab..25ba8c4 100644 --- a/setup.c +++ b/setup.c @@ -17,10 +17,6 @@ #include "device.h" #include "setup.h" -#ifndef trVDR -#define trVDR(s) tr(s) -#endif - // --- cIptvMenuEditChannel -------------------------------------------------- class cIptvMenuEditChannel : public cOsdMenu @@ -391,7 +387,7 @@ class cIptvMenuChannels : public cOsdMenu { private: void Setup(void); - cChannel *GetChannel(int Index); + cChannel *GetChannel(int Index) const; void Propagate(void); protected: @@ -431,7 +427,7 @@ void cIptvMenuChannels::Setup(void) Display(); } -cChannel *cIptvMenuChannels::GetChannel(int Index) +cChannel *cIptvMenuChannels::GetChannel(int Index) const { cIptvMenuChannelItem *p = dynamic_cast(Get(Index)); return p ? (cChannel *)p->Channel() : NULL; @@ -712,7 +708,7 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key) case kBlue: return ShowInfo(); case kInfo: if (Current() < help.Size()) return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), help[Current()])); - default: state = osContinue; + default: state = osContinue; break; } } diff --git a/sidscanner.h b/sidscanner.h index b159a24..7cc024a 100644 --- a/sidscanner.h +++ b/sidscanner.h @@ -17,11 +17,13 @@ private: protected: virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); + virtual void SetStatus(bool On); public: cSidScanner(void); - virtual void SetStatus(bool On); void SetChannel(const cChannel *Channel); + void Open() { SetStatus(true); } + void Close() { SetStatus(false); } }; #endif // __SIDSCANNER_H diff --git a/statistics.c b/statistics.c index e743328..0558c1b 100644 --- a/statistics.c +++ b/statistics.c @@ -32,7 +32,7 @@ cString cIptvSectionStatistics::GetSectionStatistic() cMutexLock MutexLock(&mutex); uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ timer.Set(); - long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * filteredData / elapsed) : 0L; + long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * filteredData / elapsed) : 0L; if (!IptvConfig.GetUseBytes()) bitrate *= 8; // no trailing linefeed here! @@ -75,7 +75,7 @@ cString cIptvPidStatistics::GetPidStatistic() cString info("Active pids:\n"); for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) { if (mostActivePids[i].pid) { - long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * mostActivePids[i].DataAmount / elapsed) : 0L; + long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * mostActivePids[i].DataAmount / elapsed) : 0L; if (!IptvConfig.GetUseBytes()) bitrate *= 8; info = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *info, i, @@ -145,7 +145,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic() cMutexLock MutexLock(&mutex); uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ timer.Set(); - long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * dataBytes / elapsed) : 0L; + long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L; if (!IptvConfig.GetUseBytes()) bitrate *= 8; cString info = cString::sprintf("Stream bitrate: %ld k%s/s\n", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit"); @@ -182,7 +182,7 @@ cString cIptvBufferStatistics::GetBufferStatistic() cMutexLock MutexLock(&mutex); uint64_t elapsed = timer.Elapsed(); /* in milliseconds */ timer.Set(); - long bitrate = elapsed ? (long)((float)1000 / KILOBYTE(1) * dataBytes / elapsed) : 0L; + long bitrate = elapsed ? (long)(((float)1000 / KILOBYTE(1)) * dataBytes / elapsed) : 0L; long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize()); float percentage = (float)((float)usedSpace / (float)totalSpace * 100.0); long totalKilos = totalSpace / KILOBYTE(1); diff --git a/streamer.c b/streamer.c index 86d1aef..a556b31 100644 --- a/streamer.c +++ b/streamer.c @@ -21,7 +21,7 @@ cIptvStreamer::cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketL // Allocate packet buffer packetBuffer = MALLOC(unsigned char, packetBufferLen); if (packetBuffer) - memset(packetBuffer, 0, packetBufferLen); + memset(packetBuffer, 0, packetBufferLen); else error("ERROR: MALLOC() failed for packet buffer"); } @@ -32,6 +32,7 @@ cIptvStreamer::~cIptvStreamer() // Close the protocol Close(); protocol = NULL; + ringBuffer = NULL; // Free allocated memory free(packetBuffer); } diff --git a/streamer.h b/streamer.h index 8c53539..cd2b583 100644 --- a/streamer.h +++ b/streamer.h @@ -24,10 +24,12 @@ private: unsigned int packetBufferLen; cIptvProtocolIf* protocol; +protected: + virtual void Action(void); + public: cIptvStreamer(cRingBufferLinear* RingBuffer, unsigned int PacketLen); virtual ~cIptvStreamer(); - virtual void Action(void); bool Set(const char* Location, const int Parameter, const int Index, cIptvProtocolIf* Protocol); bool Open(void); bool Close(void);