Compilation fixes for newer compiler, readdir_r to readdir
authorChris Tallon <chris@vomp.tv>
Sat, 11 Feb 2017 16:21:21 +0000 (16:21 +0000)
committerChris Tallon <chris@vomp.tv>
Sat, 11 Feb 2017 16:21:21 +0000 (16:21 +0000)
Makefile
config.c
mediafile.c
picturereader.c
vompclient.c
vompclientrrproc.c

index 3bca88fa1a8e73074309f7bd80cd37c265a26c56..b6a0d99ed9cb7b023341f01e053302757039c886 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ SOFILE = libvdr-$(PLUGIN).so
 
 INCLUDES +=
 
-DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D__STL_CONFIG_H
 
 # VOMP-INSERT
 DEFINES += -DVOMPSERVER
index 3866abc7582c069e27a8e3a9f3132185afbd011c..f4a5e01173a098734d5443f03c0617870ea5410b 100644 (file)
--- a/config.c
+++ b/config.c
@@ -137,7 +137,7 @@ FILE* Config::copyToHere(long position)
 
   while (newPos < position)
   {
-    fgets(buffer, BUFFER_LENGTH-1, file);
+    if (!fgets(buffer, BUFFER_LENGTH-1, file)) break;
     fputs(buffer, newFile);
     newPos += strlen(buffer);
   }
@@ -183,7 +183,8 @@ int Config::deleteValue(const char* section, char* key)
   }
 
   FILE* newFile = copyToHere(ftell(file) - lastLineLength);
-  fgets(buffer, BUFFER_LENGTH-1, file);
+
+  if (  fgets(buffer, BUFFER_LENGTH-1, file)  );
 
   return copyRest(newFile);
 }
@@ -226,7 +227,7 @@ int Config::setValueString(const char* section, const char* key, const char* new
         return 0;
       }
 
-      fgets(buffer, BUFFER_LENGTH-1, file);
+      if (  fgets(buffer, BUFFER_LENGTH-1, file)  );
       fprintf(newFile, "%s = %s\n", key, newValue);
       return copyRest(newFile);
     }
index 93bbfcad139b7f7fe2e435047fca6f06d5c5ac50..a148e5d14c0f8ad948e47cc3f68bb9cd6cce52db 100644 (file)
@@ -121,13 +121,19 @@ MediaList* MediaFile::getMediaList(const MediaURI * parent){
   const char *dirname=parent->getName();
   //open the directory and read out the entries
   DIR *d=opendir(dirname);
+  if (d == NULL) return rt;
   struct dirent *e;
+
+  /* readdir_r is now deprecated in favour of readdir (which is effectively thread safe)
   union { // according to "The GNU C Library Reference Manual"
     struct dirent d;
     char b[offsetof(struct dirent, d_name) + NAME_MAX + 1];
     } u;
 
   while (d != NULL && (readdir_r(d,&u.d,&e) == 0) && e != NULL) {
+  */
+
+  while (e = readdir(d)) {
     const char * fname=e->d_name;
     if ( fname == NULL) continue;
     if (strcmp(fname,".") == 0) continue;
@@ -141,9 +147,9 @@ MediaList* MediaFile::getMediaList(const MediaURI * parent){
       if (m) delete m;
     }
   }
-  if (d != NULL) closedir(d);
+  closedir(d);
   return rt;
-  }
+}
 
 
 int MediaFile::openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize) {
index d2a7a66a03d0e8af9beb3f22dad0ab2239878241..53e3d11869cb62c5bbe2154131ca5580c18a2701 100644 (file)
@@ -83,8 +83,8 @@ std::string PictureReader::getPictName(TVMediaRequest & req)
 
    switch (req.type) {
    case 0: { //serie
-      if (series.seriesId != req.primary_id ||
-          series.episodeId != req.secondary_id) {
+      if (series.seriesId != (int)req.primary_id ||
+          series.episodeId != (int)req.secondary_id) {
           series.actors.clear();
           series.posters.clear();
           series.banners.clear();
@@ -147,7 +147,7 @@ std::string PictureReader::getPictName(TVMediaRequest & req)
        return std::string("");
    } break;
    case 1: { //movie
-      if (movie.movieId != req.primary_id ) {
+      if (movie.movieId != (int)req.primary_id ) {
           movie.actors.clear();
           movie.movieId = req.primary_id;
           x->scraper->Service("GetMovie",&movie);
@@ -295,7 +295,6 @@ void PictureReader::threadMethod()
   ULONG *p;
   ULONG headerLength = sizeof(ULONG) * 4;
   UCHAR buffer[headerLength];
-  int amountReceived;
 
 //   threadSetKillable(); ??
 
index 6724231dc32c2b209756141ba4392d532420c6dc..118eb5cd5125940c5f18b18b69f5319f55740315 100644 (file)
@@ -417,19 +417,8 @@ cChannel* VompClient::channelFromNumber(ULONG channelNumber)
   {
     if (!channel->GroupSep())
     {
-//      log->log("Client", Log::DEBUG, "Looking for channel %lu::: number: %i name: '%s'", channelNumber, channel->Number(), channel->Name());
-
-      if (channel->Number() == (int)channelNumber)
-      {
-        int vpid = channel->Vpid();
-#if VDRVERSNUM < 10300
-        int apid1 = channel->Apid1();
-#else
-        int apid1 = channel->Apid(0);
-#endif
-//        log->log("Client", Log::DEBUG, "Found channel number %lu, vpid = %i, apid1 = %i", channelNumber, vpid, apid1);
-        return channel;
-      }
+//    log->log("Client", Log::DEBUG, "Looking for channel %lu::: number: %i name: '%s'", channelNumber, channel->Number(), channel->Name());
+      if (channel->Number() == (int)channelNumber) return channel;
     }
   }
 
index 1de40e27cd8886b6739fb2bfaebf4b739787132f..8cea99ad8cccb850876826bea7147aa64fbf0ae4 100644 (file)
@@ -2070,7 +2070,6 @@ int VompClientRRProc::processGetEventScraperEventType()
   cSchedulesLock MutexLock;
   const cSchedules *Schedules = cSchedules::Schedules(MutexLock);
 #endif
-  const cSchedule * Schedule;
   if (Schedules && channel)
   {
      const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());