Discussion:
[libdvdcss-devel] le grande cleanup
Diego Biurrun
2014-10-29 20:33:00 UTC
Permalink
Bon soir mesdames et messieurs, I 'ave a grande patch set for vous.

I cleaned up libdvdcss as well as I could. This still needs some
testing, but we're really getting somewhere. So far I only compiled
it on Linux, Cygwin, and MSVC.

Creating and initializing of the cache directories seems buggy. The
tag file is created before the cache directory. Sounds like it always
used to fail and the tag file was created on the second call a program
made to dvdcss_open().

Speaking of dvdcss_open(), I cut it down from 500 lines to something
more sane. libdvdcss is starting to look sane overall; I'm happy.

No, I don't plan to drop support for all those legacy OSes. Those are
troll patches that tell you how much extra code each OS needs:

Drop support for Solaris.
9 files changed, 6 insertions(+), 320 deletions(-)

Drop support for OS/2.
9 files changed, 6 insertions(+), 364 deletions(-)

Drop support for QNX.
6 files changed, 5 insertions(+), 183 deletions(-)

Drop support for BeOS.
7 files changed, 11 insertions(+), 181 deletions(-)

Drop support for Windows 9x.
7 files changed, 11 insertions(+), 620 deletions(-)

I think Windows 9x should go for sure. The others we can discuss.

cordialement, Diegó


[PATCH 01/46] attributes.m4: Properly declare parameterless main()
[PATCH 02/46] attributes.m4: Drop extra quoting from config.h text in
[PATCH 03/46] Replace "char const" by "const char".
[PATCH 04/46] Mark strings as const where appropriate.
[PATCH 05/46] Drop unnecessary NULL check before free().
[PATCH 06/46] error: Drop unused and disabled _print_debug function.
[PATCH 07/46] error: Drop unnecessary #includes.
[PATCH 08/46] error: Drop unnecessary macro indirection for
[PATCH 09/46] Drop leading underscore from externally visible
[PATCH 10/46] solaris: Drop no use or single use macros
[PATCH 11/46] device: Eliminate nonsense conditional test
[PATCH 12/46] Drop support for Windows 9x.
[PATCH 13/46] indentation cosmetics (for squashing)
[PATCH 14/46] Rename win_readv() to win2k_readv for consistency.
[PATCH 15/46] ioctl: Replace magic number by DVDCSS_BLOCK_SIZE macro
[PATCH 16/46] typo fixes
[PATCH 17/46] Comment some #endifs for increased readability.
[PATCH 18/46] ioctl: cosmetics: Coalesce some macro and declaration
[PATCH 19/46] ioctl: Add missing header to fix standalone compilation
[PATCH 20/46] build: Add $(EXEEXT) to tools shorthand to fix build on
[PATCH 21/46] dvd_region: #include ioctl.c instead of linking against
[PATCH 22/46] dvd_region: Use dvdcss_open() instead of plain open()
[PATCH 23/46] device: Use correct type for ReadFile() function
[PATCH 24/46] device: Move Win32-specific fallback macro to common.h
[PATCH 25/46] device: Refactor a number of block size calculations
[PATCH 26/46] Remove bogus error checking of dvdcss_close_device()
[PATCH 27/46] Replace GCC-specific bits in print_debug macro by
[PATCH 28/46] css: Check the return value of a malloc() invocation
[PATCH 29/46] msvc: Map some POSIX function names to their ISO C++
[PATCH 30/46] ioctl: Initialize variable before use in
[PATCH 31/46] device: Check return value of snprintf() in
[PATCH 32/46] libdvdcss: Drop unnecessary void* pointer casts
[PATCH 33/46] libdvdcss: Avoid a cast when comparing the return
[PATCH 34/46] libdvdcss: Factor out setting library verbosity from
[PATCH 35/46] libdvdcss: Refactor error handling in dvdcss_open()
[PATCH 36/46] libdvdcss: Factor out setting DVD access method from
[PATCH 37/46] libdvdcss: Factor out setting cache directory from
[PATCH 38/46] libdvdcss: Improve some comments in dvdcss_open()
[PATCH 39/46] libdvdcss: Factor out writing cache directory tag from
[PATCH 40/46] libdvdcss: Factor out creating cache directory from
[PATCH 41/46] Add QNX to list of supported OSes.
[PATCH 42/46] Update NEWS file with latest changes.
[PATCH 43/46] Drop support for BeOS.
[PATCH 44/46] Drop support for QNX.
[PATCH 45/46] Drop support for OS/2.
[PATCH 46/46] Drop support for Solaris.
Diego Biurrun
2014-10-29 20:33:02 UTC
Permalink
---
m4/attributes.m4 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 39d02e3..850a4ee 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
- AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
CFLAGS="$ac_save_CFLAGS"
@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
AS_TR_SH([cc_cv_ldflags_$1]),
[ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1"
- AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 1; }])],
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_ldflags_$1])="])
LDFLAGS="$ac_save_LDFLAGS"
@@ -281,7 +281,7 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
CFLAGS="$CFLAGS $cc_cv_werror"
for cc_attribute_align_try in 64 32 16 8 4 2; do
AC_COMPILE_IFELSE([
- int main() {
+ int main(void) {
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
return c;
}], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
--
1.9.1
Diego Biurrun
2014-10-29 20:33:04 UTC
Permalink
The latter is the more common idiom, the former reads weird.
---
src/css.c | 2 +-
src/device.c | 20 ++++++++++----------
src/device.h | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/css.c b/src/css.c
index b70759a..68eaf4b 100644
--- a/src/css.c
+++ b/src/css.c
@@ -103,7 +103,7 @@ static int _dvdcss_titlekey ( dvdcss_t, int , dvd_key_t );
*****************************************************************************/
int _dvdcss_test( dvdcss_t dvdcss )
{
- char const *psz_type, *psz_rpc;
+ const char *psz_type, *psz_rpc;
int i_ret, i_copyright, i_type, i_mask, i_rpc;

i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
diff --git a/src/device.c b/src/device.c
index 4f2d27a..9bfcba9 100644
--- a/src/device.c
+++ b/src/device.c
@@ -77,14 +77,14 @@
/*****************************************************************************
* Device reading prototypes
*****************************************************************************/
-static int libc_open ( dvdcss_t, char const * );
+static int libc_open ( dvdcss_t, const char * );
static int libc_seek ( dvdcss_t, int );
static int libc_read ( dvdcss_t, void *, int );
static int libc_readv ( dvdcss_t, struct iovec *, int );

#ifdef WIN32
-static int win2k_open ( dvdcss_t, char const * );
-static int aspi_open ( dvdcss_t, char const * );
+static int win2k_open ( dvdcss_t, const char * );
+static int aspi_open ( dvdcss_t, const char * );
static int win2k_seek ( dvdcss_t, int );
static int aspi_seek ( dvdcss_t, int );
static int win2k_read ( dvdcss_t, void *, int );
@@ -93,7 +93,7 @@ static int win_readv ( dvdcss_t, struct iovec *, int );

static int aspi_read_internal ( int, void *, int );
#elif defined( __OS2__ )
-static int os2_open ( dvdcss_t, char const * );
+static int os2_open ( dvdcss_t, const char * );
/* just use macros for libc */
# define os2_seek libc_seek
# define os2_read libc_read
@@ -354,7 +354,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )

int _dvdcss_open ( dvdcss_t dvdcss )
{
- char const *psz_device = dvdcss->psz_device;
+ const char *psz_device = dvdcss->psz_device;

print_debug( dvdcss, "opening target `%s'", psz_device );

@@ -409,7 +409,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
}

#ifdef DVDCSS_RAW_OPEN
-int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
+int _dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
{
dvdcss->i_raw_fd = open( psz_device, 0 );

@@ -478,7 +478,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
/*****************************************************************************
* Open commands.
*****************************************************************************/
-static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
+static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
{
dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );

@@ -496,7 +496,7 @@ static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
}

#if defined( WIN32 )
-static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
+static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
{
char psz_dvd[7];
snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
@@ -532,7 +532,7 @@ static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
return 0;
}

-static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
+static int aspi_open( dvdcss_t dvdcss, const char *psz_device )
{
HMODULE hASPI;
DWORD dwSupportInfo;
@@ -652,7 +652,7 @@ static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
#endif

#ifdef __OS2__
-static int os2_open ( dvdcss_t dvdcss, char const *psz_device )
+static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
{
char psz_dvd[] = "X:";
HFILE hfile;
diff --git a/src/device.h b/src/device.h
index e45d075..4c7f38b 100644
--- a/src/device.h
+++ b/src/device.h
@@ -60,6 +60,6 @@ int _dvdcss_close ( dvdcss_t );
/*****************************************************************************
* Device reading prototypes, raw-device specific
*****************************************************************************/
-int _dvdcss_raw_open ( dvdcss_t, char const * );
+int _dvdcss_raw_open ( dvdcss_t, const char * );

#endif /* DVDCSS_DEVICE_H */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:03 UTC
Permalink
The quotes were preventing an ifelse clause in the message from taking effect.
---
m4/attributes.m4 | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 850a4ee..f8b2fc5 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -131,8 +131,7 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
[AC_DEFINE(
AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
- [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
- )
+ Define this if the compiler supports __attribute__((ifelse([$2], , [$1], [$2]))))
$4],
[$5])
])
--
1.9.1
Diego Biurrun
2014-10-29 20:33:05 UTC
Permalink
---
src/device.c | 2 +-
src/dvdcss/dvdcss.h | 2 +-
src/libdvdcss.c | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/device.c b/src/device.c
index 9bfcba9..7a96e9f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -196,7 +196,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )

int i;
#else
- char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
+ const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
int i, i_fd;
#endif

diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
index 035b093..64f95cf 100644
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -72,7 +72,7 @@ typedef struct dvdcss_s* dvdcss_t;
/*
* Exported prototypes.
*/
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target );
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target );
LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t );
LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t,
int i_blocks,
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 9cdf899..03a8a7b 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -148,16 +148,16 @@
* calls. \e libdvdcss checks whether ioctls can be performed on the disc,
* and when possible, the disc key is retrieved.
*/
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
{
char psz_buffer[PATH_MAX];
int i_ret;

- char *psz_method = getenv( "DVDCSS_METHOD" );
- char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
- char *psz_cache = getenv( "DVDCSS_CACHE" );
+ const char *psz_method = getenv( "DVDCSS_METHOD" );
+ const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+ const char *psz_cache = getenv( "DVDCSS_CACHE" );
#ifdef DVDCSS_RAW_OPEN
- char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
+ const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif

dvdcss_t dvdcss;
@@ -270,7 +270,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
#ifdef __OS2__
if( *psz_home == '/' || *psz_home == '\\')
{
- char *psz_unixroot = getenv("UNIXROOT");
+ const char *psz_unixroot = getenv("UNIXROOT");

if( psz_unixroot &&
psz_unixroot[0] &&
--
1.9.1
Jean-Baptiste Kempf
2014-10-30 13:02:33 UTC
Permalink
Post by Diego Biurrun
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target );
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target );
Isn't that an API/ABI break?

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-10-30 15:09:43 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target );
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target );
Isn't that an API/ABI break?
It shouldn't be. ABI should not change at all as no position or size of
a symbol is affected. API-wise there might be fresh warnings, but all
code should remain compatible.

Diego
David Woodhouse
2014-11-05 12:02:58 UTC
Permalink
Post by Diego Biurrun
It shouldn't be. ABI should not change at all as no position or size of
a symbol is affected. API-wise there might be fresh warnings, but all
code should remain compatible.
There shouldn't even be fresh warnings. If you'd made the change in the
other direction there might be (passing a const char * to a function
which takes a char * will trigger a warning). But you can always pass a
non-const pointer to something which promises not to touch it.
--
dwmw2
Jean-Baptiste Kempf
2014-11-05 12:08:14 UTC
Permalink
Post by David Woodhouse
Post by Diego Biurrun
It shouldn't be. ABI should not change at all as no position or size of
a symbol is affected. API-wise there might be fresh warnings, but all
code should remain compatible.
There shouldn't even be fresh warnings. If you'd made the change in the
other direction there might be (passing a const char * to a function
which takes a char * will trigger a warning). But you can always pass a
non-const pointer to something which promises not to touch it.
OK.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Elio Pettenò
2014-11-05 17:22:15 UTC
Permalink
Post by Diego Biurrun
- char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
+ const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
This should probably be a const char * const.

See https://blog.flameeyes.eu/2007/12/array-of-pointers-and-array-of-arrays

Diego Elio Pettenò — Flameeyes
***@flameeyes.eu — http://blog.flameeyes.eu/
Diego Biurrun
2014-10-29 20:33:06 UTC
Permalink
---
src/device.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/device.c b/src/device.c
index 7a96e9f..c7531bf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -450,12 +450,9 @@ int _dvdcss_close ( dvdcss_t dvdcss )
}

/* Free readv temporary buffer */
- if( dvdcss->p_readv_buffer )
- {
- free( dvdcss->p_readv_buffer );
- dvdcss->p_readv_buffer = NULL;
- dvdcss->i_readv_buf_size = 0;
- }
+ free( dvdcss->p_readv_buffer );
+ dvdcss->p_readv_buffer = NULL;
+ dvdcss->i_readv_buf_size = 0;

return 0;
#else
@@ -926,7 +923,7 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
{
dvdcss->i_readv_buf_size = i_blocks * DVDCSS_BLOCK_SIZE;

- if( dvdcss->p_readv_buffer ) free( dvdcss->p_readv_buffer );
+ free( dvdcss->p_readv_buffer );

/* Allocate a buffer which will be used as a temporary storage
* for readv */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:07 UTC
Permalink
---
src/error.c | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/src/error.c b/src/error.c
index 5bc6bd3..2d37dbd 100644
--- a/src/error.c
+++ b/src/error.c
@@ -51,16 +51,3 @@ void _print_error( dvdcss_t dvdcss, char *psz_string )

dvdcss->psz_error = psz_string;
}
-
-/*****************************************************************************
- * Debug messages
- *****************************************************************************/
-#if 0
-void _print_debug( dvdcss_t dvdcss, char *psz_string )
-{
- if( dvdcss->b_debug )
- {
- fprintf( stderr, "libdvdcss debug: %s\n", psz_string );
- }
-}
-#endif
--
1.9.1
Diego Biurrun
2014-10-29 20:33:08 UTC
Permalink
---
src/error.c | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/src/error.c b/src/error.c
index 2d37dbd..7ea62ae 100644
--- a/src/error.c
+++ b/src/error.c
@@ -20,23 +20,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/

-#include "config.h"
-
#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif

#include "dvdcss/dvdcss.h"

-#include "common.h"
-#include "css.h"
#include "libdvdcss.h"

/*****************************************************************************
--
1.9.1
Diego Biurrun
2014-10-29 20:33:09 UTC
Permalink
---
src/error.c | 2 +-
src/libdvdcss.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/error.c b/src/error.c
index 7ea62ae..9d5f242 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, char *psz_string )
{
if( dvdcss->b_errors )
{
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 2faaa5d..71e8daf 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -87,7 +87,6 @@ struct dvdcss_s
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-#define print_error(dvdcss,msg) _print_error(dvdcss,msg)
#if defined( _MSC_VER )
#include <stdarg.h>
__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
@@ -110,6 +109,6 @@ __forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
}
#endif

-void _print_error ( dvdcss_t, char * );
+void print_error ( dvdcss_t, char * );

#endif /* DVDCSS_LIBDVDCSS_H */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:10 UTC
Permalink
C99 reserves identifier names starting with an underscore at the file level.
---
src/css.c | 40 ++++++++++++++++++++--------------------
src/css.h | 8 ++++----
src/device.c | 10 +++++-----
src/device.h | 10 +++++-----
src/libdvdcss.c | 20 ++++++++++----------
5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/css.c b/src/css.c
index 68eaf4b..f4f82d1 100644
--- a/src/css.c
+++ b/src/css.c
@@ -88,10 +88,10 @@ static int AttackPattern ( uint8_t const[], uint8_t * );
static int AttackPadding ( uint8_t const[] );
#endif

-static int _dvdcss_titlekey ( dvdcss_t, int , dvd_key_t );
+static int dvdcss_titlekey ( dvdcss_t, int , dvd_key_t );

