Discussion:
[libdvdcss-devel] Win32: Fix broken mkdir() invocations that need to be mapped to _mkdir()
Diego Biurrun
2013-02-11 12:59:41 UTC
Permalink
libdvdcss | branch: master | Diego Biurrun <***@biurrun.de> | Mon Feb 11 01:21:26 2013 +0100| [1fab727ead1c7f84300cae8d077a24c9c9aa83aa] | committer: Jean-Baptiste Kempf

Win32: Fix broken mkdir() invocations that need to be mapped to _mkdir()
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=1fab727ead1c7f84300cae8d077a24c9c9aa83aa
---

src/libdvdcss.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 01eafef..4a09084 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -132,6 +132,10 @@
#include "ioctl.h"
#include "device.h"

+#if defined(WIN32)
+#define mkdir(a, b) _mkdir(a)
+#endif
+
/**
* \brief Symbol for version checks.
*
@@ -521,11 +525,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )

/* We have a disc name or ID, we can create the cache dir */
i = sprintf( dvdcss->psz_cachefile, "%s", psz_cache );
-#if !defined( WIN32 ) || defined( SYS_CYGWIN )
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
-#else
- i_ret = mkdir( dvdcss->psz_cachefile );
-#endif
if( i_ret < 0 && errno != EEXIST )
{
print_error( dvdcss, "failed creating cache directory" );
@@ -535,11 +535,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )

i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title,
psz_serial, psz_key );
-#if !defined( WIN32 ) || defined( SYS_CYGWIN )
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
-#else
- i_ret = mkdir( dvdcss->psz_cachefile );
-#endif
if( i_ret < 0 && errno != EEXIST )
{
print_error( dvdcss, "failed creating cache subdirectory" );
Alexander Strasser
2013-02-11 20:10:23 UTC
Permalink
Post by Diego Biurrun
Win32: Fix broken mkdir() invocations that need to be mapped to _mkdir()
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=1fab727ead1c7f84300cae8d077a24c9c9aa83aa
---
src/libdvdcss.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 01eafef..4a09084 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -132,6 +132,10 @@
#include "ioctl.h"
#include "device.h"
+#if defined(WIN32)
+#define mkdir(a, b) _mkdir(a)
+#endif
I guess this renders direct.h necessary for MSVC. I believe
the code was broken before though.

For MinGW direct.h might not be necessary if I remember my
latest tests correctly. But merely including it won't hurt for
MinGW nor OS/2 AFAICT.

Alexander
Diego Biurrun
2013-02-11 20:11:49 UTC
Permalink
Post by Alexander Strasser
Post by Diego Biurrun
Win32: Fix broken mkdir() invocations that need to be mapped to _mkdir()
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -132,6 +132,10 @@
#include "ioctl.h"
#include "device.h"
+#if defined(WIN32)
+#define mkdir(a, b) _mkdir(a)
+#endif
I guess this renders direct.h necessary for MSVC. I believe
the code was broken before though.
For MinGW direct.h might not be necessary if I remember my
latest tests correctly. But merely including it won't hurt for
MinGW nor OS/2 AFAICT.
I tested on MinGW, it worked there w/o a direct.h #include.

Diego
Jean-Baptiste Kempf
2013-02-11 22:06:04 UTC
Permalink
Post by Diego Biurrun
Post by Alexander Strasser
I guess this renders direct.h necessary for MSVC. I believe
the code was broken before though.
It wasn't, because of the later direct.h inclusion.
Post by Diego Biurrun
Post by Alexander Strasser
For MinGW direct.h might not be necessary if I remember my
latest tests correctly. But merely including it won't hurt for
MinGW nor OS/2 AFAICT.
I tested on MinGW, it worked there w/o a direct.h #include.
Indeed, but I think we should include it, because of MSVC.

Best regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Dave Yeo
2013-02-12 00:16:39 UTC
Permalink
Post by Alexander Strasser
For MinGW direct.h might not be necessary if I remember my
latest tests correctly. But merely including it won't hurt for
MinGW nor OS/2 AFAICT.
It shouldn't hurt OS/2.
Dave

Loading...