[vlc-commits] [Git][videolan/vlc][3.0.x] 9 commits: chromaprint: missing cast

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Dec 9 08:32:46 UTC 2023



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
770789f2 by Rémi Denis-Courmont at 2023-12-07T15:49:16+01:00
chromaprint: missing cast

(cherry picked from commit 7bd5bab3e43ae187f7219db61ed85d06d2ba0547)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
6179d6b8 by Rémi Denis-Courmont at 2023-12-07T15:57:40+01:00
win32: wrap {g,s}etsockopt()

char * can alias anything, and Winsock relies on that. Unfortunately,
the compiler still issues warnings. This works around that.

(cherry picked from commit 36715d9b79f34824e126c2bc3aee2f1c1c16af46)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
3391108f by Steve Lhomme at 2023-12-07T15:57:40+01:00
netsync: use char for temporary local buffer

On Windows recvfrom/revc/sendto expects a char*.

- - - - -
27e584d7 by Steve Lhomme at 2023-12-07T15:57:40+01:00
access/dtv: move the lfind() Windows hack in the module

So that we don't have to include search.h each time vlc_fixups.h is used.

The Win32 prototype of lfind() expects an unsigned* for 'nelp', not a size_t*.

(cherry picked from commit 7c43bcba27b6fe256456d93a9d32e10648f08da8)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
5a9ca37a by Steve Lhomme at 2023-12-07T15:57:40+01:00
vlc_common: fix swab() calls on win32 that don't use const on source pointer

(cherry picked from commit a9e0b1124e19225b903a2926951781e84002c410)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
b758e194 by Steve Lhomme at 2023-12-07T15:57:40+01:00
avcodec: encoder: fix MPEG4 matrix passed as const

lavc expects a pointer that it will free in avcodec_free_context().

(cherry picked from commit d86c4c87aa78130a4fd00294e25df865d0e2b327)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
55be3ce6 by Steve Lhomme at 2023-12-07T15:57:40+01:00
smb: fix potential string to wide string copy

The type of net_resource depends on the UNICODE define.

- - - - -
5ae924bf by Steve Lhomme at 2023-12-07T15:57:40+01:00
dxva2: add missing mask initializers

- - - - -
08c7a667 by Steve Lhomme at 2023-12-07T15:58:38+01:00
win32/modules: use cast with GetProcAddress function pointers

- - - - -


11 changed files:

- include/vlc_common.h
- include/vlc_fixups.h
- include/vlc_network.h
- modules/access/dtv/access.c
- modules/access/smb.c
- modules/codec/avcodec/dxva2.c
- modules/codec/avcodec/encoder.c
- modules/control/netsync.c
- modules/stream_out/chromaprint.c
- src/text/url.c
- src/win32/plugin.c


Changes:

=====================================
include/vlc_common.h
=====================================
@@ -947,6 +947,11 @@ static inline void SetQWLE (void *p, uint64_t qw)
 #       define O_NONBLOCK 0
 #   endif
 
+/* the mingw32 swab() and win32 _swab() prototypes expect a char* instead of a
+   const void* */
+#  define swab(a,b,c)  swab((char*) (a), (char*) (b), (c))
+
+
 #   include <tchar.h>
 #endif /* _WIN32 */
 


