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

Changed 'unsigned' to 'signed' in some places to avoid trouble with abs() in gcc6+

This commit is contained in:
Klaus Schmidinger 2017-01-09 15:21:13 +01:00
parent 6773ab35d2
commit 6121095a30
6 changed files with 18 additions and 15 deletions

View File

@ -2850,6 +2850,7 @@ Derek Kelly <user.vdr@gmail.com>
for suggesting to add ARGSDIR to the ONEDIR section of Make.config.template for suggesting to add ARGSDIR to the ONEDIR section of Make.config.template
for suggesting to change the naming of "binary skip mode" to "adaptive skip mode" for suggesting to change the naming of "binary skip mode" to "adaptive skip mode"
for suggesting to make the -u option also accept a numerical user id for suggesting to make the -u option also accept a numerical user id
for reporting a problem with abs() in gcc6+ when called with an unsigned variable
Marcel Unbehaun <frostworks@gmx.de> Marcel Unbehaun <frostworks@gmx.de>
for adding cRecordingInfo::GetEvent() for adding cRecordingInfo::GetEvent()

View File

@ -8898,3 +8898,5 @@ Video Disk Recorder Revision History
now only triggered if there acually is more than one CAM in the system. now only triggered if there acually is more than one CAM in the system.
- Fixed updating the elapsed/remaining time in the progress display during fast - Fixed updating the elapsed/remaining time in the progress display during fast
forward/rewind. forward/rewind.
- Changed 'unsigned' to 'signed' in some places to avoid trouble with abs() in
gcc6+ (reported by Derek Kelly).

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: diseqc.c 3.4 2015/01/26 12:02:14 kls Exp $ * $Id: diseqc.c 4.1 2017/01/09 15:10:40 kls Exp $
*/ */
#include "diseqc.h" #include "diseqc.h"
@ -253,10 +253,10 @@ bool cDiseqc::Parse(const char *s)
return result; return result;
} }
uint cDiseqc::SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes) const int cDiseqc::SetScrFrequency(int SatFrequency, const cScr *Scr, uint8_t *Codes) const
{ {
if ((Codes[0] & 0xF0) == 0x70 ) { // EN50607 aka JESS if ((Codes[0] & 0xF0) == 0x70 ) { // EN50607 aka JESS
uint t = SatFrequency == 0 ? 0 : (SatFrequency - 100); int t = SatFrequency == 0 ? 0 : (SatFrequency - 100);
if (t < 2048 && Scr->Channel() >= 0 && Scr->Channel() < 32) { if (t < 2048 && Scr->Channel() >= 0 && Scr->Channel() < 32) {
Codes[1] = t >> 8 | Scr->Channel() << 3; Codes[1] = t >> 8 | Scr->Channel() << 3;
Codes[2] = t; Codes[2] = t;
@ -266,7 +266,7 @@ uint cDiseqc::SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes
} }
} }
else { // EN50494 aka Unicable else { // EN50494 aka Unicable
uint t = SatFrequency == 0 ? 0 : (SatFrequency + Scr->UserBand() + 2) / 4 - 350; // '+ 2' together with '/ 4' results in rounding! int t = SatFrequency == 0 ? 0 : (SatFrequency + Scr->UserBand() + 2) / 4 - 350; // '+ 2' together with '/ 4' results in rounding!
if (t < 1024 && Scr->Channel() >= 0 && Scr->Channel() < 8) { if (t < 1024 && Scr->Channel() >= 0 && Scr->Channel() < 8) {
Codes[3] = t >> 8 | (t == 0 ? 0 : scrBank << 2) | Scr->Channel() << 5; Codes[3] = t >> 8 | (t == 0 ? 0 : scrBank << 2) | Scr->Channel() << 5;
Codes[4] = t; Codes[4] = t;
@ -399,7 +399,7 @@ const char *cDiseqc::GetCodes(const char *s, uchar *Codes, uint8_t *MaxCodes) co
return NULL; return NULL;
} }
cDiseqc::eDiseqcActions cDiseqc::Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, uint *Frequency) const cDiseqc::eDiseqcActions cDiseqc::Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, int *Frequency) const
{ {
if (!*CurrentAction) if (!*CurrentAction)
*CurrentAction = commands; *CurrentAction = commands;

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: diseqc.h 3.1 2013/06/12 11:52:17 kls Exp $ * $Id: diseqc.h 4.1 2017/01/09 15:11:19 kls Exp $
*/ */
#ifndef __DISEQC_H #ifndef __DISEQC_H
@ -86,7 +86,7 @@ private:
mutable int scrBank; mutable int scrBank;
char *commands; char *commands;
bool parsing; bool parsing;
uint SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes) const; int SetScrFrequency(int SatFrequency, const cScr *Scr, uint8_t *Codes) const;
int SetScrPin(const cScr *Scr, uint8_t *Codes) const; int SetScrPin(const cScr *Scr, uint8_t *Codes) const;
const char *Wait(const char *s) const; const char *Wait(const char *s) const;
const char *GetPosition(const char *s) const; const char *GetPosition(const char *s) const;
@ -96,7 +96,7 @@ public:
cDiseqc(void); cDiseqc(void);
~cDiseqc(); ~cDiseqc();
bool Parse(const char *s); bool Parse(const char *s);
eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, uint *Frequency) const; eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, int *Frequency) const;
///< Parses the DiSEqC commands and returns the appropriate action code ///< Parses the DiSEqC commands and returns the appropriate action code
///< with every call. CurrentAction must be the address of a character pointer, ///< with every call. CurrentAction must be the address of a character pointer,
///< which is initialized to NULL. This pointer is used internally while parsing ///< which is initialized to NULL. This pointer is used internally while parsing

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: dvbdevice.c 4.3 2016/11/07 13:55:58 kls Exp $ * $Id: dvbdevice.c 4.4 2017/01/09 15:11:39 kls Exp $
*/ */
#include "dvbdevice.h" #include "dvbdevice.h"
@ -329,7 +329,7 @@ private:
void ClearEventQueue(void) const; void ClearEventQueue(void) const;
bool GetFrontendStatus(fe_status_t &Status) const; bool GetFrontendStatus(fe_status_t &Status) const;
cPositioner *GetPositioner(void); cPositioner *GetPositioner(void);
void ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency); void ExecuteDiseqc(const cDiseqc *Diseqc, int *Frequency);
void ResetToneAndVoltage(void); void ResetToneAndVoltage(void);
bool SetFrontend(void); bool SetFrontend(void);
virtual void Action(void); virtual void Action(void);
@ -696,7 +696,7 @@ cPositioner *cDvbTuner::GetPositioner(void)
return positioner; return positioner;
} }
void cDvbTuner::ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency) void cDvbTuner::ExecuteDiseqc(const cDiseqc *Diseqc, int *Frequency)
{ {
if (!lnbPowerTurnedOn) { if (!lnbPowerTurnedOn) {
CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power
@ -806,7 +806,7 @@ bool cDvbTuner::SetFrontend(void)
SETCMD(DTV_DELIVERY_SYSTEM, frontendType); SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) { if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) {
unsigned int frequency = channel.Frequency(); int frequency = channel.Frequency();
if (Setup.DiSEqC) { if (Setup.DiSEqC) {
if (const cDiseqc *diseqc = Diseqcs.Get(device->CardIndex() + 1, channel.Source(), frequency, dtp.Polarization(), &scr)) { if (const cDiseqc *diseqc = Diseqcs.Get(device->CardIndex() + 1, channel.Source(), frequency, dtp.Polarization(), &scr)) {
frequency -= diseqc->Lof(); frequency -= diseqc->Lof();
@ -829,7 +829,7 @@ bool cDvbTuner::SetFrontend(void)
} }
else { else {
int tone = SEC_TONE_OFF; int tone = SEC_TONE_OFF;
if (frequency < (unsigned int)Setup.LnbSLOF) { if (frequency < Setup.LnbSLOF) {
frequency -= Setup.LnbFrequLo; frequency -= Setup.LnbFrequLo;
tone = SEC_TONE_OFF; tone = SEC_TONE_OFF;
} }

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: remux.c 4.3 2016/12/22 12:58:20 kls Exp $ * $Id: remux.c 4.4 2017/01/09 15:05:05 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -1629,7 +1629,7 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
Div += parser->IFrameTemporalReferenceOffset(); Div += parser->IFrameTemporalReferenceOffset();
if (Div <= 0) if (Div <= 0)
Div = 1; Div = 1;
uint32_t Delta = ptsValues[0] / Div; int Delta = ptsValues[0] / Div;
// determine frame info: // determine frame info:
if (isVideo) { if (isVideo) {
if (Delta == 3753) if (Delta == 3753)