diff options
-rw-r--r-- | HISTORY.h | 9 | ||||
-rw-r--r-- | Make.config | 26 | ||||
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | epg2vdr.c | 2 | ||||
-rw-r--r-- | handler.h | 6 | ||||
-rw-r--r-- | lib/common.h | 3 | ||||
-rw-r--r-- | lib/db.h | 2 | ||||
-rw-r--r-- | lib/searchtimer.h | 2 | ||||
-rw-r--r-- | menu.c | 2 | ||||
-rw-r--r-- | menu.h | 4 | ||||
-rw-r--r-- | menusched.c | 10 | ||||
-rw-r--r-- | parameters.c | 13 | ||||
-rw-r--r-- | recinfofile.c | 36 | ||||
-rw-r--r-- | svdrpclient.c | 8 | ||||
-rw-r--r-- | svdrpclient.h | 7 | ||||
-rw-r--r-- | ttools.c | 2 | ||||
-rw-r--r-- | update.c | 2 | ||||
-rw-r--r-- | update.h | 2 |
18 files changed, 77 insertions, 66 deletions
@@ -5,8 +5,8 @@ * */ -#define _VERSION "1.1.50" -#define VERSION_DATE "19.03.2017" +#define _VERSION "1.1.51" +#define VERSION_DATE "20.03.2017" #define DB_API 4 @@ -19,6 +19,11 @@ /* * ------------------------------------ +2017-03-20: version 1.1.51 (horchi) + - change: Removed compiler warnings when using clang + - added: Added clang++ to Make.config (as optional compiler) + - change: Fixed APIVERSION check for VDR < 2.2.0 (thx to nobanzai) + 2017-03-19: version 1.1.50 (horchi) - bugfix: Fixed AMC address lookup diff --git a/Make.config b/Make.config index a7e2c8b..66bf692 100644 --- a/Make.config +++ b/Make.config @@ -10,11 +10,17 @@ PREFIX = /usr/local DEBUG = 1 +#USE_CLANG = 1 # ----------------------- # don't touch below ;) -CC = g++ +ifdef USE_CLANG + CC = clang++ +else + CC = g++ +endif + doCompile = $(CC) -c $(CFLAGS) $(DEFINES) doLink = $(CC) $(LFLAGS) doLib = ar -rs @@ -28,14 +34,20 @@ ifdef DEBUG CXXFLAGS += -ggdb -O0 endif -CXXFLAGS += -fPIC -Wreturn-type -Wall -Wno-parentheses -Wformat -pedantic \ - -Wno-long-long -Wunused-variable -Wunused-label -Wno-unused-result \ - -Wunused-value -Wunused-but-set-variable -Wunused-function -Wno-variadic-macros \ - -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CXXFLAGS += -fPIC -Wreturn-type -Wall -Wno-parentheses -Wformat -pedantic \ + -Wno-long-long -Wunused-variable -Wunused-label -Wno-unused-result \ + -Wunused-value -Wunused-function -Wno-variadic-macros \ + -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CXXFLAGS += -std=c++11 -D__STDC_FORMAT_MACROS -CXXFLAGS += -std=c++11 -D__STDC_FORMAT_MACROS +ifdef USE_CLANG + CXXFLAGS += -x c++ -Wunused-const-variable +else + CXXFLAGS += -Wunused-but-set-variable +endif -CFLAGS += $(CXXFLAGS) +DEFINES += -D__STL_CONFIG_H +CFLAGS += $(CXXFLAGS) %.o: %.c $(doCompile) -o $@ $< @@ -117,11 +117,12 @@ hlib: ### Implicit rules: %.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< + $(doCompile) $(INCLUDES) -o $@ $< +# $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< ### Dependencies: -MAKEDEP = $(CXX) -MM -MG +MAKEDEP = $(CC) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile $(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ @@ -157,7 +158,7 @@ install-i18n: $(I18Nmsgs) ### Targets: $(SOFILE): hlib $(OBJS) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ + $(CC) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ install-lib: $(SOFILE) install -D -m644 $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) @@ -14,7 +14,7 @@ #include "menu.h" #include "handler.h" -#if defined (APIVERSNUM) && (APIVERSNUM < 20200) +#if defined (APIVERSNUM) || (APIVERSNUM < 20200) # error VDR API versions < 2.2.0 are not supported ! #endif @@ -480,7 +480,7 @@ class cEpgHandlerInstance return true; } - uchar currentTableId = ::max(uchar(evtMemList[evtKey].tableid), uchar(0x4E)); + uchar currentTableId = std::max(uchar(evtMemList[evtKey].tableid), uchar(0x4E)); // skip bigger ids as current @@ -596,7 +596,7 @@ class cEpgHandlerInstance eventsDb->getValue("DELFLG")->setNull(); } - if (!insert && abs(event->StartTime() - eventsDb->getIntValue("StartTime")) > 6*tmeSecondsPerHour) + if (!insert && std::abs(event->StartTime() - eventsDb->getIntValue("StartTime")) > 6*tmeSecondsPerHour) { tell(3, "Handler: Info: Start time of %d/%s - '%s' moved %ld hours from %s to %s - '%s'", event->EventID(), (const char*)channelId.ToString(), @@ -892,7 +892,7 @@ class cEpgHandlerInstance cDbStatement* selectMergeSp; cDbStatement* selectEventByStarttime; - cUpdate* update; + // cUpdate* update; }; //*************************************************************************** diff --git a/lib/common.h b/lib/common.h index df1c236..28536ec 100644 --- a/lib/common.h +++ b/lib/common.h @@ -45,7 +45,6 @@ class MemoryStruct; inline long min(long a, long b) { return a < b ? a : b; } inline long max(long a, long b) { return a > b ? a : b; } #else -# define __STL_CONFIG_H # include <vdr/tools.h> #endif @@ -133,7 +132,7 @@ int gunzip(MemoryStruct* zippedData, MemoryStruct* unzippedData); // MemoryStruct //*************************************************************************** -struct MemoryStruct +class MemoryStruct { public: @@ -1055,7 +1055,7 @@ class cDbConnection MYSQL* mysql; - int initialized; + // int initialized; int attached; int inTact; int connectDropped; diff --git a/lib/searchtimer.h b/lib/searchtimer.h index ecd3624..c99bc6b 100644 --- a/lib/searchtimer.h +++ b/lib/searchtimer.h @@ -65,9 +65,9 @@ class cSearchTimer cDbStatement* selectDoneTimer; cDbStatement* selectActiveSearchtimers; cDbStatement* selectSearchtimerMaxModSp; - cDbStatement* selectActiveVdrs; cDbStatement* selectAllTimer; cDbStatement* selectTimerByEvent; + // cDbStatement* selectActiveVdrs; // cDbStatement* selectConflictingTimers; cDbValue startValue; @@ -511,7 +511,7 @@ int cMenuDb::initUserTimes() { char* time; - if (time = strchr(p, '=')) + if ((time = strchr(p, '='))) *time++ = 0; if (!isEmpty(time)) @@ -359,7 +359,7 @@ class cMenuEpgSearchTimers : public cOsdMenu private: cMenuDb* menuDb; - int helpKeys; + // int helpKeys; }; //*************************************************************************** @@ -452,7 +452,7 @@ class cMenuEpgWhatsOn : public cOsdMenu int helpKeys; time_t helpKeyTime; int helpKeyTimeMode; - int timerState; + // int timerState; eOSState Record(); eOSState Switch(); bool Update(); diff --git a/menusched.c b/menusched.c index c2521e3..40b345d 100644 --- a/menusched.c +++ b/menusched.c @@ -5,8 +5,6 @@ * */ -#define __STL_CONFIG_H - #include <string> #include <vdr/menuitems.h> @@ -207,7 +205,7 @@ cMenuEpgScheduleItem::cMenuEpgScheduleItem(cMenuDb* db, const cEvent* Event, char* bp; size_t size; - if (inMem = open_memstream(&bp, &size)) + if ((inMem = open_memstream(&bp, &size))) { Event->Dump(inMem, "", yes); fflush(inMem); @@ -436,7 +434,7 @@ int cMenuEpgEvent::setEvent(const cEvent* Event, int timerMatch) { const cEvent* e; - if (e = getNextPrevEvent(event, -1)) + if ((e = getNextPrevEvent(event, -1))) { if (dispSchedule) prevTime = l2pTime(e->StartTime(), "%H:%M"); @@ -444,7 +442,7 @@ int cMenuEpgEvent::setEvent(const cEvent* Event, int timerMatch) prevChannel = channels->GetByChannelID(e->ChannelID(), true); } - if (e = getNextPrevEvent(event, +1)) + if ((e = getNextPrevEvent(event, +1))) { if (dispSchedule) nextTime = l2pTime(e->StartTime(), "%H:%M"); @@ -1037,7 +1035,7 @@ eOSState cMenuEpgWhatsOn::Record() if (!item) return osContinue; - if (timerid = menuDb->lookupTimer(item->epgEvent, timerMatch, remote)) // -> loads timerDb and vdrDb + if ((timerid = menuDb->lookupTimer(item->epgEvent, timerMatch, remote))) // -> loads timerDb and vdrDb { menuDb->timerDb->clear(); menuDb->timerDb->setValue("ID", timerid); diff --git a/parameters.c b/parameters.c index 05b0eba..fdd3e4b 100644 --- a/parameters.c +++ b/parameters.c @@ -87,7 +87,7 @@ cParameters::Parameter* cParameters::getDefinition(const char* owner, const char if (owner[0] == '@') owner = "@"; - + if (strcmp(owner, "epgd") == 0 && strstr(name, ".md5")) name = "md5"; @@ -161,12 +161,12 @@ int cParameters::getParameter(const char* owner, const char* name, char* value) if (strcasecmp(owner, "uuid") == 0) owner = Epg2VdrConfig.uuid; - + parametersDb->clear(); parametersDb->setValue("OWNER", owner); parametersDb->setValue("NAME", name); - if (found = parametersDb->find()) + if ((found = parametersDb->find())) { if (value) sprintf(value, "%s", parametersDb->getStrValue("Value")); @@ -193,7 +193,7 @@ int cParameters::getParameter(const char* owner, const char* name, long int& val int found; found = getParameter(owner, name, txt); - + if (!isEmpty(txt)) value = atol(txt); else @@ -203,7 +203,7 @@ int cParameters::getParameter(const char* owner, const char* name, long int& val } //*************************************************************************** -// Set String Parameter +// Set String Parameter //*************************************************************************** int cParameters::setParameter(const char* owner, const char* name, const char* value) @@ -227,7 +227,7 @@ int cParameters::setParameter(const char* owner, const char* name, const char* v { if (rep(value, definition->regexp) != success) { - tell(0, "Ignoring '%s' for parameter '%s/%s' don't match expression '%s'", + tell(0, "Ignoring '%s' for parameter '%s/%s' don't match expression '%s'", value, owner, name, definition->regexp); return fail; @@ -250,4 +250,3 @@ int cParameters::setParameter(const char* owner, const char* name, long int valu return setParameter(owner, name, txt); } - diff --git a/recinfofile.c b/recinfofile.c index cc957da..6c1b00c 100644 --- a/recinfofile.c +++ b/recinfofile.c @@ -37,7 +37,7 @@ const char* cEventDetails::fields[] = "SCRSERIESID", "SCRSERIESEPISODE", "SCRMOVIEID", - + // just in recordinglist, not in events or useevents row "CHANNELNAME", @@ -57,7 +57,7 @@ void cEventDetails::setValue(const char* name, const char* value) std::map<std::string,std::string>::iterator it; it = values.find(name); - + if (it == values.end() || it->first != value) { changes++; @@ -162,24 +162,24 @@ int cEventDetails::storeToFs(const char* path) FILE* f; char* fileName = 0; std::map<std::string,std::string>::iterator it; - + asprintf(&fileName, "%s/info.epg2vdr", path); - + if (!(f = fopen(fileName, "w"))) { tell(0, "Error opening file '%s' failed, %s", fileName, strerror(errno)); free(fileName); - + return fail; } - + tell(0, "Storing event details to '%s'", fileName); - - // store fields - + + // store fields + for (it = values.begin(); it != values.end(); it++) fprintf(f, "%s: %s\n", it->first.c_str(), it->second.c_str()); - + free(fileName); fclose(f); @@ -211,32 +211,32 @@ int cEventDetails::loadFromFs(const char* path) { tell(0, "Error opening file '%s' failed, %s", fileName, strerror(errno)); free(fileName); - + return fail; } - + tell(3, "Loading event details from '%s'", fileName); - - // load fields - + + // load fields + char* p; char* s; cReadLine readLine; - while (s = readLine.Read(f)) + while ((s = readLine.Read(f))) { if (!(p = strchr(s, ':'))) { tell(0, " "); continue; } - + *(p++) = 0; p = skipspace(rTrim(p)); if (!isEmpty(p)) values[s] = p; - } + } free(fileName); fclose(f); diff --git a/svdrpclient.c b/svdrpclient.c index 53be015..8b1ee54 100644 --- a/svdrpclient.c +++ b/svdrpclient.c @@ -479,7 +479,7 @@ int cSvdrpClient::connect() { // map hostname to ip - if (hostInfo = ::gethostbyname(ip)) + if ((hostInfo = ::gethostbyname(ip))) memcpy((char*)&remoteAddr, hostInfo->h_addr, hostInfo->h_length); else if ((remoteAddr = inet_addr(ip)) == INADDR_NONE) @@ -515,7 +515,7 @@ int cSvdrpClient::connect() { if (errno != EINPROGRESS) { - tell(0, "SVDRPCL: connect to %s:%hu failed: %s", ip, port, strerror(errno)); + tell(0, "SVDRPCL: connect to %s:%d failed: %s", ip, port, strerror(errno)); return -1; } @@ -554,7 +554,7 @@ int cSvdrpClient::connect() if (result != 0) { - tell(0, "SVDRPCL: Error connecting to %s:%hu: %s", ip, port, strerror(errno)); + tell(0, "SVDRPCL: Error connecting to %s:%d: %s", ip, port, strerror(errno)); ::close(sock); return -1; @@ -597,7 +597,7 @@ int cSvdrpClient::open() if (greeting.First() && greeting.First()->Text()) msg = greeting.First()->Text(); - tell(2, "SVDRPCL: connected to %s:%hu '%s'", ip, port, msg); + tell(2, "SVDRPCL: connected to %s:%d '%s'", ip, port, msg); return 0; } diff --git a/svdrpclient.h b/svdrpclient.h index f0f7078..d927c47 100644 --- a/svdrpclient.h +++ b/svdrpclient.h @@ -17,12 +17,11 @@ #include "lib/common.h" #ifdef VDR_PLUGIN -# define __STL_CONFIG_H # include <vdr/tools.h> #else //*************************************************************************** -// +// //*************************************************************************** class cListObject { @@ -109,7 +108,7 @@ public: // Line //*************************************************************************** -class cLine : public cListObject +class cLine : public cListObject { public: @@ -128,7 +127,7 @@ class cLine : public cListObject // SVDRP Client //*************************************************************************** -class cSvdrpClient +class cSvdrpClient { private: @@ -666,7 +666,7 @@ cEpgEvent* createEventCopy(const cEvent* event) char* bp; size_t size; - if (inMem = open_memstream(&bp, &size)) + if ((inMem = open_memstream(&bp, &size))) { event->Dump(inMem, "", yes); fflush(inMem); @@ -1429,7 +1429,7 @@ int cUpdate::refreshEpg(const char* forChannelId, int maxTries) // get event / timer - if (event = s->GetEvent(eventsDb->getIntValue("USEID"))) + if ((event = s->GetEvent(eventsDb->getIntValue("USEID")))) { if (Us::isRemove(updFlg)) tell(2, "Remove event %uld of channel '%s' due to updflg %c", @@ -11,8 +11,6 @@ #include <mysql/mysql.h> #include <queue> -#define __STL_CONFIG_H - #include <vdr/status.h> #include "lib/common.h" |