[libdvdnav-devel] src/dvd_input.c: Annotate unused function parameters

Andrew Clayton git at videolan.org
Wed Nov 5 11:44:51 CET 2014


libdvdread | branch: master | Andrew Clayton <andrew at digital-domain.net> | Tue Nov  4 01:08:32 2014 +0000| [d2314b8c65ca1a3a92fcc9b46791375e24dbfd9b] | committer: Jean-Baptiste Kempf

src/dvd_input.c: Annotate unused function parameters

In libdvdread some functions take parameters that are unused. These
functions are for working without the libdvdcss library but have to have
the same prototype as the ones for working with it as these are
presented as single API.

As such we get the following warnings from GCC (4.8.3)

    src/dvd_input.c: In function 'file_error':
    src/dvd_input.c:186:37: warning: unused parameter 'dev'
      [-Wunused-parameter]
     static char *file_error(dvd_input_t dev)
                                         ^
    src/dvd_input.c: In function 'file_title':
    src/dvd_input.c:210:35: warning: unused parameter 'dev'
      [-Wunused-parameter]
     static int file_title(dvd_input_t dev, int block)
                                       ^
    src/dvd_input.c:210:44: warning: unused parameter 'block'
      [-Wunused-parameter]
     static int file_title(dvd_input_t dev, int block)
                                                ^
    src/dvd_input.c: In function 'file_read':
    src/dvd_input.c:218:69: warning: unused parameter 'flags'
      [-Wunused-parameter]
     static int file_read(dvd_input_t dev, void *buffer, int blocks,
                          int flags)
                              ^
The previous commit added a #define set to __attribute__((unused)) when
GCC is being used (empty otherwise). This can be used to inform the
compiler about such unused parameters and gets rid of those warnings.

Signed-off-by: Andrew Clayton <andrew at digital-domain.net>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/libdvdread.git/?a=commit;h=d2314b8c65ca1a3a92fcc9b46791375e24dbfd9b
---

 src/dvd_input.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/dvd_input.c b/src/dvd_input.c
index 3b7f679..da4803e 100644
--- a/src/dvd_input.c
+++ b/src/dvd_input.c
@@ -183,7 +183,7 @@ static dvd_input_t file_open(const char *target)
 /**
  * return the last error message
  */
-static char *file_error(dvd_input_t dev)
+static char *file_error(dvd_input_t dev UNUSED)
 {
   /* use strerror(errno)? */
   return (char *)"unknown error";
@@ -207,7 +207,7 @@ static int file_seek(dvd_input_t dev, int blocks)
 /**
  * set the block for the beginning of a new title (key).
  */
-static int file_title(dvd_input_t dev, int block)
+static int file_title(dvd_input_t dev UNUSED, int block UNUSED)
 {
   return -1;
 }
@@ -215,7 +215,8 @@ static int file_title(dvd_input_t dev, int block)
 /**
  * read data from the device.
  */
-static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags)
+static int file_read(dvd_input_t dev, void *buffer, int blocks,
+		     int flags UNUSED)
 {
   size_t len;
 



More information about the libdvdnav-devel mailing list