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

Added an 'int' typecast to calculations involving FramesPerSecond() to avoid compiler warnings

This commit is contained in:
Klaus Schmidinger 2009-01-24 11:42:24 +01:00
parent c2ecee3d40
commit fa848a6f2e
4 changed files with 12 additions and 8 deletions

View File

@ -5956,3 +5956,5 @@ Video Disk Recorder Revision History
the actual pids of the channel. the actual pids of the channel.
- Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if - Fixed cDevice::PlayTsAudio() and made cDevice::PlayTsVideo() return 0 if
PlayVideo() didn't play anything. PlayVideo() didn't play anything.
- Added an 'int' typecast to calculations involving FramesPerSecond() to avoid
compiler warnings.

View File

@ -4,10 +4,11 @@
* 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: dvbplayer.c 2.1 2009/01/05 16:52:40 kls Exp $ * $Id: dvbplayer.c 2.2 2009/01/24 11:42:07 kls Exp $
*/ */
#include "dvbplayer.h" #include "dvbplayer.h"
#include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include "recording.h" #include "recording.h"
#include "remux.h" #include "remux.h"
@ -347,7 +348,7 @@ bool cDvbPlayer::Save(void)
if (index) { if (index) {
int Index = writeIndex; int Index = writeIndex;
if (Index >= 0) { if (Index >= 0) {
Index -= RESUMEBACKUP * framesPerSecond; Index -= int(round(RESUMEBACKUP * framesPerSecond));
if (Index > 0) if (Index > 0)
Index = index->GetNextIFrame(Index, false); Index = index->GetNextIFrame(Index, false);
else else

7
menu.c
View File

@ -4,12 +4,13 @@
* 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: menu.c 2.4 2009/01/06 14:34:17 kls Exp $ * $Id: menu.c 2.5 2009/01/24 11:42:24 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -4170,8 +4171,8 @@ void cReplayControl::TimeSearchProcess(eKeys Key)
{ {
#define STAY_SECONDS_OFF_END 10 #define STAY_SECONDS_OFF_END 10
int Seconds = (timeSearchTime >> 24) * 36000 + ((timeSearchTime & 0x00FF0000) >> 16) * 3600 + ((timeSearchTime & 0x0000FF00) >> 8) * 600 + (timeSearchTime & 0x000000FF) * 60; int Seconds = (timeSearchTime >> 24) * 36000 + ((timeSearchTime & 0x00FF0000) >> 16) * 3600 + ((timeSearchTime & 0x0000FF00) >> 8) * 600 + (timeSearchTime & 0x000000FF) * 60;
int Current = (lastCurrent / FramesPerSecond()); int Current = int(round(lastCurrent / FramesPerSecond()));
int Total = (lastTotal / FramesPerSecond()); int Total = int(round(lastTotal / FramesPerSecond()));
switch (Key) { switch (Key) {
case k0 ... k9: case k0 ... k9:
if (timeSearchPos < 4) { if (timeSearchPos < 4) {

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: recording.c 2.6 2009/01/18 11:02:09 kls Exp $ * $Id: recording.c 2.7 2009/01/24 11:31:16 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1698,7 +1698,7 @@ cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond)
{ {
char buffer[16]; char buffer[16];
double Seconds; double Seconds;
int f = modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1; int f = int(modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1);
int s = int(Seconds); int s = int(Seconds);
int m = s / 60 % 60; int m = s / 60 % 60;
int h = s / 3600; int h = s / 3600;
@ -1720,7 +1720,7 @@ int HMSFToIndex(const char *HMSF, double FramesPerSecond)
int SecondsToFrames(int Seconds, double FramesPerSecond) int SecondsToFrames(int Seconds, double FramesPerSecond)
{ {
return round(Seconds * FramesPerSecond); return int(round(Seconds * FramesPerSecond));
} }
// --- ReadFrame ------------------------------------------------------------- // --- ReadFrame -------------------------------------------------------------