Fixed some lint warnings.

This commit is contained in:
Rolf Ahrenberg 2009-03-20 17:43:31 +02:00
parent 74761da04a
commit 30abbc3e80
11 changed files with 31 additions and 30 deletions

View File

@ -95,7 +95,8 @@ VDR Plugin 'iptv' Revision History
(Thanks to ua0lnj for reporting this one). (Thanks to ua0lnj for reporting this one).
- Added optional patches to disable CA updates. - Added optional patches to disable CA updates.
2009-xx-xx: Version 0.2.6 2009-03-22: Version 0.2.6
- Added a note about recommended frequencies into README. - Added a note about recommended frequencies into README.
- Fixed a locking bug with section filters. - Fixed a locking bug with section filters.
- Fixed some lint warnings.

View File

@ -41,8 +41,6 @@
#define SECTION_FILTER_TABLE_SIZE 7 #define SECTION_FILTER_TABLE_SIZE 7
#define TS_SYNC_BYTE 0x47
#define ERROR_IF_FUNC(exp, errstr, func, ret) \ #define ERROR_IF_FUNC(exp, errstr, func, ret) \
do { \ do { \
if (exp) { \ if (exp) { \

View File

@ -24,7 +24,7 @@ cIptvConfig::cIptvConfig(void)
unsigned int cIptvConfig::GetDisabledFiltersCount(void) const unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
{ {
unsigned int n = 0; unsigned int n = 0;
while ((disabledFilters[n] != -1) && (n < ARRAY_SIZE(disabledFilters))) while ((n < ARRAY_SIZE(disabledFilters) && (disabledFilters[n] != -1)))
n++; n++;
return n; return n;
} }

View File

@ -16,6 +16,7 @@
cIptvProtocolFile::cIptvProtocolFile() cIptvProtocolFile::cIptvProtocolFile()
: fileDelay(0), : fileDelay(0),
fileStream(NULL),
isActive(false) isActive(false)
{ {
debug("cIptvProtocolFile::cIptvProtocolFile()\n"); debug("cIptvProtocolFile::cIptvProtocolFile()\n");

View File

@ -62,8 +62,7 @@ bool cIptvProtocolHttp::Connect(void)
sockAddr.sin_addr.s_addr = inet_addr(*host->h_addr_list); sockAddr.sin_addr.s_addr = inet_addr(*host->h_addr_list);
} }
int err = connect(socketDesc, (struct sockaddr*)&sockAddr, int err = connect(socketDesc, (struct sockaddr *)&sockAddr, sizeof(sockAddr));
sizeof(sockAddr));
// Non-blocking sockets always report in-progress error when connected // Non-blocking sockets always report in-progress error when connected
ERROR_IF_FUNC(err < 0 && errno != EINPROGRESS, "connect()", CloseSocket(), return false); ERROR_IF_FUNC(err < 0 && errno != EINPROGRESS, "connect()", CloseSocket(), return false);
// Select with 800ms timeout on the socket completion, check if it is writable // Select with 800ms timeout on the socket completion, check if it is writable
@ -123,7 +122,7 @@ bool cIptvProtocolHttp::Disconnect(void)
} }
bool cIptvProtocolHttp::GetHeaderLine(char* dest, unsigned int destLen, bool cIptvProtocolHttp::GetHeaderLine(char* dest, unsigned int destLen,
unsigned int &recvLen) unsigned int &recvLen)
{ {
debug("cIptvProtocolHttp::GetHeaderLine()\n"); debug("cIptvProtocolHttp::GetHeaderLine()\n");
bool linefeed = false; bool linefeed = false;

View File

@ -20,8 +20,7 @@ private:
private: private:
bool Connect(void); bool Connect(void);
bool Disconnect(void); bool Disconnect(void);
bool GetHeaderLine(char* dest, unsigned int destLen, bool GetHeaderLine(char* dest, unsigned int destLen, unsigned int &recvLen);
unsigned int &recvLen);
bool ProcessHeaders(void); bool ProcessHeaders(void);
public: public:

View File

@ -68,6 +68,7 @@ cIptvSectionFilter::~cIptvSectionFilter()
unlink(pipeName); unlink(pipeName);
fifoDescriptor = -1; fifoDescriptor = -1;
readDescriptor = -1; readDescriptor = -1;
secbuf = NULL;
} }
int cIptvSectionFilter::GetReadDesc(void) int cIptvSectionFilter::GetReadDesc(void)
@ -91,24 +92,25 @@ int cIptvSectionFilter::Filter(void)
uint8_t neq = 0; uint8_t neq = 0;
int i; int i;
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) { if (secbuf) {
uint8_t local_xor = filter_value[i] ^ secbuf[i]; for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
if (maskandmode[i] & local_xor) uint8_t local_xor = filter_value[i] ^ secbuf[i];
return 0; if (maskandmode[i] & local_xor)
neq |= maskandnotmode[i] & local_xor; return 0;
} neq |= maskandnotmode[i] & local_xor;
}
if (doneq && !neq) if (doneq && !neq)
return 0; return 0;
// There is no data in the fifo, more can be written // There is no data in the fifo, more can be written
if (!select_single_desc(fifoDescriptor, 0, false)) { if (!select_single_desc(fifoDescriptor, 0, false)) {
i = write(fifoDescriptor, secbuf, seclen); i = write(fifoDescriptor, secbuf, seclen);
ERROR_IF(i < 0, "write()"); ERROR_IF(i < 0, "write()");
// Update statistics // Update statistics
AddSectionStatistic(i, 1); AddSectionStatistic(i, 1);
}
} }
return 0; return 0;
} }

