add workaround also for duplicate(non dvb compliant) tsid/nid combinations in cable /
[enigma2.git] / lib / dvb / db.cpp
index 8f418daccda3810dd9bf03c2bc2df08554c611ed..e4a9771304ccbe26a572c1dc66622374dd5cd24f 100644 (file)
@@ -417,7 +417,7 @@ void eDVBDB::reloadServicelist()
                } else
                        while ((!str.empty()) && str[1]==':') // new: p:, f:, c:%02d...
                        {
-                               unsigned int c=str.find(',');
+                               size_t c=str.find(',');
                                char p=str[0];
                                std::string v;
                                if (c == std::string::npos)
@@ -560,7 +560,7 @@ void eDVBDB::loadBouquet(const char *path)
                eDebug("Bouquet load failed.. no path given..");
                return;
        }
-       unsigned int pos = bouquet_name.rfind('/');
+       size_t pos = bouquet_name.rfind('/');
        if ( pos != std::string::npos )
                bouquet_name.erase(0, pos+1);
        if (bouquet_name.empty())
@@ -627,7 +627,7 @@ void eDVBDB::loadBouquet(const char *path)
                                }
                                if ( tmp.flags&eServiceReference::canDescent )
                                {
-                                       unsigned int pos = tmp.path.rfind('/');
+                                       size_t pos = tmp.path.rfind('/');
                                        char buf[256];
                                        std::string path = tmp.path;
                                        if ( pos != std::string::npos )
@@ -760,7 +760,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje
                Py_INCREF(Py_False);
                return Py_False;
        }
-       int tmp, *dest,
+       int tmp, *dest = NULL,
                modulation, system, freq, sr, pol, fec;
        char *end_ptr;
        const Attribute *at;
@@ -863,6 +863,8 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje
                                Py_DECREF(sat_pos);
                        if (sat_name)
                                Py_DECREF(sat_name);
+                       if (sat_flags)
+                               Py_DECREF(sat_flags);
                }
        }
        Py_INCREF(Py_True);
@@ -1158,10 +1160,15 @@ RESULT eDVBDB::removeServices(eDVBChannelID chid, unsigned int orbpos)
                        if ((unsigned int)sat.orbital_position != orbpos)
                                remove=false;
                }
-               else if (orbpos != 0xFFFFFFFF) // do not remove -C or -T transponders when a orbital position is given..
-                       remove=false;
-               if ( remove && chid.dvbnamespace != eNs && chid.dvbnamespace != ch.dvbnamespace )
-                       remove=false;
+               if ( remove && chid.dvbnamespace != eNs )
+               {
+                       if (system == iDVBFrontend::feCable && chid.dvbnamespace.get() == 0xFFFF0000)
+                               ;
+                       else if (system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == 0xEEEE0000)
+                               ;
+                       else if ( chid.dvbnamespace != ch.dvbnamespace )
+                               remove=false;
+               }
                if ( remove && chid.original_network_id != eOnid && chid.original_network_id != ch.original_network_id )
                        remove=false;
                if ( remove && chid.transport_stream_id != eTsid && chid.transport_stream_id != ch.transport_stream_id )
@@ -1247,8 +1254,15 @@ RESULT eDVBDB::removeFlags(unsigned int flagmask, eDVBChannelID chid, unsigned i
                        if ((unsigned int)sat.orbital_position != orbpos)
                                remove=false;
                }
-               if ( remove && chid.dvbnamespace != eNs && chid.dvbnamespace != ch.dvbnamespace )
-                       remove=false;
+               if ( remove && chid.dvbnamespace != eNs )
+               {
+                       if (system == iDVBFrontend::feCable && chid.dvbnamespace.get() == 0xFFFF0000)
+                               ;
+                       else if (system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == 0xEEEE0000)
+                               ;
+                       else if ( chid.dvbnamespace != ch.dvbnamespace )
+                               remove=false;
+               }
                if ( remove && chid.original_network_id != eOnid && chid.original_network_id != ch.original_network_id )
                        remove=false;
                if ( remove && chid.transport_stream_id != eTsid && chid.transport_stream_id != ch.transport_stream_id )
@@ -1335,7 +1349,7 @@ RESULT eDVBDB::getBouquet(const eServiceReference &ref, eBouquet* &bouquet)
                eDebug("getBouquet failed.. no path given!");
                return -1;
        }
-       unsigned int pos = str.find("FROM BOUQUET \"");
+       size_t pos = str.find("FROM BOUQUET \"");
        if ( pos != std::string::npos )
        {
                str.erase(0, pos+14);