OSDN Git Service

add bit parser
[rec10/rec10-git.git] / epgdump / sdt.c
index bfc3c28..3cc2f23 100755 (executable)
@@ -178,8 +178,9 @@ void dumpSDT(unsigned char *ptr, SVT_CONTROL *top,STATION **station, int * stati
 
                                if ( logd.logo_transmission_type != 0x01 ) continue;
                                for (i=0; i<stationi; i++) {
-                                       if ( pStation[i].svId == sdtb.service_id ) {
+                                       if ( pStation[i].svId == sdtb.service_id && pStation[i].logo_version < logd.logo_version ) {
                                                pStation[i].logo_download_data_id = logd.download_data_id;
+                                               pStation[i].logo_version = logd.logo_version;
                                        }
                                }
 
@@ -214,14 +215,14 @@ void dumpSDT(unsigned char *ptr, SVT_CONTROL *top,STATION **station, int * stati
                                                }
                                        }
 
-                                       pStation = realloc(pStation,(stationi+1)*sizeof(STATION));
-                                       if (!pStation) printf( "Realloc returned NULL!!! stationi = %d\n", stationi);
+                                       pStation = realloc(pStation, (stationi + 1) * sizeof(STATION));
+                                       memset(&pStation[stationi], 0, sizeof(STATION));
+
                                        pStation[stationi].name = malloc( strlen(desc.service_name) + 1 );
                                        pStation[stationi].ontv = malloc( strlen(sid) + 1 );
                                        pStation[stationi].tsId = sdth.transport_stream_id;
                                        pStation[stationi].onId = sdth.original_network_id;
                                        pStation[stationi].svId = sdtb.service_id;
-                                       memset(pStation[stationi].logo_array, 0, sizeof(pStation[stationi].logo_array));
 
                                        strcpy(pStation[stationi].name, desc.service_name);
                                        strcpy(pStation[stationi].ontv, sid);