/*****************************************************************************
- * _dvdcss_test: check if the disc is encrypted or not
+ * dvdcss_test: check if the disc is encrypted or not
*****************************************************************************
* Return values:
* 1: DVD is scrambled but can be read
@@ -101,7 +101,7 @@ static int _dvdcss_titlekey ( dvdcss_t, int , dvd_key_t );
* -3: drive is RPC-II, region is not set, and DVD is scrambled: the RPC
* scheme will prevent us from reading the scrambled data
*****************************************************************************/
-int _dvdcss_test( dvdcss_t dvdcss )
+int dvdcss_test( dvdcss_t dvdcss )
{
const char *psz_type, *psz_rpc;
int i_ret, i_copyright, i_type, i_mask, i_rpc;
@@ -113,11 +113,11 @@ int _dvdcss_test( dvdcss_t dvdcss )
{
/* Maybe we didn't have enough privileges to read the copyright
* (see ioctl_ReadCopyright comments).
- * Apparently, on unencrypted DVDs _dvdcss_disckey() always fails, so
+ * Apparently, on unencrypted DVDs dvdcss_disckey() always fails, so
* we can check this as a workaround. */
i_ret = 0;
i_copyright = 1;
- if( _dvdcss_disckey( dvdcss ) < 0 )
+ if( dvdcss_disckey( dvdcss ) < 0 )
{
i_copyright = 0;
}
@@ -175,12 +175,12 @@ int _dvdcss_test( dvdcss_t dvdcss )
}

/*****************************************************************************
- * _dvdcss_title: crack or decrypt the current title key if needed
+ * dvdcss_title: crack or decrypt the current title key if needed
*****************************************************************************
* This function should only be called by dvdcss->pf_seek and should eventually
* not be external if possible.
*****************************************************************************/
-int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
+int dvdcss_title ( dvdcss_t dvdcss, int i_block )
{
dvd_title_t *p_title;
dvd_title_t *p_newtitle;
@@ -247,7 +247,7 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
/* Crack or decrypt CSS title key for current VTS */
if( i_ret < 0 )
{
- i_ret = _dvdcss_titlekey( dvdcss, i_block, p_title_key );
+ i_ret = dvdcss_titlekey( dvdcss, i_block, p_title_key );

if( i_ret < 0 )
{
@@ -318,7 +318,7 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
}

/*****************************************************************************
- * _dvdcss_disckey: get disc key.
+ * dvdcss_disckey: get disc key.
*****************************************************************************
* This function should only be called if DVD ioctls are present.
* It will set dvdcss->i_method = DVDCSS_METHOD_TITLE if it fails to find
@@ -327,7 +327,7 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
* -disc key hash crack,
* -decryption with player keys if they are available.
*****************************************************************************/
-int _dvdcss_disckey( dvdcss_t dvdcss )
+int dvdcss_disckey( dvdcss_t dvdcss )
{
unsigned char p_buffer[ DVD_DISCKEY_SIZE ];
dvd_key_t p_disc_key;
@@ -411,9 +411,9 @@ int _dvdcss_disckey( dvdcss_t dvdcss )


/*****************************************************************************
- * _dvdcss_titlekey: get title key.
+ * dvdcss_titlekey: get title key.
*****************************************************************************/
-static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
+static int dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
{
static uint8_t p_garbage[ DVDCSS_BLOCK_SIZE ]; /* we never read it back */
uint8_t p_key[ KEY_SIZE ];
@@ -508,7 +508,7 @@ static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
dvdcss->pf_seek( dvdcss, 0 );
dvdcss->pf_read( dvdcss, p_garbage, 1 );
dvdcss->pf_seek( dvdcss, 0 );
- _dvdcss_disckey( dvdcss );
+ dvdcss_disckey( dvdcss );

/* Fallback */
}
@@ -526,12 +526,12 @@ static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
}

/*****************************************************************************
- * _dvdcss_unscramble: does the actual descrambling of data
+ * dvdcss_unscramble: does the actual descrambling of data
*****************************************************************************
* sec : sector to unscramble
* key : title key for this sector
*****************************************************************************/
-int _dvdcss_unscramble( dvd_key_t p_key, uint8_t *p_sec )
+int dvdcss_unscramble( dvd_key_t p_key, uint8_t *p_sec )
{
unsigned int i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
uint8_t *p_end = p_sec + DVDCSS_BLOCK_SIZE;
@@ -961,8 +961,8 @@ static void CryptKey( int i_key_type, int i_variant,
* DecryptKey: decrypt p_crypted with p_key.
*****************************************************************************
* Used to decrypt the disc key, with a player key, after requesting it
- * in _dvdcss_disckey and to decrypt title keys, with a disc key, requested
- * in _dvdcss_titlekey.
+ * in dvdcss_disckey and to decrypt title keys, with a disc key, requested
+ * in dvdcss_titlekey.
* The player keys and the resulting disc key are only used as KEKs
* (key encryption keys).
* Decryption is slightly dependent on the type of key:
@@ -1477,7 +1477,7 @@ static int i_tries = 0, i_success = 0;
/*****************************************************************************
* CrackTitleKey: try to crack title key from the contents of a VOB.
*****************************************************************************
- * This function is called by _dvdcss_titlekey to find a title key, if we've
+ * This function is called by dvdcss_titlekey to find a title key, if we've
* chosen to crack title key instead of decrypting it with the disc key.
* The DVD should have been opened and be in an authenticated state.
* i_pos is the starting sector, i_len is the maximum number of sectors to read
@@ -1523,8 +1523,8 @@ static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
"secret arcanes to recover", i_pos );

/* Reset the drive before trying to continue */
- _dvdcss_close( dvdcss );
- _dvdcss_open( dvdcss );
+ dvdcss_close_device( dvdcss );
+ dvdcss_open_device( dvdcss );

b_read_error = 1;
continue;
diff --git a/src/css.h b/src/css.h
index 8b47840..005a26c 100644
--- a/src/css.h
+++ b/src/css.h
@@ -54,9 +54,9 @@ typedef struct css_s
/*****************************************************************************
* Prototypes in css.c
*****************************************************************************/
-int _dvdcss_test ( dvdcss_t );
-int _dvdcss_title ( dvdcss_t, int );
-int _dvdcss_disckey ( dvdcss_t );
-int _dvdcss_unscramble ( uint8_t *, uint8_t * );
+int dvdcss_test ( dvdcss_t );
+int dvdcss_title ( dvdcss_t, int );
+int dvdcss_disckey ( dvdcss_t );
+int dvdcss_unscramble ( uint8_t *, uint8_t * );

#endif /* DVDCSS_CSS_H */
diff --git a/src/device.c b/src/device.c
index c7531bf..4dc586e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -100,7 +100,7 @@ static int os2_open ( dvdcss_t, const char * );
# define os2_readv libc_readv
#endif

-int _dvdcss_use_ioctls( dvdcss_t dvdcss )
+int dvdcss_use_ioctls( dvdcss_t dvdcss )
{
#if defined( WIN32 )
if( dvdcss->b_file )
@@ -162,7 +162,7 @@ int _dvdcss_use_ioctls( dvdcss_t dvdcss )
#endif
}

-void _dvdcss_check ( dvdcss_t dvdcss )
+void dvdcss_check_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
DWORD drives;
@@ -352,7 +352,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )
print_error( dvdcss, "could not find a suitable default drive" );
}

-int _dvdcss_open ( dvdcss_t dvdcss )
+int dvdcss_open_device ( dvdcss_t dvdcss )
{
const char *psz_device = dvdcss->psz_device;

@@ -409,7 +409,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
}

#ifdef DVDCSS_RAW_OPEN
-int _dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
+int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
{
dvdcss->i_raw_fd = open( psz_device, 0 );

@@ -429,7 +429,7 @@ int _dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
}
#endif

-int _dvdcss_close ( dvdcss_t dvdcss )
+int dvdcss_close_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
if( dvdcss->b_file )
diff --git a/src/device.h b/src/device.h
index 4c7f38b..ff1e67f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -52,14 +52,14 @@ struct iovec
/*****************************************************************************
* Device reading prototypes
*****************************************************************************/
-int _dvdcss_use_ioctls ( dvdcss_t );
-void _dvdcss_check ( dvdcss_t );
-int _dvdcss_open ( dvdcss_t );
-int _dvdcss_close ( dvdcss_t );
+int dvdcss_use_ioctls ( dvdcss_t );
+void dvdcss_check_device ( dvdcss_t );
+int dvdcss_open_device ( dvdcss_t );
+int dvdcss_close_device ( dvdcss_t );

/*****************************************************************************
* Device reading prototypes, raw-device specific
*****************************************************************************/
-int _dvdcss_raw_open ( dvdcss_t, const char * );
+int dvdcss_raw_open ( dvdcss_t, const char * );

#endif /* DVDCSS_DEVICE_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 03a8a7b..196db68 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -311,8 +311,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
/*
* Open device
*/
- _dvdcss_check( dvdcss );
- i_ret = _dvdcss_open( dvdcss );
+ dvdcss_check_device( dvdcss );
+ i_ret = dvdcss_open_device( dvdcss );
if( i_ret < 0 )
{
free( dvdcss->psz_device );
@@ -321,11 +321,11 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
}

dvdcss->b_scrambled = 1; /* Assume the worst */
- dvdcss->b_ioctls = _dvdcss_use_ioctls( dvdcss );
+ dvdcss->b_ioctls = dvdcss_use_ioctls( dvdcss );

if( dvdcss->b_ioctls )
{
- i_ret = _dvdcss_test( dvdcss );
+ i_ret = dvdcss_test( dvdcss );

if( i_ret == -3 )
{
@@ -352,7 +352,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
/* If disc is CSS protected and the ioctls work, authenticate the drive */
if( dvdcss->b_scrambled && dvdcss->b_ioctls )
{
- i_ret = _dvdcss_disckey( dvdcss );
+ i_ret = dvdcss_disckey( dvdcss );

if( i_ret < 0 )
{
@@ -516,7 +516,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
#ifdef DVDCSS_RAW_OPEN
if( psz_raw_device != NULL )
{
- _dvdcss_raw_open( dvdcss, psz_raw_device );
+ dvdcss_raw_open( dvdcss, psz_raw_device );
}
#endif

@@ -572,7 +572,7 @@ LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t dvdcss, int i_blocks, int i_flags )
|| ( i_flags & DVDCSS_SEEK_KEY ) )
{
/* check the title key */
- if( _dvdcss_title( dvdcss, i_blocks ) )
+ if( dvdcss_title( dvdcss, i_blocks ) )
{
return -1;
}
@@ -640,7 +640,7 @@ LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t dvdcss, void *p_buffer,
/* Decrypt the blocks we managed to read */
for( i_index = i_ret; i_index; i_index-- )
{
- _dvdcss_unscramble( dvdcss->css.p_title_key, p_buffer );
+ dvdcss_unscramble( dvdcss->css.p_title_key, p_buffer );
((uint8_t*)p_buffer)[0x14] &= 0x8f;
p_buffer = (uint8_t *)p_buffer + DVDCSS_BLOCK_SIZE;
}
@@ -715,7 +715,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
iov_len = _p_iovec->iov_len;
}

- _dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
+ dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
((uint8_t*)iov_base)[0x14] &= 0x8f;

iov_base = (void *) ((uint8_t*)iov_base + DVDCSS_BLOCK_SIZE);
@@ -748,7 +748,7 @@ LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
p_title = p_tmptitle;
}

- i_ret = _dvdcss_close( dvdcss );
+ i_ret = dvdcss_close_device( dvdcss );

if( i_ret < 0 )
{
--
1.9.1
Diego Biurrun
2014-10-29 20:33:11 UTC
Permalink
---
src/ioctl.c | 3 +--
src/ioctl.h | 2 --
2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/ioctl.c b/src/ioctl.c
index 81a46c2..e60ed3d 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -1579,8 +1579,7 @@ static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type )
rs_cdb->cdb_opaque[ 8 ] = (p_sc->uscsi_buflen >> 8) & 0xff;
rs_cdb->cdb_opaque[ 9 ] = p_sc->uscsi_buflen & 0xff;
p_sc->uscsi_cdblen = 12;
-
- USCSI_TIMEOUT( p_sc, 15 );
+ p_sc->uscsi_timeout = 15;
}

/*****************************************************************************
diff --git a/src/ioctl.h b/src/ioctl.h
index b01ddcb..ce64153 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -57,8 +57,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
* Common macro, Solaris specific
*****************************************************************************/
#if defined( SOLARIS_USCSI )
-#define USCSI_TIMEOUT( SC, TO ) ( (SC)->uscsi_timeout = (TO) )
-#define USCSI_RESID( SC ) ( (SC)->uscsi_resid )
#define INIT_USCSI( TYPE, SIZE ) \
struct uscsi_cmd sc = { 0 }; \
union scsi_cdb rs_cdb; \
--
1.9.1
Diego Biurrun
2014-10-29 20:33:12 UTC
Permalink
---
src/device.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/device.c b/src/device.c
index 4dc586e..e894e2b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -109,14 +109,7 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )
}

/* FIXME: implement this for Windows */
- if( WIN2K )
- {
- return 1;
- }
- else
- {
- return 1;
- }
+ return 1;
#elif defined( __OS2__ )
ULONG ulMode;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:13 UTC
Permalink
These Windows versions are obsolete since a long time and have no more real
world usage. Also, the support code for Windows 9x is ugly and a maintenance
burden.
---

This also simplifies the Windows 2000 code, which is another argument in
favor of dropping Windows 9x IMO.

NEWS | 4 +-
libdvdcss.spec.in | 8 +-
src/device.c | 280 +-----------------------------------------------------
src/ioctl.c | 229 +-------------------------------------------
src/ioctl.h | 92 ------------------
src/libdvdcss.c | 4 +-
test/dvd_region.c | 14 ---
7 files changed, 11 insertions(+), 620 deletions(-)

diff --git a/NEWS b/NEWS
index d65dd93..322b6bb 100644
--- a/NEWS
+++ b/NEWS
@@ -5,10 +5,8 @@ Changes between 1.2.13 and 1.3.0:
- the function dvdcss_title()
- the type dvdcss_handle
- the variable dvdcss_interface_2
- * Drop support for Windows 98 and Windows NT 4.0.
- Windows 98 SE with IE 5.0 and Windows NT 4.0 SP4 with IE 5.0 are required.
* Support for Android
- * Drop support for HP-UX.
+ * Drop support for HP-UX and Windows 9x.


Changes between 1.2.12 and 1.2.13:
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 29b50de..f150623 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,8 +32,8 @@ 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, BeOS, Mac OS X, Solaris, OS/2, Windows 98 SE (with IE 5.0) or
- later, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0)
+ 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 +49,8 @@ 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, BeOS, Mac OS X, Solaris, OS/2, Windows 98 SE (with IE 5.0) or
- later, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0)
+ 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/device.c b/src/device.c
index e894e2b..dce8ce6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -84,14 +84,10 @@ static int libc_readv ( dvdcss_t, struct iovec *, int );

#ifdef WIN32
static int win2k_open ( dvdcss_t, const char * );
-static int aspi_open ( dvdcss_t, const char * );
static int win2k_seek ( dvdcss_t, int );
-static int aspi_seek ( dvdcss_t, int );
static int win2k_read ( dvdcss_t, void *, int );
-static int aspi_read ( dvdcss_t, void *, int );
static int win_readv ( dvdcss_t, struct iovec *, int );

-static int aspi_read_internal ( int, void *, int );
#elif defined( __OS2__ )
static int os2_open ( dvdcss_t, const char * );
/* just use macros for libc */
@@ -362,7 +358,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;

- if( !dvdcss->b_file && WIN2K )
+ if( !dvdcss->b_file )
{
print_debug( dvdcss, "using Win2K API for access" );
dvdcss->pf_seek = win2k_seek;
@@ -370,14 +366,6 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
dvdcss->pf_readv = win_readv;
return win2k_open( dvdcss, psz_device );
}
- else if( !dvdcss->b_file )
- {
- print_debug( dvdcss, "using ASPI for access" );
- dvdcss->pf_seek = aspi_seek;
- dvdcss->pf_read = aspi_read;
- dvdcss->pf_readv = win_readv;
- return aspi_open( dvdcss, psz_device );
- }
else
#elif defined( __OS2__ )
/* If device is "X:" or "X:\", we are not actually opening a file. */
@@ -429,18 +417,10 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
{
close( dvdcss->i_fd );
}
- else if( WIN2K )
+ else
{
CloseHandle( (HANDLE) dvdcss->i_fd );
}
- else /* ASPI */
- {
- struct w32_aspidev *fd = (struct w32_aspidev *) dvdcss->i_fd;
-
- /* Unload ASPI and free w32_aspidev structure */
- FreeLibrary( (HMODULE) fd->hASPI );
- free( (void*) dvdcss->i_fd );
- }

/* Free readv temporary buffer */
free( dvdcss->p_readv_buffer );
@@ -521,124 +501,6 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )

return 0;
}
-
-static int aspi_open( dvdcss_t dvdcss, const char *psz_device )
-{
- HMODULE hASPI;
- DWORD dwSupportInfo;
- struct w32_aspidev *fd;
- int i, j, i_hostadapters;
- GETASPI32SUPPORTINFO lpGetSupport;
- SENDASPI32COMMAND lpSendCommand;
- char c_drive = psz_device[0];
-
- /* load ASPI and init w32_aspidev structure */
- hASPI = LoadLibrary( "wnaspi32.dll" );
- if( hASPI == NULL )
- {
- print_error( dvdcss, "unable to load wnaspi32.dll" );
- return -1;
- }
-
- lpGetSupport = (GETASPI32SUPPORTINFO) GetProcAddress( hASPI, "GetASPI32SupportInfo" );
- lpSendCommand = (SENDASPI32COMMAND) GetProcAddress( hASPI, "SendASPI32Command" );
-
- if(lpGetSupport == NULL || lpSendCommand == NULL )
- {
- print_error( dvdcss, "unable to get ASPI function pointers" );
- FreeLibrary( hASPI );
- return -1;
- }
-
- dwSupportInfo = lpGetSupport();
-
- if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS )
- {
- print_error( dvdcss, "no ASPI adapters found" );
- FreeLibrary( hASPI );
- return -1;
- }
-
- if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP )
- {
- print_error( dvdcss, "unable to initialize ASPI layer" );
- FreeLibrary( hASPI );
- return -1;
- }
-
- i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) );
- if( i_hostadapters == 0 )
- {
- print_error( dvdcss, "no ASPI adapters ready" );
- FreeLibrary( hASPI );
- return -1;
- }
-
- fd = malloc( sizeof( struct w32_aspidev ) );
- if( fd == NULL )
- {
- print_error( dvdcss, "not enough memory" );
- FreeLibrary( hASPI );
- return -1;
- }
-
- fd->i_blocks = 0;
- fd->hASPI = (long) hASPI;
- fd->lpSendCommand = lpSendCommand;
-
- c_drive = c_drive > 'Z' ? c_drive - 'a' : c_drive - 'A';
-
- for( i = 0; i < i_hostadapters; i++ )
- {
- for( j = 0; j < 15; j++ )
- {
- struct SRB_GetDiskInfo srbDiskInfo;
-
- srbDiskInfo.SRB_Cmd = SC_GET_DISK_INFO;
- srbDiskInfo.SRB_HaId = i;
- srbDiskInfo.SRB_Flags = 0;
- srbDiskInfo.SRB_Hdr_Rsvd = 0;
- srbDiskInfo.SRB_Target = j;
- srbDiskInfo.SRB_Lun = 0;
-
- lpSendCommand( (void*) &srbDiskInfo );
-
- if( (srbDiskInfo.SRB_Status == SS_COMP) &&
- (srbDiskInfo.SRB_Int13HDriveInfo == c_drive) )
- {
- /* Make sure this is a CD-ROM device */
- struct SRB_GDEVBlock srbGDEVBlock = { 0 };
-
- srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE;
- srbGDEVBlock.SRB_HaId = i;
- srbGDEVBlock.SRB_Target = j;
-
- lpSendCommand( (void*) &srbGDEVBlock );
-
- if( ( srbGDEVBlock.SRB_Status == SS_COMP ) &&
- ( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) )
- {
- fd->i_sid = MAKEWORD( i, j );
- dvdcss->i_fd = (int) fd;
- dvdcss->i_pos = 0;
- return 0;
- }
- else
- {
- free( fd );
- FreeLibrary( hASPI );
- print_error( dvdcss,"this is not a CD-ROM drive" );
- return -1;
- }
- }
- }
- }
-
- free( (void*) fd );
- FreeLibrary( hASPI );
- print_error( dvdcss, "unable to get haid and target (ASPI)" );
- return -1;
-}
#endif

#ifdef __OS2__
@@ -731,35 +593,6 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )

return dvdcss->i_pos;
}
-
-static int aspi_seek( dvdcss_t dvdcss, int i_blocks )
-{
- int i_old_blocks;
- char sz_buf[ DVDCSS_BLOCK_SIZE ];
- struct w32_aspidev *fd = (struct w32_aspidev *) dvdcss->i_fd;
-
- if( dvdcss->i_pos == i_blocks )
- {
- /* We are already in position */
- return i_blocks;
- }
-
- i_old_blocks = fd->i_blocks;
- fd->i_blocks = i_blocks;
-
- if( aspi_read_internal( dvdcss->i_fd, sz_buf, 1 ) == -1 )
- {
- fd->i_blocks = i_old_blocks;
- dvdcss->i_pos = -1;
- return -1;
- }
-
- (fd->i_blocks)--;
-
- dvdcss->i_pos = fd->i_blocks;
-
- return dvdcss->i_pos;
-}
#endif

/*****************************************************************************
@@ -815,20 +648,6 @@ static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
dvdcss->i_pos += i_bytes / DVDCSS_BLOCK_SIZE;
return i_bytes / DVDCSS_BLOCK_SIZE;
}
-
-static int aspi_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
-{
- int i_read = aspi_read_internal( dvdcss->i_fd, p_buffer, i_blocks );
-
- if( i_read < 0 )
- {
- dvdcss->i_pos = -1;
- return i_read;
- }
-
- dvdcss->i_pos += i_read;
- return i_read;
-}
#endif

/*****************************************************************************
@@ -903,7 +722,7 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

#if defined( WIN32 )
/*****************************************************************************
- * win_readv: vectored read using ReadFile for Win2K and ASPI for win9x
+ * win_readv: vectored read using ReadFile for Win2K
*****************************************************************************/
static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
{
@@ -938,8 +757,6 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

i_blocks_total /= DVDCSS_BLOCK_SIZE;

- if( WIN2K )
- {
unsigned long int i_bytes;
if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
@@ -951,19 +768,6 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
return -1;
}
i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;
- }
- else /* Win9x */
- {
- i_blocks_read = aspi_read_internal( dvdcss->i_fd,
- dvdcss->p_readv_buffer,
- i_blocks_total );
- if( i_blocks_read < 0 )
- {
- /* See above */
- dvdcss->i_pos = -1;
- return -1;
- }
- }

/* We just have to copy the content of the temp buffer into the iovecs */
for( i_index = 0, i_blocks_total = i_blocks_read;
@@ -983,82 +787,4 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
dvdcss->i_pos += i_blocks_read;
return i_blocks_read;
}
-
-static int aspi_read_internal( int i_fd, void *p_data, int i_blocks )
-{
- HANDLE hEvent;
- struct SRB_ExecSCSICmd ssc = { 0 };
- struct w32_aspidev *fd = (struct w32_aspidev *) i_fd;
-
- /* Create the transfer completion event */
- hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
- if( hEvent == NULL )
- {
- return -1;
- }
-
- ssc.SRB_Cmd = SC_EXEC_SCSI_CMD;
- ssc.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY;
- ssc.SRB_HaId = LOBYTE( fd->i_sid );
- ssc.SRB_Target = HIBYTE( fd->i_sid );
- ssc.SRB_SenseLen = SENSE_LEN;
-
- ssc.SRB_PostProc = (LPVOID) hEvent;
- ssc.SRB_BufPointer = p_data;
- ssc.SRB_CDBLen = 12;
-
- ssc.CDBByte[0] = 0xA8; /* RAW */
- ssc.CDBByte[2] = (UCHAR) (fd->i_blocks >> 24);
- ssc.CDBByte[3] = (UCHAR) (fd->i_blocks >> 16) & 0xff;
- ssc.CDBByte[4] = (UCHAR) (fd->i_blocks >> 8) & 0xff;
- ssc.CDBByte[5] = (UCHAR) (fd->i_blocks) & 0xff;
-
- /* We have to break down the reads into 64KB pieces (ASPI restriction) */
- if( i_blocks > 32 )
- {
- ssc.SRB_BufLen = 32 * DVDCSS_BLOCK_SIZE;
- ssc.CDBByte[9] = 32;
- fd->i_blocks += 32;
-
- /* Initiate transfer */
- ResetEvent( hEvent );
- fd->lpSendCommand( (void*) &ssc );
-
- /* transfer the next 64KB (aspi_read_internal is called recursively)
- * We need to check the status of the read on return */
- if( aspi_read_internal( i_fd,
- (uint8_t*) p_data + 32 * DVDCSS_BLOCK_SIZE,
- i_blocks - 32) < 0 )
- {
- return -1;
- }
- }
- else
- {
- /* This is the last transfer */
- ssc.SRB_BufLen = i_blocks * DVDCSS_BLOCK_SIZE;
- ssc.CDBByte[9] = (UCHAR) i_blocks;
- fd->i_blocks += i_blocks;
-
- /* Initiate transfer */
- ResetEvent( hEvent );
- fd->lpSendCommand( (void*) &ssc );
-
- }
-
- /* If the command has still not been processed, wait until it's finished */
- if( ssc.SRB_Status == SS_PENDING )
- {
- WaitForSingleObject( hEvent, INFINITE );
- }
- CloseHandle( hEvent );
-
- /* check that the transfer went as planned */
- if( ssc.SRB_Status != SS_COMP )
- {
- return -1;
- }
-
- return i_blocks;
-}
#endif
diff --git a/src/ioctl.c b/src/ioctl.c
index e60ed3d..cca2924 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -103,12 +103,10 @@ static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
#endif

/*****************************************************************************
- * Local prototypes, win32 (aspi) specific
+ * Local prototypes, Win32 specific
*****************************************************************************/
#if defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-static void WinInitSSC ( struct SRB_ExecSCSICmd *, int );
-static int WinSendSSC ( int, struct SRB_ExecSCSICmd * );
#endif

/*****************************************************************************
@@ -188,8 +186,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvdbs.copyrightProtectionSystemType;

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );

/* When using IOCTL_DVD_READ_STRUCTURE and
@@ -207,18 +203,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
{
*pi_copyright = p_buffer[ 4 ];
}
- }
- else
- {
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- ssc.CDBByte[ 6 ] = i_layer;
- ssc.CDBByte[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- *pi_copyright = p_buffer[ 4 ];
- }

#elif defined( __QNXNTO__ )

@@ -329,8 +313,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_DISK_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -349,23 +331,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
}

memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
- }
- else
- {
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- ssc.CDBByte[ 7 ] = DVD_STRUCT_DISCKEY;
- ssc.CDBByte[ 10 ] = *pi_agid << 6;
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- if( i_ret < 0 )
- {
- return i_ret;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
- }

#elif defined( __QNXNTO__ )

@@ -480,8 +445,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_TITLE_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -497,21 +460,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- ssc.CDBByte[ 2 ] = ( i_pos >> 24 ) & 0xff;
- ssc.CDBByte[ 3 ] = ( i_pos >> 16 ) & 0xff;
- ssc.CDBByte[ 4 ] = ( i_pos >> 8 ) & 0xff;
- ssc.CDBByte[ 5 ] = ( i_pos ) & 0xff;
- ssc.CDBByte[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
- }

#elif defined( __QNXNTO__ )

@@ -613,8 +561,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = dvdbs.grantID;

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
ULONG id;
DWORD tmp;

@@ -622,17 +568,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
&tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;

*pi_agid = id;
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- ssc.CDBByte[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- *pi_agid = p_buffer[ 7 ] >> 6;
- }

#elif defined( __QNXNTO__ )

@@ -723,8 +658,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -743,17 +676,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
}

memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 16 );
-
- ssc.CDBByte[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
- }

#elif defined( __QNXNTO__ )

@@ -842,8 +764,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
*pi_asf = dvdbs.successFlag;

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_ASF_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -866,17 +786,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )

keyData = (PDVD_ASF)key->KeyData;
*pi_asf = keyData->SuccessFlag;
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- ssc.CDBByte[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- *pi_asf = p_buffer[ 7 ] & 1;
- }

#elif defined( __QNXNTO__ )

@@ -967,8 +876,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -982,17 +889,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- ssc.CDBByte[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
- }

#elif defined( __QNXNTO__ )

@@ -1073,29 +969,10 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;

i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
- }
- else
- {
-#if defined( __MINGW32__ )
- INIT_SSC( GPCMD_REPORT_KEY, 0 );
-#else
- INIT_SSC( GPCMD_REPORT_KEY, 1 );
-
- ssc.SRB_BufLen = 0;
- ssc.CDBByte[ 8 ] = 0;
- ssc.CDBByte[ 9 ] = 0;
-#endif
-
- ssc.CDBByte[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = WinSendSSC( i_fd, &ssc );
- }

#elif defined( __QNXNTO__ )

@@ -1189,8 +1066,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -1204,18 +1079,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
- }
- else
- {
- INIT_SSC( GPCMD_SEND_KEY, 16 );
-
- ssc.CDBByte[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- i_ret = WinSendSSC( i_fd, &ssc );
- }

#elif defined( __QNXNTO__ )

@@ -1312,8 +1175,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -1327,18 +1188,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )

i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
- }
- else
- {
- INIT_SSC( GPCMD_SEND_KEY, 12 );
-
- ssc.CDBByte[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- i_ret = WinSendSSC( i_fd, &ssc );
- }

#elif defined( __QNXNTO__ )

@@ -1443,8 +1292,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_scheme = dvdbs.rpcScheme;

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
DWORD tmp;
uint8_t buffer[DVD_RPC_KEY_LENGTH] = { 0 };
PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
@@ -1466,19 +1313,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_type = keyData->TypeCode;
*p_mask = keyData->RegionMask;
*p_scheme = keyData->RpcScheme;
- }
- else
- {
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- ssc.CDBByte[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = WinSendSSC( i_fd, &ssc );
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
- }

#elif defined( __QNXNTO__ )

@@ -1677,67 +1511,6 @@ static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )

p_sptd->TimeOutValue = 2;
}
-
-/*****************************************************************************
- * WinInitSSC: initialize a ssc structure for the win32 aspi layer
- *****************************************************************************
- * This function initializes a ssc raw device command structure for future
- * use, either a read command or a write command.
- *****************************************************************************/
-static void WinInitSSC( struct SRB_ExecSCSICmd *p_ssc, int i_type )
-{
- memset( p_ssc->SRB_BufPointer, 0, p_ssc->SRB_BufLen );
-
- switch( i_type )
- {
- case GPCMD_SEND_KEY:
- p_ssc->SRB_Flags = SRB_DIR_OUT;
- break;
-
- case GPCMD_READ_DVD_STRUCTURE:
- case GPCMD_REPORT_KEY:
- p_ssc->SRB_Flags = SRB_DIR_IN;
- break;
- }
-
- p_ssc->SRB_Cmd = SC_EXEC_SCSI_CMD;
- p_ssc->SRB_Flags |= SRB_EVENT_NOTIFY;
-
- p_ssc->CDBByte[ 0 ] = i_type;
-
- p_ssc->CDBByte[ 8 ] = (uint8_t)(p_ssc->SRB_BufLen >> 8) & 0xff;
- p_ssc->CDBByte[ 9 ] = (uint8_t) p_ssc->SRB_BufLen & 0xff;
- p_ssc->SRB_CDBLen = 12;
-
- p_ssc->SRB_SenseLen = SENSE_LEN;
-}
-
-/*****************************************************************************
- * WinSendSSC: send a ssc structure to the aspi layer
- *****************************************************************************/
-static int WinSendSSC( int i_fd, struct SRB_ExecSCSICmd *p_ssc )
-{
- HANDLE hEvent = NULL;
- struct w32_aspidev *fd = (struct w32_aspidev *) i_fd;
-
- hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
- if( hEvent == NULL )
- {
- return -1;
- }
-
- p_ssc->SRB_PostProc = hEvent;
- p_ssc->SRB_HaId = LOBYTE( fd->i_sid );
- p_ssc->SRB_Target = HIBYTE( fd->i_sid );
-
- ResetEvent( hEvent );
- if( fd->lpSendCommand( (void*) p_ssc ) == SS_PENDING )
- WaitForSingleObject( hEvent, INFINITE );
-
- CloseHandle( hEvent );
-
- return p_ssc->SRB_Status == SS_COMP ? 0 : -1;
-}
#endif

