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

Several code modifications to avoid compiler warnings

This commit is contained in:
Klaus Schmidinger 2009-12-06 12:57:45 +01:00
parent 1b973fd8eb
commit 6a208294be
37 changed files with 166 additions and 90 deletions

View File

@ -2459,6 +2459,7 @@ Michael Nork <mnork0@gmx.net>
Winfried Köhler <w_koehl@gmx.de>
for fixing wrong value for TableIdBAT in libsi/si.h
for making several code modifications to avoid compiler warnings
Igor M. Liplianin <liplianin@tut.by>
for a patch that was used to convert VDR to the S2API driver API

View File

@ -6197,7 +6197,7 @@ Video Disk Recorder Revision History
- Fixed the default value for "Pause key handling" in the MANUAL (reported by
Diego Pierotto).
2009-12-05: Version 1.7.11
2009-12-06: Version 1.7.11
- Fixed resetting the file size when regenerating the index file.
- The new function cDevice::PatPmtParser() can be used in derived devices to access
@ -6209,3 +6209,4 @@ Video Disk Recorder Revision History
- The 'sky' plugin is no longer part of the VDR source.
- Improved SPU handling on devices with limited OSD capabilities (thanks to
Matthieu Castet).
- Several code modifications to avoid compiler warnings (thanks to Winfried Köhler).

View File

@ -63,6 +63,10 @@ VDR Plugin 'hello' Revision History
- Updated the Croatian language texts (thanks to Adrian Caval).
2008-009-06 Version 0.2.3
2008-09-06: Version 0.2.3
- Updated the Turkish language texts (thanks to Oktay Yolgeçen).
2009-12-06: Version 0.2.4
- Several code modifications to avoid compiler warnings (thanks to Winfried Köhler).

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: hello.c 2.1 2008/09/06 14:30:00 kls Exp $
* $Id: hello.c 2.2 2009/12/06 12:30:15 kls Exp $
*/
#include <getopt.h>
@ -12,7 +12,7 @@
#include <vdr/interface.h>
#include <vdr/plugin.h>
static const char *VERSION = "0.2.3";
static const char *VERSION = "0.2.4";
static const char *DESCRIPTION = trNOOP("A friendly greeting");
static const char *MAINMENUENTRY = trNOOP("Hello");
@ -96,7 +96,7 @@ bool cPluginHello::ProcessArgs(int argc, char *argv[])
static struct option long_options[] = {
{ "aaa", required_argument, NULL, 'a' },
{ "bbb", no_argument, NULL, 'b' },
{ NULL }
{ NULL, no_argument, NULL, 0 }
};
int c;

View File

