[vlc-devel] [PATCH 4/4] vlc_search: remap win64 lfind as it expects a unsigned* where we get a size_t*

Steve Lhomme robux4 at ycbcr.xyz
Mon Jul 15 13:38:43 CEST 2019


Co-authored-by: RĂ©mi Denis-Courmont <remi at remlab.net>
---
 include/vlc_search.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/vlc_search.h b/include/vlc_search.h
index 7ca6e6d2dd..10055f90ec 100644
--- a/include/vlc_search.h
+++ b/include/vlc_search.h
@@ -30,4 +30,18 @@
 #include <search.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _WIN64
+/* the Win32 prorotype of lfind() expects an unsigned int for 'nelp' */
+# define lfind(a,b,c,d,e) \
+         lfind(a,b, &(unsigned){ (*(c) > UINT_MAX) ? UINT_MAX : *(c) },d,e)
+#endif /* _WIN64 */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif /* !LIBVLC_SEARCH_H */
-- 
2.17.1



More information about the vlc-devel mailing list