#if defined( __QNXNTO__ )
diff --git a/src/ioctl.h b/src/ioctl.h
index ce64153..7e66d27 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -96,12 +96,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#define INIT_SSC( TYPE, SIZE ) \
- struct SRB_ExecSCSICmd ssc = { 0 }; \
- uint8_t p_buffer[ (SIZE)+1 ]; \
- ssc.SRB_BufPointer = (unsigned char *)p_buffer; \
- ssc.SRB_BufLen = (SIZE); \
- WinInitSSC( &ssc, (TYPE) );
#endif

/*****************************************************************************
@@ -291,92 +285,6 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
UCHAR Cdb[16];
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;

-/*****************************************************************************
- * win32 aspi specific
- *****************************************************************************/
-
-typedef DWORD (CALLBACK *GETASPI32SUPPORTINFO)(VOID);
-typedef DWORD (CALLBACK *SENDASPI32COMMAND)(LPVOID);
-
-#define WIN2K ( GetVersion() < 0x80000000 )
-#define ASPI_HAID 0
-#define ASPI_TARGET 0
-#define DTYPE_CDROM 0x05
-
-#define SENSE_LEN 0x0E
-#define SC_GET_DEV_TYPE 0x01
-#define SC_EXEC_SCSI_CMD 0x02
-#define SC_GET_DISK_INFO 0x06
-#define SS_COMP 0x01
-#define SS_PENDING 0x00
-#define SS_NO_ADAPTERS 0xE8
-#define SRB_DIR_IN 0x08
-#define SRB_DIR_OUT 0x10
-#define SRB_EVENT_NOTIFY 0x40
-
-struct w32_aspidev
-{
- long hASPI;
- short i_sid;
- int i_blocks;
- SENDASPI32COMMAND lpSendCommand;
-};
-
-#pragma pack(1)
-
-struct SRB_GetDiskInfo
-{
- unsigned char SRB_Cmd;
- unsigned char SRB_Status;
- unsigned char SRB_HaId;
- unsigned char SRB_Flags;
- unsigned long SRB_Hdr_Rsvd;
- unsigned char SRB_Target;
- unsigned char SRB_Lun;
- unsigned char SRB_DriveFlags;
- unsigned char SRB_Int13HDriveInfo;
- unsigned char SRB_Heads;
- unsigned char SRB_Sectors;
- unsigned char SRB_Rsvd1[22];
-};
-
-struct SRB_GDEVBlock
-{
- unsigned char SRB_Cmd;
- unsigned char SRB_Status;
- unsigned char SRB_HaId;
- unsigned char SRB_Flags;
- unsigned long SRB_Hdr_Rsvd;
- unsigned char SRB_Target;
- unsigned char SRB_Lun;
- unsigned char SRB_DeviceType;
- unsigned char SRB_Rsvd1;
-};
-
-struct SRB_ExecSCSICmd
-{
- unsigned char SRB_Cmd;
- unsigned char SRB_Status;
- unsigned char SRB_HaId;
- unsigned char SRB_Flags;
- unsigned long SRB_Hdr_Rsvd;
- unsigned char SRB_Target;
- unsigned char SRB_Lun;
- unsigned short SRB_Rsvd1;
- unsigned long SRB_BufLen;
- unsigned char *SRB_BufPointer;
- unsigned char SRB_SenseLen;
- unsigned char SRB_CDBLen;
- unsigned char SRB_HaStat;
- unsigned char SRB_TargStat;
- unsigned long *SRB_PostProc;
- unsigned char SRB_Rsvd2[20];
- unsigned char CDBByte[16];
- unsigned char SenseArea[SENSE_LEN+2];
-};
-
-#pragma pack()
-
#endif

/*****************************************************************************
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 196db68..d4c81e9 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, BeOS, Mac OS X, Solaris, OS/2, Windows 98 SE
- * (with IE 5.0) or later, and Windows NT 4.0 (with IE 5.0) or later.
+ * NetBSD, OpenBSD, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0
+ * (with IE 5.0) 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.
diff --git a/test/dvd_region.c b/test/dvd_region.c
index d5e80fd..a41eff1 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -90,8 +90,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- if( WIN2K ) /* NT/2k/XP */
- {
INIT_SPTD( GPCMD_SEND_KEY, 8 );

sptd.Cdb[ 10 ] = DVD_SEND_RPC;
@@ -100,18 +98,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
p_buffer[ 4 ] = i_pdrc;

i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
- }
- else
- {
- INIT_SSC( GPCMD_SEND_KEY, 8 );
-
- ssc.CDBByte[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = WinSendSSC( i_fd, &ssc );
- }

#elif defined( __QNXNTO__ )
--
1.9.1
Reimar Döffinger
2014-10-30 06:57:26 UTC
Permalink
Hi!
Nice work on the patchset.
Post by Diego Biurrun
These Windows versions are obsolete since a long time and have no more real
world usage. Also, the support code for Windows 9x is ugly and a maintenance
burden.
---
This also simplifies the Windows 2000 code, which is another argument in
favor of dropping Windows 9x IMO.
If someone is interested in keeping it they should at least clean up the code.
There is quite a bit of code duplication etc. which is at least part of what makes it so large.
Diego Biurrun
2014-10-29 20:33:14 UTC
Permalink
---

This is supposed to be squashed into the Windows 9x removal. Or not,
but it's easier to review without these whitespace changes.

src/device.c | 22 ++---
src/ioctl.c | 250 +++++++++++++++++++++++++++---------------------------
test/dvd_region.c | 10 +--
3 files changed, 141 insertions(+), 141 deletions(-)

diff --git a/src/device.c b/src/device.c
index dce8ce6..514aa1e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -757,17 +757,17 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

i_blocks_total /= DVDCSS_BLOCK_SIZE;

- unsigned long int i_bytes;
- if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
- i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
- {
- /* The read failed... too bad.
- * As in the POSIX spec the file position is left
- * unspecified after a failure */
- dvdcss->i_pos = -1;
- return -1;
- }
- i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;
+ unsigned long int i_bytes;
+ if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
+ i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
+ {
+ /* The read failed... too bad.
+ * As in the POSIX spec the file position is left
+ * unspecified after a failure */
+ dvdcss->i_pos = -1;
+ return -1;
+ }
+ i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;

/* We just have to copy the content of the temp buffer into the iovecs */
for( i_index = 0, i_blocks_total = i_blocks_read;
diff --git a/src/ioctl.c b/src/ioctl.c
index cca2924..c33ea66 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -186,23 +186,23 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = dvdbs.copyrightProtectionSystemType;

#elif defined( WIN32 )
- INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
+ INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );

- /* When using IOCTL_DVD_READ_STRUCTURE and
- DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
- seems to be always 6 ???
- To work around this MS bug we try to send a raw SCSI command
- instead (if we've got enough privileges to do so). */
+ /* When using IOCTL_DVD_READ_STRUCTURE and
+ DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
+ seems to be always 6 ???
+ To work around this MS bug we try to send a raw SCSI command
+ instead (if we've got enough privileges to do so). */

- sptd.Cdb[ 6 ] = i_layer;
- sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
+ sptd.Cdb[ 6 ] = i_layer;
+ sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;

- i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
+ i_ret = SEND_SPTD( i_fd, &sptd, &tmp );

- if( i_ret == 0 )
- {
- *pi_copyright = p_buffer[ 4 ];
- }
+ if( i_ret == 0 )
+ {
+ *pi_copyright = p_buffer[ 4 ];
+ }

#elif defined( __QNXNTO__ )

@@ -313,24 +313,24 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_DISK_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_DISK_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_DISK_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdDiskKey;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_DISK_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdDiskKey;
+ key->KeyFlags = 0;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- if( i_ret < 0 )
- {
- return i_ret;
- }
+ if( i_ret < 0 )
+ {
+ return i_ret;
+ }

- memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
+ memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );

#elif defined( __QNXNTO__ )

@@ -445,21 +445,21 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_TITLE_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_TITLE_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_TITLE_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdTitleKey;
- key->KeyFlags = 0;
- key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
- 2048 /*DVDCSS_BLOCK_SIZE*/;
+ key->KeyLength = DVD_TITLE_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdTitleKey;
+ key->KeyFlags = 0;
+ key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
+ 2048 /*DVDCSS_BLOCK_SIZE*/;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
+ memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

#elif defined( __QNXNTO__ )

@@ -561,13 +561,13 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = dvdbs.grantID;

#elif defined( WIN32 )
- ULONG id;
- DWORD tmp;
+ ULONG id;
+ DWORD tmp;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
- &tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
+ &tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;

- *pi_agid = id;
+ *pi_agid = id;

#elif defined( __QNXNTO__ )

@@ -658,24 +658,24 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdChallengeKey;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdChallengeKey;
+ key->KeyFlags = 0;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- if( i_ret < 0 )
- {
- return i_ret;
- }
+ if( i_ret < 0 )
+ {
+ return i_ret;
+ }

- memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
+ memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );

#elif defined( __QNXNTO__ )

@@ -764,28 +764,28 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
*pi_asf = dvdbs.successFlag;

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_ASF_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
- PDVD_ASF keyData;
+ DWORD tmp;
+ uint8_t buffer[DVD_ASF_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ PDVD_ASF keyData;

- key->KeyLength = DVD_ASF_LENGTH;
- key->KeyType = DvdAsf;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_ASF_LENGTH;
+ key->KeyType = DvdAsf;
+ key->KeyFlags = 0;

- keyData = (PDVD_ASF)key->KeyData;
- keyData->SuccessFlag = *pi_asf;
+ keyData = (PDVD_ASF)key->KeyData;
+ keyData->SuccessFlag = *pi_asf;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- if( i_ret < 0 )
- {
- return i_ret;
- }
+ if( i_ret < 0 )
+ {
+ return i_ret;
+ }

- keyData = (PDVD_ASF)key->KeyData;
- *pi_asf = keyData->SuccessFlag;
+ keyData = (PDVD_ASF)key->KeyData;
+ *pi_asf = keyData->SuccessFlag;

#elif defined( __QNXNTO__ )

@@ -876,19 +876,19 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_BUS_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdBusKey1;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_BUS_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdBusKey1;
+ key->KeyFlags = 0;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
+ memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

#elif defined( __QNXNTO__ )

@@ -969,10 +969,10 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- DWORD tmp;
+ DWORD tmp;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
- pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
+ pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;

#elif defined( __QNXNTO__ )

@@ -1066,19 +1066,19 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdChallengeKey;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdChallengeKey;
+ key->KeyFlags = 0;

- memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );
+ memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

#elif defined( __QNXNTO__ )

@@ -1175,19 +1175,19 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ DWORD tmp;
+ uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;

- key->KeyLength = DVD_BUS_KEY_LENGTH;
- key->SessionId = *pi_agid;
- key->KeyType = DvdBusKey2;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_BUS_KEY_LENGTH;
+ key->SessionId = *pi_agid;
+ key->KeyType = DvdBusKey2;
+ key->KeyFlags = 0;

- memcpy( key->KeyData, p_key, DVD_KEY_SIZE );
+ memcpy( key->KeyData, p_key, DVD_KEY_SIZE );

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

#elif defined( __QNXNTO__ )

@@ -1292,27 +1292,27 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_scheme = dvdbs.rpcScheme;

#elif defined( WIN32 )
- DWORD tmp;
- uint8_t buffer[DVD_RPC_KEY_LENGTH] = { 0 };
- PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
- PDVD_RPC_KEY keyData;
+ DWORD tmp;
+ uint8_t buffer[DVD_RPC_KEY_LENGTH] = { 0 };
+ PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+ PDVD_RPC_KEY keyData;

- key->KeyLength = DVD_RPC_KEY_LENGTH;
- key->KeyType = DvdGetRpcKey;
- key->KeyFlags = 0;
+ key->KeyLength = DVD_RPC_KEY_LENGTH;
+ key->KeyType = DvdGetRpcKey;
+ key->KeyFlags = 0;

- i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
- key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+ i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+ key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

- if( i_ret < 0 )
- {
- return i_ret;
- }
+ if( i_ret < 0 )
+ {
+ return i_ret;
+ }

- keyData = (PDVD_RPC_KEY)key->KeyData;
- *p_type = keyData->TypeCode;
- *p_mask = keyData->RegionMask;
- *p_scheme = keyData->RpcScheme;
+ keyData = (PDVD_RPC_KEY)key->KeyData;
+ *p_type = keyData->TypeCode;
+ *p_mask = keyData->RegionMask;
+ *p_scheme = keyData->RpcScheme;

#elif defined( __QNXNTO__ )

diff --git a/test/dvd_region.c b/test/dvd_region.c
index a41eff1..4b61be5 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -90,14 +90,14 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );

#elif defined( WIN32 )
- INIT_SPTD( GPCMD_SEND_KEY, 8 );
+ INIT_SPTD( GPCMD_SEND_KEY, 8 );

- sptd.Cdb[ 10 ] = DVD_SEND_RPC;
+ sptd.Cdb[ 10 ] = DVD_SEND_RPC;

- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
+ p_buffer[ 1 ] = 6;
+ p_buffer[ 4 ] = i_pdrc;

- i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
+ i_ret = SEND_SPTD( i_fd, &sptd, &tmp );

#elif defined( __QNXNTO__ )
--
1.9.1
Diego Biurrun
2014-10-29 20:33:15 UTC
Permalink
---
src/device.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/device.c b/src/device.c
index 514aa1e..9d7cbc8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -83,10 +83,10 @@ static int libc_read ( dvdcss_t, void *, int );
static int libc_readv ( dvdcss_t, struct iovec *, int );

#ifdef WIN32
-static int win2k_open ( dvdcss_t, const char * );
-static int win2k_seek ( dvdcss_t, int );
-static int win2k_read ( dvdcss_t, void *, int );
-static int win_readv ( dvdcss_t, struct iovec *, int );
+static int win2k_open ( dvdcss_t, const char * );
+static int win2k_seek ( dvdcss_t, int );
+static int win2k_read ( dvdcss_t, void *, int );
+static int win2k_readv ( dvdcss_t, struct iovec *, int );

#elif defined( __OS2__ )
static int os2_open ( dvdcss_t, const char * );
@@ -363,7 +363,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
print_debug( dvdcss, "using Win2K API for access" );
dvdcss->pf_seek = win2k_seek;
dvdcss->pf_read = win2k_read;
- dvdcss->pf_readv = win_readv;
+ dvdcss->pf_readv = win2k_readv;
return win2k_open( dvdcss, psz_device );
}
else
@@ -722,9 +722,9 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

#if defined( WIN32 )
/*****************************************************************************
- * win_readv: vectored read using ReadFile for Win2K
+ * win2k_readv: vectored read using ReadFile for Win2K
*****************************************************************************/
-static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
+static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
{
int i_index;
int i_blocks_read, i_blocks_total = 0;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:16 UTC
Permalink
---
src/ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ioctl.c b/src/ioctl.c
index c33ea66..442f91b 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -83,8 +83,8 @@
# include <sys/dcmd_cam.h>
#endif

+#include "dvdcss/dvdcss.h"
#include "common.h"
-
#include "ioctl.h"

/*****************************************************************************
@@ -454,7 +454,7 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
key->KeyType = DvdTitleKey;
key->KeyFlags = 0;
key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
- 2048 /*DVDCSS_BLOCK_SIZE*/;
+ DVDCSS_BLOCK_SIZE;

i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:17 UTC
Permalink
---
src/css.c | 2 +-
src/device.c | 2 +-
src/ioctl.c | 4 ++--
src/ioctl.h | 4 ++--
src/libdvdcss.c | 6 +++---
5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/css.c b/src/css.c
index f4f82d1..b899fc9 100644
--- a/src/css.c
+++ b/src/css.c
@@ -462,7 +462,7 @@ static int dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )

case 1:
/* Drive status is OK. */
- /* If the title key request failed, but we did not loose ASF,
+ /* If the title key request failed, but we did not lose ASF,
* we might still have the AGID. Other code assumes that we
* will not after this so invalidate it(?). */
if( i_ret < 0 )
diff --git a/src/device.c b/src/device.c
index 9d7cbc8..802a73f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -372,7 +372,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
if( psz_device[0] && psz_device[1] == ':' &&
( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
{
- print_debug( dvdcss, "using OS2 API for access" );
+ print_debug( dvdcss, "using OS/2 API for access" );
dvdcss->pf_seek = os2_seek;
dvdcss->pf_read = os2_read;
dvdcss->pf_readv = os2_readv;
diff --git a/src/ioctl.c b/src/ioctl.c
index 442f91b..a993808 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -117,7 +117,7 @@ static void QNXInitCPT ( CAM_PASS_THRU *, int );
#endif

/*****************************************************************************
- * Local prototypes, OS2 specific
+ * Local prototypes, OS/2 specific
*****************************************************************************/
#if defined( __OS2__ )
static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
@@ -1548,7 +1548,7 @@ static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )
/*****************************************************************************
* OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
*****************************************************************************
- * This function initializes a OS2 'execute SCSI command' structure for
+ * This function initializes an OS/2 'execute SCSI command' structure for
* future use, either a read command or a write command.
*****************************************************************************/
static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
diff --git a/src/ioctl.h b/src/ioctl.h
index 7e66d27..453a119 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -114,7 +114,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
#endif

/*****************************************************************************
- * Common macro, OS2 specific
+ * Common macro, OS/2 specific
*****************************************************************************/
#if defined( __OS2__ )
#define INIT_SSC( TYPE, SIZE ) \
@@ -288,7 +288,7 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
#endif

/*****************************************************************************
- * OS2 ioctl specific
+ * OS/2 ioctl specific
*****************************************************************************/
#if defined( __OS2__ )

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index d4c81e9..59bd12d 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -468,8 +468,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
}
}

- /* Get disk key, since some discs have got same title, manufacturing
- * date and serial number, but different keys */
+ /* Get disk key, since some discs have the same title, manufacturing
+ * date and serial number, but different keys. */
if( dvdcss->b_scrambled )
{
psz_key[0] = '-';
@@ -520,7 +520,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
}
#endif

- /* Seek at the beginning, just for safety. */
+ /* Seek to the beginning, just for safety. */
dvdcss->pf_seek( dvdcss, 0 );

return dvdcss;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:18 UTC
Permalink
---
src/common.h | 8 ++++----
src/css.c | 6 +++---
src/device.c | 12 ++++++------
src/ioctl.c | 8 ++++----
src/ioctl.h | 4 ++--
src/libdvdcss.c | 8 ++++----
src/libdvdcss.h | 2 +-
7 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/common.h b/src/common.h
index a83b0c0..b4c4fa7 100644
--- a/src/common.h
+++ b/src/common.h
@@ -58,7 +58,7 @@ typedef _off_t off_t;
# else
# define off_t long long
# endif
-# endif
+# endif /* defined( __MINGW32__ ) */

# if defined( _MSC_VER )
# define lseek _lseeki64
@@ -70,15 +70,15 @@ typedef __int64 off_t;
# endif
# define stat _stati64
# define snprintf _snprintf
-# endif
+# endif /* defined( _MSC_VER ) */

-#endif
+#endif /* defined( WIN32 ) */

#ifdef __ANDROID__
# undef lseek
# define lseek lseek64
# undef off_t
# define off_t off64_t
-#endif
+#endif /* __ANDROID__ */

#endif /* DVDCSS_COMMON_H */
diff --git a/src/css.c b/src/css.c
index b899fc9..3d73080 100644
--- a/src/css.c
+++ b/src/css.c
@@ -122,7 +122,7 @@ int dvdcss_test( dvdcss_t dvdcss )
i_copyright = 0;
}
}
-#endif
+#endif /* WIN32 */

if( i_ret < 0 )
{
@@ -1562,7 +1562,7 @@ static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
{
b_stop_scanning = 1;
}
-#endif
+#endif /* 0 */
}

