[libdvdnav-devel] [PATCH] libdvdread: ifo_print.c, remove unused function parameters

Steve Dibb beandog at gentoo.org
Sat Apr 26 20:37:55 CEST 2014


ifo_print.c is a standalone C file that prints information about the IFO 
to stdout.  It's very helpful for developers trying to debug DVDs, but 
otherwise it is not required anywhere in the code for libdvdread to run.

The header file only has two exposed functions: ifo_print() which runs 
through a full dump of everything, and dvdread_print_time().

Regardless of its independence, I'd argue for not removing the 
ifo_print.{c,h} files.  An old libdvdread sample file that previously 
shipped with libdvdread is actually very helpful:

https://github.com/hilbix/libdvdread-samples/blob/master/ifo_dump.c

It's still got bugs, so here's a patch for removing unused parameters. 
It looks like a "level" integer was intended at some time, but never used.

This patch fixes these compiler warnings:

src/ifo_print.c:33:32: warning: unused parameter 'level' 
[-Wunused-parameter]
static void ifo_print_time(int level, dvd_time_t *dtime) {
                                ^
src/ifo_print.c:83:44: warning: unused parameter 'level' 
[-Wunused-parameter]
static void ifo_print_video_attributes(int level, video_attr_t *attr) {
                                            ^
src/ifo_print.c:196:44: warning: unused parameter 'level' 
[-Wunused-parameter]
static void ifo_print_audio_attributes(int level, audio_attr_t *attr) {
                                            ^
src/ifo_print.c:351:43: warning: unused parameter 'level' 
[-Wunused-parameter]
static void ifo_print_subp_attributes(int level, subp_attr_t *attr) {
                                           ^

diff --git a/src/ifo_print.c b/src/ifo_print.c
index 1d6b64b..7438aec 100644
--- a/src/ifo_print.c
+++ b/src/ifo_print.c
@@ -30,7 +30,7 @@
  #include "dvdread/ifo_print.h"

  /* Put this in some other file / package?  It's used in nav_print too. */
-static void ifo_print_time(int level, dvd_time_t *dtime) {
+static void ifo_print_time(dvd_time_t *dtime) {
    const char *rate;
    assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);
    assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
@@ -61,7 +61,7 @@ static void ifo_print_time(int level, dvd_time_t *dtime) {
  }

  void dvdread_print_time(dvd_time_t *dtime) {
-  ifo_print_time(5, dtime);
+  ifo_print_time(dtime);
  }

  /* Put this in some other file / package?  It's used in nav_print too.
@@ -80,7 +80,7 @@ static void ifo_print_cmd(int row, vm_cmd_t *command) {
    printf("\n");
  }

-static void ifo_print_video_attributes(int level, video_attr_t *attr) {
+static void ifo_print_video_attributes(video_attr_t *attr) {

    /* The following test is shorter but not correct ISO C,
       memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */
@@ -193,7 +193,7 @@ static void ifo_print_video_attributes(int level, 
video_attr_t *attr) {
    }
  }

-static void ifo_print_audio_attributes(int level, audio_attr_t *attr) {
+static void ifo_print_audio_attributes(audio_attr_t *attr) {

    if(attr->audio_format == 0
       && attr->multichannel_extension == 0
@@ -348,7 +348,7 @@ static void ifo_print_audio_attributes(int level, 
audio_attr_t *attr) {
    printf("Unknown3: %d ", attr->unknown3);
  }

-static void ifo_print_subp_attributes(int level, subp_attr_t *attr) {
+static void ifo_print_subp_attributes(subp_attr_t *attr) {

    if(attr->type == 0
       && attr->lang_code == 0
@@ -527,20 +527,20 @@ static void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
    printf("Start sector of VMGM_VOBU_ADMAP: %08x\n",
           vmgi_mat->vmgm_vobu_admap);
    printf("Video attributes of VMGM_VOBS: ");
-  ifo_print_video_attributes(5, &vmgi_mat->vmgm_video_attr);
+  ifo_print_video_attributes(&vmgi_mat->vmgm_video_attr);
    printf("\n");
    printf("VMGM Number of Audio attributes: %i\n",
           vmgi_mat->nr_of_vmgm_audio_streams);
    if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
      printf("\tstream %i status: ", 1);
-    ifo_print_audio_attributes(5, &vmgi_mat->vmgm_audio_attr);
+    ifo_print_audio_attributes(&vmgi_mat->vmgm_audio_attr);
      printf("\n");
    }
    printf("VMGM Number of Sub-picture attributes: %i\n",
           vmgi_mat->nr_of_vmgm_subp_streams);
    if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
      printf("\tstream %2i status: ", 1);
-    ifo_print_subp_attributes(5, &vmgi_mat->vmgm_subp_attr);
+    ifo_print_subp_attributes(&vmgi_mat->vmgm_subp_attr);
      printf("\n");
    }
  }
@@ -569,14 +569,14 @@ static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
    printf("Start sector of VTS_VOBU_ADMAP:  %08x\n", 
vtsi_mat->vts_vobu_admap);

    printf("Video attributes of VTSM_VOBS: ");
-  ifo_print_video_attributes(5, &vtsi_mat->vtsm_video_attr);
+  ifo_print_video_attributes(&vtsi_mat->vtsm_video_attr);
    printf("\n");

    printf("VTSM Number of Audio attributes: %i\n",
           vtsi_mat->nr_of_vtsm_audio_streams);
    if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
      printf("\tstream %i status: ", 1);
-    ifo_print_audio_attributes(5, &vtsi_mat->vtsm_audio_attr);
+    ifo_print_audio_attributes(&vtsi_mat->vtsm_audio_attr);
      printf("\n");
    }

@@ -584,19 +584,19 @@ static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
           vtsi_mat->nr_of_vtsm_subp_streams);
    if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
      printf("\tstream %2i status: ", 1);
-    ifo_print_subp_attributes(5, &vtsi_mat->vtsm_subp_attr);
+    ifo_print_subp_attributes(&vtsi_mat->vtsm_subp_attr);
      printf("\n");
    }

    printf("Video attributes of VTS_VOBS: ");
-  ifo_print_video_attributes(5, &vtsi_mat->vts_video_attr);
+  ifo_print_video_attributes(&vtsi_mat->vts_video_attr);
    printf("\n");

    printf("VTS Number of Audio attributes: %i\n",
           vtsi_mat->nr_of_vts_audio_streams);
    for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
      printf("\tstream %i status: ", i);
-    ifo_print_audio_attributes(5, &vtsi_mat->vts_audio_attr[i]);
+    ifo_print_audio_attributes(&vtsi_mat->vts_audio_attr[i]);
      printf("\n");
    }

@@ -604,7 +604,7 @@ static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
           vtsi_mat->nr_of_vts_subp_streams);
    for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
      printf("\tstream %2i status: ", i);
-    ifo_print_subp_attributes(5, &vtsi_mat->vts_subp_attr[i]);
+    ifo_print_subp_attributes(&vtsi_mat->vts_subp_attr[i]);
      printf("\n");
    }
  }
