Discussion:
[libdvdcss-devel] [PATCH] build: win32: Surround Windows-specific code by appropriate ifdef
Diego Biurrun
2013-01-29 19:42:24 UTC
Permalink
Also drop related unnecessary direct.h #include and configure.ac check.
---

This is tested on Linux, Cygwin and MinGW. I suspect somebody will have
to test it on MSVC.

configure.ac | 3 ---
src/libdvdcss.c | 6 +-----
2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 44ff25c..a4a7b6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,9 +58,6 @@ CAN_BUILD_LIBDVDCSS=0

dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 01eafef..877abf5 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif

-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -238,7 +234,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
--
1.7.9.5
Diego Biurrun
2013-01-29 20:02:44 UTC
Permalink
Post by Diego Biurrun
Also drop related unnecessary direct.h #include and configure.ac check.
---
This is tested on Linux, Cygwin and MinGW. I suspect somebody will have
to test it on MSVC.
To clarify - compile-tested. It gets harder and harder to get both a
DVD and a suitable computer with an optical drive these days :)

Diego
Jean-Baptiste Kempf
2013-01-30 17:08:42 UTC
Permalink
Post by Diego Biurrun
Post by Diego Biurrun
Also drop related unnecessary direct.h #include and configure.ac check.
---
This is tested on Linux, Cygwin and MinGW. I suspect somebody will have
to test it on MSVC.
To clarify - compile-tested. It gets harder and harder to get both a
DVD and a suitable computer with an optical drive these days :)
Tested to work.
MSVC? not a big deal, and it will work, since the change is minimal.

It does not change that the code is broken, as before.

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2013-02-01 12:05:51 UTC
Permalink
Also move the direct.h #include into that block and drop the direct.h
configure.ac check. That header file is always available on Windows.

Signed-off-by: Diego Biurrun <***@biurrun.de>
---
configure.ac | 3 ---
src/libdvdcss.c | 7 ++-----
2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e708..326db26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,6 @@ CAN_BUILD_LIBDVDCSS=0

dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a09084..0b2c20f 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif

-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -242,7 +238,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
+#include <direct.h>
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
--
1.7.9.5
Jean-Baptiste Kempf
2013-02-01 12:38:55 UTC
Permalink
Post by Diego Biurrun
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
+#include <direct.h>
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
This section of the work does not use mkidr, but somewhere else, so I
don't see why the include is here.
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2013-02-10 12:03:20 UTC
Permalink
Also move the direct.h #include into that block and drop the direct.h
configure.ac check. That header file is always available on Windows.

Signed-off-by: Diego Biurrun <***@biurrun.de>
---

Now w/o unnecessary direct.h #include.

configure.ac | 3 ---
src/libdvdcss.c | 6 +-----
2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e708..326db26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,6 @@ CAN_BUILD_LIBDVDCSS=0

dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a09084..c4c6d77 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif

-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -242,7 +238,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
--
1.7.9.5
Alexander Strasser
2013-02-10 14:03:48 UTC
Permalink
Hi!
Post by Diego Biurrun
Also move the direct.h #include into that block and drop the direct.h
Where did you move it in the patch?
Post by Diego Biurrun
configure.ac check. That header file is always available on Windows.
I do not think I have nor need direct.h on Cygwin.
Post by Diego Biurrun
---
Now w/o unnecessary direct.h #include.
Or did you mean you removed direct.h include? If yes
then the commit message is confusing.

Also I had the impression you submitted a patch for
MSVC earlier which would need direct.h to be included.


Alexander
Post by Diego Biurrun
configure.ac | 3 ---
src/libdvdcss.c | 6 +-----
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index ca2e708..326db26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,6 @@ CAN_BUILD_LIBDVDCSS=0
dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a09084..c4c6d77 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif
-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"
#include "common.h"
@@ -242,7 +238,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
--
1.7.9.5
Diego Biurrun
2013-02-10 14:41:38 UTC
Permalink
Also drop the now unnecessary direct.h configure.ac check. That header
file is no longer used and always available on Windows.

Signed-off-by: Diego Biurrun <***@biurrun.de>
---

Now with updated log message and msvc change.

configure.ac | 3 ---
msvc/config.h | 1 -
src/libdvdcss.c | 6 +-----
3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e708..326db26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,6 @@ CAN_BUILD_LIBDVDCSS=0

dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/msvc/config.h b/msvc/config.h
index d61b8c1..389facb 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -7,7 +7,6 @@
/* #undef DVD_STRUCT_IN_SYS_CDIO_H */
/* #undef DVD_STRUCT_IN_SYS_DVDIO_H */
/* #undef HAVE_BSD_DVD_STRUCT */
-#define HAVE_DIRECT_H 1
#define HAVE_DLFCN_H 1
/* #undef HAVE_DVD_H */
/* #undef HAVE_INTTYPES_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a09084..c4c6d77 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif

-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -242,7 +238,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32)
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
--
1.7.9.5
Jean-Baptiste Kempf
2013-02-11 00:27:18 UTC
Permalink
Post by Diego Biurrun
Also drop the now unnecessary direct.h configure.ac check. That header
file is no longer used and always available on Windows.
DOn't we need direct.h for mkdir?

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Diego Biurrun
2013-02-13 22:33:18 UTC
Permalink
libdvdcss | branch: master | Diego Biurrun <***@biurrun.de> | Wed Feb 13 22:50:00 2013 +0100| [77f561a53feaf5b2ebaf55e00e43189c8b9be237] | committer: Jean-Baptiste Kempf

build: win32: Surround Windows-specific code by appropriate ifdef

Also drop the now unnecessary direct.h configure.ac check.
That header file is always available on Windows.
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=77f561a53feaf5b2ebaf55e00e43189c8b9be237
---

configure.ac | 3 ---
msvc/config.h | 1 -
src/libdvdcss.c | 9 +++------
3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7c92ce6..d938d64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,9 +48,6 @@ CAN_BUILD_LIBDVDCSS=0

dnl for windoze
AC_CHECK_HEADERS(windows.h,[
- AC_CHECK_HEADERS(direct.h,,,[
- #include <windows.h>
- ])
AC_CHECK_HEADERS(winioctl.h,[
CAN_BUILD_LIBDVDCSS=1
],,[
diff --git a/msvc/config.h b/msvc/config.h
index ac88ea2..5a313ee 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -7,7 +7,6 @@
/* #undef DVD_STRUCT_IN_SYS_CDIO_H */
/* #undef DVD_STRUCT_IN_SYS_DVDIO_H */
/* #undef HAVE_BSD_DVD_STRUCT */
-#define HAVE_DIRECT_H 1
#define HAVE_DLFCN_H 1
/* #undef HAVE_DVD_H */
/* #undef HAVE_INTTYPES_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index b10f598..2bbb2dc 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -120,10 +120,6 @@
# include <limits.h>
#endif

-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
-
#include "dvdcss/dvdcss.h"

#include "common.h"
@@ -132,7 +128,8 @@
#include "ioctl.h"
#include "device.h"

-#if defined(WIN32)
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include <direct.h>
#define mkdir(a, b) _mkdir(a)
#endif

@@ -242,7 +239,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
-#ifdef HAVE_DIRECT_H
+#if defined(WIN32) && !defined(__CYGWIN__)
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );

Loading...