mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Fixed some lint warnings.
This commit is contained in:
parent
74761da04a
commit
30abbc3e80
3
HISTORY
3
HISTORY
@ -95,7 +95,8 @@ VDR Plugin 'iptv' Revision History
|
||||
(Thanks to ua0lnj for reporting this one).
|
||||
- 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.
|
||||
- Fixed a locking bug with section filters.
|
||||
- Fixed some lint warnings.
|
||||
|
2
common.h
2
common.h
@ -41,8 +41,6 @@
|
||||
|
||||
#define SECTION_FILTER_TABLE_SIZE 7
|
||||
|
||||
#define TS_SYNC_BYTE 0x47
|
||||
|
||||
#define ERROR_IF_FUNC(exp, errstr, func, ret) \
|
||||
do { \
|
||||
if (exp) { \
|
||||
|
2
config.c
2
config.c
@ -24,7 +24,7 @@ cIptvConfig::cIptvConfig(void)
|
||||
unsigned int cIptvConfig::GetDisabledFiltersCount(void) const
|
||||
{
|
||||
unsigned int n = 0;
|
||||
while ((disabledFilters[n] != -1) && (n < ARRAY_SIZE(disabledFilters)))
|
||||
while ((n < ARRAY_SIZE(disabledFilters) && (disabledFilters[n] != -1)))
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
cIptvProtocolFile::cIptvProtocolFile()
|
||||
: fileDelay(0),
|
||||
fileStream(NULL),
|
||||
isActive(false)
|
||||
{
|
||||
debug("cIptvProtocolFile::cIptvProtocolFile()\n");
|
||||
|
@ -62,8 +62,7 @@ bool cIptvProtocolHttp::Connect(void)
|
||||
sockAddr.sin_addr.s_addr = inet_addr(*host->h_addr_list);
|
||||
}
|
||||
|
||||
int err = connect(socketDesc, (struct sockaddr*)&sockAddr,
|
||||
sizeof(sockAddr));
|
||||
int err = connect(socketDesc, (struct sockaddr *)&sockAddr, sizeof(sockAddr));
|
||||
// Non-blocking sockets always report in-progress error when connected
|
||||
ERROR_IF_FUNC(err < 0 && errno != EINPROGRESS, "connect()", CloseSocket(), return false);
|
||||
// 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,
|
||||
unsigned int &recvLen)
|
||||
unsigned int &recvLen)
|
||||
{
|
||||
debug("cIptvProtocolHttp::GetHeaderLine()\n");
|
||||
bool linefeed = false;
|
||||
|
@ -20,8 +20,7 @@ private:
|
||||
private:
|
||||
bool Connect(void);
|
||||
bool Disconnect(void);
|
||||
bool GetHeaderLine(char* dest, unsigned int destLen,
|
||||
unsigned int &recvLen);
|
||||
bool GetHeaderLine(char* dest, unsigned int destLen, unsigned int &recvLen);
|
||||
bool ProcessHeaders(void);
|
||||
|
||||
public:
|
||||
|
@ -68,6 +68,7 @@ cIptvSectionFilter::~cIptvSectionFilter()
|
||||
unlink(pipeName);
|
||||
fifoDescriptor = -1;
|
||||
readDescriptor = -1;
|
||||
secbuf = NULL;
|
||||
}
|
||||
|
||||
int cIptvSectionFilter::GetReadDesc(void)
|
||||
@ -91,24 +92,25 @@ int cIptvSectionFilter::Filter(void)
|
||||
uint8_t neq = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
||||
uint8_t local_xor = filter_value[i] ^ secbuf[i];
|
||||
if (maskandmode[i] & local_xor)
|
||||
return 0;
|
||||
neq |= maskandnotmode[i] & local_xor;
|
||||
}
|
||||
if (secbuf) {
|
||||
for (i = 0; i < DMX_MAX_FILTER_SIZE; ++i) {
|
||||
uint8_t local_xor = filter_value[i] ^ secbuf[i];
|
||||
if (maskandmode[i] & local_xor)
|
||||
return 0;
|
||||
neq |= maskandnotmode[i] & local_xor;
|
||||
}
|
||||
|
||||
if (doneq && !neq)
|
||||
return 0;
|
||||
if (doneq && !neq)
|
||||
return 0;
|
||||
|
||||
// There is no data in the fifo, more can be written
|
||||
if (!select_single_desc(fifoDescriptor, 0, false)) {
|
||||
i = write(fifoDescriptor, secbuf, seclen);
|
||||
ERROR_IF(i < 0, "write()");
|
||||
// Update statistics
|
||||
AddSectionStatistic(i, 1);
|
||||
// There is no data in the fifo, more can be written
|
||||
if (!select_single_desc(fifoDescriptor, 0, false)) {
|
||||
i = write(fifoDescriptor, secbuf, seclen);
|
||||
ERROR_IF(i < 0, "write()");
|
||||
// Update statistics
|
||||
AddSectionStatistic(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
setup.c
6
setup.c
@ -433,14 +433,14 @@ void cIptvMenuChannels::Setup(void)
|
||||
|
||||
cChannel *cIptvMenuChannels::GetChannel(int Index)
|
||||
{
|
||||
cIptvMenuChannelItem *p = (cIptvMenuChannelItem *)Get(Index);
|
||||
cIptvMenuChannelItem *p = dynamic_cast<cIptvMenuChannelItem *>(Get(Index));
|
||||
return p ? (cChannel *)p->Channel() : NULL;
|
||||
}
|
||||
|
||||
void cIptvMenuChannels::Propagate(void)
|
||||
{
|
||||
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();
|
||||
Display();
|
||||
Channels.SetModified(true);
|
||||
@ -618,7 +618,7 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys Key)
|
||||
case kYellow: page = IPTV_DEVICE_INFO_FILTERS;
|
||||
UpdateInfo();
|
||||
break;
|
||||
case kBlue: IptvConfig.SetUseBytes(!IptvConfig.GetUseBytes());
|
||||
case kBlue: IptvConfig.SetUseBytes(IptvConfig.GetUseBytes() ? 0 : 1);
|
||||
UpdateInfo();
|
||||
break;
|
||||
default: if (timeout.TimedOut())
|
||||
|
4
socket.c
4
socket.c
@ -109,7 +109,7 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen)
|
||||
socklen_t addrlen = sizeof(sockAddr);
|
||||
int len = 0;
|
||||
// Read data from socket
|
||||
if (isActive)
|
||||
if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
|
||||
len = recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&sockAddr, &addrlen);
|
||||
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);
|
||||
// Read data from socket
|
||||
if (isActive)
|
||||
if (isActive && socketDesc && BufferAddr && (BufferLen > 0))
|
||||
return recvfrom(socketDesc, BufferAddr, BufferLen, MSG_DONTWAIT,
|
||||
(struct sockaddr *)&sockAddr, &addrlen);
|
||||
return 0;
|
||||
|
@ -119,7 +119,7 @@ void cIptvPidStatistics::AddPidStatistic(u_short Pid, long Payload)
|
||||
mostActivePids[numberOfElements - 1].pid = Pid;
|
||||
mostActivePids[numberOfElements - 1].DataAmount = Payload;
|
||||
// Re-sort
|
||||
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
|
||||
qsort(mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ cIptvStreamer::~cIptvStreamer()
|
||||
debug("cIptvStreamer::~cIptvStreamer()\n");
|
||||
// Close the protocol
|
||||
Close();
|
||||
protocol = NULL;
|
||||
// Free allocated memory
|
||||
free(packetBuffer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user