Discussion:
[libdvdcss-devel] [PATCH 1/7] Clean up and simplify raw device support.
Jean-Baptiste Kempf
2014-11-16 19:52:57 UTC
Permalink
Treat access to raw devices just like accessing any other device instead of
providing different semantics. libdvdcss now tries raw devices on all OSes
and bails out instead of continuing if accessing a raw device failed.
I'm not so sure about that, tbh.
Aren't you breaking some use cases?
Not sure which use cases you might mean.
Yes, this changes behavior, intentionally. If raw device access is requested
and accessing the device fails, we bail out. Previously libdvdcss would
continue. However, I consider the new behavior more sensible. If you want
raw access, silent fallback is no good IMO.
Why not fallback but with a warning?

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Jean-Baptiste Kempf
2014-11-16 19:41:52 UTC
Permalink
Please don't.

We use MSVC from autotools.
MSVC does not use the autotools build system.
---
Makefile.am | 7 +------
configure.ac | 6 +-----
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 0469c0c..b435121 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,12 +30,7 @@ libdvdcss_la_SOURCES = \
src/error.c \
src/common.h
-libdvdcss_la_LDFLAGS = -version-info $(DVDCSS_LTVERSION) $(DVDCSS_LDFLAGS)
-libdvdcss_la_LIBADD =
-
-if !SYS_MSVC
-libdvdcss_la_LDFLAGS += -no-undefined
-endif
+libdvdcss_la_LDFLAGS = -version-info $(DVDCSS_LTVERSION) $(DVDCSS_LDFLAGS) -no-undefined
test_csstest_SOURCES = test/csstest.c
test_csstest_LDADD = libdvdcss.la
diff --git a/configure.ac b/configure.ac
index f37057f..f222457 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,11 +111,7 @@ case x"${host_os}" in
xos2*)
LDFLAGS="-Zbin-files"
;;
- x*msvc*)
- SYS_MSVC=1
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
- ;;
- x*mingw* | *wince* | *mingwce*)
+ x*msvc* | x*mingw* | *wince* | *mingwce*)
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
x*)
--
2.1.0
_______________________________________________
libdvdcss-devel mailing list
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
Fabian Greffrath
2014-11-17 08:07:46 UTC
Permalink
Post by Jean-Baptiste Kempf
We use MSVC from autotools.
Can you explain how? I'd be delighted to know.
./configure CC=cl.exe

That should work.

