mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Added an EPG bugfix for broadcasters who put literal "\n" strings in their EPG
This commit is contained in:
parent
db81c07b27
commit
32b11e1a53
5
HISTORY
5
HISTORY
@ -9919,10 +9919,13 @@ Video Disk Recorder Revision History
|
||||
- A device is now always kept occupied if a timer is in VPS margin or needs the
|
||||
transponder (thanks to Markus Ehrnsperger).
|
||||
|
||||
2024-06-13:
|
||||
2024-06-21:
|
||||
|
||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||
- Fixed a possible access of a deleted object in the EIT scanner.
|
||||
- Fixed setting T2 system ID from NIT (thanks to Stefan Herdler).
|
||||
- When starting an editing process, VDR now first checks whether there is enough
|
||||
free disk space to take up the edited version of the recording.
|
||||
- Added an EPG bugfix for broadcasters who put literal "\n" strings in their EPG.
|
||||
Note that the string version of strreplace() has been modified, so that it
|
||||
replaces all occurrences of the search string, not just the first one.
|
||||
|
19
epg.c
19
epg.c
@ -7,7 +7,7 @@
|
||||
* Original version (as used in VDR before 1.3.0) written by
|
||||
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
|
||||
*
|
||||
* $Id: epg.c 5.8 2024/03/06 20:16:51 kls Exp $
|
||||
* $Id: epg.c 5.9 2024/06/21 06:27:20 kls Exp $
|
||||
*/
|
||||
|
||||
#include "epg.h"
|
||||
@ -885,6 +885,23 @@ void cEvent::FixEpgBugs(void)
|
||||
|
||||
Final:
|
||||
|
||||
// And then there are the specially gifted people who put a literal "\n" string where there should be
|
||||
// a '\n' character:
|
||||
if (shortText) {
|
||||
if (char *p = strstr(shortText, "\\n")) {
|
||||
*p = 0;
|
||||
p += 2;
|
||||
char *s = strdup(shortText);
|
||||
char *d = strdup(cString::sprintf("%s\n\n%s", p, description));
|
||||
free(shortText);
|
||||
free(description);
|
||||
shortText = s;
|
||||
description = d;
|
||||
EpgBugFixStat(12, ChannelID());
|
||||
}
|
||||
}
|
||||
description = strreplace(description, "\\n", " \n");
|
||||
|
||||
// VDR can't usefully handle newline characters in the title, shortText or component description of EPG
|
||||
// data, so let's always convert them to blanks (independent of the setting of EPGBugfixLevel):
|
||||
strreplace(title, '\n', ' ');
|
||||
|
35
tools.c
35
tools.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.c 5.10 2024/02/15 14:57:56 kls Exp $
|
||||
* $Id: tools.c 5.11 2024/06/21 06:27:20 kls Exp $
|
||||
*/
|
||||
|
||||
#include "tools.h"
|
||||
@ -151,26 +151,29 @@ char *strreplace(char *s, char c1, char c2)
|
||||
|
||||
char *strreplace(char *s, const char *s1, const char *s2)
|
||||
{
|
||||
if (!s || !s1 || !s2)
|
||||
if (!s || !s1 || !s2 || strcmp(s1, s2) == 0)
|
||||
return s;
|
||||
char *p = strstr(s, s1);
|
||||
if (p) {
|
||||
int of = p - s;
|
||||
char *q = s;
|
||||
if (char *p = strstr(s, s1)) {
|
||||
int l = strlen(s);
|
||||
int l1 = strlen(s1);
|
||||
int l2 = strlen(s2);
|
||||
if (l2 > l1) {
|
||||
if (char *NewBuffer = (char *)realloc(s, l + l2 - l1 + 1))
|
||||
s = NewBuffer;
|
||||
else {
|
||||
esyslog("ERROR: out of memory");
|
||||
return s;
|
||||
do {
|
||||
int of = p - s;
|
||||
if (l2 > l1) {
|
||||
if (char *NewBuffer = (char *)realloc(s, l + l2 - l1 + 1))
|
||||
s = NewBuffer;
|
||||
else {
|
||||
esyslog("ERROR: out of memory");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
char *sof = s + of;
|
||||
if (l2 != l1)
|
||||
memmove(sof + l2, sof + l1, l - of - l1 + 1);
|
||||
memcpy(sof, s2, l2);
|
||||
char *sof = s + of;
|
||||
if (l2 != l1)
|
||||
memmove(sof + l2, sof + l1, l - of - l1 + 1);
|
||||
memcpy(sof, s2, l2);
|
||||
q = sof + l2;
|
||||
} while (p = strstr(q, s1));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user