@ -33,3 +33,7 @@ VDR Plugin 'pictures' Revision History
2008-03-14: Version 0.0.7
- Added Russian translations (thanks to Alexander Gross).
2009-12-06: Version 0.0.8
- Several code modifications to avoid compiler warnings (thanks to Winfried Köhler).

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: pictures.c 1.7 2008/03/14 12:57:19 kls Exp $
* $Id: pictures.c 2.1 2009/12/06 12:30:21 kls Exp $
*/
#include <getopt.h>
@ -11,7 +11,7 @@
#include "menu.h"
#include "player.h"
static const char *VERSION = "0.0.7";
static const char *VERSION = "0.0.8";
static const char *DESCRIPTION = trNOOP("A simple picture viewer");
static const char *MAINMENUENTRY = trNOOP("Pictures");
@ -82,7 +82,7 @@ bool cPluginPictures::ProcessArgs(int argc, char *argv[])
// Implement command line argument processing here if applicable.
static struct option long_options[] = {
{ "dir", required_argument, NULL, 'd' },
{ NULL }
{ NULL, no_argument, NULL, 0 }
};
int c;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 2.8 2009/08/30 11:25:50 kls Exp $
* $Id: channels.c 2.9 2009/12/05 15:28:32 kls Exp $
*/
#include "channels.h"
@ -24,14 +24,14 @@ const tChannelParameterMap InversionValues[] = {
{ 0, INVERSION_OFF, trNOOP("off") },
{ 1, INVERSION_ON, trNOOP("on") },
{ 999, INVERSION_AUTO, trNOOP("auto") },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap BandwidthValues[] = {
{ 6, 6000000, "6 MHz" },
{ 7, 7000000, "7 MHz" },
{ 8, 8000000, "8 MHz" },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap CoderateValues[] = {
@ -47,7 +47,7 @@ const tChannelParameterMap CoderateValues[] = {
{ 89, FEC_8_9, "8/9" },
{ 910, FEC_9_10, "9/10" },
{ 999, FEC_AUTO, trNOOP("auto") },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap ModulationValues[] = {
@ -62,20 +62,20 @@ const tChannelParameterMap ModulationValues[] = {
{ 10, VSB_8, "VSB8" },
{ 11, VSB_16, "VSB16" },
{ 998, QAM_AUTO, "QAMAUTO" },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap SystemValues[] = {
{ 0, SYS_DVBS, "DVB-S" },
{ 1, SYS_DVBS2, "DVB-S2" },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap TransmissionValues[] = {
{ 2, TRANSMISSION_MODE_2K, "2K" },
{ 8, TRANSMISSION_MODE_8K, "8K" },
{ 999, TRANSMISSION_MODE_AUTO, trNOOP("auto") },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap GuardValues[] = {
@ -84,7 +84,7 @@ const tChannelParameterMap GuardValues[] = {
{ 16, GUARD_INTERVAL_1_16, "1/16" },
{ 32, GUARD_INTERVAL_1_32, "1/32" },
{ 999, GUARD_INTERVAL_AUTO, trNOOP("auto") },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap HierarchyValues[] = {
@ -93,7 +93,7 @@ const tChannelParameterMap HierarchyValues[] = {
{ 2, HIERARCHY_2, "2" },
{ 4, HIERARCHY_4, "4" },
{ 999, HIERARCHY_AUTO, trNOOP("auto") },
{ -1 }
{ -1, 0, NULL }
};
const tChannelParameterMap RollOffValues[] = {
@ -101,7 +101,7 @@ const tChannelParameterMap RollOffValues[] = {
{ 20, ROLLOFF_20, "0.20" },
{ 25, ROLLOFF_25, "0.25" },
{ 35, ROLLOFF_35, "0.35" },
{ -1 }
{ -1, 0, NULL }
};
int UserIndex(int Value, const tChannelParameterMap *Map)
@ -259,6 +259,7 @@ int cChannel::Transponder(int Frequency, char Polarization)
case 'v': Frequency += 200000; break;
case 'l': Frequency += 300000; break;
case 'r': Frequency += 400000; break;
default: esyslog("ERROR: invalid value for Polarization '%c'", Polarization);
}
return Frequency;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 2.6 2009/08/30 11:05:54 kls Exp $
* $Id: channels.h 2.7 2009/12/06 12:57:45 kls Exp $
*/
#ifndef __CHANNELS_H
@ -188,9 +188,9 @@ public:
const char *Alang(int i) const { return (0 <= i && i < MAXAPIDS) ? alangs[i] : ""; }
const char *Dlang(int i) const { return (0 <= i && i < MAXDPIDS) ? dlangs[i] : ""; }
const char *Slang(int i) const { return (0 <= i && i < MAXSPIDS) ? slangs[i] : ""; }
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS) ? subtitlingTypes[i] : 0; }
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? compositionPageIds[i] : 0; }
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? ancillaryPageIds[i] : 0; }
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS) ? subtitlingTypes[i] : uchar(0); }
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? compositionPageIds[i] : uint16_t(0); }
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS) ? ancillaryPageIds[i] : uint16_t(0); }
int Tpid(void) const { return tpid; }
const int *Caids(void) const { return caids; }
int Ca(int Index = 0) const { return Index < MAXCAIDS ? caids[Index] : 0; }

15
ci.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.c 2.3 2009/08/16 13:21:07 kls Exp $
* $Id: ci.c 2.4 2009/12/05 15:51:12 kls Exp $
*/
#include "ci.h"
@ -1424,6 +1424,15 @@ bool cCiTransportConnection::Process(cTPDU *TPDU)
SendTPDU(T_DTC_REPLY);
state = stIDLE;
return true;
case T_RCV:
case T_CREATE_TC:
case T_CTC_REPLY:
case T_DTC_REPLY:
case T_NEW_TC:
case T_TC_ERROR:
break;
default:
esyslog("ERROR: unknown TPDU tag: 0x%02X (%s)", TPDU->Tag(), __FUNCTION__);
}
}
else if (timer.TimedOut())
@ -1443,6 +1452,8 @@ bool cCiTransportConnection::Process(cTPDU *TPDU)
state = stIDLE;
}
return true;
default:
esyslog("ERROR: unknown state: %d (%s)", state, __FUNCTION__);
}
return true;
}
@ -1668,6 +1679,8 @@ void cCamSlot::Process(cTPDU *TPDU)
NewConnection();
resendPmt = caProgramList.Count() > 0;
break;
default:
esyslog("ERROR: unknown module status %d (%s)", ms, __FUNCTION__);
}
lastModuleStatus = ms;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 2.5 2009/06/13 10:25:05 kls Exp $
* $Id: config.c 2.6 2009/12/05 15:30:30 kls Exp $
*/
#include "config.h"
@ -76,7 +76,7 @@ const char *cCommand::Execute(const char *Parameters)
while ((c = fgetc(p)) != EOF) {
if (l % 20 == 0)
result = (char *)realloc(result, l + 21);
result[l++] = c;
result[l++] = char(c);
}
if (result)
result[l] = 0;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 2.26 2009/11/22 13:19:03 kls Exp $
* $Id: device.c 2.27 2009/12/05 15:52:54 kls Exp $
*/
#include "device.h"
@ -371,6 +371,7 @@ void cDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
case vdfCenterCutOut:
spuDecoder->setScaleMode(cSpuDecoder::eSpuNormal);
break;
default: esyslog("ERROR: invalid value for VideoDisplayFormat '%d'", VideoDisplayFormat);
}
}
}
@ -611,6 +612,7 @@ bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
case scrNoTransfer: Skins.Message(mtError, tr("Can't start Transfer Mode!"));
return false;
case scrFailed: break; // loop will retry
default: esyslog("ERROR: invalid return value from SetChannel");
}
esyslog("retrying");
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: diseqc.c 1.6 2008/02/10 14:09:27 kls Exp $
* $Id: diseqc.c 2.1 2009/12/05 15:57:02 kls Exp $
*/
#include "diseqc.h"
@ -36,7 +36,7 @@ bool cDiseqc::Parse(const char *s)
if (4 <= fields && fields <= 5) {
source = cSource::FromString(sourcebuf);
if (Sources.Get(source)) {
polarization = toupper(polarization);
polarization = char(toupper(polarization));
if (polarization == 'V' || polarization == 'H' || polarization == 'L' || polarization == 'R') {
parsing = true;
char *CurrentAction = NULL;
@ -81,7 +81,7 @@ char *cDiseqc::Codes(char *s)
errno = 0;
int n = strtol(t, &p, 16);
if (!errno && p != t && 0 <= n && n <= 255) {
codes[numCodes++] = n;
codes[numCodes++] = uchar(n);
t = skipspace(p);
}
else {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 2.21 2009/06/06 11:17:20 kls Exp $
* $Id: dvbdevice.c 2.22 2009/12/05 16:02:11 kls Exp $
*/
#include "dvbdevice.h"
@ -238,6 +238,7 @@ bool cDvbTuner::SetFrontend(void)
}
}
break;
default: esyslog("ERROR: unknown diseqc command %d", da);
}
}
diseqcCommands = diseqc->Commands();
@ -383,6 +384,8 @@ void cDvbTuner::Action(void)
lastTimeoutReport = 0;
continue;
}
break;
default: esyslog("ERROR: unknown tuner status %d", tunerStatus);
}
if (tunerStatus != tsTuned)
@ -720,6 +723,7 @@ void cDvbDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat)
case vdfCenterCutOut:
CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_CENTER_CUT_OUT));
break;
default: esyslog("ERROR: unknown video display format %d", VideoDisplayFormat);
}
}
}
@ -1179,6 +1183,7 @@ bool cDvbDevice::SetPlayMode(ePlayMode PlayMode)
close(fd_audio);
fd_video = fd_audio = -1;
break;
default: esyslog("ERROR: unknown playmode %d", PlayMode);
}
playMode = PlayMode;
return true;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbplayer.c 2.17 2009/05/31 14:12:42 kls Exp $
* $Id: dvbplayer.c 2.18 2009/12/05 16:04:04 kls Exp $
*/
#include "dvbplayer.h"
@ -666,6 +666,7 @@ void cDvbPlayer::Forward(void)
trickSpeed = NORMAL_SPEED;
TrickSpeed(Setup.MultiSpeedMode ? -1 : -MAX_SPEEDS);
break;
default: esyslog("ERROR: unknown playMode %d (%s)", playMode, __FUNCTION__);
}
}
}
@ -717,6 +718,7 @@ void cDvbPlayer::Backward(void)
TrickSpeed(Setup.MultiSpeedMode ? -1 : -MAX_SPEEDS);
}
break;
default: esyslog("ERROR: unknown playMode %d (%s)", playMode, __FUNCTION__);
}
}
}

