[vlc-commits] vlc_fixup: remap win64 lfind as it expects a unsigned* where we get a size_t*

Steve Lhomme git at videolan.org
Fri Jul 19 15:29:45 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jul 15 13:27:29 2019 +0200| [21d8e8c917c085edb382c88a73b928c993e44780] | committer: Steve Lhomme

vlc_fixup: remap win64 lfind as it expects a unsigned* where we get a size_t*

So now we include search.h for every file we compile.

Co-authored-by: RĂ©mi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=21d8e8c917c085edb382c88a73b928c993e44780
---

 include/vlc_fixups.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 2164f690b1..1518b84362 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -490,6 +490,16 @@ void twalk( const void *root, void(*action)(const void *nodep, VISIT which, int
 void *lfind( const void *key, const void *base, size_t *nmemb,
              size_t size, int(*cmp)(const void *, const void *) );
 #endif /* HAVE_SEARCH_H */
+
+#ifdef _WIN64
+# ifdef HAVE_SEARCH_H
+#  include <search.h>
+# endif
+/* the Win32 prototype of lfind() expects an unsigned* for 'nelp' */
+# define lfind(a,b,c,d,e) \
+         lfind((a),(b), &(unsigned){ (*(c) > UINT_MAX) ? UINT_MAX : *(c) }, (d),(e))
+#endif /* _WIN64 */
+
 #ifndef HAVE_TDESTROY
 void tdestroy( void *root, void (*free_node)(void *nodep) );
 #endif



More information about the vlc-commits mailing list