i_pos++;
@@ -1726,4 +1726,4 @@ static int AttackPadding( uint8_t const p_sec[ DVDCSS_BLOCK_SIZE ] )

return 0;
}
-#endif
+#endif /* 0 */
diff --git a/src/device.c b/src/device.c
index 802a73f..6e37e37 100644
--- a/src/device.c
+++ b/src/device.c
@@ -408,7 +408,7 @@ int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )

return 0;
}
-#endif
+#endif /* DVDCSS_RAW_OPEN */

int dvdcss_close_device ( dvdcss_t dvdcss )
{
@@ -501,7 +501,7 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )

return 0;
}
-#endif
+#endif /* defined( WIN32 ) */

#ifdef __OS2__
static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
@@ -532,7 +532,7 @@ static int os2_open ( dvdcss_t dvdcss, const char *psz_device )

return 0;
}
-#endif
+#endif /* __OS2__ */

/*****************************************************************************
* Seek commands.
@@ -593,7 +593,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )

return dvdcss->i_pos;
}
-#endif
+#endif /* defined( WIN32 ) */

/*****************************************************************************
* Read commands.
@@ -648,7 +648,7 @@ static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
dvdcss->i_pos += i_bytes / DVDCSS_BLOCK_SIZE;
return i_bytes / DVDCSS_BLOCK_SIZE;
}
-#endif
+#endif /* defined( WIN32 ) */

/*****************************************************************************
* Readv commands.
@@ -787,4 +787,4 @@ static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
dvdcss->i_pos += i_blocks_read;
return i_blocks_read;
}
-#endif
+#endif /* defined( WIN32 ) */
diff --git a/src/ioctl.c b/src/ioctl.c
index a993808..72adf33 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -1479,7 +1479,7 @@ static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )

return ioctl( i_fd, USCSICMD, p_sc );
}
-#endif
+#endif /* defined( SOLARIS_USCSI ) */

#if defined( WIN32 )
/*****************************************************************************
@@ -1511,7 +1511,7 @@ static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )

p_sptd->TimeOutValue = 2;
}
-#endif
+#endif /* defined( WIN32 ) */

#if defined( __QNXNTO__ )
/*****************************************************************************
@@ -1542,7 +1542,7 @@ static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )

p_cpt->cam_timeout = CAM_TIME_DEFAULT;
}
-#endif
+#endif /* defined( __QNXNTO__ ) */

#if defined( __OS2__ )
/*****************************************************************************
@@ -1571,4 +1571,4 @@ static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
p_sdc->id_code = 0x31304443; // 'CD01'
p_sdc->cmd_length = 12;
}
-#endif
+#endif /* defined( __OS2__ ) */
diff --git a/src/ioctl.h b/src/ioctl.h
index 453a119..1c6cb0c 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -285,7 +285,7 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
UCHAR Cdb[16];
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;

-#endif
+#endif /* defined( WIN32 ) */

/*****************************************************************************
* OS/2 ioctl specific
@@ -311,6 +311,6 @@ struct OS2_ExecSCSICmd

#pragma pack()

-#endif
+#endif /* defined( __OS2__ ) */

#endif /* DVDCSS_IOCTL_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 59bd12d..7bd888b 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -242,7 +242,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
}
#else
char *psz_home = NULL;
-# ifdef HAVE_PWD_H
+#ifdef HAVE_PWD_H
struct passwd *p_pwd;

/* Try looking in password file for home dir. */
@@ -251,7 +251,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
{
psz_home = p_pwd->pw_dir;
}
-# endif
+#endif /* HAVE_PWD_H */

if( psz_home == NULL )
{
@@ -281,7 +281,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
home_pos = 2;
}
}
-#endif
+#endif /* __OS2__ */
snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
"%s/.dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
@@ -518,7 +518,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
{
dvdcss_raw_open( dvdcss, psz_raw_device );
}
-#endif
+#endif /* DVDCSS_RAW_OPEN */

/* Seek to the beginning, just for safety. */
dvdcss->pf_seek( dvdcss, 0 );
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 71e8daf..8ac0633 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -70,7 +70,7 @@ struct dvdcss_s
int b_file;
char * p_readv_buffer;
int i_readv_buf_size;
-#endif
+#endif /* WIN32 */

#ifdef DVDCSS_RAW_OPEN
int i_raw_fd;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:19 UTC
Permalink
---

Or not, this is a debatable cosmetic patch...

src/ioctl.c | 29 +++++------------------------
src/ioctl.h | 37 ++++++-------------------------------
2 files changed, 11 insertions(+), 55 deletions(-)

diff --git a/src/ioctl.c b/src/ioctl.c
index 72adf33..788282a 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -88,38 +88,19 @@
#include "ioctl.h"

/*****************************************************************************
- * Local prototypes, BeOS specific
+ * Local prototypes, OS specific
*****************************************************************************/
#if defined( __BEOS__ )
static void BeInitRDC ( raw_device_command *, int );
#endif
-
-/*****************************************************************************
- * Local prototypes, Solaris specific
- *****************************************************************************/
-#if defined( SOLARIS_USCSI )
+#elif defined( SOLARIS_USCSI )
static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
-#endif
-
-/*****************************************************************************
- * Local prototypes, Win32 specific
- *****************************************************************************/
-#if defined( WIN32 )
+#elif defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-#endif
-
-/*****************************************************************************
- * Local prototypes, QNX specific
- *****************************************************************************/
-#if defined( __QNXNTO__ )
+#elif defined( __QNXNTO__ )
static void QNXInitCPT ( CAM_PASS_THRU *, int );
-#endif
-
-/*****************************************************************************
- * Local prototypes, OS/2 specific
- *****************************************************************************/
-#if defined( __OS2__ )
+#elif defined( __OS2__ )
static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
#endif

diff --git a/src/ioctl.h b/src/ioctl.h
index 1c6cb0c..1ba090f 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -42,7 +42,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
#define DVD_DISCKEY_SIZE 2048

/*****************************************************************************
- * Common macro, BeOS specific
+ * Common macros, OS specific
*****************************************************************************/
#if defined( __BEOS__ )
#define INIT_RDC( TYPE, SIZE ) \
@@ -51,12 +51,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, Solaris specific
- *****************************************************************************/
-#if defined( SOLARIS_USCSI )
+#elif defined( SOLARIS_USCSI )
#define INIT_USCSI( TYPE, SIZE ) \
struct uscsi_cmd sc = { 0 }; \
union scsi_cdb rs_cdb; \
@@ -65,24 +60,14 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
sc.uscsi_bufaddr = (caddr_t)p_buffer; \
sc.uscsi_buflen = (SIZE); \
SolarisInitUSCSI( &sc, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, Darwin specific
- *****************************************************************************/
-#if defined( DARWIN_DVD_IOCTL )
+#elif defined( DARWIN_DVD_IOCTL )
#define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \
DKDVD_TYPE dvd = { 0 }; \
BUFFER_TYPE dvdbs = { 0 }; \
dvd.format = FORMAT; \
dvd.buffer = &dvdbs; \
dvd.bufferLength = sizeof(dvdbs);
-#endif
-
-/*****************************************************************************
- * Common macro, win32 specific
- *****************************************************************************/
-#if defined( WIN32 )
+#elif defined( WIN32 )
#define INIT_SPTD( TYPE, SIZE ) \
DWORD tmp; \
SCSI_PASS_THROUGH_DIRECT sptd = { 0 }; \
@@ -96,12 +81,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#endif
-
-/*****************************************************************************
- * Common macro, QNX specific
- *****************************************************************************/
-#if defined( __QNXNTO__ )
+#elif defined( __QNXNTO__ )
#define INIT_CPT( TYPE, SIZE ) \
CAM_PASS_THRU * p_cpt = { 0 }; \
uint8_t * p_buffer; \
@@ -111,12 +91,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
p_cpt->cam_data_ptr = sizeof( CAM_PASS_THRU ); \
p_cpt->cam_dxfer_len = (SIZE); \
QNXInitCPT( p_cpt, (TYPE) );
-#endif
-
-/*****************************************************************************
- * Common macro, OS/2 specific
- *****************************************************************************/
-#if defined( __OS2__ )
+#elif defined( __OS2__ )
#define INIT_SSC( TYPE, SIZE ) \
struct OS2_ExecSCSICmd sdc = { 0 }; \
uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \
--
1.9.1
Diego Biurrun
2014-10-29 20:33:20 UTC
Permalink
---
src/ioctl.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/ioctl.h b/src/ioctl.h
index 1ba090f..501a69b 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -143,6 +143,7 @@ typedef union dvd_authinfo dvd_authinfo;

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#include <winioctl.h>

#define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_READ_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
--
1.9.1
Diego Biurrun
2014-10-29 20:33:21 UTC
Permalink
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 726ea7f..9a471d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,7 +61,7 @@ stamp-doxygen: doc/doxygen.cfg src/libdvdcss.c src/dvdcss/dvdcss.h
doxygen $<
touch $@

-tools: test/csstest test/dvd_region
+tools: test/csstest$(EXEEXT) test/dvd_region$(EXEEXT)

clean-local:
-rm -Rf stamp-doxygen doc/html
--
1.9.1
Diego Biurrun
2014-10-29 20:33:22 UTC
Permalink
On non-Linux platform dvd_region uses static functions from ioctl.c,
so just linking against the object file is not enough.
---
Makefile.am | 2 +-
test/dvd_region.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 9a471d3..583a1f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,7 +39,7 @@ test_csstest_SOURCES = test/csstest.c
test_csstest_LDADD = libdvdcss.la
test_csstest_CFLAGS = -I $(top_srcdir)/src

-test_dvd_region_SOURCES = test/dvd_region.c src/ioctl.c
+test_dvd_region_SOURCES = test/dvd_region.c
test_dvd_region_LDADD = libdvdcss.la
test_dvd_region_CFLAGS = -I $(top_srcdir)/src

diff --git a/test/dvd_region.c b/test/dvd_region.c
index 4b61be5..1488dab 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "common.h"
#include "ioctl.h"
+#include "ioctl.c"

#define DEFAULT_DEVICE "/dev/dvd"
--
1.9.1
Diego Biurrun
2014-10-29 20:33:23 UTC
Permalink
---
test/dvd_region.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/test/dvd_region.c b/test/dvd_region.c
index 1488dab..3cbfe3f 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -21,6 +21,7 @@
#include "config.h"
#include "common.h"
#include "ioctl.h"
+#include "libdvdcss.h"
#include "ioctl.c"

#define DEFAULT_DEVICE "/dev/dvd"
@@ -226,7 +227,8 @@ static void usage(void)
int main(int argc, char *argv[])
{
char device_name[FILENAME_MAX], c, set, region = 0;
- int fd, ret;
+ int ret;
+ dvdcss_t dvdcss;

strcpy(device_name, DEFAULT_DEVICE);
set = 0;
@@ -257,21 +259,18 @@ int main(int argc, char *argv[])
return -1;
}

- /* TODO: use dvdcss_open instead of open */
-
- if( (fd = open(device_name, O_RDONLY | O_NONBLOCK)) < 0 ) {
- perror("open");
+ if( !(dvdcss = dvdcss_open(device_name)) ) {
usage();
return 1;
}

{
int copyright;
- ret = ioctl_ReadCopyright( fd, 0, &copyright );
+ ret = ioctl_ReadCopyright( dvdcss->i_fd, 0, &copyright );
printf( "ret %d, copyright %d\n", ret, copyright );
}

- if( (ret = print_region(fd)) < 0 )
+ if( (ret = print_region(dvdcss->i_fd)) < 0 )
return ret;

if( set ) {
@@ -280,7 +279,7 @@ int main(int argc, char *argv[])
exit(0);
}

- if( (ret = set_region(fd, region)) < 0 )
+ if( (ret = set_region(dvdcss->i_fd, region)) < 0 )
return ret;
}
--
1.9.1
Diego Biurrun
2014-10-29 20:33:24 UTC
Permalink
This fixes some related incompatible pointer type warnings.
---
src/device.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index 6e37e37..cd32acd 100644
--- a/src/device.c
+++ b/src/device.c
@@ -635,11 +635,11 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
#if defined( WIN32 )
static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
- int i_bytes;
+ DWORD i_bytes;

if( !ReadFile( (HANDLE) dvdcss->i_fd, p_buffer,
i_blocks * DVDCSS_BLOCK_SIZE,
- (LPDWORD)&i_bytes, NULL ) )
+ &i_bytes, NULL ) )
{
dvdcss->i_pos = -1;
return -1;
@@ -728,6 +728,7 @@ static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
{
int i_index;
int i_blocks_read, i_blocks_total = 0;
+ DWORD i_bytes;

/* Check the size of the readv temp buffer, just in case we need to
* realloc something bigger */
@@ -757,7 +758,6 @@ static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

i_blocks_total /= DVDCSS_BLOCK_SIZE;

- unsigned long int i_bytes;
if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
{
--
1.9.1
Diego Biurrun
2014-10-29 20:33:25 UTC
Permalink
---
src/common.h | 4 ++++
src/device.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/common.h b/src/common.h
index b4c4fa7..983521e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -48,6 +48,10 @@
# define PATH_MAX MAX_PATH
# endif

+# ifndef INVALID_SET_FILE_POINTER
+# define INVALID_SET_FILE_POINTER ((DWORD)-1)
+# endif
+
/* several type definitions */
# if defined( __MINGW32__ )
# define lseek _lseeki64
diff --git a/src/device.c b/src/device.c
index cd32acd..0c77b63 100644
--- a/src/device.c
+++ b/src/device.c
@@ -567,10 +567,6 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
{
LARGE_INTEGER li_seek;

-#ifndef INVALID_SET_FILE_POINTER
-# define INVALID_SET_FILE_POINTER ((DWORD)-1)
-#endif
-
if( dvdcss->i_pos == i_blocks )
{
/* We are already in position */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:26 UTC
Permalink
---
src/device.c | 46 ++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/device.c b/src/device.c
index 0c77b63..81152cb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -539,7 +539,7 @@ static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
*****************************************************************************/
static int libc_seek( dvdcss_t dvdcss, int i_blocks )
{
- off_t i_seek;
+ off_t i_ret, i_seek = i_blocks * DVDCSS_BLOCK_SIZE;

if( dvdcss->i_pos == i_blocks )
{
@@ -547,17 +547,16 @@ static int libc_seek( dvdcss_t dvdcss, int i_blocks )
return i_blocks;
}

- i_seek = i_blocks * DVDCSS_BLOCK_SIZE;
- i_seek = lseek( dvdcss->i_read_fd, i_seek, SEEK_SET );
+ i_ret = lseek( dvdcss->i_read_fd, i_seek, SEEK_SET );

- if( i_seek < 0 )
+ if( i_ret < 0 )
{
print_error( dvdcss, "seek error" );
dvdcss->i_pos = -1;
- return i_seek;
+ return i_ret;
}

- dvdcss->i_pos = i_seek / DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos = i_seek;

return dvdcss->i_pos;
}
@@ -596,7 +595,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
*****************************************************************************/
static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
- off_t i_size, i_ret;
+ off_t i_size, i_ret, i_ret_blocks;

i_size = i_blocks * DVDCSS_BLOCK_SIZE;
i_ret = read( dvdcss->i_read_fd, p_buffer, i_size );
@@ -608,24 +607,26 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
return i_ret;
}

+ i_ret_blocks = i_ret / DVDCSS_BLOCK_SIZE;
+
/* Handle partial reads */
if( i_ret != i_size )
{
int i_seek;

dvdcss->i_pos = -1;
- i_seek = libc_seek( dvdcss, i_ret / DVDCSS_BLOCK_SIZE );
+ i_seek = libc_seek( dvdcss, i_ret_blocks );
if( i_seek < 0 )
{
return i_seek;
}

/* We have to return now so that i_pos isn't clobbered */
- return i_ret / DVDCSS_BLOCK_SIZE;
+ return i_ret_blocks;
}

- dvdcss->i_pos += i_ret / DVDCSS_BLOCK_SIZE;
- return i_ret / DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos += i_ret_blocks;
+ return i_ret_blocks;
}

#if defined( WIN32 )
@@ -641,8 +642,9 @@ static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
return -1;
}

- dvdcss->i_pos += i_bytes / DVDCSS_BLOCK_SIZE;
- return i_bytes / DVDCSS_BLOCK_SIZE;
+ i_bytes /= DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos += i_bytes;
+ return i_bytes;
}
#endif /* defined( WIN32 ) */

@@ -681,6 +683,7 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
}

i_total += i_bytes;
+ i_total /= DVDCSS_BLOCK_SIZE;

if( i_bytes != i_len )
{
@@ -689,19 +692,19 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
int i_seek;

dvdcss->i_pos = -1;
- i_seek = libc_seek( dvdcss, i_total / DVDCSS_BLOCK_SIZE );
+ i_seek = libc_seek( dvdcss, i_total );
if( i_seek < 0 )
{
return i_seek;
}

/* We have to return now so that i_pos isn't clobbered */
- return i_total / DVDCSS_BLOCK_SIZE;
+ return i_total;
}
}

- dvdcss->i_pos += i_total / DVDCSS_BLOCK_SIZE;
- return i_total / DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos += i_total;
+ return i_total;
#else
int i_read = readv( dvdcss->i_read_fd, p_iovec, i_blocks );

@@ -711,8 +714,9 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
return i_read;
}

- dvdcss->i_pos += i_read / DVDCSS_BLOCK_SIZE;
- return i_read / DVDCSS_BLOCK_SIZE;
+ i_read /= DVDCSS_BLOCK_SIZE;
+ dvdcss->i_pos += i_read;
+ return i_read;
#endif
}

@@ -752,10 +756,8 @@ static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )

if( i_blocks_total <= 0 ) return 0;

- i_blocks_total /= DVDCSS_BLOCK_SIZE;
-
if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
- i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
+ i_blocks_total, &i_bytes, NULL ) )
{
/* The read failed... too bad.
* As in the POSIX spec the file position is left
--
1.9.1
Diego Biurrun
2014-10-29 20:33:27 UTC
Permalink
The function does not return any errors.
---

I guess the real solution is to properly check for errors inside of
dvdcss_close_device() - formerly known as _dvdcss_close - instead.

src/device.c | 6 +-----
src/device.h | 2 +-
src/libdvdcss.c | 8 +-------
3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/device.c b/src/device.c
index 81152cb..c91f9a3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -410,7 +410,7 @@ int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
}
#endif /* DVDCSS_RAW_OPEN */

-int dvdcss_close_device ( dvdcss_t dvdcss )
+void dvdcss_close_device ( dvdcss_t dvdcss )
{
#if defined( WIN32 )
if( dvdcss->b_file )
@@ -426,8 +426,6 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
free( dvdcss->p_readv_buffer );
dvdcss->p_readv_buffer = NULL;
dvdcss->i_readv_buf_size = 0;
-
- return 0;
#else
close( dvdcss->i_fd );

@@ -438,8 +436,6 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
dvdcss->i_raw_fd = -1;
}
#endif
-
- return 0;
#endif
}

diff --git a/src/device.h b/src/device.h
index ff1e67f..f56489f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -55,7 +55,7 @@ struct iovec
int dvdcss_use_ioctls ( dvdcss_t );
void dvdcss_check_device ( dvdcss_t );
int dvdcss_open_device ( dvdcss_t );
-int dvdcss_close_device ( dvdcss_t );
+void dvdcss_close_device ( dvdcss_t );

/*****************************************************************************
* Device reading prototypes, raw-device specific
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 7bd888b..057c20b 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -737,7 +737,6 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
{
dvd_title_t *p_title;
- int i_ret;

/* Free our list of keys */
p_title = dvdcss->p_titles;
@@ -748,12 +747,7 @@ LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
p_title = p_tmptitle;
}

- i_ret = dvdcss_close_device( dvdcss );
-
- if( i_ret < 0 )
- {
- return i_ret;
- }
+ dvdcss_close_device( dvdcss );