View File

@ -8,7 +8,7 @@
*
* parts of this file are derived from the OMS program.
*
* $Id: dvbspu.c 2.3 2009/12/05 14:41:40 kls Exp $
* $Id: dvbspu.c 2.4 2009/12/05 16:06:12 kls Exp $
*/
#include "dvbspu.h"

View File

@ -8,7 +8,7 @@
*
* parts of this file are derived from the OMS program.
*
* $Id: dvbspu.h 2.2 2009/12/05 14:40:08 kls Exp $
* $Id: dvbspu.h 2.3 2009/12/05 15:17:08 kls Exp $
*/
#ifndef __DVBSPU_H
@ -197,8 +197,7 @@ inline uint32_t cDvbSpuPalette::yuv2rgb(uint32_t yuv_color)
inline uint32_t cDvbSpuPalette::getColor(uint8_t idx, uint8_t trans) const
{
uint8_t t = trans == 0x0f ? 0xff : trans << 4;
return palette[idx] | (t << 24);
return palette[idx] | (trans == 0x0f) ? 0xff000000 : (trans << 28);
}
#endif // __DVBSPU_H

View File

@ -7,7 +7,7 @@
* Original author: Marco Schlüßler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
*
* $Id: dvbsubtitle.c 2.2 2009/11/22 12:28:53 kls Exp $
* $Id: dvbsubtitle.c 2.3 2009/12/05 16:11:54 kls Exp $
*/
#include "dvbsubtitle.h"
@ -160,21 +160,22 @@ void cSubtitleObject::DecodeSubBlock(const uchar *Data, int Length, bool Even)
;
break;
case 0x20: //TODO
dbgobjects("sub block 2 to 4 map");
dbgobjects("sub block 2 to 4 map\n");
index += 4;
break;
case 0x21: //TODO
dbgobjects("sub block 2 to 8 map");
dbgobjects("sub block 2 to 8 map\n");
index += 4;
break;
case 0x22: //TODO
dbgobjects("sub block 4 to 8 map");
dbgobjects("sub block 4 to 8 map\n");
index += 16;
break;
case 0xF0:
x = 0;
y += 2;
break;
default: dbgobjects("unknown sub block %s %d\n", __FUNCTION__, __LINE__);
}
}
}
@ -233,7 +234,7 @@ bool cSubtitleObject::Decode2BppCodeString(const uchar *Data, int &Index, int &x
rl = 1; //color 0
else {
code = Get2Bits(Data, Index);
switch (code & 0x3) { //switch_3
switch (code & 3) { //switch_3
case 0:
return false;
case 1:
@ -247,6 +248,7 @@ bool cSubtitleObject::Decode2BppCodeString(const uchar *Data, int &Index, int &x
rl = (Get2Bits(Data, Index) << 6) + (Get2Bits(Data, Index) << 4) + (Get2Bits(Data, Index) << 2) + Get2Bits(Data, Index) + 29;
color = Get2Bits(Data, Index);
break;
default: ;
}
}
}
@ -283,6 +285,7 @@ bool cSubtitleObject::Decode4BppCodeString(const uchar *Data, int &Index, int &x
rl = (Get4Bits(Data, Index) << 4) + Get4Bits(Data, Index) + 25;
color = Get4Bits(Data, Index);
break;
default: ;
}
}
else {
@ -516,6 +519,7 @@ void cDvbSubtitlePage::SetState(int State)
break;
case 3: // reserved
break;
default: dbgpages("unknown page state (%s %d)\n", __FUNCTION__, __LINE__);
}
}
@ -900,6 +904,7 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t
case 2: region->FillRegion((Data[6 + 9] & 0x0C) >> 2); break;
case 4: region->FillRegion((Data[6 + 9] & 0xF0) >> 4); break;
case 8: region->FillRegion(Data[6 + 8]); break;
default: dbgregions("unknown bpp %d (%s %d)\n", region->Bpp(), __FUNCTION__, __LINE__);
}
}
for (int i = 6 + 10; i < segmentLength; i += 6) {

3
eit.c
View File

@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
* $Id: eit.c 2.6 2009/06/21 13:46:20 kls Exp $
* $Id: eit.c 2.7 2009/12/05 16:13:22 kls Exp $
*/
#include "eit.h"
@ -354,5 +354,6 @@ void cEitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
cTDT TDT(Data);
}
break;
default: ;
}
}

