diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-01-14 13:00:47 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-01-14 13:00:47 +0100 |
commit | 262f20eaa03e03b7db88a1def47ae95bc7703682 (patch) | |
tree | 1b6b00a2edf35778746249b945fe4a3f42435679 | |
parent | a7d8c92ddcd5d964930e2f0004b30702111884b4 (diff) | |
download | vdr-262f20eaa03e03b7db88a1def47ae95bc7703682.tar.gz vdr-262f20eaa03e03b7db88a1def47ae95bc7703682.tar.bz2 |
Changed IndexToHMSF() so that it can handle negative Index values
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | recording.c | 11 |
2 files changed, 9 insertions, 5 deletions
@@ -6781,7 +6781,7 @@ Video Disk Recorder Revision History - Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg). - Fixed a crash with malformed SI data (patch from vdr-portal). -2012-01-12: Version 1.7.23 +2012-01-14: Version 1.7.23 - Removed the '.pl' suffix from svdrpsend.pl (sorry, I missed that one). - Fixed bonding more than two devices. @@ -6825,3 +6825,4 @@ Video Disk Recorder Revision History - The parameters that are only used by "second generation" delivery systems (DVB-S2 and DVB-T2) are no longer written into channels.conf for "first generation" delivery systems (DVB-S and DVB-T). +- Changed IndexToHMSF() so that it can handle negative Index values. diff --git a/recording.c b/recording.c index 698b2db0..cb4918e3 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.41 2011/12/10 14:22:37 kls Exp $ + * $Id: recording.c 2.42 2012/01/14 12:50:58 kls Exp $ */ #include "recording.h" @@ -2035,15 +2035,18 @@ cUnbufferedFile *cFileName::NextFile(void) cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond) { - char buffer[16]; + const char *Sign = ""; + if (Index < 0) { + Index = -Index; + Sign = "-"; + } double Seconds; int f = int(modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1); int s = int(Seconds); int m = s / 60 % 60; int h = s / 3600; s %= 60; - snprintf(buffer, sizeof(buffer), WithFrame ? "%d:%02d:%02d.%02d" : "%d:%02d:%02d", h, m, s, f); - return buffer; + return cString::sprintf(WithFrame ? "%s%d:%02d:%02d.%02d" : "%s%d:%02d:%02d", Sign, h, m, s, f); } int HMSFToIndex(const char *HMSF, double FramesPerSecond) |