[libdvdnav-devel] [PATCH] Remove checks for 'zero' variables.

beandog at gentoo.org beandog at gentoo.org
Mon Mar 23 02:04:12 CET 2015


From: Steve Dibb <steve.dibb at gmail.com>

The 'zero' variables are populated with the data from the filesystem,
but are never used by any part of the library. Documentation by others
is listed as reserved / unknown[1]. Ignore the validity of the data.

1. http://dvd.sourceforge.net/dvdinfo/ifo_vmg.html
---
 src/ifo_read.c | 61 ----------------------------------------------------------
 src/nav_read.c | 21 --------------------
 2 files changed, 82 deletions(-)

diff --git a/src/ifo_read.c b/src/ifo_read.c
index ea3c3fc..a895cf6 100644
--- a/src/ifo_read.c
+++ b/src/ifo_read.c
@@ -556,18 +556,6 @@ static int ifoRead_VMG(ifo_handle_t *ifofile) {
   read_subp_attr(&vmgi_mat->vmgm_subp_attr);
 
 
-  CHECK_ZERO(vmgi_mat->zero_1);
-  CHECK_ZERO(vmgi_mat->zero_2);
-  /* DVDs created by VDR-to-DVD device LG RC590M violate the following check with
-   * vmgi_mat->zero_3 = 0x00000000010000000000000000000000000000. */
-  CHECK_ZERO(vmgi_mat->zero_3);
-  CHECK_ZERO(vmgi_mat->zero_4);
-  CHECK_ZERO(vmgi_mat->zero_5);
-  CHECK_ZERO(vmgi_mat->zero_6);
-  CHECK_ZERO(vmgi_mat->zero_7);
-  CHECK_ZERO(vmgi_mat->zero_8);
-  CHECK_ZERO(vmgi_mat->zero_9);
-  CHECK_ZERO(vmgi_mat->zero_10);
   CHECK_VALUE(vmgi_mat->vmg_last_sector != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_sector != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_sector * 2 <= vmgi_mat->vmg_last_sector);
@@ -652,27 +640,6 @@ static int ifoRead_VTS(ifo_handle_t *ifofile) {
   B2N_32(vtsi_mat->vts_vobu_admap);
 
 
-  CHECK_ZERO(vtsi_mat->zero_1);
-  CHECK_ZERO(vtsi_mat->zero_2);
-  CHECK_ZERO(vtsi_mat->zero_3);
-  CHECK_ZERO(vtsi_mat->zero_4);
-  CHECK_ZERO(vtsi_mat->zero_5);
-  CHECK_ZERO(vtsi_mat->zero_6);
-  CHECK_ZERO(vtsi_mat->zero_7);
-  CHECK_ZERO(vtsi_mat->zero_8);
-  CHECK_ZERO(vtsi_mat->zero_9);
-  CHECK_ZERO(vtsi_mat->zero_10);
-  CHECK_ZERO(vtsi_mat->zero_11);
-  CHECK_ZERO(vtsi_mat->zero_12);
-  CHECK_ZERO(vtsi_mat->zero_13);
-  CHECK_ZERO(vtsi_mat->zero_14);
-  CHECK_ZERO(vtsi_mat->zero_15);
-  CHECK_ZERO(vtsi_mat->zero_16);
-  CHECK_ZERO(vtsi_mat->zero_17);
-  CHECK_ZERO(vtsi_mat->zero_18);
-  CHECK_ZERO(vtsi_mat->zero_19);
-  CHECK_ZERO(vtsi_mat->zero_20);
-  CHECK_ZERO(vtsi_mat->zero_21);
   CHECK_VALUE(vtsi_mat->vtsi_last_sector*2 <= vtsi_mat->vts_last_sector);
   CHECK_VALUE(vtsi_mat->vtsi_last_byte/DVD_BLOCK_LEN <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vtsm_vobs == 0 ||
@@ -703,12 +670,6 @@ static int ifoRead_VTS(ifo_handle_t *ifofile) {
 
   for(i = 0; i < 8; i++) {
     read_multichannel_ext(&vtsi_mat->vts_mu_audio_attr[i]);
-    CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero1);
-    CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero2);
-    CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero3);
-    CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero4);
-    CHECK_ZERO0(vtsi_mat->vts_mu_audio_attr[i].zero5);
-    CHECK_ZERO(vtsi_mat->vts_mu_audio_attr[i].zero6);
   }
 
   return 1;