7
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 2.1 2008/05/01 14:53:55 kls Exp $
* $Id: epg.c 2.2 2009/12/05 16:17:08 kls Exp $
*/
#include "epg.h"
@ -603,6 +603,7 @@ void cEvent::FixEpgBugs(void)
case 0x0F: p->description = strdup("HD 16:9"); break;
case 0x0C:
case 0x10: p->description = strdup("HD >16:9"); break;
default: ;
}
EpgBugFixStat(9, ChannelID());
}
@ -621,12 +622,13 @@ void cEvent::FixEpgBugs(void)
if (!p->description) {
switch (p->type) {
case 0x05: p->description = strdup("Dolby Digital"); break;
// all others will just display the language
default: ; // all others will just display the language
}
EpgBugFixStat(11, ChannelID());
}
}
break;
default: ;
}
}
}
@ -863,6 +865,7 @@ void cSchedule::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtT
p->Dump(f, Prefix);
}
break;
default: esyslog("ERROR: unknown DumpMode %d (%s %d)", DumpMode, __FUNCTION__, __LINE__);
}
fprintf(f, "%sc\n", Prefix);
}

3
font.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: font.c 2.2 2009/05/03 11:15:39 kls Exp $
* $Id: font.c 2.3 2009/12/05 16:19:00 kls Exp $
*/
#include "font.h"
@ -346,6 +346,7 @@ const cFont *cFont::GetFont(eDvbFont Font)
case fontOsd: SetFont(Font, Setup.FontOsd, Setup.FontOsdSize); break;
case fontSml: SetFont(Font, Setup.FontSml, Setup.FontSmlSize); break;
case fontFix: SetFont(Font, Setup.FontFix, Setup.FontFixSize); break;
default: esyslog("ERROR: unknown Font %d (%s %d)", Font, __FUNCTION__, __LINE__);
}
}
return fonts[Font];

View File

@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* $Id: si.c 1.25 2008/03/05 17:00:55 kls Exp $
* $Id: si.c 2.1 2009/12/05 16:20:12 kls Exp $
* *
***************************************************************************/
@ -720,6 +720,7 @@ Descriptor *Descriptor::getDescriptor(CharArray da, DescriptorTagDomain domain,
break;
}
break;
default: ; // unknown domain, nothing to do
}
d->setData(da);
return d;

View File

@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* $Id: si.h 2.1 2008/09/06 12:44:06 kls Exp $
* $Id: si.h 2.2 2009/12/06 11:37:35 kls Exp $
* *
***************************************************************************/
@ -411,6 +411,8 @@ public:
return data.FourBytes(index);
case 8:
return (SixtyFourBit(data.FourBytes(index)) << 32) | data.FourBytes(index+4);
default:
return 0; // just to avoid a compiler warning
}
return 0; // just to avoid a compiler warning
}