View File

@ -433,14 +433,14 @@ void cIptvMenuChannels::Setup(void)
cChannel *cIptvMenuChannels::GetChannel(int Index) cChannel *cIptvMenuChannels::GetChannel(int Index)
{ {
cIptvMenuChannelItem *p = (cIptvMenuChannelItem *)Get(Index); cIptvMenuChannelItem *p = dynamic_cast<cIptvMenuChannelItem *>(Get(Index));
return p ? (cChannel *)p->Channel() : NULL; return p ? (cChannel *)p->Channel() : NULL;
} }
void cIptvMenuChannels::Propagate(void) void cIptvMenuChannels::Propagate(void)
{ {
Channels.ReNumber(); Channels.ReNumber();
for (cIptvMenuChannelItem *ci = (cIptvMenuChannelItem *)First(); ci; ci = (cIptvMenuChannelItem *)ci->Next()) for (cIptvMenuChannelItem *ci = dynamic_cast<cIptvMenuChannelItem *>(First()); ci; ci = dynamic_cast<cIptvMenuChannelItem *>(ci->Next()))
ci->Set(); ci->Set();
Display(); Display();
Channels.SetModified(true); Channels.SetModified(true);
@ -618,7 +618,7 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys Key)
case kYellow: page = IPTV_DEVICE_INFO_FILTERS; case kYellow: page = IPTV_DEVICE_INFO_FILTERS;
UpdateInfo(); UpdateInfo();
break; break;
case kBlue: IptvConfig.SetUseBytes(!IptvConfig.GetUseBytes()); case kBlue: IptvConfig.SetUseBytes(IptvConfig.GetUseBytes() ? 0 : 1);
UpdateInfo(); UpdateInfo();
break; break;
default: if (timeout.TimedOut()) default: if (timeout.TimedOut())

View File

@ -109,7 +109,7 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
socklen_t addrlen = sizeof(sockAddr); socklen_t addrlen = sizeof(sockAddr);
int len = 0; int len = 0;
// Read data from socket // Read data from socket
if (isActive) if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
len = recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT, len = recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
(struct sockaddr *)&sockAddr, &addrlen); (struct sockaddr *)&sockAddr, &addrlen);
if ((len > 0) && (BufferAddr[0] == TS_SYNC_BYTE)) { if ((len > 0) && (BufferAddr[0] == TS_SYNC_BYTE)) {
@ -173,7 +173,7 @@ int cIptvTcpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
} }
socklen_t addrlen = sizeof(sockAddr); socklen_t addrlen = sizeof(sockAddr);
// Read data from socket // Read data from socket
if (isActive) if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
return recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT, return recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
(struct sockaddr *)&sockAddr, &addrlen); (struct sockaddr *)&sockAddr, &addrlen);
return 0; return 0;

View File

@ -119,7 +119,7 @@ void cIptvPidStatistics::AddPidStatistic(u_short Pid, long Payload)
mostActivePids[numberOfElements - 1].pid = Pid; mostActivePids[numberOfElements - 1].pid = Pid;
mostActivePids[numberOfElements - 1].DataAmount = Payload; mostActivePids[numberOfElements - 1].DataAmount = Payload;
// Re-sort // Re-sort
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids); qsort(mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
} }
} }

View File

@ -31,6 +31,7 @@ cIptvStreamer::~cIptvStreamer()
debug("cIptvStreamer::~cIptvStreamer()\n"); debug("cIptvStreamer::~cIptvStreamer()\n");
// Close the protocol // Close the protocol
Close(); Close();
protocol = NULL;
// Free allocated memory // Free allocated memory
free(packetBuffer); free(packetBuffer);
} }