[libdvdcss-devel] [PATCH 2/7] error: const correctness
Jean-Baptiste Kempf
jb at videolan.org
Wed Nov 5 11:34:00 CET 2014
Ship it, but mention the minor change in NEWS.
On 04 Nov, Diego Biurrun wrote :
> ---
>
> Returning "const char *" feels slightly weird, for some reason..
>
> src/dvdcss/dvdcss.h | 2 +-
> src/error.c | 2 +-
> src/libdvdcss.c | 2 +-
> src/libdvdcss.h | 4 ++--
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
> index 64f95cf..ea62b8b 100644
> --- a/src/dvdcss/dvdcss.h
> +++ b/src/dvdcss/dvdcss.h
> @@ -85,7 +85,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t,
> void *p_iovec,
> int i_blocks,
> int i_flags );
> -LIBDVDCSS_EXPORT char * dvdcss_error ( dvdcss_t );
> +LIBDVDCSS_EXPORT const char *dvdcss_error ( const dvdcss_t );
>
> LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( dvdcss_t );
>
> diff --git a/src/error.c b/src/error.c
> index 9d5f242..00aee4a 100644
> --- a/src/error.c
> +++ b/src/error.c
> @@ -29,7 +29,7 @@
> /*****************************************************************************
> * Error messages
> *****************************************************************************/
> -void print_error( dvdcss_t dvdcss, char *psz_string )
> +void print_error( dvdcss_t dvdcss, const char *psz_string )
> {
> if( dvdcss->b_errors )
> {
> diff --git a/src/libdvdcss.c b/src/libdvdcss.c
> index 975d745..ab80b9c 100644
> --- a/src/libdvdcss.c
> +++ b/src/libdvdcss.c
> @@ -562,7 +562,7 @@ error:
> * Return a string with the last error message produced by \e libdvdcss.
> * Useful to conveniently format error messages in external applications.
> */
> -LIBDVDCSS_EXPORT char * dvdcss_error ( dvdcss_t dvdcss )
> +LIBDVDCSS_EXPORT const char * dvdcss_error ( const dvdcss_t dvdcss )
> {
> return dvdcss->psz_error;
> }
> diff --git a/src/libdvdcss.h b/src/libdvdcss.h
> index 399a1a3..221e6fe 100644
> --- a/src/libdvdcss.h
> +++ b/src/libdvdcss.h
> @@ -70,7 +70,7 @@ struct dvdcss_s
> char * psz_block;
>
> /* Error management */
> - char * psz_error;
> + const char *psz_error;
> int b_errors;
> int b_debug;
>
> @@ -96,6 +96,6 @@ struct dvdcss_s
> fprintf( stderr, "\n" ); \
> }
>
> -void print_error ( dvdcss_t, char * );
> +void print_error ( dvdcss_t, const char * );
>
> #endif /* DVDCSS_LIBDVDCSS_H */
> --
> 1.9.1
>
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the libdvdcss-devel
mailing list