13
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 2.9 2009/06/21 09:56:06 kls Exp $
* $Id: menu.c 2.10 2009/12/06 11:29:05 kls Exp $
*/
#include "menu.h"
@ -1373,6 +1373,7 @@ eOSState cMenuSchedule::Number(void)
case cMenuScheduleItem::ssmThisThis: PrepareScheduleThisThis(Event, Channel); break;
case cMenuScheduleItem::ssmThisAll: PrepareScheduleThisAll(Event, Channel); break;
case cMenuScheduleItem::ssmAllAll: PrepareScheduleAllAll(Event, Channel); break;
default: esyslog("ERROR: unknown SortMode %d (%s %d)", cMenuScheduleItem::SortMode(), __FUNCTION__, __LINE__);
}
CurrentItem = (cMenuScheduleItem *)Get(Current());
Sort();
@ -1897,6 +1898,7 @@ void cMenuRecordings::SetHelpKeys(void)
case 1: SetHelp(tr("Button$Open")); break;
case 2:
case 3: SetHelp(RecordingCommands.Count() ? tr("Commands") : tr("Button$Play"), tr("Button$Rewind"), tr("Button$Delete"), NewHelpKeys == 3 ? tr("Button$Info") : NULL);
default: ;
}
helpKeys = NewHelpKeys;
}
@ -2242,18 +2244,18 @@ eOSState cMenuSetupOSD::ProcessKey(eKeys Key)
Utf8Strn0Cpy(data.OSDTheme, themes.Name(themeIndex), sizeof(data.OSDTheme));
ModifiedAppearance |= themeIndex != originalThemeIndex;
}
if (data.OSDLeftP != Setup.OSDLeftP || data.OSDTopP != Setup.OSDTopP || data.OSDWidthP != Setup.OSDWidthP || data.OSDHeightP != Setup.OSDHeightP)
if (!(DoubleEqual(data.OSDLeftP, Setup.OSDLeftP) && DoubleEqual(data.OSDTopP, Setup.OSDTopP) && DoubleEqual(data.OSDWidthP, Setup.OSDWidthP) && DoubleEqual(data.OSDHeightP, Setup.OSDHeightP)))
ModifiedAppearance = true;
if (data.UseSmallFont != Setup.UseSmallFont || data.AntiAlias != Setup.AntiAlias)
ModifiedAppearance = true;
Utf8Strn0Cpy(data.FontOsd, fontOsdNames[fontOsdIndex], sizeof(data.FontOsd));
Utf8Strn0Cpy(data.FontSml, fontSmlNames[fontSmlIndex], sizeof(data.FontSml));
Utf8Strn0Cpy(data.FontFix, fontFixNames[fontFixIndex], sizeof(data.FontFix));
if (strcmp(data.FontOsd, Setup.FontOsd) || data.FontOsdSizeP != Setup.FontOsdSizeP)
if (strcmp(data.FontOsd, Setup.FontOsd) || !DoubleEqual(data.FontOsdSizeP, Setup.FontOsdSizeP))
ModifiedAppearance = true;
if (strcmp(data.FontSml, Setup.FontSml) || data.FontSmlSizeP != Setup.FontSmlSizeP)
if (strcmp(data.FontSml, Setup.FontSml) || !DoubleEqual(data.FontSmlSizeP, Setup.FontSmlSizeP))
ModifiedAppearance = true;
if (strcmp(data.FontFix, Setup.FontFix) || data.FontFixSizeP != Setup.FontFixSizeP)
if (strcmp(data.FontFix, Setup.FontFix) || !DoubleEqual(data.FontFixSizeP, Setup.FontFixSizeP))
ModifiedAppearance = true;
}
@ -3152,6 +3154,7 @@ static void SetTrackDescriptions(int LiveChannel)
break;
case 4: cDevice::PrimaryDevice()->SetAvailableTrack(ttDolby, indexDolby++, 0, LiveChannel ? NULL : p->language, p->description);
break;
default: ;
}
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 2.4 2009/05/03 13:37:55 kls Exp $
* $Id: menuitems.c 2.5 2009/12/06 11:31:20 kls Exp $
*/
#include "menuitems.h"
@ -257,7 +257,7 @@ eOSState cMenuEditPrcItem::ProcessKey(eKeys Key)
return state;
}
newValue /= factor;
if (newValue != *value && (!fresh || min <= newValue) && newValue <= max) {
if (!DoubleEqual(newValue, *value) && (!fresh || min <= newValue) && newValue <= max) {
*value = newValue;
Set();
}
@ -666,6 +666,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
return ProcessKey(kYellow);
}
break;
default: ;
}
}
}
@ -675,6 +676,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
case kfEnd: pos = lengthUtf8 - 1; break;
case kfIns: return ProcessKey(kGreen);
case kfDel: return ProcessKey(kYellow);
default: ;
}
}
}
@ -975,6 +977,7 @@ eOSState cMenuEditTimeItem::ProcessKey(eKeys Key)
pos++;
}
break;
default: ;
}
}
else if (NORMALKEY(Key) == kLeft) { // TODO might want to increase the delta if repeated quickly?

3
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: nit.c 2.3 2008/12/20 10:57:50 kls Exp $
* $Id: nit.c 2.4 2009/12/06 11:36:16 kls Exp $
*/
#include "nit.h"
@ -110,6 +110,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
case 1: f = BCD2INT(f) / 100; break;
case 2: f = BCD2INT(f) / 10; break;
case 3: f = f * 10; break;
default: ;
}
Frequencies[n++] = f;
}

