[libbluray-devel] snprintf is not defined in MSVC

cb2000 git at videolan.org
Wed Sep 12 12:54:00 CEST 2012


libbluray | branch: master | cb2000 <cb2000 at anonymous.org> | Wed Sep 12 12:38:09 2012 +0300| [c1ac09b1052376018ef8641f757d4830b2d80e78] | committer: hpi1

snprintf is not defined in MSVC

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c1ac09b1052376018ef8641f757d4830b2d80e78
---

 src/file/dl_posix.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/file/dl_posix.c b/src/file/dl_posix.c
index e3ca145..2c5c0a8 100644
--- a/src/file/dl_posix.c
+++ b/src/file/dl_posix.c
@@ -47,12 +47,16 @@ static const char *dlerror(char *buf, int buf_size)
                        wbuf, sizeof(wbuf)/sizeof(wbuf[0]), NULL)) {
         WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, buf, buf_size, NULL, NULL);
     } else {
+#ifdef _MSC_VER
+        _snprintf(buf, buf_size, "error %d", (int)error_code);
+#else
         snprintf(buf, buf_size, "error %d", (int)error_code);
+#endif
     }
 
     return buf;
 }
-#endif
+#endif /* _WIN32 */
 
 static void   *_dl_dlopen  ( const char* path )
 {



More information about the libbluray-devel mailing list