free( dvdcss->psz_device );
free( dvdcss );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:28 UTC
Permalink
---
src/libdvdcss.h | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 8ac0633..4f1f4af 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -87,27 +87,13 @@ struct dvdcss_s
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-#if defined( _MSC_VER )
-#include <stdarg.h>
-__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
-{
- va_list args;
-
- fprintf( stderr, "libdvdcss debug: " );
- va_start( args, msg );
- vfprintf( stderr, msg, args );
- va_end( args );
- fprintf( stderr, "\n" );
-}
-#else
-#define print_debug(dvdcss,msg,args...) \
+#define print_debug( dvdcss, ... ) \
if( dvdcss->b_debug ) \
{ \
fprintf( stderr, "libdvdcss debug: " ); \
- fprintf( stderr, msg, ##args ); \
+ fprintf( stderr, __VA_ARGS__ ); \
fprintf( stderr, "\n" ); \
}
-#endif

void print_error ( dvdcss_t, char * );
--
1.9.1
Reimar Döffinger
2014-10-30 07:02:45 UTC
Permalink
Post by Diego Biurrun
---
src/libdvdcss.h | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 8ac0633..4f1f4af 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -87,27 +87,13 @@ struct dvdcss_s
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-#if defined( _MSC_VER )
-#include <stdarg.h>
-__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
-{
- va_list args;
-
- fprintf( stderr, "libdvdcss debug: " );
- va_start( args, msg );
- vfprintf( stderr, msg, args );
- va_end( args );
- fprintf( stderr, "\n" );
-}
-#else
-#define print_debug(dvdcss,msg,args...) \
+#define print_debug( dvdcss, ... ) \
if( dvdcss->b_debug ) \
{ \
fprintf( stderr, "libdvdcss debug: " ); \
- fprintf( stderr, msg, ##args ); \
+ fprintf( stderr, __VA_ARGS__ ); \
fprintf( stderr, "\n" ); \
Probably nobody cares, but this most likely won't compile anymore on oldish MSVC versions.
Diego Biurrun
2014-10-30 10:50:11 UTC
Permalink
Post by Reimar Döffinger
Post by Diego Biurrun
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -87,27 +87,13 @@ struct dvdcss_s
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-#if defined( _MSC_VER )
-#include <stdarg.h>
-__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
-{
- va_list args;
-
- fprintf( stderr, "libdvdcss debug: " );
- va_start( args, msg );
- vfprintf( stderr, msg, args );
- va_end( args );
- fprintf( stderr, "\n" );
-}
-#else
-#define print_debug(dvdcss,msg,args...) \
+#define print_debug( dvdcss, ... ) \
if( dvdcss->b_debug ) \
{ \
fprintf( stderr, "libdvdcss debug: " ); \
- fprintf( stderr, msg, ##args ); \
+ fprintf( stderr, __VA_ARGS__ ); \
fprintf( stderr, "\n" ); \
Probably nobody cares, but this most likely won't compile anymore on oldish MSVC versions.
Quite possibly, yes. The current MSVC version is the first with sensible
C99 support, so it feels like a good version to require :)

j-b, do we care about old MSVC?

Diego
Jean-Baptiste Kempf
2014-10-30 12:57:33 UTC
Permalink
Post by Diego Biurrun
Post by Reimar Döffinger
Post by Diego Biurrun
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -87,27 +87,13 @@ struct dvdcss_s
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-#if defined( _MSC_VER )
-#include <stdarg.h>
-__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
-{
- va_list args;
-
- fprintf( stderr, "libdvdcss debug: " );
- va_start( args, msg );
- vfprintf( stderr, msg, args );
- va_end( args );
- fprintf( stderr, "\n" );
-}
-#else
-#define print_debug(dvdcss,msg,args...) \
+#define print_debug( dvdcss, ... ) \
if( dvdcss->b_debug ) \
{ \
fprintf( stderr, "libdvdcss debug: " ); \
- fprintf( stderr, msg, ##args ); \
+ fprintf( stderr, __VA_ARGS__ ); \
fprintf( stderr, "\n" ); \
Probably nobody cares, but this most likely won't compile anymore on oldish MSVC versions.
Quite possibly, yes. The current MSVC version is the first with sensible
C99 support, so it feels like a good version to require :)
j-b, do we care about old MSVC?
No.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
David Woodhouse
2014-10-30 23:25:05 UTC
Permalink
Post by Diego Biurrun
Post by Reimar Döffinger
Probably nobody cares, but this most likely won't compile anymore on oldish MSVC versions.
Quite possibly, yes. The current MSVC version is the first with sensible
C99 support, so it feels like a good version to require :)
MSVC has actually supported variadic macros since VS2005, according to
http://msdn.microsoft.com/en-us/library/ms177415%28v=vs.80%29.aspx
--
dwmw2
Diego Biurrun
2014-10-29 20:33:29 UTC
Permalink
This prevents a possible NULL pointer dereference further along.
---
src/css.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/css.c b/src/css.c
index 3d73080..90957d5 100644
--- a/src/css.c
+++ b/src/css.c
@@ -297,6 +297,10 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )

/* Write in the new title and its key */
p_newtitle = malloc( sizeof( dvd_title_t ) );
+ if( p_newtitle == NULL )
+ {
+ return -1;
+ }
p_newtitle->i_startlb = i_block;
memcpy( p_newtitle->p_key, p_title_key, KEY_SIZE );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:30 UTC
Permalink
This silences related complaints from MSVC about those function names.
---
src/common.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/common.h b/src/common.h
index 983521e..bfa6c18 100644
--- a/src/common.h
+++ b/src/common.h
@@ -74,6 +74,11 @@ typedef __int64 off_t;
# endif
# define stat _stati64
# define snprintf _snprintf
+# define strdup _strdup
+# define open _open
+# define close _close
+# define read _read
+# define write _write
# endif /* defined( _MSC_VER ) */

#endif /* defined( WIN32 ) */
--
1.9.1
Reimar Döffinger
2014-10-30 07:03:48 UTC
Permalink
Post by Diego Biurrun
This silences related complaints from MSVC about those function names.
IMHO we should disable the warning instead.
Jean-Baptiste Kempf
2014-10-30 13:05:58 UTC
Permalink
Post by Reimar Döffinger
Post by Diego Biurrun
This silences related complaints from MSVC about those function names.
IMHO we should disable the warning instead.
No. This is the correct way. The old ones are NOT following the C/C++
standard. Using the new ones, starting with _ is the correct way.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-10-29 20:33:31 UTC
Permalink
This silences a complaint from the MSVC code analyzer.
---
src/ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ioctl.c b/src/ioctl.c
index 788282a..19b5a18 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -543,7 +543,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

#elif defined( WIN32 )
ULONG id;
- DWORD tmp;
+ DWORD tmp = 0;

i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
&tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
--
1.9.1
Diego Biurrun
2014-10-29 20:33:32 UTC
Permalink
This silences a complaint from the MSVC code analyzer.
---
src/device.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index c91f9a3..288fc93 100644
--- a/src/device.c
+++ b/src/device.c
@@ -465,7 +465,10 @@ static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
{
char psz_dvd[7];
- snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
+ if( snprintf( psz_dvd, sizeof(psz_dvd), "\\\\.\\%c:", psz_device[0] ) < 0)
+ {
+ goto error;
+ }

/* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
* _and_ write access to the device (so we can make SCSI Pass Through
@@ -489,13 +492,16 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )

if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
{
- print_error( dvdcss, "failed opening device" );
- return -1;
+ goto error;
}

dvdcss->i_pos = 0;

return 0;
+
+error:
+ print_error( dvdcss, "failed opening device" );
+ return -1;
}
#endif /* defined( WIN32 ) */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:33 UTC
Permalink
---
src/libdvdcss.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 057c20b..0a3a12a 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -681,7 +681,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
int i_blocks,
int i_flags )
{
- struct iovec *_p_iovec = (struct iovec *)p_iovec;
+ struct iovec *_p_iovec = p_iovec;
int i_ret, i_index;
void *iov_base;
size_t iov_len;
@@ -718,7 +718,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
((uint8_t*)iov_base)[0x14] &= 0x8f;

- iov_base = (void *) ((uint8_t*)iov_base + DVDCSS_BLOCK_SIZE);
+ iov_base = (uint8_t*)iov_base + DVDCSS_BLOCK_SIZE;
iov_len -= DVDCSS_BLOCK_SIZE;
}
--
1.9.1
Diego Biurrun
2014-10-29 20:33:34 UTC
Permalink
---
src/libdvdcss.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 0a3a12a..839dcb0 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -375,8 +375,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
if( i_fd >= 0 )
{
- size_t len = strlen(psz_tag);
- if( write( i_fd, psz_tag, len ) < (long)len )
+ ssize_t len = strlen(psz_tag);
+ if( write( i_fd, psz_tag, len ) < len )
{
print_error( dvdcss,
"Error writing cache directory tag, continuing..\n" );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:35 UTC
Permalink
---

I set b_debug to '1' instead of 'i', it's supposed to be Boolean after all.

src/libdvdcss.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 839dcb0..aeba15c 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -136,6 +136,24 @@
#define mkdir(a, b) _mkdir(a)
#endif

+static void set_verbosity( dvdcss_t dvdcss )
+{
+ const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+
+ dvdcss->b_debug = 0;
+ dvdcss->b_errors = 0;
+
+ if( psz_verbose != NULL )
+ {
+ int i = atoi( psz_verbose );
+
+ if( i >= 2 )
+ dvdcss->b_debug = 1;
+ if( i >= 1 )
+ dvdcss->b_errors = 1;
+ }
+}
+
/**
* \brief Open a DVD device or directory and return a dvdcss instance.
*
@@ -154,7 +172,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
int i_ret;

const char *psz_method = getenv( "DVDCSS_METHOD" );
- const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
const char *psz_cache = getenv( "DVDCSS_CACHE" );
#ifdef DVDCSS_RAW_OPEN
const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
@@ -182,19 +199,11 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
dvdcss->psz_error = "no error";
dvdcss->i_method = DVDCSS_METHOD_KEY;
dvdcss->psz_cachefile[0] = '\0';
- dvdcss->b_debug = 0;
- dvdcss->b_errors = 0;

/*
* Find verbosity from DVDCSS_VERBOSE environment variable
*/
- if( psz_verbose != NULL )
- {
- int i = atoi( psz_verbose );
-
- if( i >= 2 ) dvdcss->b_debug = i;
- if( i >= 1 ) dvdcss->b_errors = 1;
- }
+ set_verbosity( dvdcss );

/*
* Find method from DVDCSS_METHOD environment variable
--
1.9.1
Diego Biurrun
2014-10-29 20:33:36 UTC
Permalink
---
src/libdvdcss.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index aeba15c..44303a8 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -226,9 +226,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
{
print_error( dvdcss, "unknown decrypt method, please choose "
"from 'title', 'key' or 'disc'" );
- free( dvdcss->psz_device );
- free( dvdcss );
- return NULL;
+ goto error;
}
}

@@ -324,9 +322,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
i_ret = dvdcss_open_device( dvdcss );
if( i_ret < 0 )
{
- free( dvdcss->psz_device );
- free( dvdcss );
- return NULL;
+ goto error;
}

dvdcss->b_scrambled = 1; /* Assume the worst */
@@ -533,6 +529,11 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
dvdcss->pf_seek( dvdcss, 0 );

return dvdcss;
+
+error:
+ free( dvdcss->psz_device );
+ free( dvdcss );
+ return NULL;
}

/**
--
1.9.1
Diego Biurrun
2014-10-29 20:33:37 UTC
Permalink
---
src/libdvdcss.c | 50 ++++++++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 44303a8..c74ef7b 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -154,6 +154,34 @@ static void set_verbosity( dvdcss_t dvdcss )
}
}

+static int set_access_method( dvdcss_t dvdcss )
+{
+ const char *psz_method = getenv( "DVDCSS_METHOD" );
+
+ if( !psz_method )
+ return 0;
+
+ if( !strncmp( psz_method, "key", 4 ) )
+ {
+ dvdcss->i_method = DVDCSS_METHOD_KEY;
+ }
+ else if( !strncmp( psz_method, "disc", 5 ) )
+ {
+ dvdcss->i_method = DVDCSS_METHOD_DISC;
+ }
+ else if( !strncmp( psz_method, "title", 5 ) )
+ {
+ dvdcss->i_method = DVDCSS_METHOD_TITLE;
+ }
+ else
+ {
+ print_error( dvdcss, "unknown decrypt method, please choose "
+ "from 'title', 'key' or 'disc'" );
+ return -1;
+ }
+ return 0;
+}
+
/**
* \brief Open a DVD device or directory and return a dvdcss instance.
*
@@ -171,7 +199,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
char psz_buffer[PATH_MAX];
int i_ret;

- const char *psz_method = getenv( "DVDCSS_METHOD" );
const char *psz_cache = getenv( "DVDCSS_CACHE" );
#ifdef DVDCSS_RAW_OPEN
const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
@@ -208,26 +235,9 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
/*
* Find method from DVDCSS_METHOD environment variable
*/
- if( psz_method != NULL )
+ if( set_access_method( dvdcss ) < 0 )
{
- if( !strncmp( psz_method, "key", 4 ) )
- {
- dvdcss->i_method = DVDCSS_METHOD_KEY;
- }
- else if( !strncmp( psz_method, "disc", 5 ) )
- {
- dvdcss->i_method = DVDCSS_METHOD_DISC;
- }
- else if( !strncmp( psz_method, "title", 5 ) )
- {
- dvdcss->i_method = DVDCSS_METHOD_TITLE;
- }
- else
- {
- print_error( dvdcss, "unknown decrypt method, please choose "
- "from 'title', 'key' or 'disc'" );
- goto error;
- }
+ goto error;
}

/*
--
1.9.1
Diego Biurrun
2014-10-29 20:33:38 UTC
Permalink
---
src/libdvdcss.c | 130 +++++++++++++++++++++++++++++---------------------------
1 file changed, 67 insertions(+), 63 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index c74ef7b..d886ad9 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -182,67 +182,11 @@ static int set_access_method( dvdcss_t dvdcss )
return 0;
}

-/**
- * \brief Open a DVD device or directory and return a dvdcss instance.
- *
- * \param psz_target a string containing the target name, for instance
- * "/dev/hdc" or "E:"
- * \return a handle to a dvdcss instance or NULL on error.
- *
- * Initialize the \e libdvdcss library, open the requested DVD device or
- * directory, and return a handle to be used for all subsequent \e libdvdcss
- * calls. \e libdvdcss checks whether ioctls can be performed on the disc,
- * and when possible, the disc key is retrieved.
- */
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
+static char *set_cache_directory( dvdcss_t dvdcss )
{
char psz_buffer[PATH_MAX];
- int i_ret;
-
- const char *psz_cache = getenv( "DVDCSS_CACHE" );
-#ifdef DVDCSS_RAW_OPEN
- const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
-#endif
-
- dvdcss_t dvdcss;
-
- /*
- * Allocate the library structure
- */
- dvdcss = malloc( sizeof( struct dvdcss_s ) );
- if( dvdcss == NULL )
- {
- return NULL;
- }
+ char *psz_cache = getenv( "DVDCSS_CACHE" );

- /*
- * Initialize structure with default values
- */
-#ifdef DVDCSS_RAW_OPEN
- dvdcss->i_raw_fd = -1;
-#endif
- dvdcss->p_titles = NULL;
- dvdcss->psz_device = strdup( psz_target );
- dvdcss->psz_error = "no error";
- dvdcss->i_method = DVDCSS_METHOD_KEY;
- dvdcss->psz_cachefile[0] = '\0';
-
- /*
- * Find verbosity from DVDCSS_VERBOSE environment variable
- */
- set_verbosity( dvdcss );
-
- /*
- * Find method from DVDCSS_METHOD environment variable
- */
- if( set_access_method( dvdcss ) < 0 )
- {
- goto error;
- }
-
- /*
- * If DVDCSS_CACHE was not set, try to guess a default value
- */
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
@@ -307,23 +251,83 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
#endif
}

- /*
- * Find cache dir from the DVDCSS_CACHE environment variable
- */
+ /* sanity check psz_cache value */
if( psz_cache != NULL )
{
if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
{
- psz_cache = NULL;
+ return NULL;
}
/* Check that we can add the ID directory and the block filename */
else if( strlen( psz_cache ) + 1 + 32 + 1 + (KEY_SIZE * 2) + 10 + 1
PATH_MAX )
{
print_error( dvdcss, "cache directory name is too long" );
- psz_cache = NULL;
+ return NULL;
}
}
+ return psz_cache;
+}
+
+/**
+ * \brief Open a DVD device or directory and return a dvdcss instance.
+ *
+ * \param psz_target a string containing the target name, for instance
+ * "/dev/hdc" or "E:"
+ * \return a handle to a dvdcss instance or NULL on error.
+ *
+ * Initialize the \e libdvdcss library, open the requested DVD device or
+ * directory, and return a handle to be used for all subsequent \e libdvdcss
+ * calls. \e libdvdcss checks whether ioctls can be performed on the disc,
+ * and when possible, the disc key is retrieved.
+ */
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
+{
+ int i_ret;
+
+ const char *psz_cache;
+#ifdef DVDCSS_RAW_OPEN
+ const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
+#endif
+
+ dvdcss_t dvdcss;
+
+ /*
+ * Allocate the library structure
+ */
+ dvdcss = malloc( sizeof( struct dvdcss_s ) );
+ if( dvdcss == NULL )
+ {
+ return NULL;
+ }
+
+ /*
+ * Initialize structure with default values
+ */
+#ifdef DVDCSS_RAW_OPEN
+ dvdcss->i_raw_fd = -1;
+#endif
+ dvdcss->p_titles = NULL;
+ dvdcss->psz_device = strdup( psz_target );
+ dvdcss->psz_error = "no error";
+ dvdcss->i_method = DVDCSS_METHOD_KEY;
+ dvdcss->psz_cachefile[0] = '\0';
+
+ /*
+ * Find verbosity from DVDCSS_VERBOSE environment variable
+ */
+ set_verbosity( dvdcss );
+
+ /*
+ * Find method from DVDCSS_METHOD environment variable
+ */
+ if( set_access_method( dvdcss ) < 0 )
+ {
+ goto error;
+ }
+
+ /* Set CSS key cache directory. */
+ psz_cache = set_cache_directory( dvdcss );

/*
* Open device
--
1.9.1
Diego Biurrun
2014-10-29 20:33:39 UTC
Permalink
---
src/libdvdcss.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index d886ad9..4e78da1 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -290,20 +290,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif

- dvdcss_t dvdcss;
-
- /*
- * Allocate the library structure
- */
- dvdcss = malloc( sizeof( struct dvdcss_s ) );
+ /* Allocate the library structure */
+ dvdcss_t dvdcss = malloc( sizeof( struct dvdcss_s ) );
if( dvdcss == NULL )
{
return NULL;
}

- /*
- * Initialize structure with default values
- */
+ /* Initialize structure with default values */
#ifdef DVDCSS_RAW_OPEN
dvdcss->i_raw_fd = -1;
#endif
@@ -313,14 +307,10 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
dvdcss->i_method = DVDCSS_METHOD_KEY;
dvdcss->psz_cachefile[0] = '\0';

- /*
- * Find verbosity from DVDCSS_VERBOSE environment variable
- */
+ /* Set library verbosity from DVDCSS_VERBOSE environment variable. */
set_verbosity( dvdcss );

- /*
- * Find method from DVDCSS_METHOD environment variable
- */
+ /* Set DVD access method from DVDCSS_METHOD environment variable. */
if( set_access_method( dvdcss ) < 0 )
{
goto error;
@@ -329,9 +319,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
/* Set CSS key cache directory. */
psz_cache = set_cache_directory( dvdcss );

- /*
- * Open device
- */
+ /* Open device */
dvdcss_check_device( dvdcss );
i_ret = dvdcss_open_device( dvdcss );
if( i_ret < 0 )
--
1.9.1
Diego Biurrun
2014-10-29 20:33:40 UTC
Permalink
---

I think this is broken, the cache directory does not exist on the
first invocation of libdvdcss.

src/libdvdcss.c | 45 +++++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4e78da1..dc27d69 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -269,6 +269,30 @@ static char *set_cache_directory( dvdcss_t dvdcss )
return psz_cache;
}

+static void write_cache_dir_tag( dvdcss_t dvdcss, const char *psz_cache )
+{
+ static const char psz_tag[] =
+ "Signature: 8a477f597d28d172789f06886806bc55\r\n"
+ "# This file is a cache directory tag created by libdvdcss.\r\n"
+ "# For information about cache directory tags, see:\r\n"
+ "# http://www.brynosaurus.com/cachedir/\r\n";
+ char psz_tagfile[PATH_MAX + 1 + 12 + 1];
+ int i_fd;
+
+ sprintf( psz_tagfile, "%s/CACHEDIR.TAG", psz_cache );
+ i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
+ if( i_fd >= 0 )
+ {
+ ssize_t len = strlen(psz_tag);
+ if( write( i_fd, psz_tag, len ) < len )
+ {
+ print_error( dvdcss,
+ "Error writing cache directory tag, continuing..\n" );
+ }
+ close( i_fd );
+ }
+}
+
/**
* \brief Open a DVD device or directory and return a dvdcss instance.
*
@@ -370,26 +394,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
/* If the cache is enabled, write the cache directory tag */
if( psz_cache )
{
- static const char psz_tag[] =
- "Signature: 8a477f597d28d172789f06886806bc55\r\n"
- "# This file is a cache directory tag created by libdvdcss.\r\n"
- "# For information about cache directory tags, see:\r\n"
- "# http://www.brynosaurus.com/cachedir/\r\n";
- char psz_tagfile[PATH_MAX + 1 + 12 + 1];
- int i_fd;
-
- sprintf( psz_tagfile, "%s/CACHEDIR.TAG", psz_cache );
- i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
- if( i_fd >= 0 )
- {
- ssize_t len = strlen(psz_tag);
- if( write( i_fd, psz_tag, len ) < len )
- {
- print_error( dvdcss,
- "Error writing cache directory tag, continuing..\n" );
- }
- close( i_fd );
- }
+ write_cache_dir_tag( dvdcss, psz_cache );
}

/* If the cache is enabled, extract a unique disc ID */
--
1.9.1
Diego Biurrun
2014-10-29 20:33:41 UTC
Permalink
---

Should probably be done before creating the cache tag.

src/libdvdcss.c | 258 ++++++++++++++++++++++++++++----------------------------
1 file changed, 129 insertions(+), 129 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index dc27d69..f86f606 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -293,6 +293,132 @@ static void write_cache_dir_tag( dvdcss_t dvdcss, const char *psz_cache )
}
}

+static void create_cache_dir( dvdcss_t dvdcss, const char *psz_cache )
+{
+ uint8_t p_sector[DVDCSS_BLOCK_SIZE];
+ char psz_key[1 + KEY_SIZE * 2 + 1];
+ char *psz_title;
+ uint8_t *psz_serial;
+ int i, i_ret;
+
+ /* We read sector 0. If it starts with 0x000001ba (BE), we are
+ * reading a VOB file, and we should not cache anything. */
+
+ i_ret = dvdcss->pf_seek( dvdcss, 0 );
+ if( i_ret != 0 )
+ {
+ return;
+ }
+
+ i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
+ if( i_ret != 1 )
+ {
+ return;
+ }
+
+ if( p_sector[0] == 0x00 && p_sector[1] == 0x00
+ && p_sector[2] == 0x01 && p_sector[3] == 0xba )
+ {
+ return;
+ }
+
+ /* The data we are looking for is at sector 16 (32768 bytes):
+ * - offset 40: disc title (32 uppercase chars)
+ * - offset 813: manufacturing date + serial no (16 digits) */
+
+ i_ret = dvdcss->pf_seek( dvdcss, 16 );
+ if( i_ret != 16 )
+ {
+ return;
+ }
+
+ i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
+ if( i_ret != 1 )
+ {
+ return;
+ }
+
+ /* Get the disc title */
+ psz_title = (char *)p_sector + 40;
+ psz_title[32] = '\0';
+
+ for( i = 0 ; i < 32 ; i++ )
+ {
+ if( psz_title[i] <= ' ' )
+ {
+ psz_title[i] = '\0';
+ break;
+ }
+ else if( psz_title[i] == '/' || psz_title[i] == '\\' )
+ {
+ psz_title[i] = '-';
+ }
+ }
+
+ /* Get the date + serial */
+ psz_serial = p_sector + 813;
+ psz_serial[16] = '\0';
+
+ /* Check that all characters are digits, otherwise convert. */
+ for( i = 0 ; i < 16 ; i++ )
+ {
+ if( psz_serial[i] < '0' || psz_serial[i] > '9' )
+ {
+ char psz_tmp[16 + 1];
+ sprintf( psz_tmp,
+ "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
+ psz_serial[0], psz_serial[1], psz_serial[2],
+ psz_serial[3], psz_serial[4], psz_serial[5],
+ psz_serial[6], psz_serial[7] );
+ memcpy( psz_serial, psz_tmp, 16 );
+ break;
+ }
+ }
+
+ /* Get disk key, since some discs have the same title, manufacturing
+ * date and serial number, but different keys. */
+ if( dvdcss->b_scrambled )
+ {
+ psz_key[0] = '-';
+ for( i = 0; i < KEY_SIZE; i++ )
+ {
+ sprintf( &psz_key[1+i*2], "%.2x", dvdcss->css.p_disc_key[i] );
+ }
+ psz_key[1 + KEY_SIZE * 2] = '\0';
+ }
+ else
+ {
+ psz_key[0] = 0;
+ }
+
+ /* We have a disc name or ID, we can create the cache dir */
+ i = sprintf( dvdcss->psz_cachefile, "%s", psz_cache );
+ i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
+ if( i_ret < 0 && errno != EEXIST )
+ {
+ print_error( dvdcss, "failed creating cache directory" );
+ dvdcss->psz_cachefile[0] = '\0';
+ return;
+ }
+
+ i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title,
+ psz_serial, psz_key );
+ i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
+ if( i_ret < 0 && errno != EEXIST )
+ {
+ print_error( dvdcss, "failed creating cache subdirectory" );
+ dvdcss->psz_cachefile[0] = '\0';
+ return;
+ }
+ i += sprintf( dvdcss->psz_cachefile + i, "/");
+
+ /* Pointer to the filename we will use. */
+ dvdcss->psz_block = dvdcss->psz_cachefile + i;
+
+ print_debug( dvdcss, "using CSS key cache dir: %s",
+ dvdcss->psz_cachefile );
+}
+
/**
* \brief Open a DVD device or directory and return a dvdcss instance.
*
@@ -391,140 +517,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
}
}

- /* If the cache is enabled, write the cache directory tag */
+ /* If the cache is enabled, write the cache directory tag
+ * and create the cache directory. */
if( psz_cache )
{
write_cache_dir_tag( dvdcss, psz_cache );
+ create_cache_dir( dvdcss, psz_cache );
}

- /* If the cache is enabled, extract a unique disc ID */
- if( psz_cache )
- {
- uint8_t p_sector[DVDCSS_BLOCK_SIZE];
- char psz_key[1 + KEY_SIZE * 2 + 1];
- char *psz_title;
- uint8_t *psz_serial;
- int i;
-
- /* We read sector 0. If it starts with 0x000001ba (BE), we are
- * reading a VOB file, and we should not cache anything. */
-
- i_ret = dvdcss->pf_seek( dvdcss, 0 );
- if( i_ret != 0 )
- {
- goto nocache;
- }
-
- i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
- if( i_ret != 1 )
- {
- goto nocache;
- }
-
- if( p_sector[0] == 0x00 && p_sector[1] == 0x00
- && p_sector[2] == 0x01 && p_sector[3] == 0xba )
- {
- goto nocache;
- }
-
- /* The data we are looking for is at sector 16 (32768 bytes):
- * - offset 40: disc title (32 uppercase chars)
- * - offset 813: manufacturing date + serial no (16 digits) */
-
- i_ret = dvdcss->pf_seek( dvdcss, 16 );
- if( i_ret != 16 )
- {
- goto nocache;
- }
-
- i_ret = dvdcss->pf_read( dvdcss, p_sector, 1 );
- if( i_ret != 1 )
- {
- goto nocache;
- }
-
- /* Get the disc title */
- psz_title = (char *)p_sector + 40;
- psz_title[32] = '\0';
-
- for( i = 0 ; i < 32 ; i++ )
- {
- if( psz_title[i] <= ' ' )
- {
- psz_title[i] = '\0';
- break;
- }
- else if( psz_title[i] == '/' || psz_title[i] == '\\' )
- {
- psz_title[i] = '-';
- }
- }
-
- /* Get the date + serial */
- psz_serial = p_sector + 813;
- psz_serial[16] = '\0';
-
- /* Check that all characters are digits, otherwise convert. */
- for( i = 0 ; i < 16 ; i++ )
- {
- if( psz_serial[i] < '0' || psz_serial[i] > '9' )
- {
- char psz_tmp[16 + 1];
- sprintf( psz_tmp,
- "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
- psz_serial[0], psz_serial[1], psz_serial[2],
- psz_serial[3], psz_serial[4], psz_serial[5],
- psz_serial[6], psz_serial[7] );
- memcpy( psz_serial, psz_tmp, 16 );
- break;
- }
- }
-
- /* Get disk key, since some discs have the same title, manufacturing
- * date and serial number, but different keys. */
- if( dvdcss->b_scrambled )
- {
- psz_key[0] = '-';
- for( i = 0; i < KEY_SIZE; i++ )
- {
- sprintf( &psz_key[1+i*2], "%.2x", dvdcss->css.p_disc_key[i] );
- }
- psz_key[1 + KEY_SIZE * 2] = '\0';
- }
- else
- {
- psz_key[0] = 0;
- }
-
- /* We have a disc name or ID, we can create the cache dir */
- i = sprintf( dvdcss->psz_cachefile, "%s", psz_cache );
- i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
- if( i_ret < 0 && errno != EEXIST )
- {
- print_error( dvdcss, "failed creating cache directory" );
- dvdcss->psz_cachefile[0] = '\0';
- goto nocache;
- }
-
- i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title,
- psz_serial, psz_key );
- i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
- if( i_ret < 0 && errno != EEXIST )
- {
- print_error( dvdcss, "failed creating cache subdirectory" );
- dvdcss->psz_cachefile[0] = '\0';
- goto nocache;
- }
- i += sprintf( dvdcss->psz_cachefile + i, "/");
-
- /* Pointer to the filename we will use. */
- dvdcss->psz_block = dvdcss->psz_cachefile + i;
-
- print_debug( dvdcss, "using CSS key cache dir: %s",
- dvdcss->psz_cachefile );
- }
- nocache:
-
#ifdef DVDCSS_RAW_OPEN
if( psz_raw_device != NULL )
{
--
1.9.1
Diego Biurrun
2014-10-29 20:33:42 UTC
Permalink
---
libdvdcss.spec.in | 8 ++++----
src/libdvdcss.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index f150623..424f50e 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,8 +32,8 @@ 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, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0)
- or later.
+ OpenBSD, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE
+ 5.0) 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 +49,8 @@ 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, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0)
- or later.
+ OpenBSD, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE
+ 5.0) 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 f86f606..8acfbb1 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, BeOS, Mac OS X, Solaris, OS/2, and Windows NT 4.0
- * (with IE 5.0) or later.
+ * NetBSD, OpenBSD, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows
+ * NT 4.0 (with IE 5.0) 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.
--
1.9.1
Diego Biurrun
2014-10-29 20:33:43 UTC
Permalink
---
NEWS | 1 +
1 file changed, 1 insertion(+)

