summarylogtreecommitdiffstats
path: root/vdr-epgsync-vdr-2.3.2.patch
blob: b66a66c1df10b29cfa9be409f8c59fb032f6f072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Author: fnu
https://www.vdr-portal.de/forum/index.php?thread/130045-produktive-problem-und-pluginl%C3%B6sungen-f%C3%BCr-vdr-2-3-2-und-h%C3%B6her/&postID=1284634#post1284634

Index: b/thread.c
===================================================================
--- a/thread.c
+++ b/thread.c
@@ -42,9 +42,18 @@
 	}
 }
 
+#if APIVERSNUM < 20301
 cChannel *GetChannelByName(const char* Name, const cChannel *IgnoreChannel = NULL, eChannelTypes Type = ctAll)
+#else
+const cChannel *GetChannelByName(const char* Name, const cChannel *IgnoreChannel = NULL, eChannelTypes Type = ctAll)
+#endif
 {
+#if APIVERSNUM < 20301
 	for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) {
+#else
+	LOCK_CHANNELS_READ;
+	for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel)) {
+#endif
 		if (strcasecmp(Name, channel->Name()) == 0 || strcasecmp(Name, channel->ShortName()) == 0) {
 			if (IsType(channel, Type) && channel != IgnoreChannel)
 				return channel;
@@ -95,6 +104,7 @@
 		if (EpgSyncSetup.redirectChannels == rcmId) {
 			// Direct import, no mapping:
 			// loop through local channels, get channels by ID
+#if APIVERSNUM < 20301
 			cSchedulesLock *lock = NULL;
 			for (cChannel *channel = Channels.First(); channel && Running();
 					channel = Channels.Next(channel)) {
@@ -102,13 +112,22 @@
 					lock = new cSchedulesLock();
 				if (cSchedules::Schedules(*lock)->GetSchedule(channel)) {
 					DELETENULL(lock);
+#else
+			LOCK_CHANNELS_READ;
+			for (const cChannel *channel = Channels->First(); channel && Running();
+					channel = Channels->Next(channel)) {
+				LOCK_SCHEDULES_READ;
+				if (Schedules->GetSchedule(channel)) {
+#endif
 					if (CmdLSTE(f, *channel->GetChannelID().ToString())) {
 						AddSchedule(f);
 					}
 					cCondWait::SleepMs(EPGSYNC_SLEEPMS);
 				}
 			}
+#if APIVERSNUM < 20301
 			DELETENULL(lock);
+#endif
 		}
 		else {
 			// Map channels by name:
@@ -182,7 +201,12 @@
 			targetChannel = NULL;
 
 			const char* p = skipspace(s + 1);
+#if APIVERSNUM < 20301
 			cChannel *c = Channels.GetByChannelID(tChannelID::FromString(p));
+#else
+			LOCK_CHANNELS_READ;
+			const cChannel *c = Channels->GetByChannelID(tChannelID::FromString(p));
+#endif
 			bool cOk = IsType(c, (eChannelTypes) EpgSyncSetup.channelTypes);
 
 			if (cOk && EpgSyncSetup.redirectChannels != rcmNameId) {