]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/libdvdread.patch
ALL: Merge the win32-contrib branch.
[vlc] / extras / contrib / src / Patches / libdvdread.patch
1 diff -ru libdvdread-0.9.4/dvdread/bswap.h libdvdread/dvdread/bswap.h
2 --- libdvdread-0.9.4/dvdread/bswap.h    2002-12-15 01:09:12.000000000 +0100
3 +++ libdvdread/dvdread/bswap.h  2005-08-31 19:24:57.000000000 +0200
4 @@ -65,7 +65,7 @@
5   * functionality! 
6   */
7  
8 -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32)
9 +#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined( __BEOS__ )
10  #define B2N_16(x) \
11   x = ((((x) & 0xff00) >> 8) | \
12        (((x) & 0x00ff) << 8))
13 diff -ru libdvdread-0.9.4/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c
14 --- libdvdread-0.9.4/dvdread/dvd_reader.c       2003-02-13 23:31:21.000000000 +0100
15 +++ libdvdread/dvdread/dvd_reader.c     2005-08-31 19:24:57.000000000 +0200
16 @@ -324,8 +324,7 @@
17      else
18  #endif
19      {
20 -        ret = stat( path, &fileinfo );
21 -        if( ret < 0 ) {
22 +        if( *path && (ret = stat( path, &fileinfo ) < 0) ) {
23             /* If we can't stat the file, give up */
24             fprintf( stderr, "libdvdread: Can't stat %s\n", path );
25             perror("");
26 @@ -315,7 +314,7 @@
27      have_css = dvdinput_setup();
28  
29      /* First check if this is a block/char device or a file*/
30 -    if( S_ISBLK( fileinfo.st_mode ) || 
31 +    if( !*path || S_ISBLK( fileinfo.st_mode ) || 
32         S_ISCHR( fileinfo.st_mode ) || 
33         S_ISREG( fileinfo.st_mode ) ) {
34  
35 @@ -344,14 +343,16 @@
36  
37         /* Resolve any symlinks and get the absolut dir name. */
38         {
39 +           char *current_path;
40             char *new_path;
41 -           int cdir = open( ".", O_RDONLY );
42 -           
43 -           if( cdir >= 0 ) {
44 +
45 +           current_path = getcwd( NULL, PATH_MAX );
46 +           if( current_path ) {
47                 chdir( path_copy );
48                 new_path = getcwd( NULL, PATH_MAX );
49 -               fchdir( cdir );
50 -               close( cdir );
51 +               chdir( current_path );
52 +               free( current_path );
53 +
54                 if( new_path ) {
55                     free( path_copy );
56                     path_copy = new_path;
57 @@ -504,10 +505,12 @@
58              sprintf( filename, "%s%s%s", path,
59                       ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
60                       ent->d_name );
61 +            closedir( dir );
62              return 0;
63          }
64      }
65  
66 +    closedir( dir );
67      return -1;
68  }
69