diff --git a/NEWS b/NEWS
index 322b6bb..8eafbae 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Changes between 1.2.13 and 1.3.0:
- the variable dvdcss_interface_2
* Support for Android
* Drop support for HP-UX and Windows 9x.
+ * Miscellaneous cleanups to code, documentation, build system.


Changes between 1.2.12 and 1.2.13:
--
1.9.1
Diego Biurrun
2014-10-29 20:33:44 UTC
Permalink
BeOS is a proprietary legacy OS with no real-world usage.
---
NEWS | 2 +-
configure.ac | 2 +-
libdvdcss.spec.in | 8 +--
src/ioctl.c | 157 +-----------------------------------------------------
src/ioctl.h | 9 +---
src/libdvdcss.c | 4 +-
test/dvd_region.c | 10 ----
7 files changed, 11 insertions(+), 181 deletions(-)

diff --git a/NEWS b/NEWS
index 8eafbae..bf3e1a0 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Changes between 1.2.13 and 1.3.0:
- the type dvdcss_handle
- the variable dvdcss_interface_2
* Support for Android
- * Drop support for HP-UX and Windows 9x.
+ * Drop support for HP-UX, BeOS, and Windows 9x.
* Miscellaneous cleanups to code, documentation, build system.


diff --git a/configure.ac b/configure.ac
index f4fa527..8d3d6c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,7 +138,7 @@ AC_CHECK_HEADERS(windows.h,[
])
])

-dnl for Un*x and BeOS
+dnl for Un*x
AC_CHECK_HEADERS(sys/ioctl.h,[
CAN_BUILD_LIBDVDCSS=1
AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h dvd.h)
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 424f50e..f6ae407 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,8 +32,8 @@ 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, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE
- 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE 5.0)
+ 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 +49,8 @@ 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, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE
- 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE 5.0)
+ 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/ioctl.c b/src/ioctl.c
index 19b5a18..6c6e910 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -3,8 +3,7 @@
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
*
- * Authors: Markus Kuespert <***@beosmail.com>
- * Sam Hocevar <***@zoy.org>
+ * Authors: Sam Hocevar <***@zoy.org>
* Jon Lech Johansen <jon-***@nanocrew.net>
* Håkan Hjort <***@dtek.chalmers.se>
* Eugenio Jarosiewicz <***@cise.ufl.edu>
@@ -64,10 +63,6 @@
#ifdef DVD_STRUCT_IN_DVD_H
# include <dvd.h>
#endif
-#ifdef __BEOS__
-# include <malloc.h>
-# include <scsi.h>
-#endif
#ifdef SOLARIS_USCSI
# include <dlfcn.h>
# include <unistd.h>
@@ -90,10 +85,7 @@
/*****************************************************************************
* Local prototypes, OS specific
*****************************************************************************/
-#if defined( __BEOS__ )
-static void BeInitRDC ( raw_device_command *, int );
-#endif
-#elif defined( SOLARIS_USCSI )
+#if defined( SOLARIS_USCSI )
static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
#elif defined( WIN32 )
@@ -131,16 +123,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )

*pi_copyright = dvd.cpst;

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- rdc.command[ 6 ] = i_layer;
- rdc.command[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- *pi_copyright = p_buffer[ 4 ];
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 8 );

@@ -252,21 +234,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, dvd.data, DVD_DISCKEY_SIZE );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- rdc.command[ 7 ] = DVD_STRUCT_DISCKEY;
- rdc.command[ 10 ] = *pi_agid << 6;
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- if( i_ret < 0 )
- {
- return i_ret;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );

@@ -377,19 +344,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )

memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 12 );
-
- rdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
- rdc.command[ 3 ] = ( i_pos >> 16 ) & 0xff;
- rdc.command[ 4 ] = ( i_pos >> 8 ) & 0xff;
- rdc.command[ 5 ] = ( i_pos ) & 0xff;
- rdc.command[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 12 );

@@ -507,15 +461,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

*pi_agid = auth_info.agid;

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 8 );
-
- rdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- *pi_agid = p_buffer[ 7 ] >> 6;
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 8 );

@@ -605,15 +550,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

memcpy( p_challenge, auth_info.keychal, DVD_CHALLENGE_SIZE );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 16 );
-
- rdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 16 );

@@ -713,15 +649,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )

*pi_asf = auth_info.asf;

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 8 );
-
- rdc.command[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- *pi_asf = p_buffer[ 7 ] & 1;
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 8 );

@@ -823,15 +750,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 12 );
-
- rdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 12 );

@@ -922,13 +840,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )

i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 0 );
-
- rdc.command[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 0 );

@@ -1009,16 +920,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_SEND_KEY, 16 );
-
- rdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_SEND_KEY, 16 );

@@ -1118,16 +1019,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_SEND_KEY, 12 );
-
- rdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_SEND_KEY, 12 );

@@ -1233,17 +1124,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = auth_info.region; // ??
*p_scheme = auth_info.rpc_scheme;

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_REPORT_KEY, 8 );
-
- rdc.command[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_REPORT_KEY, 8 );

@@ -1329,39 +1209,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )

/* Local prototypes */

-#if defined( __BEOS__ )
-/*****************************************************************************
- * BeInitRDC: initialize a RDC structure for the BeOS kernel
- *****************************************************************************
- * This function initializes a BeOS raw device command structure for future
- * use, either a read command or a write command.
- *****************************************************************************/
-static void BeInitRDC( raw_device_command *p_rdc, int i_type )
-{
- memset( p_rdc->data, 0, p_rdc->data_length );
-
- switch( i_type )
- {
- case GPCMD_SEND_KEY:
- /* leave the flags to 0 */
- break;
-
- case GPCMD_READ_DVD_STRUCTURE: case GPCMD_REPORT_KEY:
- p_rdc->flags = B_RAW_DEVICE_DATA_IN; break; }
-
- p_rdc->command[ 0 ] = i_type;
-
- p_rdc->command[ 8 ] = (p_rdc->data_length >> 8) & 0xff;
- p_rdc->command[ 9 ] = p_rdc->data_length & 0xff;
- p_rdc->command_length = 12;
-
- p_rdc->sense_data = NULL;
- p_rdc->sense_data_length = 0;
-
- p_rdc->timeout = 1000000;
-}
-#endif
-
#if defined( SOLARIS_USCSI )
/*****************************************************************************
* SolarisInitUSCSI: initialize a USCSICMD structure for the Solaris kernel
diff --git a/src/ioctl.h b/src/ioctl.h
index 501a69b..4c10971 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -44,14 +44,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
/*****************************************************************************
* Common macros, OS specific
*****************************************************************************/
-#if defined( __BEOS__ )
-#define INIT_RDC( TYPE, SIZE ) \
- raw_device_command rdc = { 0 }; \
- uint8_t p_buffer[ (SIZE)+1 ]; \
- rdc.data = (char *)p_buffer; \
- rdc.data_length = (SIZE); \
- BeInitRDC( &rdc, (TYPE) );
-#elif defined( SOLARIS_USCSI )
+#if defined( SOLARIS_USCSI )
#define INIT_USCSI( TYPE, SIZE ) \
struct uscsi_cmd sc = { 0 }; \
union scsi_cdb rs_cdb; \
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 8acfbb1..5ab171e 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, BeOS, Mac OS X, Solaris, QNX, OS/2, and Windows
- * NT 4.0 (with IE 5.0) or later.
+ * NetBSD, OpenBSD, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0
+ * (with IE 5.0) 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.
diff --git a/test/dvd_region.c b/test/dvd_region.c
index 3cbfe3f..d38eeb7 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -57,16 +57,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( __BEOS__ )
- INIT_RDC( GPCMD_SEND_KEY, 8 );
-
- rdc.command[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
-
#elif defined( SOLARIS_USCSI )
INIT_USCSI( GPCMD_SEND_KEY, 8 );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:45 UTC
Permalink
---
NEWS | 2 +-
libdvdcss.spec.in | 6 +--
src/ioctl.c | 155 ------------------------------------------------------
src/ioctl.h | 10 ----
src/libdvdcss.c | 4 +-
test/dvd_region.c | 11 ----
6 files changed, 5 insertions(+), 183 deletions(-)

diff --git a/NEWS b/NEWS
index bf3e1a0..f7f905c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Changes between 1.2.13 and 1.3.0:
- the type dvdcss_handle
- the variable dvdcss_interface_2
* Support for Android
- * Drop support for HP-UX, BeOS, and Windows 9x.
+ * Drop support for HP-UX, BeOS, QNX, and Windows 9x.
* Miscellaneous cleanups to code, documentation, build system.


diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index f6ae407..67994a5 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, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE 5.0)
- or later.
+ OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) 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, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0 (with IE 5.0)
- or later.
+ OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) 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/ioctl.c b/src/ioctl.c
index 6c6e910..dee2c86 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -73,10 +73,6 @@
#ifdef DARWIN_DVD_IOCTL
# include <IOKit/storage/IODVDMediaBSDClient.h>
#endif
-#ifdef __QNXNTO__
-# include <sys/mman.h>
-# include <sys/dcmd_cam.h>
-#endif

#include "dvdcss/dvdcss.h"
#include "common.h"
@@ -90,8 +86,6 @@ static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
#elif defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-#elif defined( __QNXNTO__ )
-static void QNXInitCPT ( CAM_PASS_THRU *, int );
#elif defined( __OS2__ )
static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
#endif
@@ -167,17 +161,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
}

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- p_cpt->cam_cdb[ 6 ] = i_layer;
- p_cpt->cam_cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- *pi_copyright = p_buffer[4];
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );

@@ -280,17 +263,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- p_cpt->cam_cdb[ 7 ] = DVD_STRUCT_DISCKEY;
- p_cpt->cam_cdb[ 10 ] = *pi_agid << 6;
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
#elif defined ( __OS2__ )
INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );

@@ -396,20 +368,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 12 );
-
- p_cpt->cam_cdb[ 2 ] = ( i_pos >> 24 ) & 0xff;
- p_cpt->cam_cdb[ 3 ] = ( i_pos >> 16 ) & 0xff;
- p_cpt->cam_cdb[ 4 ] = ( i_pos >> 8 ) & 0xff;
- p_cpt->cam_cdb[ 5 ] = ( i_pos ) & 0xff;
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 12 );

@@ -495,16 +453,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

*pi_agid = id;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 8 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- *pi_agid = p_buffer[ 7 ] >> 6;
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 8 );

@@ -594,16 +542,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 16 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 16 );

@@ -695,16 +633,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
keyData = (PDVD_ASF)key->KeyData;
*pi_asf = keyData->SuccessFlag;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 8 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- *pi_asf = p_buffer[ 7 ] & 1;
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 8 );

@@ -789,16 +717,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 12 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 12 );

@@ -866,14 +784,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 0 );
-
- p_cpt->cam_cdb[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 1 );

@@ -962,17 +872,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_SEND_KEY, 16 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_SEND_KEY, 16 );

@@ -1061,17 +960,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_SEND_KEY, 12 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_SEND_KEY, 12 );

@@ -1175,18 +1063,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = keyData->RegionMask;
*p_scheme = keyData->RpcScheme;

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_REPORT_KEY, 8 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_REPORT_KEY, 8 );

@@ -1341,37 +1217,6 @@ static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )
}
#endif /* defined( WIN32 ) */

-#if defined( __QNXNTO__ )
-/*****************************************************************************
- * QNXInitCPT: initialize a CPT structure for QNX Neutrino
- *****************************************************************************
- * This function initializes a cpt command structure for future use,
- * either a read command or a write command.
- *****************************************************************************/
-static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )
-{
- switch( i_type )
- {
- case GPCMD_SEND_KEY:
- p_cpt->cam_flags = CAM_DIR_OUT;
- break;
-
- case GPCMD_READ_DVD_STRUCTURE:
- case GPCMD_REPORT_KEY:
- p_cpt->cam_flags = CAM_DIR_IN;
- break;
- }
-
- p_cpt->cam_cdb[0] = i_type;
-
- p_cpt->cam_cdb[ 8 ] = (p_cpt->cam_dxfer_len >> 8) & 0xff;
- p_cpt->cam_cdb[ 9 ] = p_cpt->cam_dxfer_len & 0xff;
- p_cpt->cam_cdb_len = 12;
-
- p_cpt->cam_timeout = CAM_TIME_DEFAULT;
-}
-#endif /* defined( __QNXNTO__ ) */
-
#if defined( __OS2__ )
/*****************************************************************************
* OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
diff --git a/src/ioctl.h b/src/ioctl.h
index 4c10971..f7c3067 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -74,16 +74,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#elif defined( __QNXNTO__ )
-#define INIT_CPT( TYPE, SIZE ) \
- CAM_PASS_THRU * p_cpt = { 0 }; \
- uint8_t * p_buffer; \
- int structSize = sizeof( CAM_PASS_THRU ) + (SIZE); \
- p_cpt = (CAM_PASS_THRU *) malloc ( structSize ); \
- p_buffer = (uint8_t *) p_cpt + sizeof( CAM_PASS_THRU ); \
- p_cpt->cam_data_ptr = sizeof( CAM_PASS_THRU ); \
- p_cpt->cam_dxfer_len = (SIZE); \
- QNXInitCPT( p_cpt, (TYPE) );
#elif defined( __OS2__ )
#define INIT_SSC( TYPE, SIZE ) \
struct OS2_ExecSCSICmd sdc = { 0 }; \
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 5ab171e..9a10ac9 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, Mac OS X, Solaris, QNX, OS/2, and Windows NT 4.0
- * (with IE 5.0) or later.
+ * NetBSD, OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with
+ * IE 5.0) 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.
diff --git a/test/dvd_region.c b/test/dvd_region.c
index d38eeb7..c4308a3 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -91,17 +91,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )

i_ret = SEND_SPTD( i_fd, &sptd, &tmp );

-#elif defined( __QNXNTO__ )
-
- INIT_CPT( GPCMD_SEND_KEY, 8 );
-
- p_cpt->cam_cdb[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
-
#elif defined( __OS2__ )
INIT_SSC( GPCMD_SEND_KEY, 8 );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:46 UTC
Permalink
---
NEWS | 2 +-
configure.ac | 3 -
libdvdcss.spec.in | 4 +-
src/device.c | 116 -----------------------------------
src/device.h | 2 +-
src/ioctl.c | 176 ------------------------------------------------------
src/ioctl.h | 35 -----------
src/libdvdcss.c | 20 +------
test/dvd_region.c | 12 ----
9 files changed, 6 insertions(+), 364 deletions(-)

diff --git a/NEWS b/NEWS
index f7f905c..2f37902 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Changes between 1.2.13 and 1.3.0:
- the type dvdcss_handle
- the variable dvdcss_interface_2
* Support for Android
- * Drop support for HP-UX, BeOS, QNX, and Windows 9x.
+ * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
* Miscellaneous cleanups to code, documentation, build system.


diff --git a/configure.ac b/configure.ac
index 8d3d6c4..868333b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,9 +108,6 @@ case x"${host_os}" in
CFLAGS="${CFLAGS} -mwin32"
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
- xos2*)
- LDFLAGS="-Zbin-files"
- ;;
x*msvc*)
SYS_MSVC=1
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 67994a5..c58d9d3 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,7 +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, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) 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.
@@ -48,7 +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, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) 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/device.c b/src/device.c
index 288fc93..2c73e02 100644
--- a/src/device.c
+++ b/src/device.c
@@ -58,14 +58,6 @@
# include <IOKit/storage/IODVDMedia.h>
#endif

-#ifdef __OS2__
-# define INCL_DOS
-# define INCL_DOSDEVIOCTL
-# include <os2.h>
-# include <io.h> /* setmode() */
-# include <fcntl.h> /* O_BINARY */
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -87,13 +79,6 @@ static int win2k_open ( dvdcss_t, const char * );
static int win2k_seek ( dvdcss_t, int );
static int win2k_read ( dvdcss_t, void *, int );
static int win2k_readv ( dvdcss_t, 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 )
@@ -106,16 +91,6 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )

/* FIXME: implement this for Windows */
return 1;
-#elif defined( __OS2__ )
- ULONG ulMode;
-
- if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
- return 1; /* What to do? Be conservative and try to use the ioctls */
-
- if( ulMode & OPEN_FLAGS_DASD )
- return 1;
-
- return 0;
#else
struct stat fileinfo;
int ret;
@@ -162,28 +137,6 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
kern_return_t kern_result;
io_iterator_t media_iterator;
CFMutableDictionaryRef classes_to_match;
-#elif defined( __OS2__ )
-#pragma pack( 1 )
- struct
- {
- BYTE bCmdInfo;
- BYTE bDrive;
- } param;
-
- struct
- {
- BYTE abEBPB[31];
- USHORT usCylinders;
- BYTE bDevType;
- USHORT usDevAttr;
- } data;
-#pragma pack()
-
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
-
- int i;
#else
const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
int i, i_fd;
@@ -297,32 +250,6 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
}