=====================================
include/vlc_fixups.h
=====================================
@@ -501,8 +501,11 @@ void *tsearch( const void *key, void **rootp, int(*cmp)(const void *, const void
 void *tfind( const void *key, const void **rootp, int(*cmp)(const void *, const void *) );
 void *tdelete( const void *key, void **rootp, int(*cmp)(const void *, const void *) );
 void twalk( const void *root, void(*action)(const void *nodep, VISIT which, int depth) );
+#ifndef _WIN32
+/* the Win32 prototype of lfind() expects an unsigned* for 'nmemb' */
 void *lfind( const void *key, const void *base, size_t *nmemb,
              size_t size, int(*cmp)(const void *, const void *) );
+#endif
 #endif /* HAVE_SEARCH_H */
 #ifndef HAVE_TDESTROY
 void tdestroy( void *root, void (*free_node)(void *nodep) );


=====================================
include/vlc_network.h
=====================================
@@ -183,6 +183,22 @@ VLC_API int vlc_close(int);
 
 /** @} */
 
+#ifdef _WIN32
+static inline int vlc_getsockopt(int s, int level, int name,
+                                 void *val, socklen_t *len)
+{
+    return getsockopt(s, level, name, (char *)val, len);
+}
+#define getsockopt vlc_getsockopt
+
+static inline int vlc_setsockopt(int s, int level, int name,
+                                 const void *val, socklen_t len)
+{
+    return setsockopt(s, level, name, (const char *)val, len);
+}
+#define setsockopt vlc_setsockopt
+#endif
+
 /* Portable network names/addresses resolution layer */
 
 #define NI_MAXNUMERICHOST 64


=====================================
modules/access/dtv/access.c
=====================================
@@ -32,6 +32,11 @@
 #ifdef HAVE_SEARCH_H
 #include <search.h>
 #endif
+#if defined(_WIN32)
+/* 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
 
 #include "dtv/dtv.h"
 


=====================================
modules/access/smb.c
=====================================
@@ -524,7 +524,7 @@ static void Win32AddConnection( stream_t *p_access, const char *psz_server,
                                 const char *psz_pwd, const char *psz_domain )
 {
     char psz_remote[MAX_PATH];
-    NETRESOURCE net_resource;
+    NETRESOURCEA net_resource;
     DWORD i_result;
     VLC_UNUSED( psz_domain );
 
@@ -544,7 +544,7 @@ static void Win32AddConnection( stream_t *p_access, const char *psz_server,
 
     net_resource.lpRemoteName = psz_remote;
 
-    i_result = WNetAddConnection2( &net_resource, psz_pwd, psz_user, 0 );
+    i_result = WNetAddConnection2A( &net_resource, psz_pwd, psz_user, 0 );
 
     if( i_result != NO_ERROR )
     {


=====================================
modules/codec/avcodec/dxva2.c
=====================================
@@ -84,12 +84,12 @@ DEFINE_GUID(DXVA_Intel_H264_NoFGT_ClearVideo,       0x604F8E68, 0x4951, 0x4c54,
 
 /* XXX Preferred format must come first */
 static const d3d9_format_t d3d_formats[] = {
-    { "YV12",   MAKEFOURCC('Y','V','1','2'),    VLC_CODEC_YV12 },
-    { "NV12",   MAKEFOURCC('N','V','1','2'),    VLC_CODEC_NV12 },
-    //{ "IMC3",   MAKEFOURCC('I','M','C','3'),    VLC_CODEC_YV12 },
-    { "P010",   MAKEFOURCC('P','0','1','0'),    VLC_CODEC_P010 },
+    { "YV12",   MAKEFOURCC('Y','V','1','2'),    VLC_CODEC_YV12, 0,0,0 },
+    { "NV12",   MAKEFOURCC('N','V','1','2'),    VLC_CODEC_NV12, 0,0,0 },
+    //{ "IMC3",   MAKEFOURCC('I','M','C','3'),    VLC_CODEC_YV12, 0,0,0 },
+    { "P010",   MAKEFOURCC('P','0','1','0'),    VLC_CODEC_P010, 0,0,0 },
 
-    { NULL, 0, 0 }
+    { NULL, 0, 0, 0,0,0 }
 };
 
 static const d3d9_format_t *D3dFindFormat(D3DFORMAT format)


=====================================
modules/codec/avcodec/encoder.c
=====================================
@@ -588,8 +588,14 @@ int InitVideoEnc( vlc_object_t *p_this )
 
         if ( p_sys->b_mpeg4_matrix )
         {
-            p_context->intra_matrix = mpeg4_default_intra_matrix;
-            p_context->inter_matrix = mpeg4_default_non_intra_matrix;
+            p_context->intra_matrix = av_malloc( sizeof(mpeg4_default_intra_matrix) );
+            if ( p_context->intra_matrix )
+                memcpy( p_context->intra_matrix, mpeg4_default_intra_matrix,
+                        sizeof(mpeg4_default_intra_matrix));
+            p_context->inter_matrix = av_malloc( sizeof(mpeg4_default_non_intra_matrix) );
+            if ( p_context->inter_matrix )
+                memcpy( p_context->inter_matrix, mpeg4_default_non_intra_matrix,
+                        sizeof(mpeg4_default_non_intra_matrix));
         }
 
         if ( p_sys->b_pre_me )


=====================================
modules/control/netsync.c
=====================================
@@ -181,7 +181,7 @@ static void *Master(void *handle)
     intf_sys_t *sys = intf->p_sys;
     for (;;) {
         struct pollfd ufd = { .fd = sys->fd, .events = POLLIN, };
-        uint64_t data[2];
+        char data[16];
 
         if (poll(&ufd, 1, -1) < 0)
             continue;
@@ -198,8 +198,8 @@ static void *Master(void *handle)
         if (master_system < 0)
             continue;
 
-        data[0] = hton64(mdate());
-        data[1] = hton64(master_system);
+        SetQWBE(&data[0], mdate());
+        SetQWBE(&data[8], master_system);
 
         /* Reply to the sender */
         sendto(sys->fd, data, 16, 0,
@@ -224,7 +224,7 @@ static void *Slave(void *handle)
 
     for (;;) {
         struct pollfd ufd = { .fd = sys->fd, .events = POLLIN, };
-        uint64_t data[2];
+        char data[16];
 
         vlc_tick_t system = GetPcrSystem(sys->input);
         if (system < 0)
@@ -233,7 +233,7 @@ static void *Slave(void *handle)
         /* Send clock request to the master */
         const vlc_tick_t send_date = mdate();
 
-        data[0] = hton64(system);
+        SetQWBE(&data[0], system);
         send(sys->fd, data, 8, 0);
 
         /* Don't block */
@@ -244,8 +244,8 @@ static void *Slave(void *handle)
         if (recv(sys->fd, data, 16, 0) < 16)
             goto wait;
 
-        const vlc_tick_t master_date   = ntoh64(data[0]);
-        const vlc_tick_t master_system = ntoh64(data[1]);
+        const vlc_tick_t master_date   = GetQWBE(&data[0]);
+        const vlc_tick_t master_system = GetQWBE(&data[8]);
         const vlc_tick_t diff_date = receive_date -
                                   ((receive_date - send_date) / 2 + master_date);
 


=====================================
modules/stream_out/chromaprint.c
=====================================
@@ -231,7 +231,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         if ( !p_sys->b_finished && id->i_samples > 0 && p_buf->i_buffer )
         {
             if(! chromaprint_feed( p_sys->p_chromaprint_ctx,
-                                   p_buf->p_buffer,
+                                   (int16_t *)p_buf->p_buffer,
                                    p_buf->i_buffer / BYTESPERSAMPLE ) )
                 msg_Warn( p_stream, "feed error" );
             id->i_samples -= i_samples;


=====================================
src/text/url.c
=====================================
@@ -892,7 +892,8 @@ static int IdnToAscii(DWORD flags, LPCWSTR str, int len, LPWSTR buf, int size)
     int (WINAPI *IdnToAsciiReal)(DWORD, LPCWSTR, int, LPWSTR, int);
     int ret = 0;
 
-    IdnToAsciiReal = GetProcAddress(h, "IdnToAscii");
+    IdnToAsciiReal = (int (WINAPI *)(DWORD, LPCWSTR, int, LPWSTR, int))
+                     GetProcAddress(h, "IdnToAscii");
     if (IdnToAsciiReal != NULL)
         ret = IdnToAsciiReal(flags, str, len, buf, size);
     else


=====================================
src/win32/plugin.c
=====================================
@@ -45,7 +45,8 @@ static BOOL WINAPI SetThreadErrorModeFallback(DWORD mode, DWORD *oldmode)
 
     BOOL (WINAPI *SetThreadErrorModeReal)(DWORD, DWORD *);
 
-    SetThreadErrorModeReal = GetProcAddress(h, "SetThreadErrorMode");
+    SetThreadErrorModeReal = (BOOL (WINAPI *)(DWORD, DWORD *))
+                              GetProcAddress(h, "SetThreadErrorMode");
     if (SetThreadErrorModeReal != NULL)
         return SetThreadErrorModeReal(mode, oldmode);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4a20ef61d027f5a1c0c1eed3231fde296f2ce623...08c7a66780740679ba1b0abe9e30e73afc6bc271

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4a20ef61d027f5a1c0c1eed3231fde296f2ce623...08c7a66780740679ba1b0abe9e30e73afc6bc271
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