From 6121095a300bb5cd8731aefb74bc7b26315ce985 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 9 Jan 2017 15:21:13 +0100 Subject: [PATCH] Changed 'unsigned' to 'signed' in some places to avoid trouble with abs() in gcc6+ --- CONTRIBUTORS | 1 + HISTORY | 2 ++ diseqc.c | 10 +++++----- diseqc.h | 6 +++--- dvbdevice.c | 10 +++++----- remux.c | 4 ++-- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index dc774b0f..1a45293f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2850,6 +2850,7 @@ Derek Kelly 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 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 for adding cRecordingInfo::GetEvent() diff --git a/HISTORY b/HISTORY index 0cb88d6c..8e32be5b 100644 --- a/HISTORY +++ b/HISTORY @@ -8898,3 +8898,5 @@ Video Disk Recorder Revision History 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 forward/rewind. +- Changed 'unsigned' to 'signed' in some places to avoid trouble with abs() in + gcc6+ (reported by Derek Kelly). diff --git a/diseqc.c b/diseqc.c index de64257f..c79e6bb6 100644 --- a/diseqc.c +++ b/diseqc.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -253,10 +253,10 @@ bool cDiseqc::Parse(const char *s) 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 - uint t = SatFrequency == 0 ? 0 : (SatFrequency - 100); + int t = SatFrequency == 0 ? 0 : (SatFrequency - 100); if (t < 2048 && Scr->Channel() >= 0 && Scr->Channel() < 32) { Codes[1] = t >> 8 | Scr->Channel() << 3; Codes[2] = t; @@ -266,7 +266,7 @@ uint cDiseqc::SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes } } 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) { Codes[3] = t >> 8 | (t == 0 ? 0 : scrBank << 2) | Scr->Channel() << 5; Codes[4] = t; @@ -399,7 +399,7 @@ const char *cDiseqc::GetCodes(const char *s, uchar *Codes, uint8_t *MaxCodes) co 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) *CurrentAction = commands; diff --git a/diseqc.h b/diseqc.h index eef36a6a..9ae9dc72 100644 --- a/diseqc.h +++ b/diseqc.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -86,7 +86,7 @@ private: mutable int scrBank; char *commands; 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; const char *Wait(const char *s) const; const char *GetPosition(const char *s) const; @@ -96,7 +96,7 @@ public: cDiseqc(void); ~cDiseqc(); 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 ///< with every call. CurrentAction must be the address of a character pointer, ///< which is initialized to NULL. This pointer is used internally while parsing diff --git a/dvbdevice.c b/dvbdevice.c index b3d54c6d..cd928c20 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -329,7 +329,7 @@ private: void ClearEventQueue(void) const; bool GetFrontendStatus(fe_status_t &Status) const; cPositioner *GetPositioner(void); - void ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency); + void ExecuteDiseqc(const cDiseqc *Diseqc, int *Frequency); void ResetToneAndVoltage(void); bool SetFrontend(void); virtual void Action(void); @@ -696,7 +696,7 @@ cPositioner *cDvbTuner::GetPositioner(void) return positioner; } -void cDvbTuner::ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency) +void cDvbTuner::ExecuteDiseqc(const cDiseqc *Diseqc, int *Frequency) { if (!lnbPowerTurnedOn) { 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); if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) { - unsigned int frequency = channel.Frequency(); + int frequency = channel.Frequency(); if (Setup.DiSEqC) { if (const cDiseqc *diseqc = Diseqcs.Get(device->CardIndex() + 1, channel.Source(), frequency, dtp.Polarization(), &scr)) { frequency -= diseqc->Lof(); @@ -829,7 +829,7 @@ bool cDvbTuner::SetFrontend(void) } else { int tone = SEC_TONE_OFF; - if (frequency < (unsigned int)Setup.LnbSLOF) { + if (frequency < Setup.LnbSLOF) { frequency -= Setup.LnbFrequLo; tone = SEC_TONE_OFF; } diff --git a/remux.c b/remux.c index 2e1bc31f..cb694760 100644 --- a/remux.c +++ b/remux.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -1629,7 +1629,7 @@ int cFrameDetector::Analyze(const uchar *Data, int Length) Div += parser->IFrameTemporalReferenceOffset(); if (Div <= 0) Div = 1; - uint32_t Delta = ptsValues[0] / Div; + int Delta = ptsValues[0] / Div; // determine frame info: if (isVideo) { if (Delta == 3753)