summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--dvbdevice.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/HISTORY b/HISTORY
index 3c3b7605..57c7b08c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8995,3 +8995,5 @@ Video Disk Recorder Revision History
- CAMs are now sent a generated EIT packet that contains a single 'present event' for
the current SID, in order to avoid any parental rating dialogs.
+- Fixed handling UNC values (the shift operator behaves unexpected for shift values
+ larger than the size of the variable).
diff --git a/dvbdevice.c b/dvbdevice.c
index 3a900a3a..70a4809b 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.9 2017/04/20 14:42:35 kls Exp $
+ * $Id: dvbdevice.c 4.10 2017/05/01 12:48:55 kls Exp $
*/
#include "dvbdevice.h"
@@ -844,13 +844,16 @@ int cDvbTuner::GetSignalQuality(void) const
// be considered low even if there haven't been any more uncorrected bocks
// for quite a while.
Unc = lastUncDelta;
- int t = time(NULL) - lastUncChange - 2;
- if (t > 0)
- Unc >>= min(t, 32);
+ if (Unc > 0) {
+ int t = time(NULL) - lastUncChange - 2;
+ if (t > 0)
+ Unc >>= min(t, int(sizeof(Unc) * 8 - 1));
+ if (Unc == 0)
+ lastUncDelta = 0;
#ifdef DEBUG_SIGNALQUALITY
- if (Unc > 0)
fprintf(stderr, "FE %d/%d: API3 UNC = %u\n", adapter, frontend, Unc);
#endif
+ }
break;
}
if (errno != EINTR) {