Hello community, here is the log from the commit of package libdvdread for openSUSE:Factory checked in at 2015-02-06 10:48:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libdvdread (Old) and /work/SRC/openSUSE:Factory/.libdvdread.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libdvdread" Changes: -------- --- /work/SRC/openSUSE:Factory/libdvdread/libdvdread.changes 2015-01-30 06:04:00.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libdvdread.new/libdvdread.changes 2015-02-06 10:48:09.000000000 +0100 @@ -1,0 +2,6 @@ +Fri Jan 30 14:38:44 UTC 2015 - joerg.loren...@ki.tng.de + +- Update to version 5.0.2: + * Add DVDOpenStream to open a dvd from a set of callbacks + +------------------------------------------------------------------- Old: ---- libdvdread-5.0.1.tar.bz2 New: ---- libdvdread-5.0.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libdvdread.spec ++++++ --- /var/tmp/diff_new_pack.QLt1qu/_old 2015-02-06 10:48:10.000000000 +0100 +++ /var/tmp/diff_new_pack.QLt1qu/_new 2015-02-06 10:48:10.000000000 +0100 @@ -21,7 +21,7 @@ License: GPL-2.0+ Group: Productivity/Multimedia/Other Url: http://www.mplayerhq.hu/ -Version: 5.0.1 +Version: 5.0.2 Release: 0 Source0: http://download.videolan.org/videolan/%{name}/%{version}/%{name}-%{version}.tar.bz2 Source1: baselibs.conf ++++++ libdvdread-5.0.1.tar.bz2 -> libdvdread-5.0.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/ChangeLog new/libdvdread-5.0.2/ChangeLog --- old/libdvdread-5.0.1/ChangeLog 2015-01-03 01:21:04.000000000 +0100 +++ new/libdvdread-5.0.2/ChangeLog 2015-01-28 17:20:32.000000000 +0100 @@ -1,3 +1,137 @@ +commit 574b886b733e8737e8cf17d9330049289e837ac3 +Author: Jean-Baptiste Kempf <j...@videolan.org> +Date: Wed Jan 28 17:17:32 2015 +0100 + + Fix compilation when staticly linked to libdvdcss + +commit cd82f3072c75736dd0459738d12dbc0da0884f28 +Author: Thomas Guillem <tho...@gllm.fr> +Date: Wed Jan 28 16:30:31 2015 +0100 + + dvd_input: always init dev->dvdcss + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit 8bda55f887d7d8e926f943977129e26eaf2ff02a +Author: KO Myung-Hun <kom...@gmail.com> +Date: Mon Jan 19 13:23:58 2015 +0900 + + src/dvd_input.c: use dvdcss2.dll instead of dvdcss.dll on OS/2 + + libtool creates a versioned dll on OS/2 as well. + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit 6b86232c82503d65b3a5d25283ae5f9a7f66acc0 +Author: Thomas Guillem <tho...@gllm.fr> +Date: Wed Jan 28 14:45:52 2015 +0100 + + dvd_input.c: can link with dvdcss without new open_stream symbol + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit 55465dba693864ea04f83455fa0f470b4fb957e4 +Author: Thomas Guillem <tho...@gllm.fr> +Date: Wed Jan 28 14:45:51 2015 +0100 + + dvd_input.c fix unused parameter warnings + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit d14f83e4ab1bf7b5856898365a8c4bd2b107c041 +Author: Jean-Baptiste Kempf <j...@videolan.org> +Date: Tue Jan 27 16:37:12 2015 +0100 + + Update NEWS for 5.0.2 + +commit 40571a6f7bdbd7c5a8530675f3c082032ab540b3 +Author: Jean-Baptiste Kempf <j...@videolan.org> +Date: Tue Jan 27 16:34:48 2015 +0100 + + Update .so version because of added API + +commit 6dfeb9b50421d98f7a228de05498d98eecd23f02 +Author: Thomas Guillem <t...@gllm.fr> +Date: Fri Oct 17 15:43:26 2014 +0200 + + add DVDOpenStream + + open a DVD Device using external read/seek callbacks (see libdvdcss). + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit f5ea91421d7912bffc8c5964409fd4454f1f5985 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:42 2015 -0700 + + Check for malloc fail before setting buffer + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit 05c4e138c27ad372c2640506017b15f34b3dd92f +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:41 2015 -0700 + + Check for malloc fail before setting buffer + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit a3d569054c4e57d401137ba2e93d56afa5edd6d7 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:39 2015 -0700 + + Check for malloc fail before setting secbuf + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit e381f0766f4a1cf9b0cf526b38fca445080ba94e +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:38 2015 -0700 + + Remove unnecessary memset() calls because of calloc being used + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit 76f813477a863873bea842e4ae182b3c4cacfc96 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:37 2015 -0700 + + Use calloc instead of malloc, then memset + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit a63467f9ec4dbdb63057439665a561ac68c6cae8 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:36 2015 -0700 + + Use calloc as a safety measure since ifoRead functions populate parts of the data independently + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit a097e3da09e8fe8d32115dad8992e4326536e8c5 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:33 2015 -0700 + + Use calloc as a safety measure since ifoRead functions populate parts of the data independently + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit a267a3bc899a72712baab8bc37fe59405dcd1904 +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:32 2015 -0700 + + Use calloc as a safety measure since ifoRead functions populate parts of the data independently + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + +commit fa457d44da389ad576c1e3b3a880401a796cdcbf +Author: Steve Dibb <steve.d...@gmail.com> +Date: Thu Jan 15 13:45:13 2015 -0700 + + Set freed pointers to NULL instead of zero + + Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> + commit 4507900078d45d7262dd26bfc6405c8faadd293c Author: Jean-Baptiste Kempf <j...@videolan.org> Date: Sat Jan 3 01:16:48 2015 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/NEWS new/libdvdread-5.0.2/NEWS --- old/libdvdread-5.0.1/NEWS 2015-01-03 01:16:45.000000000 +0100 +++ new/libdvdread-5.0.2/NEWS 2015-01-27 16:37:08.000000000 +0100 @@ -1,3 +1,6 @@ +libdvdread (5.0.2) + * Add DVDOpenStream to open a dvd from a set of callbacks + libdvdread (5.0.1) * support DragonFly BSD bswap * new md5 implementation, under LGPL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/configure new/libdvdread-5.0.2/configure --- old/libdvdread-5.0.1/configure 2015-01-03 01:17:25.000000000 +0100 +++ new/libdvdread-5.0.2/configure 2015-01-27 16:45:58.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libdvdread 5.0.1. +# Generated by GNU Autoconf 2.69 for libdvdread 5.0.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='libdvdread' PACKAGE_TARNAME='libdvdread' -PACKAGE_VERSION='5.0.1' -PACKAGE_STRING='libdvdread 5.0.1' +PACKAGE_VERSION='5.0.2' +PACKAGE_STRING='libdvdread 5.0.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1332,7 +1332,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libdvdread 5.0.1 to adapt to many kinds of systems. +\`configure' configures libdvdread 5.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1402,7 +1402,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdvdread 5.0.1:";; + short | recursive ) echo "Configuration of libdvdread 5.0.2:";; esac cat <<\_ACEOF @@ -1525,7 +1525,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdvdread configure 5.0.1 +libdvdread configure 5.0.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1890,7 +1890,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libdvdread $as_me 5.0.1, which was +It was created by libdvdread $as_me 5.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2831,7 +2831,7 @@ # Define the identity of the package. PACKAGE='libdvdread' - VERSION='5.0.1' + VERSION='5.0.2' cat >>confdefs.h <<_ACEOF @@ -11962,9 +11962,9 @@ -DVDREAD_LT_CURRENT=5 -DVDREAD_LT_AGE=1 -DVDREAD_LT_REVISION=2 +DVDREAD_LT_CURRENT=6 +DVDREAD_LT_AGE=2 +DVDREAD_LT_REVISION=0 DVDREAD_LTVERSION=$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD_LT_AGE @@ -14164,7 +14164,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libdvdread $as_me 5.0.1, which was +This file was extended by libdvdread $as_me 5.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14230,7 +14230,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdvdread config.status 5.0.1 +libdvdread config.status 5.0.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/configure.ac new/libdvdread-5.0.2/configure.ac --- old/libdvdread-5.0.1/configure.ac 2014-11-05 11:44:18.000000000 +0100 +++ new/libdvdread-5.0.2/configure.ac 2015-01-27 16:37:28.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT(libdvdread, 5.0.1) +AC_INIT(libdvdread, 5.0.2) AC_CONFIG_SRCDIR([src/dvd_reader.c]) AC_PREREQ(2.53) @@ -39,9 +39,9 @@ dnl * in Linux, the library will be named dnl libname.so.(DVDREAD_LT_CURRENT - DVDREAD_LT_AGE).DVDREAD_LT_REVISION.DVDREAD_LT_AGE -DVDREAD_LT_CURRENT=5 -DVDREAD_LT_AGE=1 -DVDREAD_LT_REVISION=2 +DVDREAD_LT_CURRENT=6 +DVDREAD_LT_AGE=2 +DVDREAD_LT_REVISION=0 AC_SUBST([DVDREAD_LTVERSION], [$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD_LT_AGE]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/src/dvd_input.c new/libdvdread-5.0.2/src/dvd_input.c --- old/libdvdread-5.0.1/src/dvd_input.c 2014-12-03 16:39:13.000000000 +0100 +++ new/libdvdread-5.0.2/src/dvd_input.c 2015-01-28 17:17:27.000000000 +0100 @@ -30,7 +30,7 @@ /* The function pointers that is the exported interface of this file. */ -dvd_input_t (*dvdinput_open) (const char *); +dvd_input_t (*dvdinput_open) (const char *, void *, dvd_reader_stream_cb *); int (*dvdinput_close) (dvd_input_t); int (*dvdinput_seek) (dvd_input_t, int); int (*dvdinput_title) (dvd_input_t, int); @@ -40,6 +40,8 @@ #ifdef HAVE_DVDCSS_DVDCSS_H /* linking to libdvdcss */ # include <dvdcss/dvdcss.h> +# define DVDcss_open_stream(a, b) \ + dvdcss_open_stream((void*)(a), (dvdcss_stream_cb*)(b)) # define DVDcss_open(a) dvdcss_open((char*)(a)) # define DVDcss_close dvdcss_close # define DVDcss_seek dvdcss_seek @@ -58,6 +60,8 @@ #endif typedef struct dvdcss_s *dvdcss_t; +typedef struct dvdcss_stream_cb dvdcss_stream_cb; +static dvdcss_t (*DVDcss_open_stream) (void *, dvdcss_stream_cb *); static dvdcss_t (*DVDcss_open) (const char *); static int (*DVDcss_close) (dvdcss_t); static int (*DVDcss_seek) (dvdcss_t, int, int); @@ -77,9 +81,10 @@ /** - * initialize and open a DVD device or file. + * initialize and open a DVD (device or file or stream_cb) */ -static dvd_input_t css_open(const char *target) +static dvd_input_t css_open(const char *target, + void *stream, dvd_reader_stream_cb *stream_cb) { dvd_input_t dev; @@ -91,7 +96,17 @@ } /* Really open it with libdvdcss */ - dev->dvdcss = DVDcss_open(target); + if(target) + dev->dvdcss = DVDcss_open(target); + else if(stream && stream_cb) { +#ifdef HAVE_DVDCSS_DVDCSS_H + dev->dvdcss = DVDcss_open_stream(stream, (dvdcss_stream_cb *)stream_cb); +#else + dev->dvdcss = DVDcss_open_stream ? + DVDcss_open_stream(stream, (dvdcss_stream_cb *)stream_cb) : + NULL; +#endif + } if(dev->dvdcss == 0) { fprintf(stderr, "libdvdread: Could not open %s with libdvdcss.\n", target); free(dev); @@ -154,10 +169,14 @@ /** * initialize and open a DVD device or file. */ -static dvd_input_t file_open(const char *target) +static dvd_input_t file_open(const char *target, + void *stream UNUSED, + dvd_reader_stream_cb *stream_cb UNUSED) { dvd_input_t dev; + if(target == NULL) + return NULL; /* Allocate the library structure */ dev = malloc(sizeof(*dev)); if(dev == NULL) { @@ -287,7 +306,7 @@ #elif defined(WIN32) #define CSS_LIB "libdvdcss-2.dll" #elif defined(__OS2__) - #define CSS_LIB "dvdcss.dll" + #define CSS_LIB "dvdcss2.dll" #else #define CSS_LIB "libdvdcss.so.2" #endif @@ -299,6 +318,8 @@ #else #define U_S #endif + DVDcss_open_stream = (dvdcss_t (*)(void *, dvdcss_stream_cb *)) + dlsym(dvdcss_library, U_S "dvdcss_open_stream"); DVDcss_open = (dvdcss_t (*)(const char*)) dlsym(dvdcss_library, U_S "dvdcss_open"); DVDcss_close = (int (*)(dvdcss_t)) @@ -317,7 +338,7 @@ "http://www.videolan.org/\n" ); dlclose(dvdcss_library); dvdcss_library = NULL; - } else if(!DVDcss_open || !DVDcss_close || !DVDcss_seek + } else if(!DVDcss_open || !DVDcss_close || !DVDcss_seek || !DVDcss_read || !DVDcss_error) { fprintf(stderr, "libdvdread: Missing symbols in %s, " "this shouldn't happen !\n", CSS_LIB); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/src/dvd_input.h new/libdvdread-5.0.2/src/dvd_input.h --- old/libdvdread-5.0.1/src/dvd_input.h 2014-08-30 23:20:04.000000000 +0200 +++ new/libdvdread-5.0.2/src/dvd_input.h 2015-01-27 16:24:31.000000000 +0100 @@ -55,7 +55,8 @@ * Function pointers that will be filled in by the input implementation. * These functions provide the main API. */ -extern dvd_input_t (*dvdinput_open) (const char *); +extern dvd_input_t (*dvdinput_open) (const char *, + void *, dvd_reader_stream_cb *); extern int (*dvdinput_close) (dvd_input_t); extern int (*dvdinput_seek) (dvd_input_t, int); extern int (*dvdinput_title) (dvd_input_t, int); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/src/dvd_reader.c new/libdvdread-5.0.2/src/dvd_reader.c --- old/libdvdread-5.0.1/src/dvd_reader.c 2014-11-06 19:29:59.000000000 +0100 +++ new/libdvdread-5.0.2/src/dvd_reader.c 2015-01-27 16:24:31.000000000 +0100 @@ -229,14 +229,17 @@ /** - * Open a DVD image or block device file. + * Open a DVD image or block device file or use stream_cb functions. */ -static dvd_reader_t *DVDOpenImageFile( const char *location, int have_css ) +static dvd_reader_t *DVDOpenImageFile( const char *location, + void *stream, + dvd_reader_stream_cb *stream_cb, + int have_css ) { dvd_reader_t *dvd; dvd_input_t dev; - dev = dvdinput_open( location ); + dev = dvdinput_open( location, stream, stream_cb ); if( !dev ) { fprintf( stderr, "libdvdread: Can't open %s for reading\n", location ); return NULL; @@ -343,8 +346,9 @@ } #endif - -dvd_reader_t *DVDOpen( const char *ppath ) +static dvd_reader_t *DVDOpenCommon( const char *ppath, + void *stream, + dvd_reader_stream_cb *stream_cb ) { struct stat fileinfo; int ret, have_css, retval, cdir = -1; @@ -356,6 +360,13 @@ int len; #endif + /* Try to open DVD using stream_cb functions */ + if( stream != NULL && stream_cb != NULL ) + { + have_css = dvdinput_setup(); + return DVDOpenImageFile( NULL, stream, stream_cb, have_css ); + } + if( ppath == NULL ) goto DVDOpen_error; @@ -383,7 +394,7 @@ /* maybe "host:port" url? try opening it with acCeSS library */ if( strchr(path,':') ) { - ret_val = DVDOpenImageFile( path, have_css ); + ret_val = DVDOpenImageFile( path, NULL, NULL, have_css ); free(path); return ret_val; } @@ -412,7 +423,7 @@ #endif if(!dev_name) goto DVDOpen_error; - dvd = DVDOpenImageFile( dev_name, have_css ); + dvd = DVDOpenImageFile( dev_name, NULL, NULL, have_css ); free( dev_name ); free(path); return dvd; @@ -503,7 +514,7 @@ " mounted on %s for CSS authentication\n", dev_name, s[i].f_mntonname); - auth_drive = DVDOpenImageFile( dev_name, have_css ); + auth_drive = DVDOpenImageFile( dev_name, NULL, NULL, have_css ); break; } } @@ -516,7 +527,7 @@ " mounted on %s for CSS authentication\n", dev_name, fe->fs_file ); - auth_drive = DVDOpenImageFile( dev_name, have_css ); + auth_drive = DVDOpenImageFile( dev_name, NULL, NULL, have_css ); } #elif defined(__sun) mntfile = fopen( MNTTAB, "r" ); @@ -532,7 +543,7 @@ " mounted on %s for CSS authentication\n", dev_name, mp.mnt_mountp ); - auth_drive = DVDOpenImageFile( dev_name, have_css ); + auth_drive = DVDOpenImageFile( dev_name, NULL, NULL, have_css ); break; } } @@ -550,7 +561,7 @@ " mounted on %s for CSS authentication\n", me->mnt_fsname, me->mnt_dir ); - auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css ); + auth_drive = DVDOpenImageFile( me->mnt_fsname, NULL, NULL, have_css ); dev_name = strdup(me->mnt_fsname); break; } @@ -564,7 +575,7 @@ ( !path[2] || ((path[2] == '\\' || path[2] == '/') && !path[3]))) #endif - auth_drive = DVDOpenImageFile( path, have_css ); + auth_drive = DVDOpenImageFile( path, NULL, NULL, have_css ); #endif #if !defined(_WIN32) && !defined(__OS2__) @@ -612,6 +623,17 @@ return NULL; } +dvd_reader_t *DVDOpen( const char *ppath ) +{ + return DVDOpenCommon( ppath, NULL, NULL ); +} + +dvd_reader_t *DVDOpenStream( void *stream, + dvd_reader_stream_cb *stream_cb ) +{ + return DVDOpenCommon( NULL, stream, stream_cb ); +} + void DVDClose( dvd_reader_t *dvd ) { if( dvd ) { @@ -726,7 +748,7 @@ return NULL; } - dev = dvdinput_open( full_path ); + dev = dvdinput_open( full_path, NULL, NULL ); if( !dev ) { fprintf( stderr, "libdvdread:DVDOpenFilePath:dvdinput_open %s failed\n", full_path ); return NULL; @@ -837,7 +859,7 @@ return NULL; } - dev = dvdinput_open( full_path ); + dev = dvdinput_open( full_path, NULL, NULL ); if( dev == NULL ) { free( dvd_file ); return NULL; @@ -870,7 +892,7 @@ } dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN; - dvd_file->title_devs[ i ] = dvdinput_open( full_path ); + dvd_file->title_devs[ i ] = dvdinput_open( full_path, NULL, NULL ); dvdinput_title( dvd_file->title_devs[ i ], 0 ); dvd_file->filesize += dvd_file->title_sizes[ i ]; } @@ -1323,12 +1345,12 @@ ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 ); secbuf_base = malloc( numsec * DVD_VIDEO_LB_LEN + 2048 ); - secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048); if( !secbuf_base ) { fprintf( stderr, "libdvdread: Can't allocate memory " "for file read!\n" ); return 0; } + secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~((uintptr_t)2047)) + 2048); if( dvd_file->dvd->isImageFile ) { ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, @@ -1393,7 +1415,6 @@ ssize_t bytes_read; ssize_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN; char *buffer_base = malloc( file_size + 2048 ); - char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048); if( buffer_base == NULL ) { DVDCloseFile( dvd_file ); @@ -1402,6 +1423,8 @@ return -1; } + char *buffer = (char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048); + bytes_read = DVDReadBytes( dvd_file, buffer, file_size ); if( bytes_read != file_size ) { fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes" @@ -1444,7 +1467,6 @@ } buffer_base = malloc( DVD_VIDEO_LB_LEN + 2048 ); - buffer = (unsigned char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048); if( buffer_base == NULL ) { fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to " @@ -1452,6 +1474,8 @@ return -1; } + buffer = (unsigned char *)(((uintptr_t)buffer_base & ~((uintptr_t)2047)) + 2048); + ret = InternalUDFReadBlocksRaw( dvd, 16, 1, buffer, 0 ); if( ret != 1 ) { fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/src/dvdread/dvd_reader.h new/libdvdread-5.0.2/src/dvdread/dvd_reader.h --- old/libdvdread-5.0.1/src/dvdread/dvd_reader.h 2014-08-30 23:20:04.000000000 +0200 +++ new/libdvdread-5.0.2/src/dvdread/dvd_reader.h 2015-01-27 16:24:31.000000000 +0100 @@ -69,6 +69,14 @@ */ typedef struct dvd_file_s dvd_file_t; +struct dvd_reader_stream_cb +{ + int ( *pf_seek ) ( void *p_stream, uint64_t i_pos); + int ( *pf_read ) ( void *p_stream, void* buffer, int i_read); + int ( *pf_readv ) ( void *p_stream, void *p_iovec, int i_blocks); +}; +typedef struct dvd_reader_stream_cb dvd_reader_stream_cb; + /** * Public type that is used to provide statistics on a handle. */ @@ -81,6 +89,8 @@ /** * Opens a block device of a DVD-ROM file, or an image file, or a directory * name for a mounted DVD or HD copy of a DVD. + * The second form of Open function (DVDOpenStream) can be used to + * provide custom stream_cb functions to access the DVD (see libdvdcss). * * If the given file is a block device, or is the mountpoint for a block * device, then that device is used for CSS authentication using libdvdcss. @@ -96,11 +106,15 @@ * path/vts_01_1.vob * * @param path Specifies the the device, file or directory to be used. + * @param stream is a private handle used by stream_cb + * @param stream_cb is a struct containing seek and read functions * @return If successful a a read handle is returned. Otherwise 0 is returned. * * dvd = DVDOpen(path); + * dvd = DVDOpenStream(stream, &stream_cb); */ dvd_reader_t *DVDOpen( const char * ); +dvd_reader_t *DVDOpenStream( void *, dvd_reader_stream_cb * ); /** * Closes and cleans up the DVD reader object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdvdread-5.0.1/src/ifo_read.c new/libdvdread-5.0.2/src/ifo_read.c --- old/libdvdread-5.0.1/src/ifo_read.c 2014-10-24 16:28:44.000000000 +0200 +++ new/libdvdread-5.0.2/src/ifo_read.c 2015-01-21 17:22:42.000000000 +0100 @@ -292,12 +292,10 @@ int bup_file_opened = 0; char ifo_filename[13]; - ifofile = malloc(sizeof(ifo_handle_t)); + ifofile = calloc(1, sizeof(ifo_handle_t)); if(!ifofile) return NULL; - memset(ifofile, 0, sizeof(ifo_handle_t)); - ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_FILE); if(!ifofile->file) { /* Failed to open IFO, try to open BUP */ ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE); @@ -359,11 +357,10 @@ /* Try BUP instead */ ifoClose(ifofile); - ifofile = malloc(sizeof(ifo_handle_t)); + ifofile = calloc(1, sizeof(ifo_handle_t)); if(!ifofile) return NULL; - memset(ifofile, 0, sizeof(ifo_handle_t)); ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE); if (title) @@ -425,12 +422,10 @@ ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { ifo_handle_t *ifofile; - ifofile = malloc(sizeof(ifo_handle_t)); + ifofile = calloc(1, sizeof(ifo_handle_t)); if(!ifofile) return NULL; - memset(ifofile, 0, sizeof(ifo_handle_t)); - ifofile->file = DVDOpenFile(dvd, 0, DVD_READ_INFO_FILE); if(!ifofile->file) /* Should really catch any error and try to fallback */ ifofile->file = DVDOpenFile(dvd, 0, DVD_READ_INFO_BACKUP_FILE); @@ -452,12 +447,10 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { ifo_handle_t *ifofile; - ifofile = malloc(sizeof(ifo_handle_t)); + ifofile = calloc(1, sizeof(ifo_handle_t)); if(!ifofile) return NULL; - memset(ifofile, 0, sizeof(ifo_handle_t)); - if(title <= 0 || title > 99) { fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title); free(ifofile); @@ -517,7 +510,7 @@ static int ifoRead_VMG(ifo_handle_t *ifofile) { vmgi_mat_t *vmgi_mat; - vmgi_mat = malloc(sizeof(vmgi_mat_t)); + vmgi_mat = calloc(1, sizeof(vmgi_mat_t)); if(!vmgi_mat) return 0; @@ -525,19 +518,19 @@ if(!DVDFileSeek_(ifofile->file, 0)) { free(ifofile->vmgi_mat); - ifofile->vmgi_mat = 0; + ifofile->vmgi_mat = NULL; return 0; } if(!DVDReadBytes(ifofile->file, vmgi_mat, sizeof(vmgi_mat_t))) { free(ifofile->vmgi_mat); - ifofile->vmgi_mat = 0; + ifofile->vmgi_mat = NULL; return 0; } if(strncmp("DVDVIDEO-VMG", vmgi_mat->vmg_identifier, 12) != 0) { free(ifofile->vmgi_mat); - ifofile->vmgi_mat = 0; + ifofile->vmgi_mat = NULL; return 0; } @@ -611,7 +604,7 @@ vtsi_mat_t *vtsi_mat; int i; - vtsi_mat = malloc(sizeof(vtsi_mat_t)); + vtsi_mat = calloc(1, sizeof(vtsi_mat_t)); if(!vtsi_mat) return 0; @@ -726,8 +719,6 @@ pgc_command_tbl_t *cmd_tbl, unsigned int offset) { - memset(cmd_tbl, 0, sizeof(pgc_command_tbl_t)); - if(!DVDFileSeek_(ifofile->file, offset)) return 0; @@ -916,7 +907,7 @@ } if(pgc->command_tbl_offset != 0) { - pgc->command_tbl = malloc(sizeof(pgc_command_tbl_t)); + pgc->command_tbl = calloc(1, sizeof(pgc_command_tbl_t)); if(!pgc->command_tbl) return 0; @@ -929,7 +920,7 @@ } if(pgc->program_map_offset != 0 && pgc->nr_of_programs>0) { - pgc->program_map = malloc(pgc->nr_of_programs * sizeof(pgc_program_map_t)); + pgc->program_map = calloc(pgc->nr_of_programs, sizeof(pgc_program_map_t)); if(!pgc->program_map) { return 0; } @@ -942,7 +933,7 @@ } if(pgc->cell_playback_offset != 0 && pgc->nr_of_cells>0) { - pgc->cell_playback = malloc(pgc->nr_of_cells * sizeof(cell_playback_t)); + pgc->cell_playback = calloc(pgc->nr_of_cells, sizeof(cell_playback_t)); if(!pgc->cell_playback) { return 0; } @@ -956,7 +947,7 @@ } if(pgc->cell_position_offset != 0 && pgc->nr_of_cells>0) { - pgc->cell_position = malloc(pgc->nr_of_cells * sizeof(cell_position_t)); + pgc->cell_position = calloc(pgc->nr_of_cells, sizeof(cell_position_t)); if(!pgc->cell_position) { return 0; } @@ -981,8 +972,8 @@ return 0; /* It seems that first_play_pgc is optional after all. */ - ifofile->first_play_pgc = 0; - if(ifofile->vmgi_mat->first_play_pgc == 0) + ifofile->first_play_pgc = NULL; + if(!ifofile->vmgi_mat->first_play_pgc) return 1; ifofile->first_play_pgc = calloc(1, sizeof(pgc_t)); @@ -1042,7 +1033,7 @@ if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->tt_srpt * DVD_BLOCK_LEN)) return 0; - tt_srpt = malloc(sizeof(tt_srpt_t)); + tt_srpt = calloc(1, sizeof(tt_srpt_t)); if(!tt_srpt) return 0; @@ -1059,10 +1050,10 @@ info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE; - tt_srpt->title = malloc(info_length); + tt_srpt->title = calloc(1, info_length); if(!tt_srpt->title) { free(tt_srpt); - ifofile->tt_srpt = 0; + ifofile->tt_srpt = NULL; return 0; } if(!(DVDReadBytes(ifofile->file, tt_srpt->title, info_length))) { @@ -1128,7 +1119,8 @@ if(ifofile->tt_srpt) { free(ifofile->tt_srpt->title); free(ifofile->tt_srpt); - ifofile->tt_srpt = 0; + ifofile->tt_srpt->title = NULL; + ifofile->tt_srpt = NULL; } } @@ -1151,7 +1143,7 @@ ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) return 0; - vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t)); + vts_ptt_srpt = calloc(1, sizeof(vts_ptt_srpt_t)); if(!vts_ptt_srpt) return 0; @@ -1171,7 +1163,7 @@ CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); /* ?? */ info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE; - data = malloc(info_length); + data = calloc(1, info_length); if(!data) goto fail; @@ -1209,7 +1201,7 @@ vts_ptt_srpt->ttu_offset = data; - vts_ptt_srpt->title = malloc(vts_ptt_srpt->nr_of_srpts * sizeof(ttu_t)); + vts_ptt_srpt->title = calloc(vts_ptt_srpt->nr_of_srpts, sizeof(ttu_t)); if(!vts_ptt_srpt->title) goto fail; @@ -1229,7 +1221,7 @@ CHECK_VALUE(n % 4 == 0); vts_ptt_srpt->title[i].nr_of_ptts = n / 4; - vts_ptt_srpt->title[i].ptt = malloc(n * sizeof(ptt_info_t)); + vts_ptt_srpt->title[i].ptt = calloc(n, sizeof(ptt_info_t)); if(!vts_ptt_srpt->title[i].ptt) { for(n = 0; n < i; n++) free(vts_ptt_srpt->title[n].ptt); @@ -1276,7 +1268,7 @@ fail: free(data); - ifofile->vts_ptt_srpt = 0; + ifofile->vts_ptt_srpt = NULL; free(vts_ptt_srpt->title); free(vts_ptt_srpt); return 0; @@ -1316,7 +1308,7 @@ if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) return 0; - ptl_mait = malloc(sizeof(ptl_mait_t)); + ptl_mait = calloc(1, sizeof(ptl_mait_t)); if(!ptl_mait) return 0; @@ -1340,7 +1332,7 @@ <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE); info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); - ptl_mait->countries = malloc(info_length); + ptl_mait->countries = calloc(1, info_length); if(!ptl_mait->countries) { free(ptl_mait); ifofile->ptl_mait = NULL; @@ -1385,13 +1377,12 @@ return 0; } info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); - pf_temp = malloc(info_length); + pf_temp = calloc(1, info_length); if(!pf_temp) { free_ptl_mait(ptl_mait, i); ifofile->ptl_mait = NULL; return 0; } - memset(pf_temp, 0, info_length); if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) { fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table at index %d.\n",i); free(pf_temp); @@ -1402,7 +1393,7 @@ for (j = 0; j < ((ptl_mait->nr_of_vtss + 1U) * 8U); j++) { B2N_16(pf_temp[j]); } - ptl_mait->countries[i].pf_ptl_mai = malloc(info_length); + ptl_mait->countries[i].pf_ptl_mai = calloc(1, info_length); if(!ptl_mait->countries[i].pf_ptl_mai) { free(pf_temp); free_ptl_mait(ptl_mait, i); @@ -1462,7 +1453,7 @@ if(!DVDFileSeek_(ifofile->file, offset)) return 0; - vts_tmapt = malloc(sizeof(vts_tmapt_t)); + vts_tmapt = calloc(1, sizeof(vts_tmapt_t)); if(!vts_tmapt) return 0; @@ -1482,7 +1473,7 @@ info_length = vts_tmapt->nr_of_tmaps * 4; - vts_tmap_srp = malloc(info_length); + vts_tmap_srp = calloc(1, info_length); if(!vts_tmap_srp) { free(vts_tmapt); ifofile->vts_tmapt = NULL; @@ -1506,7 +1497,7 @@ info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t); - vts_tmapt->tmap = malloc(info_length); + vts_tmapt->tmap = calloc(1, info_length); if(!vts_tmapt->tmap) { free(vts_tmap_srp); free(vts_tmapt); @@ -1514,8 +1505,6 @@ return 0; } - memset(vts_tmapt->tmap, 0, info_length); /* So ifoFree_VTS_TMAPT works. */ - for(i = 0; i < vts_tmapt->nr_of_tmaps; i++) { if(!DVDFileSeek_(ifofile->file, offset + vts_tmap_srp[i])) { ifoFree_VTS_TMAPT(ifofile); @@ -1538,7 +1527,7 @@ info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t); - vts_tmapt->tmap[i].map_ent = malloc(info_length); + vts_tmapt->tmap[i].map_ent = calloc(1, info_length); if(!vts_tmapt->tmap[i].map_ent) { ifoFree_VTS_TMAPT(ifofile); return 0; @@ -1586,14 +1575,14 @@ if(ifofile->vtsi_mat->vts_c_adt == 0) /* mandatory */ return 0; - ifofile->vts_c_adt = malloc(sizeof(c_adt_t)); + ifofile->vts_c_adt = calloc(1, sizeof(c_adt_t)); if(!ifofile->vts_c_adt) return 0; if(!ifoRead_C_ADT_internal(ifofile, ifofile->vts_c_adt, ifofile->vtsi_mat->vts_c_adt)) { free(ifofile->vts_c_adt); - ifofile->vts_c_adt = 0; + ifofile->vts_c_adt = NULL; return 0; } @@ -1618,13 +1607,13 @@ return 0; } - ifofile->menu_c_adt = malloc(sizeof(c_adt_t)); + ifofile->menu_c_adt = calloc(1, sizeof(c_adt_t)); if(!ifofile->menu_c_adt) return 0; if(!ifoRead_C_ADT_internal(ifofile, ifofile->menu_c_adt, sector)) { free(ifofile->menu_c_adt); - ifofile->menu_c_adt = 0; + ifofile->menu_c_adt = NULL; return 0; } @@ -1663,7 +1652,7 @@ c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t); } - c_adt->cell_adr_table = malloc(info_length); + c_adt->cell_adr_table = calloc(1, info_length); if(!c_adt->cell_adr_table) return 0; @@ -1702,7 +1691,7 @@ return; ifoFree_C_ADT_internal(ifofile->menu_c_adt); - ifofile->menu_c_adt = 0; + ifofile->menu_c_adt = NULL; } void ifoFree_TITLE_C_ADT(ifo_handle_t *ifofile) { @@ -1710,7 +1699,7 @@ return; ifoFree_C_ADT_internal(ifofile->vts_c_adt); - ifofile->vts_c_adt = 0; + ifofile->vts_c_adt = NULL; } int ifoRead_TITLE_VOBU_ADMAP(ifo_handle_t *ifofile) { @@ -1723,14 +1712,14 @@ if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */ return 0; - ifofile->vts_vobu_admap = malloc(sizeof(vobu_admap_t)); + ifofile->vts_vobu_admap = calloc(1, sizeof(vobu_admap_t)); if(!ifofile->vts_vobu_admap) return 0; if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->vts_vobu_admap, ifofile->vtsi_mat->vts_vobu_admap)) { free(ifofile->vts_vobu_admap); - ifofile->vts_vobu_admap = 0; + ifofile->vts_vobu_admap = NULL; return 0; } @@ -1755,13 +1744,13 @@ return 0; } - ifofile->menu_vobu_admap = malloc(sizeof(vobu_admap_t)); + ifofile->menu_vobu_admap = calloc(1, sizeof(vobu_admap_t)); if(!ifofile->menu_vobu_admap) return 0; if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->menu_vobu_admap, sector)) { free(ifofile->menu_vobu_admap); - ifofile->menu_vobu_admap = 0; + ifofile->menu_vobu_admap = NULL; return 0; } @@ -1788,7 +1777,7 @@ Titles with a VOBS that has no VOBUs. */ CHECK_VALUE(info_length % sizeof(uint32_t) == 0); - vobu_admap->vobu_start_sectors = malloc(info_length); + vobu_admap->vobu_start_sectors = calloc(1, info_length); if(!vobu_admap->vobu_start_sectors) { return 0; } @@ -1818,7 +1807,7 @@ return; ifoFree_VOBU_ADMAP_internal(ifofile->menu_vobu_admap); - ifofile->menu_vobu_admap = 0; + ifofile->menu_vobu_admap = NULL; } void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *ifofile) { @@ -1826,7 +1815,7 @@ return; ifoFree_VOBU_ADMAP_internal(ifofile->vts_vobu_admap); - ifofile->vts_vobu_admap = 0; + ifofile->vts_vobu_admap = NULL; } int ifoRead_PGCIT(ifo_handle_t *ifofile) { @@ -1848,7 +1837,7 @@ if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit, ifofile->vtsi_mat->vts_pgcit * DVD_BLOCK_LEN)) { free(ifofile->vts_pgcit); - ifofile->vts_pgcit = 0; + ifofile->vts_pgcit = NULL; return 0; } @@ -1887,7 +1876,7 @@ CHECK_VALUE(pgcit->nr_of_pgci_srp < 10000); /* ?? seen max of 1338 */ info_length = pgcit->nr_of_pgci_srp * PGCI_SRP_SIZE; - data = malloc(info_length); + data = calloc(1, info_length); if(!data) return 0; @@ -1896,7 +1885,7 @@ return 0; } - pgcit->pgci_srp = malloc(pgcit->nr_of_pgci_srp * sizeof(pgci_srp_t)); + pgcit->pgci_srp = calloc(pgcit->nr_of_pgci_srp, sizeof(pgci_srp_t)); if(!pgcit->pgci_srp) { free(data); return 0; @@ -2003,19 +1992,19 @@ return 0; } - ifofile->pgci_ut = malloc(sizeof(pgci_ut_t)); + ifofile->pgci_ut = calloc(1, sizeof(pgci_ut_t)); if(!ifofile->pgci_ut) return 0; if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) { free(ifofile->pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } if(!(DVDReadBytes(ifofile->file, ifofile->pgci_ut, PGCI_UT_SIZE))) { free(ifofile->pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } @@ -2030,24 +2019,24 @@ CHECK_VALUE((uint32_t)pgci_ut->nr_of_lus * PGCI_LU_SIZE < pgci_ut->last_byte); info_length = pgci_ut->nr_of_lus * PGCI_LU_SIZE; - data = malloc(info_length); + data = calloc(1, info_length); if(!data) { free(pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } if(!(DVDReadBytes(ifofile->file, data, info_length))) { free(data); free(pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } - pgci_ut->lu = malloc(pgci_ut->nr_of_lus * sizeof(pgci_lu_t)); + pgci_ut->lu = calloc(pgci_ut->nr_of_lus, sizeof(pgci_lu_t)); if(!pgci_ut->lu) { free(data); free(pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } ptr = data; @@ -2079,7 +2068,7 @@ pgci_ut->lu[i].pgcit->ref_count++; continue; } - pgci_ut->lu[i].pgcit = malloc(sizeof(pgcit_t)); + pgci_ut->lu[i].pgcit = calloc(1, sizeof(pgcit_t)); if(!pgci_ut->lu[i].pgcit) { unsigned int j; for(j = 0; j < i; j++) { @@ -2087,7 +2076,7 @@ } free(pgci_ut->lu); free(pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } pgci_ut->lu[i].pgcit->ref_count = 1; @@ -2100,7 +2089,7 @@ } free(pgci_ut->lu); free(pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; return 0; } /* FIXME: Iterate and verify that all menus that should exists accordingly @@ -2123,7 +2112,7 @@ } free(ifofile->pgci_ut->lu); free(ifofile->pgci_ut); - ifofile->pgci_ut = 0; + ifofile->pgci_ut = NULL; } } @@ -2198,7 +2187,7 @@ if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) return 0; - vts_atrt = malloc(sizeof(vts_atrt_t)); + vts_atrt = calloc(1, sizeof(vts_atrt_t)); if(!vts_atrt) return 0; @@ -2206,7 +2195,7 @@ if(!(DVDReadBytes(ifofile->file, vts_atrt, VTS_ATRT_SIZE))) { free(vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; return 0; } @@ -2220,10 +2209,10 @@ VTS_ATRT_SIZE < vts_atrt->last_byte + 1); info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t); - data = malloc(info_length); + data = calloc(1, info_length); if(!data) { free(vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; return 0; } @@ -2232,7 +2221,7 @@ if(!(DVDReadBytes(ifofile->file, data, info_length))) { free(data); free(vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; return 0; } @@ -2242,11 +2231,11 @@ } info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t); - vts_atrt->vts = malloc(info_length); + vts_atrt->vts = calloc(1, info_length); if(!vts_atrt->vts) { free(data); free(vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; return 0; } for(i = 0; i < vts_atrt->nr_of_vtss; i++) { @@ -2255,7 +2244,7 @@ (sector * DVD_BLOCK_LEN) + offset)) { free(data); free(vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; return 0; } @@ -2276,7 +2265,7 @@ free(ifofile->vts_atrt->vts); free(ifofile->vts_atrt->vts_atrt_offsets); free(ifofile->vts_atrt); - ifofile->vts_atrt = 0; + ifofile->vts_atrt = NULL; } } @@ -2298,7 +2287,7 @@ ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) return 0; - txtdt_mgi = malloc(sizeof(txtdt_mgi_t)); + txtdt_mgi = calloc(1, sizeof(txtdt_mgi_t)); if(!txtdt_mgi) { return 0; } @@ -2307,7 +2296,7 @@ if(!(DVDReadBytes(ifofile->file, txtdt_mgi, TXTDT_MGI_SIZE))) { fprintf(stderr, "libdvdread: Unable to read TXTDT_MGI.\n"); free(txtdt_mgi); - ifofile->txtdt_mgi = 0; + ifofile->txtdt_mgi = NULL; return 0; } @@ -2321,6 +2310,6 @@ if(ifofile->txtdt_mgi) { free(ifofile->txtdt_mgi); - ifofile->txtdt_mgi = 0; + ifofile->txtdt_mgi = NULL; } } -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org