- Fabian
Jean-Baptiste Kempf
2014-11-17 08:18:42 UTC
Permalink
Post by Fabian Greffrath
Post by Jean-Baptiste Kempf
We use MSVC from autotools.
Can you explain how? I'd be delighted to know.
./configure CC=cl.exe
That should work.
It's usually way more complex than that, but that's the idea.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Jean-Baptiste Kempf
2014-11-16 19:41:17 UTC
Permalink
OK.
This also allows simplifying the Windows init code.
---
src/device.c | 60 ++++++++++++++++++++++++---------------------------------
src/libdvdcss.h | 6 +++++-
2 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/src/device.c b/src/device.c
index 46ab121..8744810 100644
--- a/src/device.c
+++ b/src/device.c
@@ -96,7 +96,7 @@ static int os2_open ( dvdcss_t, const char * );
int dvdcss_use_ioctls( dvdcss_t dvdcss )
{
#if defined( WIN32 )
- if( dvdcss->b_file )
+ if( dvdcss->p_handle )
{
return 0;
}
@@ -348,38 +348,32 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
- dvdcss->b_file = 1;
- /* If device is "X:" or "X:\", we are not actually opening a file. */
- if (psz_device[0] && psz_device[1] == ':' &&
- (!psz_device[2] || (psz_device[2] == '\\' && !psz_device[3])))
- dvdcss->b_file = 0;
-
- /* Initialize readv temporary buffer */
+ dvdcss->p_handle = NULL;
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
+#endif /* defined( WIN32 ) */
- if( !dvdcss->b_file )
+#if defined( WIN32 ) || defined( __OS2__ )
+ /* If device is "X:" or "X:\", we are not actually opening a file. */
+ if( psz_device[0] && psz_device[1] == ':' &&
+ ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
{
+#if defined( WIN32 )
print_debug( dvdcss, "using Win2K API for access" );
dvdcss->pf_seek = win2k_seek;
dvdcss->pf_read = win2k_read;
dvdcss->pf_readv = win2k_readv;
return win2k_open( dvdcss, psz_device );
- }
- else
#elif defined( __OS2__ )
- /* If device is "X:" or "X:\", we are not actually opening a file. */
- if( psz_device[0] && psz_device[1] == ':' &&
- ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
- {
print_debug( dvdcss, "using OS/2 API for access" );
dvdcss->pf_seek = os2_seek;
dvdcss->pf_read = os2_read;
dvdcss->pf_readv = os2_readv;
return os2_open( dvdcss, psz_device );
+#endif /* ! ( defined( WIN32 ) || defined( __OS2__ ) ) */
}
else
-#endif
+#endif /* defined( WIN32 ) || defined( __OS2__ ) */
{
print_debug( dvdcss, "using libc for access" );
dvdcss->pf_seek = libc_seek;
@@ -397,9 +391,9 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
- if( !dvdcss->b_file )
+ if( dvdcss->p_handle )
{
- CloseHandle( (HANDLE) dvdcss->i_fd );
+ CloseHandle( dvdcss->p_handle );
}
else
#endif
@@ -449,19 +443,17 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
* won't send back the right result).
* (See Microsoft Q241374: Read and Write Access Required for SCSI
* Pass Through Requests) */
- dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
+ dvdcss->p_handle = CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_RANDOM_ACCESS, NULL );
- if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
- dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
+ if( dvdcss->p_handle == INVALID_HANDLE_VALUE )
+ dvdcss->p_handle = CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING,
+ FILE_FLAG_RANDOM_ACCESS, NULL );
- if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
+ if( dvdcss->p_handle == INVALID_HANDLE_VALUE )
{
print_error( dvdcss, "failed opening device" );
return -1;
@@ -545,8 +537,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
li_seek.QuadPart = (LONGLONG)i_blocks * DVDCSS_BLOCK_SIZE;
- li_seek.LowPart = SetFilePointer( (HANDLE) dvdcss->i_fd,
- li_seek.LowPart,
+ li_seek.LowPart = SetFilePointer( dvdcss->p_handle, li_seek.LowPart,
&li_seek.HighPart, FILE_BEGIN );
if( (li_seek.LowPart == INVALID_SET_FILE_POINTER)
&& GetLastError() != NO_ERROR)
@@ -605,9 +596,8 @@ static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
DWORD i_bytes;
- if( !ReadFile( (HANDLE) dvdcss->i_fd, p_buffer,
- i_blocks * DVDCSS_BLOCK_SIZE,
- &i_bytes, NULL ) )
+ if( !ReadFile( dvdcss->p_handle, p_buffer,i_blocks * DVDCSS_BLOCK_SIZE,
+ &i_bytes, NULL ) )
{
dvdcss->i_pos = -1;
return -1;
@@ -729,7 +719,7 @@ static int win2k_readv ( dvdcss_t dvdcss, const struct iovec *p_iovec,
if( i_blocks_total <= 0 ) return 0;
- if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
+ if( !ReadFile( dvdcss->p_handle, dvdcss->p_readv_buffer,
i_blocks_total, &i_bytes, NULL ) )
{
/* The read failed... too bad.
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 31c15bc..6d7e267 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -26,6 +26,10 @@
#include <limits.h>
+#ifdef WIN32
+# include <windows.h>
+#endif
+
#include "dvdcss/dvdcss.h"
#include "css.h"
#include "device.h"
@@ -70,7 +74,7 @@ struct dvdcss_s
int b_debug;
#ifdef WIN32
- int b_file;
+ HANDLE p_handle;
char * p_readv_buffer;
int i_readv_buf_size;
#endif /* WIN32 */
--
2.1.0
_______________________________________________
libdvdcss-devel mailing list
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
Diego Biurrun
2014-11-16 19:56:53 UTC
Permalink
Post by Jean-Baptiste Kempf
Treat access to raw devices just like accessing any other device instead of
providing different semantics. libdvdcss now tries raw devices on all OSes
and bails out instead of continuing if accessing a raw device failed.
I'm not so sure about that, tbh.
Aren't you breaking some use cases?
Not sure which use cases you might mean.
Yes, this changes behavior, intentionally. If raw device access is requested
and accessing the device fails, we bail out. Previously libdvdcss would
continue. However, I consider the new behavior more sensible. If you want
raw access, silent fallback is no good IMO.
Why not fallback but with a warning?
That's what happened previously. libdvdcss fails hard when failing to access
other devices, this makes it consistent. It's also far simpler code.

Diego
Jean-Baptiste Kempf
2014-11-16 19:39:57 UTC
Permalink
OK.
The header is available in all toolchains we care about.
---
configure.ac | 2 +-
src/css.c | 5 +----
src/device.c | 5 +----
src/libdvdcss.c | 5 +----
src/libdvdcss.h | 6 +-----
5 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5b8f79d..f37057f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
-AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h limits.h pwd.h]dnl
+AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h pwd.h]dnl
[errno.h sys/types.h sys/stat.h fcntl.h io.h])
AC_CHECK_DECL([O_BINARY], [],
diff --git a/src/css.c b/src/css.c
index 25c70c0..79cbefe 100644
--- a/src/css.c
+++ b/src/css.c
@@ -35,6 +35,7 @@
*****************************************************************************/
#include "config.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -47,10 +48,6 @@
#endif
#include <fcntl.h>
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
#include "dvdcss/dvdcss.h"
#include "common.h"
diff --git a/src/device.c b/src/device.c
index 2e0c463..51b41be 100644
--- a/src/device.c
+++ b/src/device.c
@@ -27,6 +27,7 @@
*****************************************************************************/
#include "config.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,10 +45,6 @@
# include <unistd.h>
#endif
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
#ifdef DARWIN_DVD_IOCTL
# include <paths.h>
# include <CoreFoundation/CoreFoundation.h>
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index c57773a..4a58675 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -97,6 +97,7 @@
*/
#include "config.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -115,10 +116,6 @@
# include <unistd.h>
#endif
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
# include <shlobj.h>
#endif
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index c08fadc..31c15bc 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -24,11 +24,7 @@
#ifndef DVDCSS_LIBDVDCSS_H
#define DVDCSS_LIBDVDCSS_H
-#include "config.h"
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include <limits.h>
#include "dvdcss/dvdcss.h"
#include "css.h"
--
2.1.0
_______________________________________________
libdvdcss-devel mailing list
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
Diego Biurrun
2014-11-16 19:37:14 UTC
Permalink
All supported Windows versions have IE 5.0 or later and related APIs.
---
NEWS | 4 ++--
configure.ac | 4 ----
libdvdcss.spec.in | 6 ++----
src/libdvdcss.c | 8 ++++----
4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index 86c7780..91cc13d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
Changes since 1.3.0:
--------------------
* Drop support for HP-UX.
- * Drop support for Windows 9x.
- Windows NT 4.0 SP4 with IE 5.0 is now required.
+ * Drop support for Windows 9x and Windows NT.
+ Windows 2000 is now required.
* Replace BeOS support by Haiku support.
* dvdcss_error() now returns "const char *" instad of "char *".
* Drop support for MSVC versions before 2010.
diff --git a/configure.ac b/configure.ac
index f222457..ee9f752 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,14 +106,10 @@ case x"${host_os}" in
;;
x*cygwin*)
CFLAGS="${CFLAGS} -mwin32"
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
xos2*)
LDFLAGS="-Zbin-files"
;;
- x*msvc* | x*mingw* | *wince* | *mingwce*)
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
- ;;
x*)
;;
esac
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 7734df0..0558661 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,8 +32,7 @@ Conflicts: libdvdcss0.0.1, libdvdcss0.0.2
libdvdcss is a simple library designed for accessing DVDs like a block device
without having to bother about the decryption. The important features are:
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 SP4 (with
- IE 5.0) or later.
+ OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
* Adaptability: Unlike most similar projects, libdvdcss does not require the
region of your drive to be set and will try its best to read from the disc
even in the case of a region mismatch.
@@ -49,8 +48,7 @@ Provides: %name = %version-%release
libdvdcss is a simple library designed for accessing DVDs like a block device
without having to bother about the decryption. The important features are:
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 SP4 (with
- IE 5.0) or later.
+ OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
* Adaptability: Unlike most similar projects, libdvdcss does not require the
region of your drive to be set and will try its best to read from the disc
even in the case of a region mismatch.
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a58675..4bc6821 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -31,7 +31,7 @@
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
* NetBSD, OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows
- * NT 4.0 SP4 (with IE 5.0) or later.
+ * 2000 or later.
* \li adaptability: Unlike most similar projects, libdvdcss does not require
* the region of your drive to be set and will try its best to read from
* the disc even in the case of a region mismatch.
@@ -116,7 +116,7 @@
# include <unistd.h>
#endif

-#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
+#ifdef WIN32
# include <shlobj.h>
#endif

@@ -200,7 +200,7 @@ static int set_cache_directory( dvdcss_t dvdcss )

if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
+#ifdef WIN32
char psz_home[PATH_MAX];

/* Cache our keys in
@@ -255,7 +255,7 @@ static int set_cache_directory( dvdcss_t dvdcss )
dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
psz_cache = dvdcss->psz_cachefile;
}
-#endif /* ! defined(_WIN32_IE) && _WIN32_IE >= 0x500 */
+#endif /* ! defined( WIN32 ) */
}

