[vlc-commits] [Git][videolan/vlc][3.0.x] libvlc: fix API compatibility when using libvlc from MSVC

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Nov 11 08:10:56 UTC 2023



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
ab4f2bc2 by Steve Lhomme at 2023-11-08T08:10:17+01:00
libvlc: fix API compatibility when using libvlc from MSVC

MSVC doesn't have ssize_t but it has SSIZE_T which should be similar.

clang-cl doesn't have any ssize_t in its header and defines _MSC_VER so it
should work as well.

Co-authored-by: Martin Finkel <martin at videolabs.io>

- - - - -


2 changed files:

- include/vlc/libvlc_media.h
- modules/access/imem-access.c


Changes:

=====================================
include/vlc/libvlc_media.h
=====================================
@@ -30,6 +30,12 @@
 extern "C" {
 # endif
 
+#if defined(_MSC_VER)
+#include <basetsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
+
 /** \defgroup libvlc_media LibVLC media
  * \ingroup libvlc
  * @ref libvlc_media_t is an abstract representation of a playable media.


=====================================
modules/access/imem-access.c
=====================================
@@ -28,6 +28,12 @@
 #include <vlc_access.h>
 #include <vlc_plugin.h>
 
+#ifdef _WIN32
+#include <basetsd.h> // ensure MSVC compatibility
+static_assert(sizeof(SSIZE_T) == sizeof(ssize_t),
+                "libvlc_media_read_cb type mismatch");
+#endif
+
 struct access_sys_t
 {
     void *opaque;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ab4f2bc2ec72c69fe0220d4f519b67cc5b7fc22f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ab4f2bc2ec72c69fe0220d4f519b67cc5b7fc22f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list