IOObjectRelease( media_iterator );
-#elif defined( __OS2__ )
- for( i = 0; i < 26; i++ )
- {
- param.bCmdInfo = 0;
- param.bDrive = i;
-
- rc = DosDevIOCtl( ( HFILE )-1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
- &param, sizeof( param ), &ulParamLen,
- &data, sizeof( data ), &ulDataLen );
-
- if( rc == 0 )
- {
- /* Check for removable and for cylinders */
- if( ( data.usDevAttr & 1 ) == 0 && data.usCylinders == 0xFFFF )
- {
- char psz_dvd[] = "A:";
-
- psz_dvd[0] += i;
-
- print_debug( dvdcss, "defaulting to drive `%s'", psz_dvd );
- free( dvdcss->psz_device );
- dvdcss->psz_device = strdup( psz_dvd );
- return;
- }
- }
- }
#else
for( i = 0; ppsz_devices[i]; i++ )
{
@@ -367,18 +294,6 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
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 );
- }
- else
#endif
{
print_debug( dvdcss, "using libc for access" );
@@ -505,37 +420,6 @@ error:
}
#endif /* defined( WIN32 ) */

-#ifdef __OS2__
-static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
-{
- char psz_dvd[] = "X:";
- HFILE hfile;
- ULONG ulAction;
- ULONG rc;
-
- psz_dvd[0] = psz_device[0];
-
- rc = DosOpenL( ( PSZ )psz_dvd, &hfile, &ulAction, 0, FILE_NORMAL,
- OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
- OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
- NULL );
-
- if( rc )
- {
- print_error( dvdcss, "failed to open device" );
- return -1;
- }
-
- setmode( hfile, O_BINARY );
-
- dvdcss->i_fd = dvdcss->i_read_fd = hfile;
-
- dvdcss->i_pos = 0;
-
- return 0;
-}
-#endif /* __OS2__ */
-
/*****************************************************************************
* Seek commands.
*****************************************************************************/
diff --git a/src/device.h b/src/device.h
index f56489f..2c06e8e 100644
--- a/src/device.h
+++ b/src/device.h
@@ -44,7 +44,7 @@ struct iovec

#include "dvdcss/dvdcss.h"

-#if !defined(WIN32) && !defined(__OS2__)
+#if !defined(WIN32)
# define DVDCSS_RAW_OPEN
#endif

diff --git a/src/ioctl.c b/src/ioctl.c
index dee2c86..b54c1bd 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -8,7 +8,6 @@
* Håkan Hjort <***@dtek.chalmers.se>
* Eugenio Jarosiewicz <***@cise.ufl.edu>
* David Siebörger <drs-***@rucus.ru.ac.za>
- * Alex Strelnikov <***@os2.ru>
* Gildas Bazin <***@netcourrier.com>
*
* libdvdcss is free software; you can redistribute it and/or modify
@@ -39,13 +38,6 @@
#if defined( WIN32 )
# include <windows.h>
# include <winioctl.h>
-#elif defined ( __OS2__ )
-# define INCL_DOSFILEMGR
-# define INCL_DOSDEVICES
-# define INCL_DOSDEVIOCTL
-# define INCL_DOSERRORS
-# include <os2.h>
-# include <sys/ioctl.h>
#else
# include <netinet/in.h>
# include <sys/ioctl.h>
@@ -86,8 +78,6 @@ static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
#elif defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-#elif defined( __OS2__ )
-static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
#endif

/*****************************************************************************
@@ -161,18 +151,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
}

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- sdc.command[ 6 ] = i_layer;
- sdc.command[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_copyright = p_buffer[ 4 ];
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -263,23 +241,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );

-#elif defined ( __OS2__ )
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- sdc.command[ 7 ] = DVD_STRUCT_DISCKEY;
- sdc.command[ 10 ] = *pi_agid << 6;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- if( i_ret < 0 )
- {
- return i_ret;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -368,21 +329,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- sdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
- sdc.command[ 3 ] = ( i_pos >> 16 ) & 0xff;
- sdc.command[ 4 ] = ( i_pos >> 8 ) & 0xff;
- sdc.command[ 5 ] = ( i_pos ) & 0xff;
- sdc.command[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -453,17 +399,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

*pi_agid = id;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_agid = p_buffer[ 7 ] >> 6;
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -542,17 +477,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 16 );
-
- sdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -633,17 +557,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
keyData = (PDVD_ASF)key->KeyData;
*pi_asf = keyData->SuccessFlag;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_asf = p_buffer[ 7 ] & 1;
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -717,17 +630,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, key->KeyData, DVD_KEY_SIZE );

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- sdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -784,18 +686,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 1 );
-
- sdc.data_length = 0;
- sdc.command[ 8 ] = 0;
- sdc.command[ 9 ] = 0;
-
- sdc.command[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- NULL, 0, &ulDataLen);
#else
# error "DVD ioctls are unavailable on this system"

@@ -872,18 +762,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 16 );
-
- sdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -960,18 +838,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 12 );
-
- sdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -1063,19 +929,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = keyData->RegionMask;
*p_scheme = keyData->RpcScheme;

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
-
#else
# error "DVD ioctls are unavailable on this system"

@@ -1216,32 +1069,3 @@ static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )
p_sptd->TimeOutValue = 2;
}
#endif /* defined( WIN32 ) */
-
-#if defined( __OS2__ )
-/*****************************************************************************
- * OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
- *****************************************************************************
- * This function initializes an OS/2 'execute SCSI command' structure for
- * future use, either a read command or a write command.
- *****************************************************************************/
-static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
-{
- switch( i_type )
- {
- case GPCMD_SEND_KEY:
- p_sdc->flags = 0;
- break;
-
- case GPCMD_READ_DVD_STRUCTURE:
- case GPCMD_REPORT_KEY:
- p_sdc->flags = EX_DIRECTION_IN;
- break;
- }
-
- p_sdc->command[ 0 ] = i_type;
- p_sdc->command[ 8 ] = (p_sdc->data_length >> 8) & 0xff;
- p_sdc->command[ 9 ] = p_sdc->data_length & 0xff;
- p_sdc->id_code = 0x31304443; // 'CD01'
- p_sdc->cmd_length = 12;
-}
-#endif /* defined( __OS2__ ) */
diff --git a/src/ioctl.h b/src/ioctl.h
index f7c3067..eb8cd8d 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -74,15 +74,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#elif defined( __OS2__ )
-#define INIT_SSC( TYPE, SIZE ) \
- struct OS2_ExecSCSICmd sdc = { 0 }; \
- uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \
- unsigned long ulParamLen; \
- unsigned long ulDataLen; \
- sdc.data_length = (SIZE); \
- ulParamLen = sizeof(sdc); \
- OS2InitSDC( &sdc, (TYPE) )
#endif

/*****************************************************************************
@@ -246,30 +237,4 @@ typedef struct SCSI_PASS_THROUGH_DIRECT

#endif /* defined( WIN32 ) */

-/*****************************************************************************
- * OS/2 ioctl specific
- *****************************************************************************/
-#if defined( __OS2__ )
-
-#define CDROMDISK_EXECMD 0x7A
-
-#define EX_DIRECTION_IN 0x01
-#define EX_PLAYING_CHK 0x02
-
-#pragma pack(1)
-
-struct OS2_ExecSCSICmd
-{
- unsigned long id_code; // 'CD01'
- unsigned short data_length; // length of the Data Packet
- unsigned short cmd_length; // length of the Command Buffer
- unsigned short flags; // flags
- unsigned char command[16]; // Command Buffer for SCSI command
-
-} OS2_ExecSCSICmd;
-
-#pragma pack()
-
-#endif /* defined( __OS2__ ) */
-
#endif /* DVDCSS_IOCTL_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 9a10ac9..85edba5 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with
- * IE 5.0) or later.
+ * NetBSD, OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0)
+ * 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.
@@ -227,22 +227,6 @@ static char *set_cache_directory( dvdcss_t dvdcss )
if( psz_home )
{
int home_pos = 0;
-
-#ifdef __OS2__
- if( *psz_home == '/' || *psz_home == '\\')
- {
- const char *psz_unixroot = getenv("UNIXROOT");
-
- if( psz_unixroot &&
- psz_unixroot[0] &&
- psz_unixroot[1] == ':' &&
- psz_unixroot[2] == '\0')
- {
- strcpy( psz_buffer, psz_unixroot );
- home_pos = 2;
- }
- }
-#endif /* __OS2__ */
snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
"%s/.dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
diff --git a/test/dvd_region.c b/test/dvd_region.c
index c4308a3..d601386 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -91,18 +91,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )

i_ret = SEND_SPTD( i_fd, &sptd, &tmp );

-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"
--
1.9.1
KO Myung-Hun
2014-10-30 01:54:34 UTC
Permalink
Why ?
Post by Diego Biurrun
---
NEWS | 2 +-
configure.ac | 3 -
libdvdcss.spec.in | 4 +-
src/device.c | 116 -----------------------------------
src/device.h | 2 +-
src/ioctl.c | 176 ------------------------------------------------------
src/ioctl.h | 35 -----------
src/libdvdcss.c | 20 +------
test/dvd_region.c | 12 ----
9 files changed, 6 insertions(+), 364 deletions(-)
diff --git a/NEWS b/NEWS
index f7f905c..2f37902 100644
--- a/NEWS
+++ b/NEWS
- the type dvdcss_handle
- the variable dvdcss_interface_2
* Support for Android
- * Drop support for HP-UX, BeOS, QNX, and Windows 9x.
+ * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
* Miscellaneous cleanups to code, documentation, build system.
diff --git a/configure.ac b/configure.ac
index 8d3d6c4..868333b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,9 +108,6 @@ case x"${host_os}" in
CFLAGS="${CFLAGS} -mwin32"
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
- xos2*)
- LDFLAGS="-Zbin-files"
- ;;
x*msvc*)
SYS_MSVC=1
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index 67994a5..c58d9d3 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,7 +32,7 @@ Conflicts: libdvdcss0.0.1, libdvdcss0.0.2
libdvdcss is a simple library designed for accessing DVDs like a block device
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) 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.
@@ -48,7 +48,7 @@ Provides: %name = %version-%release
libdvdcss is a simple library designed for accessing DVDs like a block device
* Portability: Currently supported platforms are GNU/Linux, FreeBSD, NetBSD,
- OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) 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/device.c b/src/device.c
index 288fc93..2c73e02 100644
--- a/src/device.c
+++ b/src/device.c
@@ -58,14 +58,6 @@
# include <IOKit/storage/IODVDMedia.h>
#endif
-#ifdef __OS2__
-# define INCL_DOS
-# define INCL_DOSDEVIOCTL
-# include <os2.h>
-# include <io.h> /* setmode() */
-# include <fcntl.h> /* O_BINARY */
-#endif
-
#include "dvdcss/dvdcss.h"
#include "common.h"
@@ -87,13 +79,6 @@ static int win2k_open ( dvdcss_t, const char * );
static int win2k_seek ( dvdcss_t, int );
static int win2k_read ( dvdcss_t, void *, int );
static int win2k_readv ( dvdcss_t, 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 )
@@ -106,16 +91,6 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )
/* FIXME: implement this for Windows */
return 1;
-#elif defined( __OS2__ )
- ULONG ulMode;
-
- if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
- return 1; /* What to do? Be conservative and try to use the ioctls */
-
- if( ulMode & OPEN_FLAGS_DASD )
- return 1;
-
- return 0;
#else
struct stat fileinfo;
int ret;
@@ -162,28 +137,6 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
kern_return_t kern_result;
io_iterator_t media_iterator;
CFMutableDictionaryRef classes_to_match;
-#elif defined( __OS2__ )
-#pragma pack( 1 )
- struct
- {
- BYTE bCmdInfo;
- BYTE bDrive;
- } param;
-
- struct
- {
- BYTE abEBPB[31];
- USHORT usCylinders;
- BYTE bDevType;
- USHORT usDevAttr;
- } data;
-#pragma pack()
-
- ULONG ulParamLen;
- ULONG ulDataLen;
- ULONG rc;
-
- int i;
#else
const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
int i, i_fd;
@@ -297,32 +250,6 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
}
IOObjectRelease( media_iterator );
-#elif defined( __OS2__ )
- for( i = 0; i < 26; i++ )
- {
- param.bCmdInfo = 0;
- param.bDrive = i;
-
- rc = DosDevIOCtl( ( HFILE )-1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
- &param, sizeof( param ), &ulParamLen,
- &data, sizeof( data ), &ulDataLen );
-
- if( rc == 0 )
- {
- /* Check for removable and for cylinders */
- if( ( data.usDevAttr & 1 ) == 0 && data.usCylinders == 0xFFFF )
- {
- char psz_dvd[] = "A:";
-
- psz_dvd[0] += i;
-
- print_debug( dvdcss, "defaulting to drive `%s'", psz_dvd );
- free( dvdcss->psz_device );
- dvdcss->psz_device = strdup( psz_dvd );
- return;
- }
- }
- }
#else
for( i = 0; ppsz_devices[i]; i++ )
{
@@ -367,18 +294,6 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
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 );
- }
- else
#endif
{
print_debug( dvdcss, "using libc for access" );
}
#endif /* defined( WIN32 ) */
-#ifdef __OS2__
-static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
-{
- char psz_dvd[] = "X:";
- HFILE hfile;
- ULONG ulAction;
- ULONG rc;
-
- psz_dvd[0] = psz_device[0];
-
- rc = DosOpenL( ( PSZ )psz_dvd, &hfile, &ulAction, 0, FILE_NORMAL,
- OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
- OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
- NULL );
-
- if( rc )
- {
- print_error( dvdcss, "failed to open device" );
- return -1;
- }
-
- setmode( hfile, O_BINARY );
-
- dvdcss->i_fd = dvdcss->i_read_fd = hfile;
-
- dvdcss->i_pos = 0;
-
- return 0;
-}
-#endif /* __OS2__ */
-
/*****************************************************************************
* Seek commands.
*****************************************************************************/
diff --git a/src/device.h b/src/device.h
index f56489f..2c06e8e 100644
--- a/src/device.h
+++ b/src/device.h
@@ -44,7 +44,7 @@ struct iovec
#include "dvdcss/dvdcss.h"
-#if !defined(WIN32) && !defined(__OS2__)
+#if !defined(WIN32)
# define DVDCSS_RAW_OPEN
#endif
diff --git a/src/ioctl.c b/src/ioctl.c
index dee2c86..b54c1bd 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -8,7 +8,6 @@
*
* libdvdcss is free software; you can redistribute it and/or modify
@@ -39,13 +38,6 @@
#if defined( WIN32 )
# include <windows.h>
# include <winioctl.h>
-#elif defined ( __OS2__ )
-# define INCL_DOSFILEMGR
-# define INCL_DOSDEVICES
-# define INCL_DOSDEVIOCTL
-# define INCL_DOSERRORS
-# include <os2.h>
-# include <sys/ioctl.h>
#else
# include <netinet/in.h>
# include <sys/ioctl.h>
@@ -86,8 +78,6 @@ static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
#elif defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
-#elif defined( __OS2__ )
-static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
#endif
/*****************************************************************************
@@ -161,18 +151,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
}
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- sdc.command[ 6 ] = i_layer;
- sdc.command[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_copyright = p_buffer[ 4 ];
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -263,23 +241,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
-#elif defined ( __OS2__ )
- INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- sdc.command[ 7 ] = DVD_STRUCT_DISCKEY;
- sdc.command[ 10 ] = *pi_agid << 6;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- if( i_ret < 0 )
- {
- return i_ret;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -368,21 +329,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- sdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
- sdc.command[ 3 ] = ( i_pos >> 16 ) & 0xff;
- sdc.command[ 4 ] = ( i_pos >> 8 ) & 0xff;
- sdc.command[ 5 ] = ( i_pos ) & 0xff;
- sdc.command[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -453,17 +399,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = id;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_agid = p_buffer[ 7 ] >> 6;
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -542,17 +477,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 16 );
-
- sdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -633,17 +557,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
keyData = (PDVD_ASF)key->KeyData;
*pi_asf = keyData->SuccessFlag;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *pi_asf = p_buffer[ 7 ] & 1;
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -717,17 +630,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 12 );
-
- sdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -784,18 +686,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 1 );
-
- sdc.data_length = 0;
- sdc.command[ 8 ] = 0;
- sdc.command[ 9 ] = 0;
-
- sdc.command[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- NULL, 0, &ulDataLen);
#else
# error "DVD ioctls are unavailable on this system"
@@ -872,18 +762,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 16 );
-
- sdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -960,18 +838,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 12 );
-
- sdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -1063,19 +929,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = keyData->RegionMask;
*p_scheme = keyData->RpcScheme;
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_REPORT_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen);
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
-
#else
# error "DVD ioctls are unavailable on this system"
@@ -1216,32 +1069,3 @@ static void WinInitSPTD( SCSI_PASS_THROUGH_DIRECT *p_sptd, int i_type )
p_sptd->TimeOutValue = 2;
}
#endif /* defined( WIN32 ) */
-
-#if defined( __OS2__ )
-/*****************************************************************************
- * OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
- *****************************************************************************
- * This function initializes an OS/2 'execute SCSI command' structure for
- * future use, either a read command or a write command.
- *****************************************************************************/
-static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
-{
- switch( i_type )
- {
- p_sdc->flags = 0;
- break;
-
- p_sdc->flags = EX_DIRECTION_IN;
- break;
- }
-
- p_sdc->command[ 0 ] = i_type;
- p_sdc->command[ 8 ] = (p_sdc->data_length >> 8) & 0xff;
- p_sdc->command[ 9 ] = p_sdc->data_length & 0xff;
- p_sdc->id_code = 0x31304443; // 'CD01'
- p_sdc->cmd_length = 12;
-}
-#endif /* defined( __OS2__ ) */
diff --git a/src/ioctl.h b/src/ioctl.h
index f7c3067..eb8cd8d 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -74,15 +74,6 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(SPTD), sizeof( SCSI_PASS_THROUGH_DIRECT ), \
(TMP), NULL ) ? 0 : -1)
-#elif defined( __OS2__ )
-#define INIT_SSC( TYPE, SIZE ) \
- struct OS2_ExecSCSICmd sdc = { 0 }; \
- uint8_t p_buffer[ (SIZE) + 1 ] = { 0 }; \
- unsigned long ulParamLen; \
- unsigned long ulDataLen; \
- sdc.data_length = (SIZE); \
- ulParamLen = sizeof(sdc); \
- OS2InitSDC( &sdc, (TYPE) )
#endif
/*****************************************************************************
@@ -246,30 +237,4 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
#endif /* defined( WIN32 ) */
-/*****************************************************************************
- * OS/2 ioctl specific
- *****************************************************************************/
-#if defined( __OS2__ )
-
-#define CDROMDISK_EXECMD 0x7A
-
-#define EX_DIRECTION_IN 0x01
-#define EX_PLAYING_CHK 0x02
-
-#pragma pack(1)
-
-struct OS2_ExecSCSICmd
-{
- unsigned long id_code; // 'CD01'
- unsigned short data_length; // length of the Data Packet
- unsigned short cmd_length; // length of the Command Buffer
- unsigned short flags; // flags
- unsigned char command[16]; // Command Buffer for SCSI command
-
-} OS2_ExecSCSICmd;
-
-#pragma pack()
-
-#endif /* defined( __OS2__ ) */
-
#endif /* DVDCSS_IOCTL_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 9a10ac9..85edba5 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,8 @@
* device without having to bother about the decryption. The important features
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, Mac OS X, Solaris, OS/2, and Windows NT 4.0 (with
- * IE 5.0) or later.
+ * NetBSD, OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0)
+ * 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.
@@ -227,22 +227,6 @@ static char *set_cache_directory( dvdcss_t dvdcss )
if( psz_home )
{
int home_pos = 0;
-
-#ifdef __OS2__
- if( *psz_home == '/' || *psz_home == '\\')
- {
- const char *psz_unixroot = getenv("UNIXROOT");
-
- if( psz_unixroot &&
- psz_unixroot[0] &&
- psz_unixroot[1] == ':' &&
- psz_unixroot[2] == '\0')
- {
- strcpy( psz_buffer, psz_unixroot );
- home_pos = 2;
- }
- }
-#endif /* __OS2__ */
snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
"%s/.dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
diff --git a/test/dvd_region.c b/test/dvd_region.c
index c4308a3..d601386 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -91,18 +91,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
-#elif defined( __OS2__ )
- INIT_SSC( GPCMD_SEND_KEY, 8 );
-
- sdc.command[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
- &sdc, sizeof(sdc), &ulParamLen,
- p_buffer, sizeof(p_buffer), &ulDataLen );
-
#else
# error "DVD ioctls are unavailable on this system"
--
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr
Diego Biurrun
2014-11-05 12:00:44 UTC
Permalink
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.

Diego
KO Myung-Hun
2014-11-06 04:16:26 UTC
Permalink
Post by Diego Biurrun
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.
This is the reason why OS/2 should be dropped ? Amazing. Anyway perhaps
you could show me the unnecessary codes of those ? And it is the problem
to define structs because system headers do not provide them ?
--
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr
Reimar Döffinger
2014-11-06 08:28:37 UTC
Permalink
Post by Diego Biurrun
Post by Diego Biurrun
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires
ifdefs
Post by Diego Biurrun
in more places than other OSes and does a lot of struct definitions
for
Post by Diego Biurrun
stuff that I would expect to be present in system headers.
This is the reason why OS/2 should be dropped ? Amazing.
I think it should not be dropped, and as Diego mentioned earlier it was not necessarily his intention either, but to start a cost/benefit discussion.
It is however a reason to ask for the code to be reviewed and if possible to be cleaned up.
While it is possible OS/2 support needs all that complexity, I think Diego suspects that it's just a case of it being badly implemented.
Post by Diego Biurrun
you could show me the unnecessary codes of those ? And it is the problem
to define structs because system headers do not provide them ?
No, but it would be a problem if some structs are defined even though the system headers do provide them or equivalents. I don't know if that is the case, but Diego seems to suspect that (I am not so sure, some of those system headers are very old and probably low-quality code so it's likely they do things that make no sense).
KO Myung-Hun
2014-11-06 11:59:54 UTC
Permalink
Post by Reimar Döffinger
Post by Diego Biurrun
Post by Diego Biurrun
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires
ifdefs
Post by Diego Biurrun
in more places than other OSes and does a lot of struct definitions
for
Post by Diego Biurrun
stuff that I would expect to be present in system headers.
This is the reason why OS/2 should be dropped ? Amazing.
I think it should not be dropped, and as Diego mentioned earlier it was not necessarily his intention either, but to start a cost/benefit discussion.
It is however a reason to ask for the code to be reviewed and if possible to be cleaned up.
While it is possible OS/2 support needs all that complexity, I think Diego suspects that it's just a case of it being badly implemented.
Post by Diego Biurrun
you could show me the unnecessary codes of those ? And it is the problem
to define structs because system headers do not provide them ?
No, but it would be a problem if some structs are defined even though the system headers do provide them or equivalents. I don't know if that is the case, but Diego seems to suspect that (I am not so sure, some of those system headers are very old and probably low-quality code so it's likely they do things that make no sense).
I agree with you. And I have no objections to Diego's work cleaning up
and re-structuring codes at all. But dropping support is different
problem, although Diego's real intention is not so.
--
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr
Diego Biurrun
2014-11-06 12:13:10 UTC
Permalink
Post by KO Myung-Hun
Post by Diego Biurrun
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.
This is the reason why OS/2 should be dropped ? Amazing. Anyway perhaps
you could show me the unnecessary codes of those ? And it is the problem
to define structs because system headers do not provide them ?
Trolling me is not going to help your case, on the contrary. Please answer
my questions instead.

