summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <kamel5 (at) gmx (dot) net>2018-04-01 13:39:31 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2019-01-27 11:38:58 +0100
commit39dfe767fcbb84c8e502c722106ee55390ace062 (patch)
tree9f6abdd04fd22b49d4f54187aed5d4c4e0414d54
parent8f1f2dea33f8b14791df1c6ad7e0145b8c08b817 (diff)
downloadvdr-plugin-tvguide-39dfe767fcbb84c8e502c722106ee55390ace062.tar.gz
vdr-plugin-tvguide-39dfe767fcbb84c8e502c722106ee55390ace062.tar.bz2
Changes for LOCKING
-rw-r--r--channelcolumn.c17
-rw-r--r--recmanager.c40
2 files changed, 33 insertions, 24 deletions
diff --git a/channelcolumn.c b/channelcolumn.c
index 6a65428..acedc01 100644
--- a/channelcolumn.c
+++ b/channelcolumn.c
@@ -43,8 +43,11 @@ void cChannelColumn::drawHeader() {
bool cChannelColumn::readGrids() {
#if VDRVERSNUM >= 20301
+ const cSchedules* schedules;
+ {
LOCK_SCHEDULES_READ;
- const cSchedules* schedules = Schedules;
+ schedules = Schedules;
+ }
#else
schedules = cSchedules::Schedules(*schedulesLock);
#endif
@@ -201,8 +204,11 @@ void cChannelColumn::AddNewGridsAtStart() {
}
//if not, i have to add new ones to the list
#if VDRVERSNUM >= 20301
+ const cSchedules* schedules;
+ {
LOCK_SCHEDULES_READ;
- const cSchedules* schedules = Schedules;
+ schedules = Schedules;
+ }
#else
schedules = cSchedules::Schedules(*schedulesLock);
#endif
@@ -254,8 +260,11 @@ void cChannelColumn::AddNewGridsAtEnd() {
}
//if not, i have to add new ones to the list
#if VDRVERSNUM >= 20301
+ const cSchedules* schedules;
+ {
LOCK_SCHEDULES_READ;
- const cSchedules* schedules = Schedules;
+ schedules = Schedules;
+ }
#else
schedules = cSchedules::Schedules(*schedulesLock);
#endif
@@ -391,4 +400,4 @@ void cChannelColumn::dumpGrids() {
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
i++;
}
-} \ No newline at end of file
+}
diff --git a/recmanager.c b/recmanager.c
index cda65ba..32ac3e8 100644
--- a/recmanager.c
+++ b/recmanager.c
@@ -43,7 +43,7 @@ bool cRecManager::RefreshRemoteTimers(void) {
bool cRecManager::CheckEventForTimer(const cEvent *event) {
bool hasTimer = false;
-
+
if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
RemoteTimers_GetMatch_v1_0 rtMatch;
rtMatch.event = event;
@@ -71,11 +71,11 @@ cTimer *cRecManager::GetTimerForEvent(const cEvent *event) {
#if VDRVERSNUM >= 20301
return timer;
}
- LOCK_TIMERS_READ;
- timer = Timers->GetMatch(event);
+ LOCK_TIMERS_READ;
+ timer = Timers->GetMatch(event);
#else
} else
- timer = Timers.GetMatch(event);
+ timer = Timers.GetMatch(event);
#endif
return timer;
}
@@ -154,7 +154,7 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
std::string newFileName = epgSearch->handler->Evaluate(recDir, event);
if (strchr(newFileName.c_str(), '%') == NULL) // only set directory to new value if all categories could have been replaced
timer->SetFile(newFileName.c_str());
- else
+ else
esyslog("tvguide: timer path not set because replacing variable was not successfull: %s", newFileName.c_str());
}
} else {
@@ -227,7 +227,7 @@ void cRecManager::DeleteTimer(const cTimer *timer) {
LOCK_TIMERS_WRITE;
cTimers* timers = Timers;
cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast
-
+
if (t->Recording()) {
t->Skip();
cRecordControls::Process(timers, time(NULL));
@@ -270,7 +270,7 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
#endif
if (!timer)
return;
-
+
bool active = newTimerSettings.HasFlags(tfActive);
int prio = newTimerSettings.Priority();
int lifetime = newTimerSettings.Lifetime();
@@ -325,7 +325,7 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
#else
Timers.SetModified();
#endif
- }
+ }
}
@@ -455,7 +455,7 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString
Schedule = schedules->GetSchedule(channel);
event = Schedule->GetEvent(eventID);
if (event) {
- searchResults[index] = event;
+ searchResults[index] = event;
} else
return NULL;
} else
@@ -606,7 +606,7 @@ void cRecManager::DeleteSearchTimer(cTVGuideSearchTimer *searchTimer, bool delTi
} else {
esyslog("tvguide: error deleting search timer \"%s\"", searchTimer->SearchString().c_str());
}
- }
+ }
}
void cRecManager::UpdateSearchTimers(void) {
@@ -653,12 +653,12 @@ const cRecording **cRecManager::SearchForRecordings(std::string searchString, in
const cRecording **matchingRecordings = NULL;
#else
cRecording **cRecManager::SearchForRecordings(std::string searchString, int &numResults) {
-
+
cRecording **matchingRecordings = NULL;
#endif
int num = 0;
numResults = 0;
-
+
#if VDRVERSNUM >= 20301
LOCK_RECORDINGS_READ;
for (const cRecording *recording = Recordings->First(); recording; recording = Recordings->Next(recording)) {
@@ -668,12 +668,12 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
std::string s1 = recording->Name();
std::string s2 = searchString;
if (s1.empty() || s2.empty()) continue;
-
+
// tolerance for fuzzy searching: 90% of the shorter text length, but at least 1
- int tolerance = std::max(1, (int)std::min(s1.size(), s2.size()) / 10);
+ int tolerance = std::max(1, (int)std::min(s1.size(), s2.size()) / 10);
bool match = FindIgnoreCase(s1, s2) >= 0 || FindIgnoreCase(s2, s1) >= 0;
-
+
if (!match) {
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
if (s1.size() > 32) s1 = s1.substr(0, 32);
@@ -683,7 +683,7 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
afuzzy_free(&af);
match = (res > 0);
}
-
+
if (!match) {
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
if (s2.size() > 32) s2 = s2.substr(0, 32);
@@ -693,7 +693,7 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
afuzzy_free(&af);
match = (res > 0);
}
-
+
if (match) {
#if VDRVERSNUM >= 20301
matchingRecordings = (const cRecording **)realloc(matchingRecordings, (num + 1) * sizeof(cRecording *));
@@ -729,7 +729,7 @@ const cEvent **cRecManager::LoadReruns(const cEvent *event, int &numResults) {
data.channelNr = 0;
data.useTitle = true;
data.useDescription = false;
-
+
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
if (!list)
@@ -822,7 +822,7 @@ const cEvent **cRecManager::WhatsOnNow(bool nowOrNext, int &numResults) {
numResults = tmpResults.size();
const cEvent **results = new const cEvent *[numResults];
for (int i=0; i<numResults; i++) {
- results[i] = tmpResults[i];
+ results[i] = tmpResults[i];
}
return results;
@@ -899,7 +899,7 @@ const cEvent **cRecManager::UserDefinedTime(int userTime, int &numResults) {
numResults = tmpResults.size();
const cEvent **results = new const cEvent *[numResults];
for (int i=0; i<numResults; i++) {
- results[i] = tmpResults[i];
+ results[i] = tmpResults[i];
}
return results;
}