/* Check that there is enough space for the cache directory path and the
--
2.1.0
Jean-Baptiste Kempf
2014-11-16 19:43:04 UTC
Permalink
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
xos2*)
LDFLAGS="-Zbin-files"
;;
- x*msvc* | x*mingw* | *wince* | *mingwce*)
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
- ;;
You must keep this, because else, some code will be miscompiled, because
of some headers magic on Mingw and MSVC.

The rest is OK.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-11-16 20:57:23 UTC
Permalink
---

Now I keep the _WIN32_IE #define to avoid unwanted side-effects.

NEWS | 4 ++--
configure.ac | 4 ++--
libdvdcss.spec.in | 6 ++----
msvc/config.h | 2 +-
src/libdvdcss.c | 8 ++++----
5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/NEWS b/NEWS
index 86c7780..91cc13d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
Changes since 1.3.0:
--------------------
* Drop support for HP-UX.
- * Drop support for Windows 9x.
- Windows NT 4.0 SP4 with IE 5.0 is now required.
+ * Drop support for Windows 9x and Windows NT.
+ Windows 2000 is now required.
* Replace BeOS support by Haiku support.
* dvdcss_error() now returns "const char *" instad of "char *".
* Drop support for MSVC versions before 2010.
diff --git a/configure.ac b/configure.ac
index f222457..9123524 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,13 +106,13 @@ case x"${host_os}" in
;;
x*cygwin*)
CFLAGS="${CFLAGS} -mwin32"
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
+ AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
;;
xos2*)
LDFLAGS="-Zbin-files"
;;
x*msvc* | x*mingw* | *wince* | *mingwce*)
- AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
+ AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
;;
x*)
;;
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 7734df0..0558661 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,8 +32,7 @@ Conflicts: libdvdcss0.0.1, libdvdcss0.0.2
libdvdcss is a simple library designed for accessing DVDs like a block device
without having to bother about the decryption. The important features are:
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 SP4 (with
- IE 5.0) or later.
+ OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
* Adaptability: Unlike most similar projects, libdvdcss does not require the
region of your drive to be set and will try its best to read from the disc
even in the case of a region mismatch.
@@ -49,8 +48,7 @@ Provides: %name = %version-%release
libdvdcss is a simple library designed for accessing DVDs like a block device
without having to bother about the decryption. The important features are:
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 SP4 (with
- IE 5.0) or later.
+ OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows 2000 or later.
* Adaptability: Unlike most similar projects, libdvdcss does not require the
region of your drive to be set and will try its best to read from the disc
even in the case of a region mismatch.
diff --git a/msvc/config.h b/msvc/config.h
index d65d53b..190b8f9 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -35,7 +35,7 @@
/* #undef SOLARIS_USCSI */
#define STDC_HEADERS 1
#define VERSION "1.3.0"
-#define _WIN32_IE 0x0500
+#define _WIN32_IE 0x0501
/* #undef const */
/* #undef inline */
/* #undef size_t */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a58675..4bc6821 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -31,7 +31,7 @@
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
* NetBSD, OpenBSD, Haiku, Mac OS X, Solaris, QNX, OS/2, and Windows
- * NT 4.0 SP4 (with IE 5.0) or later.
+ * 2000 or later.
* \li adaptability: Unlike most similar projects, libdvdcss does not require
* the region of your drive to be set and will try its best to read from
* the disc even in the case of a region mismatch.
@@ -116,7 +116,7 @@
# include <unistd.h>
#endif