@@ -1029,31 +1029,31 @@ static void 
ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
    printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);

    printf("Video attributes of VTSM_VOBS: ");
-  ifo_print_video_attributes(5, &vts_attributes->vtsm_vobs_attr);
+  ifo_print_video_attributes(&vts_attributes->vtsm_vobs_attr);
    printf("\n");
    printf("Number of Audio streams: %i\n",
           vts_attributes->nr_of_vtsm_audio_streams);
    if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
      printf("\tstream %i attributes: ", 1);
-    ifo_print_audio_attributes(5, &vts_attributes->vtsm_audio_attr);
+    ifo_print_audio_attributes(&vts_attributes->vtsm_audio_attr);
      printf("\n");
    }
    printf("Number of Subpicture streams: %i\n",
           vts_attributes->nr_of_vtsm_subp_streams);
    if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
      printf("\tstream %2i attributes: ", 1);
-    ifo_print_subp_attributes(5, &vts_attributes->vtsm_subp_attr);
+    ifo_print_subp_attributes(&vts_attributes->vtsm_subp_attr);
      printf("\n");
    }

    printf("Video attributes of VTSTT_VOBS: ");
-  ifo_print_video_attributes(5, &vts_attributes->vtstt_vobs_video_attr);
+  ifo_print_video_attributes(&vts_attributes->vtstt_vobs_video_attr);
    printf("\n");
    printf("Number of Audio streams: %i\n",
           vts_attributes->nr_of_vtstt_audio_streams);
    for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
      printf("\tstream %i attributes: ", i);
-    ifo_print_audio_attributes(5, &vts_attributes->vtstt_audio_attr[i]);
+    ifo_print_audio_attributes(&vts_attributes->vtstt_audio_attr[i]);
      printf("\n");
    }

@@ -1061,7 +1061,7 @@ static void 
ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
           vts_attributes->nr_of_vtstt_subp_streams);
    for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
      printf("\tstream %2i attributes: ", i);
-    ifo_print_subp_attributes(5, &vts_attributes->vtstt_subp_attr[i]);
+    ifo_print_subp_attributes(&vts_attributes->vtstt_subp_attr[i]);
      printf("\n");
    }
  }


More information about the libdvdnav-devel mailing list