diff options
author | horchi <vdr@jwendel.de> | 2018-01-24 10:46:14 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2018-01-24 10:46:14 +0100 |
commit | 07cf0fb8c54a4c0df01e6b3ab9885621dfa2e18d (patch) | |
tree | e767ed162438f3d07ae99ed81243713ea8d75c5e /recinfofile.c | |
parent | ba7575c2d0dc620ef91c49c71af394219cd600f7 (diff) | |
download | vdr-plugin-epg2vdr-07cf0fb8c54a4c0df01e6b3ab9885621dfa2e18d.tar.gz vdr-plugin-epg2vdr-07cf0fb8c54a4c0df01e6b3ab9885621dfa2e18d.tar.bz2 |
2018-01-24 version 1.1.79 (horchi)\n - change: minor changes, fixes and code cleanup\n\n1.1.79
Diffstat (limited to 'recinfofile.c')
-rw-r--r-- | recinfofile.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/recinfofile.c b/recinfofile.c index 5a29eae..dd9991c 100644 --- a/recinfofile.c +++ b/recinfofile.c @@ -55,14 +55,14 @@ const char* cEventDetails::fields[] = void cEventDetails::setValue(const char* name, const char* value) { - std::map<std::string,std::string>::iterator it; + // std::map<std::string,std::string>::iterator it; - it = values.find(name); + auto it = values.find(name); - if (it == values.end() || it->first != value) + if (it == values.end() || it->second != value) { changes++; - values[name] = value; + values[name] = value ? value : ""; } } @@ -77,7 +77,7 @@ void cEventDetails::setValue(const char* name, int value) int cEventDetails::updateByRow(cDbRow* row) { - std::map<std::string,std::string>::iterator it; + // std::map<std::string,std::string>::iterator it; for (int i = 0; fields[i]; i++) { @@ -106,7 +106,7 @@ int cEventDetails::updateByRow(cDbRow* row) continue; } - it = values.find(fields[i]); + auto it = values.find(fields[i]); if (it == values.end() || it->second != v) { @@ -215,14 +215,17 @@ int cEventDetails::storeToFs(const char* path) // Load From Fs //*************************************************************************** -int cEventDetails::loadFromFs(const char* path) +int cEventDetails::loadFromFs(const char* path, cDbRow* row, int doClear) { FILE* f; char* fileName = 0; std::map<std::string,std::string>::iterator it; - values.clear(); - changes = 0; + if (doClear) + { + values.clear(); + changes = 0; + } asprintf(&fileName, "%s/info.epg2vdr", path); @@ -259,6 +262,12 @@ int cEventDetails::loadFromFs(const char* path) *(p++) = 0; p = skipspace(rTrim(p)); + if (!row->getTableDef()->getField(s, /*silent*/ yes)) + { + tell(0, "Warning: Ignoring unexpected field '%s' in '%s'", s, fileName); + continue; + } + if (!isEmpty(p)) { char* value = strdup(p); |