Discussion:
[libdvdcss-devel] [PATCH 1/2] win32: consistently use snprintf() instead of _snprintf().
Diego Biurrun
2011-10-22 14:54:24 UTC
Permalink
Both functions are available on Cygwin and MinGW nowadays so there is
no need to be inconsistent anymore.
---
src/device.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index 98507f4..46a936a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -511,7 +511,7 @@ static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
{
char psz_dvd[7];
- _snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
+ snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );

/* 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
--
1.7.3.4
Diego Biurrun
2011-10-22 14:54:25 UTC
Permalink
This workaround was added for MinGW originally, but nowadays MinGW supports
snprintf() directly so it has become unnecessary.

Furthermore this can play havoc with Cygwin which does not have a _snprintf()
declaration and gives implicit function declaration warnings. Depending on
compiler flags, this can be a fatal error.
---
src/common.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/common.h b/src/common.h
index bee5aad..801b8c5 100644
--- a/src/common.h
+++ b/src/common.h
@@ -76,10 +76,6 @@ typedef __int64 off_t;
# define stat _stati64
# endif

-# ifndef snprintf
-# define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
-# endif
-
#endif

#endif /* DVDCSS_COMMON_H */
--
1.7.3.4
Jean-Baptiste Kempf
2011-10-26 05:01:34 UTC
Permalink
Post by Diego Biurrun
This workaround was added for MinGW originally, but nowadays MinGW supports
snprintf() directly so it has become unnecessary.
Applied.

Best Regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Jean-Baptiste Kempf
2011-10-26 05:01:25 UTC
Permalink
Post by Diego Biurrun
Both functions are available on Cygwin and MinGW nowadays so there is
no need to be inconsistent anymore.
Applied.

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