-#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
+#ifdef WIN32
# include <shlobj.h>
#endif

@@ -200,7 +200,7 @@ static int set_cache_directory( dvdcss_t dvdcss )

if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
+#ifdef WIN32
char psz_home[PATH_MAX];

/* Cache our keys in
@@ -255,7 +255,7 @@ static int set_cache_directory( dvdcss_t dvdcss )
dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
psz_cache = dvdcss->psz_cachefile;
}
-#endif /* ! defined(_WIN32_IE) && _WIN32_IE >= 0x500 */
+#endif /* ! defined( WIN32 ) */
}

/* Check that there is enough space for the cache directory path and the
--
2.1.0
Diego Biurrun
2014-11-16 19:37:10 UTC
Permalink
---
src/device.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/device.c b/src/device.c
index 51b41be..46ab121 100644
--- a/src/device.c
+++ b/src/device.c
@@ -392,27 +392,25 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
int dvdcss_close_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
- if( dvdcss->b_file )
- {
- close( dvdcss->i_fd );
- }
- else
- {
- CloseHandle( (HANDLE) dvdcss->i_fd );
- }
-
/* Free readv temporary buffer */
free( dvdcss->p_readv_buffer );
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
-#else
- int i_ret = close( dvdcss->i_fd );
- if( i_ret < 0 )
+
+ if( !dvdcss->b_file )
{
- print_error( dvdcss, "Failed to close fd, data loss possible." );
- return i_ret;
+ CloseHandle( (HANDLE) dvdcss->i_fd );
}
+ else
#endif
+ {
+ int i_ret = close( dvdcss->i_fd );
+ if( i_ret < 0 )
+ {
+ print_error( dvdcss, "Failed to close fd, data loss possible." );
+ return i_ret;
+ }
+ }