8
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 2.5 2009/05/09 10:42:35 kls Exp $
* $Id: osd.c 2.6 2009/12/06 11:33:47 kls Exp $
*/
#include "osd.h"
@ -101,6 +101,7 @@ void cPalette::Take(const cPalette &Palette, tIndexes *Indexes, tColor ColorFg,
switch (i) {
case 0: Color = ColorBg; break;
case 1: Color = ColorFg; break;
default: ;
}
}
int n = Index(Color);
@ -532,6 +533,7 @@ void cBitmap::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quad
case 6: cy = y2; rx /= 2; break;
case 7: cx = x2; ry /= 2; break;
case 8: cy = y1; rx /= 2; break;
default: ;
}
int TwoASquare = 2 * rx * rx;
int TwoBSquare = 2 * ry * ry;
@ -557,6 +559,7 @@ void cBitmap::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quad
case -2: DrawRectangle(x1, cy - y, cx - x, cy - y, Color); break;
case -3: DrawRectangle(x1, cy + y, cx - x, cy + y, Color); break;
case -4: DrawRectangle(cx + x, cy + y, x2, cy + y, Color); break;
default: ;
}
y++;
StoppingY += TwoASquare;
@ -591,6 +594,7 @@ void cBitmap::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quad
case -2: DrawRectangle(x1, cy - y, cx - x, cy - y, Color); break;
case -3: DrawRectangle(x1, cy + y, cx - x, cy + y, Color); break;
case -4: DrawRectangle(cx + x, cy + y, x2, cy + y, Color); break;
default: ;
}
x++;
StoppingX += TwoBSquare;
@ -921,7 +925,7 @@ void cOsdProvider::UpdateOsdSize(bool Force)
int Height;
double Aspect;
cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect);
if (Width != oldWidth || Height != oldHeight || Aspect != oldAspect || Force) {
if (Width != oldWidth || Height != oldHeight || !DoubleEqual(Aspect, oldAspect) || Force) {
Setup.OSDLeft = int(round(Width * Setup.OSDLeftP));
Setup.OSDTop = int(round(Height * Setup.OSDTopP));
Setup.OSDWidth = int(round(Width * Setup.OSDWidthP)) & ~0x07; // OSD width must be a multiple of 8

4
pat.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: pat.c 2.4 2009/08/16 15:01:03 kls Exp $
* $Id: pat.c 2.5 2009/12/06 11:39:17 kls Exp $
*/
#include "pat.h"
@ -443,7 +443,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
}
}
break;
//default: printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());//XXX
default: ;//printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());
}
for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)stream.streamDescriptors.getNext(it, SI::CaDescriptorTag)); ) {
CaDescriptors->AddCaDescriptor(d, esPid);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recorder.c 2.6 2009/11/21 15:58:12 kls Exp $
* $Id: recorder.c 2.7 2009/12/06 11:34:41 kls Exp $
*/
#include "recorder.h"
@ -128,7 +128,7 @@ void cRecorder::Action(void)
if (frameDetector->Synced()) {
if (!InfoWritten) {
if (recordingInfo.Read()) {
if (frameDetector->FramesPerSecond() > 0 && recordingInfo.FramesPerSecond() != frameDetector->FramesPerSecond()) {
if (frameDetector->FramesPerSecond() > 0 && !DoubleEqual(recordingInfo.FramesPerSecond(), frameDetector->FramesPerSecond())) {
recordingInfo.SetFramesPerSecond(frameDetector->FramesPerSecond());
recordingInfo.Write();
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 2.19 2009/11/22 19:38:04 kls Exp $
* $Id: recording.c 2.20 2009/12/06 12:55:36 kls Exp $
*/
#include "recording.h"
@ -260,6 +260,7 @@ int cResumeFile::Read(void)
switch (*s) {
case 'I': resume = atoi(t);
break;
default: ;
}
}
fclose(f);
@ -443,8 +444,8 @@ bool cRecordingInfo::Read(FILE *f)
ownEvent->SetEventID(EventID);
ownEvent->SetStartTime(StartTime);
ownEvent->SetDuration(Duration);
ownEvent->SetTableID(TableID);
ownEvent->SetVersion(Version);
ownEvent->SetTableID(uchar(TableID));
ownEvent->SetVersion(uchar(Version));
}
}
break;
@ -570,7 +571,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
if (strlen(p) > 2 && isxdigit(*(p + 1)) && isxdigit(*(p + 2))) {
char buf[3];
sprintf(buf, "%c%c", *(p + 1), *(p + 2));
unsigned char c = strtol(buf, NULL, 16);
uchar c = uchar(strtol(buf, NULL, 16));
if (c) {
*p = c;
memmove(p + 1, p + 3, strlen(p) - 2);
@ -582,6 +583,7 @@ char *ExchangeChars(char *s, bool ToFileSystem)
case '\x01': *p = '\''; break;
case '\x02': *p = '/'; break;
case '\x03': *p = ':'; break;
default: ;
}
}
}
@ -1501,19 +1503,19 @@ cIndexFile::cIndexFile(const char *FileName, bool Record, bool IsPesRecording)
if (access(fileName, R_OK) == 0) {
struct stat buf;
if (stat(fileName, &buf) == 0) {
delta = buf.st_size % sizeof(tIndexTs);
delta = int(buf.st_size % sizeof(tIndexTs));
if (delta) {
delta = sizeof(tIndexTs) - delta;
esyslog("ERROR: invalid file size (%lld) in '%s'", buf.st_size, fileName);
}
last = (buf.st_size + delta) / sizeof(tIndexTs) - 1;
last = int((buf.st_size + delta) / sizeof(tIndexTs) - 1);
if (!Record && last >= 0) {
size = last + 1;
index = MALLOC(tIndexTs, size);
if (index) {
f = open(fileName, O_RDONLY);
if (f >= 0) {
if ((int)safe_read(f, index, buf.st_size) != buf.st_size) {
if (safe_read(f, index, size_t(buf.st_size)) != buf.st_size) {
esyslog("ERROR: can't read from file '%s'", fileName);
free(index);
index = NULL;
@ -1579,8 +1581,8 @@ void cIndexFile::ConvertToPes(tIndexTs *IndexTs, int Count)
tIndexPes IndexPes;
while (Count-- > 0) {
IndexPes.offset = uint32_t(IndexTs->offset);
IndexPes.type = IndexTs->independent ? 1 : 2; // I_FRAME : "not I_FRAME" (exact frame type doesn't matter)
IndexPes.number = IndexTs->number;
IndexPes.type = uchar(IndexTs->independent ? 1 : 2); // I_FRAME : "not I_FRAME" (exact frame type doesn't matter)
IndexPes.number = uchar(IndexTs->number);
IndexPes.reserved = 0;
memcpy(IndexTs, &IndexPes, sizeof(*IndexTs));
IndexTs++;
@ -1601,7 +1603,7 @@ bool cIndexFile::CatchUp(int Index)
f = -1;
break;
}
int newLast = buf.st_size / sizeof(tIndexTs) - 1;
int newLast = int(buf.st_size / sizeof(tIndexTs) - 1);
if (newLast > last) {
if (size <= newLast) {
size *= 2;
@ -1671,7 +1673,7 @@ bool cIndexFile::Get(int Index, uint16_t *FileNumber, off_t *FileOffset, bool *I
uint16_t fn = index[Index + 1].number;
off_t fo = index[Index + 1].offset;
if (fn == *FileNumber)
*Length = fo - *FileOffset;
*Length = int(fo - *FileOffset);
else
*Length = -1; // this means "everything up to EOF" (the buffer's Read function will act accordingly)
}
@ -1702,7 +1704,7 @@ int cIndexFile::GetNextIFrame(int Index, bool Forward, uint16_t *FileNumber, off
uint16_t fn = index[Index + 1].number;
off_t fo = index[Index + 1].offset;
if (fn == *FileNumber)
*Length = fo - *FileOffset;
*Length = int(fo - *FileOffset);
else {
esyslog("ERROR: 'I' frame at end of file #%d", *FileNumber);
*Length = -1;
@ -1871,11 +1873,11 @@ cUnbufferedFile *cFileName::SetOffset(int Number, off_t Offset)
Close();
int MaxFilesPerRecording = isPesRecording ? MAXFILESPERRECORDINGPES : MAXFILESPERRECORDINGTS;
if (0 < Number && Number <= MaxFilesPerRecording) {
fileNumber = Number;
fileNumber = uint16_t(Number);
sprintf(pFileNumber, isPesRecording ? RECORDFILESUFFIXPES : RECORDFILESUFFIXTS, fileNumber);
if (record) {
if (access(fileName, F_OK) == 0) {
// files exists, check if it has non-zero size
// file exists, check if it has non-zero size
struct stat buf;
if (stat(fileName, &buf) == 0) {
if (buf.st_size != 0)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 2.10 2009/11/21 16:12:55 kls Exp $
* $Id: recording.h 2.11 2009/12/06 12:46:31 kls Exp $
*/
#ifndef __RECORDING_H
@ -253,7 +253,7 @@ public:
class cFileName {
private:
cUnbufferedFile *file;
int fileNumber;
uint16_t fileNumber;
char *fileName, *pFileNumber;
bool record;
bool blocking;
@ -262,11 +262,11 @@ public:
cFileName(const char *FileName, bool Record, bool Blocking = false, bool IsPesRecording = false);
~cFileName();
const char *Name(void) { return fileName; }
int Number(void) { return fileNumber; }
uint16_t Number(void) { return fileNumber; }
bool GetLastPatPmtVersions(int &PatVersion, int &PmtVersion);
cUnbufferedFile *Open(void);
void Close(void);
cUnbufferedFile *SetOffset(int Number, off_t Offset = 0);
cUnbufferedFile *SetOffset(int Number, off_t Offset = 0); // yes, Number is int for easier internal calculating
cUnbufferedFile *NextFile(void);
};

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.c 1.59 2008/02/23 14:14:46 kls Exp $
* $Id: remote.c 2.1 2009/12/06 12:08:03 kls Exp $
*/
#include "remote.h"
@ -287,7 +287,9 @@ int cKbdRemote::MapCodeToFunc(uint64_t Code)
if (p->code == Code)
return p->func;
}
return (Code <= 0xFF) ? Code : kfNone;
if (Code <= 0xFF)
return Code;
return kfNone;
}
int cKbdRemote::ReadKey(void)
@ -337,9 +339,11 @@ uint64_t cKbdRemote::ReadKeySequence(void)
k |= key1 & 0xFF;
} while (key1 != 0x7E);
break;
default: ;
}
}
break;
default: ;
}
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 2.31 2009/12/05 13:15:10 kls Exp $
* $Id: remux.c 2.32 2009/12/06 12:10:44 kls Exp $
*/
#include "remux.h"
@ -585,6 +585,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
}
}
break;
default: ;
}
dbgpatpmt("\n");
if (updatePrimaryDevice) {

3
sdt.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: sdt.c 2.1 2008/04/12 13:33:55 kls Exp $
* $Id: sdt.c 2.2 2009/12/06 12:11:23 kls Exp $
*/
#include "sdt.h"
@ -92,6 +92,7 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
patFilter->Trigger();
}
}
default: ;
}
}
break;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: skinsttng.c 1.28 2008/02/23 10:23:44 kls Exp $
* $Id: skinsttng.c 2.1 2009/12/06 12:12:03 kls Exp $
*/
// Star Trek: The Next Generation® is a registered trademark of Paramount Pictures
@ -1068,6 +1068,7 @@ void cSkinSTTNGDisplayTracks::SetAudioChannel(int AudioChannel)
case 0: bm = &bmAudioStereo; break;
case 1: bm = &bmAudioLeft; break;
case 2: bm = &bmAudioRight; break;
default: ;
}
if (bm)
osd->DrawBitmap(x3 + 5, y6 + (y7 - y6 - bm->Height()) / 2, *bm, Theme.Color(clrChannelSymbolOn), frameColor);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 2.4 2009/11/06 15:21:17 kls Exp $
* $Id: tools.c 2.5 2009/12/06 12:19:56 kls Exp $
*/
#include "tools.h"
@ -633,6 +633,7 @@ uint Utf8CharGet(const char *s, int Length)
case 2: return ((*s & 0x1F) << 6) | (*(s + 1) & 0x3F);
case 3: return ((*s & 0x0F) << 12) | ((*(s + 1) & 0x3F) << 6) | (*(s + 2) & 0x3F);
case 4: return ((*s & 0x07) << 18) | ((*(s + 1) & 0x3F) << 12) | ((*(s + 2) & 0x3F) << 6) | (*(s + 3) & 0x3F);
default: ;
}
return *s;
}
@ -942,8 +943,8 @@ cString WeekDayNameFull(int WeekDay)
case 4: return tr("Friday");
case 5: return tr("Saturday");
case 6: return tr("Sunday");
default: return "???";
}
return "???";
}
cString WeekDayNameFull(time_t t)