Diego
KO Myung-Hun
2014-11-07 12:40:25 UTC
Permalink
Post by Diego Biurrun
Post by KO Myung-Hun
Post by Diego Biurrun
Why ?
Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.
This is the reason why OS/2 should be dropped ? Amazing. Anyway perhaps
you could show me the unnecessary codes of those ? And it is the problem
to define structs because system headers do not provide them ?
Trolling me is not going to help your case, on the contrary. Please answer
my questions instead.
I answered to you enough. Misunderstanding is not helpful to each other.
--
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr
Dave Yeo
2014-10-30 04:50:55 UTC
Permalink
Post by Diego Biurrun
+ * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
Still possible to buy and still has a user community
Dave
Diego Biurrun
2014-11-05 12:01:02 UTC
Permalink
Post by Dave Yeo
Post by Diego Biurrun
+ * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
Still possible to buy and still has a user community
same question for you:

Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.

Diego
Jean-Baptiste Kempf
2014-11-05 12:07:50 UTC
Permalink
Post by Diego Biurrun
Post by Dave Yeo
Post by Diego Biurrun
+ * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
Still possible to buy and still has a user community
Perhaps you could explain why OS/2 is so intrusive? It requires ifdefs
in more places than other OSes and does a lot of struct definitions for
stuff that I would expect to be present in system headers.
They should be put in common.h then.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-10-29 20:33:47 UTC
Permalink
---
NEWS | 2 +-
configure.ac | 9 --
libdvdcss.spec.in | 4 +-
msvc/config.h | 1 -
src/device.c | 1 -
src/ioctl.c | 280 +-----------------------------------------------------
src/ioctl.h | 11 +--
src/libdvdcss.c | 3 +-
test/dvd_region.c | 15 ---
9 files changed, 6 insertions(+), 320 deletions(-)

diff --git a/NEWS b/NEWS
index 2f37902..d3fdaed 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Changes between 1.2.13 and 1.3.0:
- the type dvdcss_handle
- the variable dvdcss_interface_2
* Support for Android
- * Drop support for HP-UX, BeOS, QNX, OS/2, and Windows 9x.
+ * Drop support for HP-UX, Solaris, BeOS, QNX, OS/2, and Windows 9x.
* Miscellaneous cleanups to code, documentation, build system.


diff --git a/configure.ac b/configure.ac
index 868333b..cda5443 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,15 +169,6 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
LINUX_DVD_STRUCT=1
])
dnl
- dnl Solaris: sys/scsi/scsi_types.h, sys/scsi/impl/uscsi.h
- dnl
- solaris_uscsi=yes
- AC_CHECK_HEADERS([sys/scsi/scsi_types.h sys/scsi/impl/uscsi.h], [],
- [solaris_uscsi=no; break;])
- AS_IF([test "$solaris_uscsi" = "yes"], [
- AC_DEFINE(SOLARIS_USCSI, 1, Have userspace SCSI headers.)
- ])
- dnl
dnl Darwin
dnl
AC_CHECK_HEADER(IOKit/storage/IODVDMediaBSDClient.h,[
diff --git a/libdvdcss.spec.in b/libdvdcss.spec.in
index c58d9d3..f3b3224 100644
--- a/libdvdcss.spec.in
+++ b/libdvdcss.spec.in
@@ -32,7 +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, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) 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.
@@ -48,7 +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, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0) or later.
+ OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) 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 dc7fb62..b0fadb5 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -33,7 +33,6 @@
#define PACKAGE_STRING "libdvdcss 1.3.0"
#define PACKAGE_TARNAME "libdvdcss"
#define PACKAGE_VERSION "1.3.0"
-/* #undef SOLARIS_USCSI */
#define STDC_HEADERS 1
#define VERSION "1.3.0"
#define _WIN32_IE 0x0500
diff --git a/src/device.c b/src/device.c
index 2c73e02..ed2b710 100644
--- a/src/device.c
+++ b/src/device.c
@@ -106,7 +106,6 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )
* and those that don't contain/use an 'r' in the name are block devices)
*
* Linux needs a block device
- * Solaris needs a char device
* Darwin needs a char device
* OpenBSD needs a char device
* NetBSD needs a char device
diff --git a/src/ioctl.c b/src/ioctl.c
index b54c1bd..37d7ce8 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -55,13 +55,6 @@
#ifdef DVD_STRUCT_IN_DVD_H
# include <dvd.h>
#endif
-#ifdef SOLARIS_USCSI
-# include <dlfcn.h>
-# include <unistd.h>
-# include <stropts.h>
-# include <sys/scsi/scsi_types.h>
-# include <sys/scsi/impl/uscsi.h>
-#endif
#ifdef DARWIN_DVD_IOCTL
# include <IOKit/storage/IODVDMediaBSDClient.h>
#endif
@@ -73,10 +66,7 @@
/*****************************************************************************
* Local prototypes, OS specific
*****************************************************************************/
-#if defined( SOLARIS_USCSI )
-static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
-static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
-#elif defined( WIN32 )
+#if defined( WIN32 )
static void WinInitSPTD ( SCSI_PASS_THROUGH_DIRECT *, int );
#endif

@@ -107,21 +97,6 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )

*pi_copyright = dvd.cpst;

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, 8 );
-
- rs_cdb.cdb_opaque[ 6 ] = i_layer;
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
- i_ret = SolarisSendUSCSI(i_fd, &sc);
-
- if( i_ret < 0 || sc.uscsi_status ) {
- i_ret = -1;
- }
-
- *pi_copyright = p_buffer[ 4 ];
- /* s->copyright.rmi = p_buffer[ 5 ]; */
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDCopyrightInfo,
kDVDStructureFormatCopyrightInfo );
@@ -195,22 +170,6 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, dvd.data, DVD_DISCKEY_SIZE );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
-
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
- rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- return i_ret;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDDiscKeyInfo,
kDVDStructureFormatDiscKeyInfo );
@@ -277,29 +236,6 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )

memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 12 );
-
- rs_cdb.cdb_opaque[ 2 ] = ( i_pos >> 24 ) & 0xff;
- rs_cdb.cdb_opaque[ 3 ] = ( i_pos >> 16 ) & 0xff;
- rs_cdb.cdb_opaque[ 4 ] = ( i_pos >> 8 ) & 0xff;
- rs_cdb.cdb_opaque[ 5 ] = ( i_pos ) & 0xff;
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- /* Do we want to return the cp_sec flag perhaps? */
- /* a->lstk.cpm = (buf[ 4 ] >> 7) & 1; */
- /* a->lstk.cp_sec = (buf[ 4 ] >> 6) & 1; */
- /* a->lstk.cgms = (buf[ 4 ] >> 4) & 3; */
-
- memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDTitleKeyInfo,
kDVDKeyFormatTitleKey );
@@ -365,20 +301,6 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )

*pi_agid = auth_info.agid;

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- *pi_agid = p_buffer[ 7 ] >> 6;
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationGrantIDInfo,
kDVDKeyFormatAGID_CSS );
@@ -433,20 +355,6 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

memcpy( p_challenge, auth_info.keychal, DVD_CHALLENGE_SIZE );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 16 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDChallengeKeyInfo,
kDVDKeyFormatChallengeKey );
@@ -511,20 +419,6 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )

*pi_asf = auth_info.asf;

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- *pi_asf = p_buffer[ 7 ] & 1;
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationSuccessFlagInfo,
kDVDKeyFormatASF );
@@ -591,20 +485,6 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )

memcpy( p_key, auth_info.keychal, DVD_KEY_SIZE );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 12 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDKey1Info,
kDVDKeyFormatKey1 );
@@ -660,18 +540,6 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )

i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 0 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVDCSS_INVALIDATE_AGID | (*pi_agid << 6);
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_send_key_t, DVDAuthenticationGrantIDInfo,
kDVDKeyFormatAGID_Invalidate );
@@ -720,21 +588,6 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_SEND_KEY, 16 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
- if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-
- i_ret = 0;
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
kDVDKeyFormatChallengeKey );
@@ -796,21 +649,6 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_SEND_KEY, 12 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
-
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
- if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-
- i_ret = 0;
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
kDVDKeyFormatKey2 );
@@ -878,22 +716,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
*p_mask = auth_info.region; // ??
*p_scheme = auth_info.rpc_scheme;

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_REPORT_KEY, 8 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
- *p_type = p_buffer[ 4 ] >> 6;
- *p_mask = p_buffer[ 5 ];
- *p_scheme = p_buffer[ 6 ];
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_report_key_t, DVDRegionPlaybackControlInfo,
kDVDKeyFormatRegionState );
@@ -938,106 +760,6 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )

/* Local prototypes */

-#if defined( SOLARIS_USCSI )
-/*****************************************************************************
- * SolarisInitUSCSI: initialize a USCSICMD structure for the Solaris kernel
- *****************************************************************************
- * This function initializes a Solaris userspace SCSI command structure for
- * future use, either a read command or a write command.
- *****************************************************************************/
-static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type )
-{
- union scsi_cdb *rs_cdb;
- memset( p_sc->uscsi_cdb, 0, sizeof( union scsi_cdb ) );
- memset( p_sc->uscsi_bufaddr, 0, p_sc->uscsi_buflen );
-
- switch( i_type )
- {
- case GPCMD_SEND_KEY:
- p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_WRITE;
- break;
-
- case GPCMD_READ_DVD_STRUCTURE:
- case GPCMD_REPORT_KEY:
- p_sc->uscsi_flags = USCSI_ISOLATE | USCSI_READ;
- break;
- }
-
- rs_cdb = (union scsi_cdb *)p_sc->uscsi_cdb;
-
- rs_cdb->scc_cmd = i_type;
-
- rs_cdb->cdb_opaque[ 8 ] = (p_sc->uscsi_buflen >> 8) & 0xff;
- rs_cdb->cdb_opaque[ 9 ] = p_sc->uscsi_buflen & 0xff;
- p_sc->uscsi_cdblen = 12;
- p_sc->uscsi_timeout = 15;
-}
-
-/*****************************************************************************
- * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
- * for execution
- *****************************************************************************
- * When available, this function uses the function smedia_uscsi_cmd()
- * from Solaris' libsmedia library (Solaris 9 or newer) to execute the
- * USCSI command. smedia_uscsi_cmd() allows USCSI commands for
- * non-root users on removable media devices on Solaris 9; sending the
- * USCSI command directly to the device using the USCSICMD ioctl fails
- * with an EPERM error on Solaris 9.
- *
- * The code will fall back to the USCSICMD ioctl method, when
- * libsmedia.so is not available or does not export the
- * smedia_uscsi_cmd() function (on Solaris releases up to and including
- * Solaris 8). Fortunately, on these old releases non-root users are
- * allowed to perform USCSICMD ioctls on removable media devices.
- *****************************************************************************/
-static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )
-{
- void *p_handle;
-
- /* We use static variables to keep track of the libsmedia symbols, which
- * is harmless even in a multithreaded program because the library and
- * its symbols will always be mapped at the same address. */
- static int b_tried = 0;
- static int b_have_sm = 0;
- static void * (*p_get_handle) ( int32_t );
- static int (*p_uscsi_cmd) ( void *, struct uscsi_cmd * );
- static int (*p_release_handle) ( void * );
-
- if( !b_tried )
- {
- void *p_lib;
-
- p_lib = dlopen( "libsmedia.so", RTLD_NOW );
- if( p_lib )
- {
- p_get_handle = dlsym( p_lib, "smedia_get_handle" );
- p_uscsi_cmd = dlsym( p_lib, "smedia_uscsi_cmd" );
- p_release_handle = dlsym( p_lib, "smedia_release_handle" );
-
- if( p_get_handle && p_uscsi_cmd && p_release_handle )
- {
- b_have_sm = 1;
- }
- else
- {
- dlclose( p_lib );
- }
- }
-
- b_tried = 1;
- }
-
- if( b_have_sm && (p_handle = p_get_handle(i_fd)) )
- {
- int i_ret = p_uscsi_cmd( p_handle, p_sc );
- p_release_handle( p_handle );
- return i_ret;
- }
-
- return ioctl( i_fd, USCSICMD, p_sc );
-}
-#endif /* defined( SOLARIS_USCSI ) */
-
#if defined( WIN32 )
/*****************************************************************************
* WinInitSPTD: initialize a sptd structure
diff --git a/src/ioctl.h b/src/ioctl.h
index eb8cd8d..98119b5 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -44,16 +44,7 @@ int ioctl_ReportRPC ( int, int *, int *, int * );
/*****************************************************************************
* Common macros, OS specific
*****************************************************************************/
-#if defined( SOLARIS_USCSI )
-#define INIT_USCSI( TYPE, SIZE ) \
- struct uscsi_cmd sc = { 0 }; \
- union scsi_cdb rs_cdb; \
- uint8_t p_buffer[ (SIZE)+1 ]; \
- sc.uscsi_cdb = (caddr_t)&rs_cdb; \
- sc.uscsi_bufaddr = (caddr_t)p_buffer; \
- sc.uscsi_buflen = (SIZE); \
- SolarisInitUSCSI( &sc, (TYPE) );
-#elif defined( DARWIN_DVD_IOCTL )
+#if defined( DARWIN_DVD_IOCTL )
#define INIT_DVDIOCTL( DKDVD_TYPE, BUFFER_TYPE, FORMAT ) \
DKDVD_TYPE dvd = { 0 }; \
BUFFER_TYPE dvdbs = { 0 }; \
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 85edba5..ab5b665 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -30,8 +30,7 @@
* device without having to bother about the decryption. The important features
* are:
* \li portability: Currently supported platforms are GNU/Linux, FreeBSD,
- * NetBSD, OpenBSD, Mac OS X, Solaris, and Windows NT 4.0 (with IE 5.0)
- * or later.
+ * NetBSD, OpenBSD, Mac OS X, and Windows NT 4.0 (with IE 5.0) 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.
diff --git a/test/dvd_region.c b/test/dvd_region.c
index d601386..e8f18e5 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -57,21 +57,6 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )

i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );

-#elif defined( SOLARIS_USCSI )
- INIT_USCSI( GPCMD_SEND_KEY, 8 );
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_SEND_RPC;
-
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
- i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
- i_ret = -1;
- }
-
#elif defined( DARWIN_DVD_IOCTL )
INIT_DVDIOCTL( dk_dvd_send_key_t, DVDRegionPlaybackControlInfo,
kDVDKeyFormatSetRegion );
--
1.9.1
Diego Biurrun
2014-10-29 20:33:01 UTC
Permalink
There is -Wextra in CFLAGS, which includes -Wsign-compare.
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a07a3e0..f4fa527 100644
--- a/configure.ac
+++ b/configure.ac
@@ -205,7 +205,7 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
fi
])

-CC_CHECK_CFLAGS_APPEND([-Wall -Wsign-compare -Wextra])
+CC_CHECK_CFLAGS_APPEND([-Wall -Wextra])
CC_FLAG_VISIBILITY([
CC_ATTRIBUTE_VISIBILITY([default], [
CFLAGS="${CFLAGS} -fvisibility=hidden"
--
1.9.1
Reimar Döffinger
2014-10-30 07:10:32 UTC
Permalink
Post by Diego Biurrun
Drop support for OS/2.
9 files changed, 6 insertions(+), 364 deletions(-)
Drop support for BeOS.
7 files changed, 11 insertions(+), 181 deletions(-)
As you noticed, BeOS (or possibly HaikuOS) and OS/2 do in fact have an active community.
It might be worth pushing them to take some time and try to clean up the code though :)
Solaris also might be kind of active, plus it is kind of POSIX especially nowadays, so I kind of feel like voting to keep it, but on the other hand I won't work on it so maybe shouldn't get a vote.
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Everyone complaining strongly should have read this sentence ;)
Diego Biurrun
2014-10-30 10:47:00 UTC
Permalink
Post by Reimar Döffinger
Post by Diego Biurrun
Drop support for OS/2.
9 files changed, 6 insertions(+), 364 deletions(-)
Drop support for BeOS.
7 files changed, 11 insertions(+), 181 deletions(-)
As you noticed, BeOS (or possibly HaikuOS) and OS/2 do in fact have an active community.
IIUC Haiku has some community left, but BeOS is completely dead. The
question is whether all that code is truly necessary to run on Haiku,
as opposed to BeOS. I removed BeOS support from libav ages ago, but
Haiku was not affected.
Post by Reimar Döffinger
It might be worth pushing them to take some time and try to clean up the code though :)
Yeah, I do wonder why the OS/2 port creates so much more clutter than
QNX or BeOS.
Post by Reimar Döffinger
Solaris also might be kind of active, plus it is kind of POSIX
especially nowadays, so I kind of feel like voting to keep it, but on
the other hand I won't work on it so maybe shouldn't get a vote.
I do wonder if it compiles and works. Somehow I suspect it hasn't been
tested in ages.


I also wonder about those BSD support hacks. There are some extra hoops
for OpenBSD, but I very much wonder if they are still necessary now, 10+
years after their creation.
Post by Reimar Döffinger
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Everyone complaining strongly should have read this sentence ;)
Indeed :)

Diego
Jean-Baptiste Kempf
2014-10-30 13:01:28 UTC
Permalink
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Be careful: what is called here "Win9x" is in fact Adaptec SCSI
interface and runs also on Windows XP.
Post by Diego Biurrun
[PATCH 43/46] Drop support for BeOS.
[PATCH 44/46] Drop support for QNX.
[PATCH 45/46] Drop support for OS/2.
[PATCH 46/46] Drop support for Solaris.
I think this is not the way to go:
The way to go is to split this code in different files, one per OS, with
a common code calling the OS-specific functions so that supporting the rarest
OSes does not burden the maintenance of the other ones.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-10-30 15:12:45 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Be careful: what is called here "Win9x" is in fact Adaptec SCSI
interface and runs also on Windows XP.
I was wondering myself due to the "ASPI" in the names. That still leaves
the question of whether or not this code is worth keeping. On Windows XP
the other access method is available, isn't it?
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
[PATCH 43/46] Drop support for BeOS.
[PATCH 44/46] Drop support for QNX.
[PATCH 45/46] Drop support for OS/2.
[PATCH 46/46] Drop support for Solaris.
The way to go is to split this code in different files, one per OS, with
a common code calling the OS-specific functions so that supporting the rarest
OSes does not burden the maintenance of the other ones.
I have had this very thought myself. Maybe I'll get to it.

Diego
Jean-Baptiste Kempf
2014-10-30 19:24:18 UTC
Permalink
Post by Diego Biurrun
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Be careful: what is called here "Win9x" is in fact Adaptec SCSI
interface and runs also on Windows XP.
I was wondering myself due to the "ASPI" in the names. That still leaves
the question of whether or not this code is worth keeping.
I'm not sure we should keep it, tbh.
At worse, it's in the git.
Post by Diego Biurrun
On Windows XP
the other access method is available, isn't it?
Yes.
Post by Diego Biurrun
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
[PATCH 43/46] Drop support for BeOS.
[PATCH 44/46] Drop support for QNX.
[PATCH 45/46] Drop support for OS/2.
[PATCH 46/46] Drop support for Solaris.
The way to go is to split this code in different files, one per OS, with
a common code calling the OS-specific functions so that supporting the rarest
OSes does not burden the maintenance of the other ones.
I have had this very thought myself. Maybe I'll get to it.
It feels cleaner, to me, and as libdvdcss is not that big piece of code,
it wouldn't hurt too much to keep other OSes in.

But I agree 1000x that the ifdef mess we have must go away.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2014-10-30 23:01:55 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Be careful: what is called here "Win9x" is in fact Adaptec SCSI
interface and runs also on Windows XP.
I was wondering myself due to the "ASPI" in the names. That still leaves
the question of whether or not this code is worth keeping.
I'm not sure we should keep it, tbh.
At worse, it's in the git.
This code cannot have seen much testing in the last 10 years ever since
Windows 9x faded into obsolescence. Here's a better log message:

Drop support for ASPI disc access (and thus Windows 9x).

The ASPI access method is only relevant on Windows 9x versions where no
alternative exists. However, These Windows versions are obsolete since a
long time and have no more real world usage. Also, the ASPI code is ugly
and a maintenance burden.

Good to go then?
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
[PATCH 43/46] Drop support for BeOS.
[PATCH 44/46] Drop support for QNX.
[PATCH 45/46] Drop support for OS/2.
[PATCH 46/46] Drop support for Solaris.
The way to go is to split this code in different files, one per OS, with
a common code calling the OS-specific functions so that supporting the rarest
OSes does not burden the maintenance of the other ones.
I have had this very thought myself. Maybe I'll get to it.
It feels cleaner, to me, and as libdvdcss is not that big piece of code,
it wouldn't hurt too much to keep other OSes in.
I don't mind keeping the other (fringe) OSes, but I'd like to reevaluate
if they work at all, if they are worth keeping, and whether or not all
that support code is truly necessary.

IMO HP-UX is a complete fringe WTF system and Windows 9x just requires too
much clutter, thus both are not worth the trouble of continuing to deal
with them.

I strongly suspect that the BeOS code is no longer necessary for Haiku
and I similarly suspect that half the (Open)BSD hacks are now obsolete.
Post by Jean-Baptiste Kempf
But I agree 1000x that the ifdef mess we have must go away.
Nobody can disagree about this I think.

Diego
Jean-Baptiste Kempf
2014-10-31 02:56:40 UTC
Permalink
X-UID: 730
Content-Length: 2511
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
I think Windows 9x should go for sure. The others we can discuss.
Be careful: what is called here "Win9x" is in fact Adaptec SCSI
interface and runs also on Windows XP.
I was wondering myself due to the "ASPI" in the names. That still leaves
the question of whether or not this code is worth keeping.
I'm not sure we should keep it, tbh.
At worse, it's in the git.
This code cannot have seen much testing in the last 10 years ever since
Drop support for ASPI disc access (and thus Windows 9x).
The ASPI access method is only relevant on Windows 9x versions where no
alternative exists. However, These Windows versions are obsolete since a
long time and have no more real world usage. Also, the ASPI code is ugly
and a maintenance burden.
Good to go then?
Sure.
Post by Jean-Baptiste Kempf
Post by Diego Biurrun
I have had this very thought myself. Maybe I'll get to it.
It feels cleaner, to me, and as libdvdcss is not that big piece of code,
it wouldn't hurt too much to keep other OSes in.
I don't mind keeping the other (fringe) OSes, but I'd like to reevaluate
if they work at all, if they are worth keeping, and whether or not all
that support code is truly necessary.
I know OS/2 and Solaris to work.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Jean-Baptiste Kempf
2014-10-30 13:07:44 UTC
Permalink
Post by Diego Biurrun
Bon soir mesdames et messieurs, I 'ave a grande patch set for vous.
Good job.

I gave my objections, the rest is good for me.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Loading...