@@ -851,7 +812,6 @@ static int ifoRead_CELL_POSITION_TBL(ifo_handle_t *ifofile,
 
   for(i = 0; i < nr; i++) {
     B2N_16(cell_position[i].vob_id_nr);
-    CHECK_ZERO(cell_position[i].zero_1);
   }
 
   return 1;
@@ -882,7 +842,6 @@ static int ifoRead_PGC(ifo_handle_t *ifofile, pgc_t *pgc, unsigned int offset) {
   for(i = 0; i < 16; i++)
     B2N_32(pgc->palette[i]);
 
-  CHECK_ZERO(pgc->zero_1);
   CHECK_VALUE(pgc->nr_of_programs <= pgc->nr_of_cells);
 
   /* verify time (look at print_time) */
@@ -1075,14 +1034,12 @@ int ifoRead_TT_SRPT(ifo_handle_t *ifofile) {
   }
 
 
-  CHECK_ZERO(tt_srpt->zero_1);
   CHECK_VALUE(tt_srpt->nr_of_srpts != 0);
   CHECK_VALUE(tt_srpt->nr_of_srpts < 100); /* ?? */
   CHECK_VALUE(tt_srpt->nr_of_srpts * sizeof(title_info_t) <= info_length);
 
   for(i = 0; i < tt_srpt->nr_of_srpts; i++) {
     read_playback_type(&tt_srpt->title[i].pb_ty);
-    CHECK_VALUE(tt_srpt->title[i].pb_ty.zero_1 == 0);
     CHECK_VALUE(tt_srpt->title[i].nr_of_angles != 0);
     CHECK_VALUE(tt_srpt->title[i].nr_of_angles < 10);
     /* CHECK_VALUE(tt_srpt->title[i].nr_of_ptts != 0); */
@@ -1158,7 +1115,6 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
   B2N_16(vts_ptt_srpt->nr_of_srpts);
   B2N_32(vts_ptt_srpt->last_byte);
 
-  CHECK_ZERO(vts_ptt_srpt->zero_1);
   CHECK_VALUE(vts_ptt_srpt->nr_of_srpts != 0);
   CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); /* ?? */
 
@@ -1358,8 +1314,6 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
   }
 
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
-    CHECK_ZERO(ptl_mait->countries[i].zero_1);
-    CHECK_ZERO(ptl_mait->countries[i].zero_2);
     CHECK_VALUE(ptl_mait->countries[i].pf_ptl_mai_start_byte
                 + sizeof(pf_level_t) * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
   }
@@ -1469,8 +1423,6 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) {
   B2N_16(vts_tmapt->nr_of_tmaps);
   B2N_32(vts_tmapt->last_byte);
 
-  CHECK_ZERO(vts_tmapt->zero_1);
-
   info_length = vts_tmapt->nr_of_tmaps * 4;
 
   vts_tmap_srp = calloc(1, info_length);
@@ -1518,7 +1470,6 @@ int ifoRead_VTS_TMAPT(ifo_handle_t *ifofile) {
     }
 
     B2N_16(vts_tmapt->tmap[i].nr_of_entries);
-    CHECK_ZERO(vts_tmapt->tmap[i].zero_1);
 
     if(vts_tmapt->tmap[i].nr_of_entries == 0) { /* Early out if zero entries */
       vts_tmapt->tmap[i].map_ent = NULL;
@@ -1638,7 +1589,6 @@ static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile,
 
   info_length = c_adt->last_byte + 1 - C_ADT_SIZE;
 
-  CHECK_ZERO(c_adt->zero_1);
   /* assert(c_adt->nr_of_vobs > 0);
      Magic Knight Rayearth Daybreak is mastered very strange and has
      Titles with a VOBS that has no cells. */
@@ -1667,7 +1617,6 @@ static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile,
     B2N_32(c_adt->cell_adr_table[i].start_sector);
     B2N_32(c_adt->cell_adr_table[i].last_sector);
 
-    CHECK_ZERO(c_adt->cell_adr_table[i].zero_1);
     CHECK_VALUE(c_adt->cell_adr_table[i].vob_id > 0);
     CHECK_VALUE(c_adt->cell_adr_table[i].vob_id <= c_adt->nr_of_vobs);
     CHECK_VALUE(c_adt->cell_adr_table[i].cell_id > 0);
@@ -1869,7 +1818,6 @@ static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
   B2N_16(pgcit->nr_of_pgci_srp);
   B2N_32(pgcit->last_byte);
 
-  CHECK_ZERO(pgcit->zero_1);
   /* assert(pgcit->nr_of_pgci_srp != 0);
      Magic Knight Rayearth Daybreak is mastered very strange and has
      Titles with 0 PTTs. */
@@ -2013,7 +1961,6 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofile) {
   B2N_16(pgci_ut->nr_of_lus);
   B2N_32(pgci_ut->last_byte);
 
-  CHECK_ZERO(pgci_ut->zero_1);
   CHECK_VALUE(pgci_ut->nr_of_lus != 0);
   CHECK_VALUE(pgci_ut->nr_of_lus < 100); /* ?? 3-4 ? */
   CHECK_VALUE((uint32_t)pgci_ut->nr_of_lus * PGCI_LU_SIZE < pgci_ut->last_byte);
@@ -2138,13 +2085,6 @@ static int ifoRead_VTS_ATTRIBUTES(ifo_handle_t *ifofile,
   B2N_32(vts_attributes->last_byte);
   B2N_32(vts_attributes->vts_cat);
 
-  CHECK_ZERO(vts_attributes->zero_1);
-  CHECK_ZERO(vts_attributes->zero_2);
-  CHECK_ZERO(vts_attributes->zero_3);
-  CHECK_ZERO(vts_attributes->zero_4);
-  CHECK_ZERO(vts_attributes->zero_5);
-  CHECK_ZERO(vts_attributes->zero_6);
-  CHECK_ZERO(vts_attributes->zero_7);
   CHECK_VALUE(vts_attributes->nr_of_vtsm_audio_streams <= 1);
   CHECK_VALUE(vts_attributes->nr_of_vtsm_subp_streams <= 1);
   CHECK_VALUE(vts_attributes->nr_of_vtstt_audio_streams <= 8);
@@ -2202,7 +2142,6 @@ int ifoRead_VTS_ATRT(ifo_handle_t *ifofile) {
   B2N_16(vts_atrt->nr_of_vtss);
   B2N_32(vts_atrt->last_byte);
 
-  CHECK_ZERO(vts_atrt->zero_1);
   CHECK_VALUE(vts_atrt->nr_of_vtss != 0);
   CHECK_VALUE(vts_atrt->nr_of_vtss < 100); /* ?? */
   CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) +
diff --git a/src/nav_read.c b/src/nav_read.c
index 8e79a8c..d37dadc 100644
--- a/src/nav_read.c
+++ b/src/nav_read.c
@@ -143,16 +143,6 @@ void navRead_PCI(pci_t *pci, unsigned char *buffer) {
 #ifndef NDEBUG
   /* Asserts */
 
-  /* pci pci gi */
-  CHECK_VALUE(pci->pci_gi.zero1 == 0);
-
-  /* pci hli hli_gi */
-  CHECK_VALUE(pci->hli.hl_gi.zero1 == 0);
-  CHECK_VALUE(pci->hli.hl_gi.zero2 == 0);
-  CHECK_VALUE(pci->hli.hl_gi.zero3 == 0);
-  CHECK_VALUE(pci->hli.hl_gi.zero4 == 0);
-  CHECK_VALUE(pci->hli.hl_gi.zero5 == 0);
-
   /* Are there buttons defined here? */
   if((pci->hli.hl_gi.hli_ss & 0x03) != 0) {
     CHECK_VALUE(pci->hli.hl_gi.btn_ns != 0);
@@ -166,12 +156,6 @@ void navRead_PCI(pci_t *pci, unsigned char *buffer) {
   for(i = 0; i < pci->hli.hl_gi.btngr_ns; i++) {
     for(j = 0; j < (36 / pci->hli.hl_gi.btngr_ns); j++) {
       int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j;
-      CHECK_VALUE(pci->hli.btnit[n].zero1 == 0);
-      CHECK_VALUE(pci->hli.btnit[n].zero2 == 0);
-      CHECK_VALUE(pci->hli.btnit[n].zero3 == 0);
-      CHECK_VALUE(pci->hli.btnit[n].zero4 == 0);
-      CHECK_VALUE(pci->hli.btnit[n].zero5 == 0);
-      CHECK_VALUE(pci->hli.btnit[n].zero6 == 0);
 
       if (j < pci->hli.hl_gi.btn_ns) {
         CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
@@ -257,9 +241,4 @@ void navRead_DSI(dsi_t *dsi, unsigned char *buffer) {
   for(i = 0; i < 32; i++)
     dsi->synci.sp_synca[i] = getbits(&state, 32 );
 
-
-  /* Asserts */
-
-  /* dsi dsi gi */
-  CHECK_VALUE(dsi->dsi_gi.zero1 == 0);
 }
-- 
2.0.4



More information about the libdvdnav-devel mailing list