return 0;
}
--
2.1.0
Jean-Baptiste Kempf
2014-11-16 19:40:38 UTC
Permalink
OK.
Post by Diego Biurrun
---
src/device.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/device.c b/src/device.c
index 51b41be..46ab121 100644
--- a/src/device.c
+++ b/src/device.c
@@ -392,27 +392,25 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
int dvdcss_close_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
- if( dvdcss->b_file )
- {
- close( dvdcss->i_fd );
- }
- else
- {
- CloseHandle( (HANDLE) dvdcss->i_fd );
- }
-
/* Free readv temporary buffer */
free( dvdcss->p_readv_buffer );
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
-#else
- int i_ret = close( dvdcss->i_fd );
- if( i_ret < 0 )
+
+ if( !dvdcss->b_file )
{
- print_error( dvdcss, "Failed to close fd, data loss possible." );
- return i_ret;
+ CloseHandle( (HANDLE) dvdcss->i_fd );
}
+ else
#endif
+ {
+ int i_ret = close( dvdcss->i_fd );
+ if( i_ret < 0 )
+ {
+ print_error( dvdcss, "Failed to close fd, data loss possible." );
+ return i_ret;
+ }
+ }
return 0;
}
--
2.1.0
_______________________________________________
libdvdcss-devel mailing list
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
Jean-Baptiste Kempf
2014-11-16 19:41:27 UTC
Permalink
OK.
---
src/device.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/device.c b/src/device.c
index 8744810..da4ecc4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -87,10 +87,6 @@ static int win2k_readv ( dvdcss_t, const struct iovec *, int );
#elif defined( __OS2__ )
static int os2_open ( dvdcss_t, const char * );
-/* just use macros for libc */
-# define os2_seek libc_seek
-# define os2_read libc_read
-# define os2_readv libc_readv
#endif
int dvdcss_use_ioctls( dvdcss_t dvdcss )
@@ -366,9 +362,9 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
return win2k_open( dvdcss, psz_device );
#elif defined( __OS2__ )
print_debug( dvdcss, "using OS/2 API for access" );
- dvdcss->pf_seek = os2_seek;
- dvdcss->pf_read = os2_read;
- dvdcss->pf_readv = os2_readv;
+ dvdcss->pf_seek = libc_seek;
+ dvdcss->pf_read = libc_read;
+ dvdcss->pf_readv = libc_readv;
return os2_open( dvdcss, psz_device );
#endif /* ! ( defined( WIN32 ) || defined( __OS2__ ) ) */
}
--
2.1.0
_______________________________________________
libdvdcss-devel mailing list
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
Loading...