14
tools.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 2.2 2009/04/14 20:41:39 kls Exp $
* $Id: tools.h 2.3 2009/12/06 11:24:12 kls Exp $
*/
#ifndef __TOOLS_H
@ -13,7 +13,9 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <float.h>
#include <iconv.h>
#include <math.h>
#include <poll.h>
#include <stddef.h>
#include <stdint.h>
@ -60,7 +62,7 @@ void syslog_with_tid(int priority, const char *format, ...) __attribute__ ((form
int BCD2INT(int x);
// Unfortunately there are no platform independent macros for unaligned
// access. so we do it this way:
// access, so we do it this way:
template<class T> inline T get_unaligned(T *p)
{
@ -74,6 +76,14 @@ template<class T> inline void put_unaligned(unsigned int v, T* p)
((s *)p)->v = v;
}
// Comparing doubles for equality is unsafe, but unfortunately we can't
// overwrite operator==(double, double), so this will have to do:
inline bool DoubleEqual(double a, double b)
{
return fabs(a - b) <= DBL_EPSILON;
}
// When handling strings that might contain UTF-8 characters, it may be necessary
// to process a "symbol" that consists of several actual character bytes. The
// following functions allow transparently accessing a "char *" string without

4
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.tvdr.de
*
* $Id: vdr.c 2.12 2009/10/25 14:45:47 kls Exp $
* $Id: vdr.c 2.13 2009/12/06 12:20:43 kls Exp $
*/
#include <getopt.h>
@ -242,7 +242,7 @@ int main(int argc, char *argv[])
{ "vfat", no_argument, NULL, 'v' | 0x100 },
{ "video", required_argument, NULL, 'v' },
{ "watchdog", required_argument, NULL, 'w' },
{ NULL }
{ NULL, no_argument, NULL, 0 }
};
int c;