[vlc-commits] [Git][videolan/vlc][master] 22 commits: realpath: use the proper type returned by MultiByteToWideChar()
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Feb 10 18:46:34 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a81b06bf by Steve Lhomme at 2023-02-10T18:18:54+00:00
realpath: use the proper type returned by MultiByteToWideChar()
- - - - -
e71fb936 by Steve Lhomme at 2023-02-10T18:18:54+00:00
unicode: avoid warning on unused label
- - - - -
ed7b9c03 by Steve Lhomme at 2023-02-10T18:18:54+00:00
modules: fix mismatching restrict usage
- - - - -
cf9b1831 by Steve Lhomme at 2023-02-10T18:18:54+00:00
avoid empty function parameters
- - - - -
97ff6333 by Steve Lhomme at 2023-02-10T18:18:54+00:00
httpd: initialize version to 0
This is how it's done in many places.
There is one check:
if (cl->query.i_proto != HTTPD_PROTO_HTTP
|| cl->query.i_version > 0)
Which was going through with -1 which ends up being saved as a unsigned value.
This was likely not the intention.
- - - - -
04dcf3be by Steve Lhomme at 2023-02-10T18:18:54+00:00
httpd: fix uninitialized warning
- - - - -
eb80ba93 by Steve Lhomme at 2023-02-10T18:18:54+00:00
cmdline: fix uninitialized warning
- - - - -
9c307d8f by Steve Lhomme at 2023-02-10T18:18:54+00:00
mp4: fix uninitialized warning
This also make the code logic easier to follow.
- - - - -
3a57c1cf by Steve Lhomme at 2023-02-10T18:18:54+00:00
mp4: init variable
Fix uninitialized warning, although cdt2 won't be used if cdt2_size is zero.
- - - - -
7b1da25f by Steve Lhomme at 2023-02-10T18:18:54+00:00
hxxx_helper: fix uninitialized warning
- - - - -
381d0c22 by Steve Lhomme at 2023-02-10T18:18:54+00:00
demux/hls: avoid variable shadowing
- - - - -
5c67db97 by Steve Lhomme at 2023-02-10T18:18:54+00:00
variables: return size_t with var_CountChoices()
It can't report an error and that's how the value is stored.
- - - - -
2f77dce7 by Steve Lhomme at 2023-02-10T18:18:54+00:00
mpeg4audio: avoid putting negative value in unsigned value
- - - - -
20bd6055 by Steve Lhomme at 2023-02-10T18:18:54+00:00
win32: avoid setting a negative value in a DWORD
- - - - -
a1a62650 by Steve Lhomme at 2023-02-10T18:18:54+00:00
vout: fix vout linking with the Windows SDK
CLSID_SensorManager is found in sensorsapi.lib but we can just use __uuidof().
- - - - -
52e30cdd by Steve Lhomme at 2023-02-10T18:18:54+00:00
d3d: avoid using vararg macros with fixed number of params
- - - - -
eede3928 by Steve Lhomme at 2023-02-10T18:18:54+00:00
d3d: don't use empty initializers
- - - - -
bd52254a by Steve Lhomme at 2023-02-10T18:18:54+00:00
avcodec: allow including va headers from C++ code
- - - - -
1a17e8ce by Steve Lhomme at 2023-02-10T18:18:54+00:00
medialibrary: use <cstring> from C++
- - - - -
b1adadbb by Steve Lhomme at 2023-02-10T18:18:54+00:00
medialibrary: don't use named intializers in C++
- - - - -
cf96f270 by Steve Lhomme at 2023-02-10T18:18:54+00:00
medialibrary: use proper callback values
Otherwise it may use the values from this, not knowning which variant to use
if there are multiple child/parent classes.
- - - - -
674cc68b by Steve Lhomme at 2023-02-10T18:18:54+00:00
vlc_codecs.h: don't redefine some WAVE formats if already found
Some of the newest FourCC exist in the latest Windows SDK, with the same
values.
- - - - -
23 changed files:
- compat/realpath.c
- include/vlc_codecs.h
- include/vlc_media_library.h
- include/vlc_variables.h
- modules/codec/avcodec/directx_va.h
- modules/codec/avcodec/va_surface.h
- modules/codec/hxxx_helper.c
- modules/demux/hls/playlist/Parser.cpp
- modules/demux/mp4/meta.c
- modules/demux/mp4/mp4.c
- modules/demux/mpeg/ts_streamwrapper.h
- modules/lua/libs/variables.c
- modules/misc/medialibrary/fs/device.cpp
- modules/misc/medialibrary/fs/devicelister.cpp
- modules/packetizer/mpeg4audio.c
- modules/text_renderer/freetype/fonts/win32.c
- modules/video_output/win32/d3d_dynamic_shader.c
- modules/video_output/win32/d3d_shaders.h
- modules/video_output/win32/sensors.cpp
- src/config/cmdline.c
- src/network/httpd.c
- src/text/unicode.c
- src/win32/spawn.c
Changes:
=====================================
compat/realpath.c
=====================================
@@ -37,7 +37,7 @@ char *realpath(const char * restrict relpath, char * restrict resolved_path)
}
#ifdef _WIN32
- size_t len = MultiByteToWideChar( CP_UTF8, 0, relpath, -1, NULL, 0 );
+ int len = MultiByteToWideChar( CP_UTF8, 0, relpath, -1, NULL, 0 );
if (len == 0)
return NULL;
=====================================
include/vlc_codecs.h
=====================================
@@ -215,8 +215,12 @@ ATTR_PACKED
#define WAVE_FORMAT_A52 0x2000 /* a52 */
#define WAVE_FORMAT_DTSINC_DTS 0x2001 /* DTS */
+#ifndef WAVE_FORMAT_ALAC
#define WAVE_FORMAT_ALAC 0x6c61
+#endif
+#ifndef WAVE_FORMAT_OPUS
#define WAVE_FORMAT_OPUS 0x704f
+#endif
#define WAVE_FORMAT_AVCODEC_AAC 0x706D
#define WAVE_FORMAT_DIVIO_AAC 0x4143 /* Divio's AAC */
@@ -251,7 +255,9 @@ ATTR_PACKED
#define WAVE_FORMAT_G723_1 0xa100
#define WAVE_FORMAT_AAC_3 0xa106
#define WAVE_FORMAT_SPEEX 0xa109 /* Speex audio */
+#ifndef WAVE_FORMAT_FLAC
#define WAVE_FORMAT_FLAC 0xf1ac /* Xiph Flac */
+#endif
#if !defined(WAVE_FORMAT_EXTENSIBLE)
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */
=====================================
include/vlc_media_library.h
=====================================
@@ -947,13 +947,13 @@ VLC_API void vlc_ml_bookmark_list_release( vlc_ml_bookmark_list_t* p_list );
static inline vlc_ml_query_params_t vlc_ml_query_params_create(void)
{
- return (vlc_ml_query_params_t) {
- .psz_pattern = NULL,
- .i_nbResults = 0,
- .i_offset = 0,
- .i_sort = VLC_ML_SORTING_DEFAULT,
- .b_desc = false
- };
+#ifdef __cplusplus
+ vlc_ml_query_params_t ret = { };
+ ret.i_sort = VLC_ML_SORTING_DEFAULT;
+#else
+ vlc_ml_query_params_t ret = { .i_sort = VLC_ML_SORTING_DEFAULT };
+#endif
+ return ret;
}
static inline int vlc_ml_add_folder( vlc_medialibrary_t* p_ml, const char* psz_folder )
=====================================
include/vlc_variables.h
=====================================
@@ -654,7 +654,7 @@ static inline char *var_CreateGetNonEmptyStringCommand( vlc_object_t *p_obj,
}
VLC_USED
-static inline int var_CountChoices( vlc_object_t *p_obj, const char *psz_name )
+static inline size_t var_CountChoices( vlc_object_t *p_obj, const char *psz_name )
{
size_t count;
if( var_Change( p_obj, psz_name, VLC_VAR_CHOICESCOUNT, &count ) )
=====================================
modules/codec/avcodec/directx_va.h
=====================================
@@ -37,6 +37,10 @@
#include "va_surface.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct input_list_t {
void (*pf_release)(struct input_list_t *);
GUID *list;
@@ -76,4 +80,8 @@ const directx_va_mode_t * directx_va_Setup(vlc_va_t *, const directx_sys_t *, co
video_format_t *fmt_out, unsigned *surface_count);
bool directx_va_canUseDecoder(vlc_va_t *, UINT VendorId, UINT DeviceId, const GUID *pCodec, UINT driverBuild);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* AVCODEC_DIRECTX_VA_H */
=====================================
modules/codec/avcodec/va_surface.h
=====================================
@@ -30,6 +30,10 @@
#include <libavcodec/avcodec.h>
#include "va.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* */
typedef struct vlc_va_surface_t vlc_va_surface_t;
typedef struct va_pool_t va_pool_t;
@@ -108,4 +112,8 @@ void va_surface_AddRef(vlc_va_surface_t *surface);
*/
void va_surface_Release(vlc_va_surface_t *surface);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* AVCODEC_VA_SURFACE_INTERNAL_H */
=====================================
modules/codec/hxxx_helper.c
=====================================
@@ -593,7 +593,7 @@ hxxx_helper_get_annexb_config( const struct hxxx_helper_nal *pp_nal_lists[],
{
static const uint8_t annexb_startcode[] = { 0x00, 0x00, 0x00, 0x01 };
- block_t *p_block_list = NULL, *p_current;
+ block_t *p_block_list = NULL, *p_current = NULL;
for (size_t i = 0; i < i_lists_size; ++i)
{
size_t i_nals_size = 0;
=====================================
modules/demux/hls/playlist/Parser.cpp
=====================================
@@ -396,14 +396,14 @@ void M3U8Parser::parseSegments(vlc_object_t *, HLSRepresentation *rep, const std
if(segmentstoappend.size() && segmentstoappend.back()->getDisplayTime() == VLC_TICK_INVALID)
{
vlc_tick_t tempTime = absReferenceTime;
- for(auto it = segmentstoappend.crbegin(); it != segmentstoappend.crend(); ++it)
+ for(auto sit = segmentstoappend.crbegin(); sit != segmentstoappend.crend(); ++sit)
{
- vlc_tick_t duration = timescale.ToTime((*it)->duration.Get());
+ vlc_tick_t duration = timescale.ToTime((*sit)->duration.Get());
if( duration < tempTime - VLC_TICK_0 )
tempTime -= duration;
else
tempTime = VLC_TICK_0;
- (*it)->setDisplayTime(tempTime);
+ (*sit)->setDisplayTime(tempTime);
}
}
break;
=====================================
modules/demux/mp4/meta.c
=====================================
@@ -227,10 +227,15 @@ static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, const MP4
vlc_meta_type_t const* type;
char const* key;
- if( ( name != NULL && !AppleNameToMeta( name, &type, &key ) ) ||
- ( name == NULL && !AtomXA9ToMeta( i_type, &type, &key ) ) )
+ if( name != NULL)
{
- return false;
+ if ( !AppleNameToMeta( name, &type, &key ) )
+ return false;
+ }
+ else
+ {
+ if ( !AtomXA9ToMeta( i_type, &type, &key ) )
+ return false;
}
char* psz_utf = ExtractString( p_box );
=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -705,7 +705,7 @@ static block_t * MP4_EIA608_Convert( block_t * p_block )
/* cdt2 is optional */
uint_fast32_t cdt2_size = 0;
- const uint8_t *cdt2;
+ const uint8_t *cdt2 = NULL;
if (p_block->i_buffer >= 8) {
size_t size = GetDWBE(p_block->p_buffer) - 8;
=====================================
modules/demux/mpeg/ts_streamwrapper.h
=====================================
@@ -31,7 +31,7 @@ static ssize_t ts_stream_wrapper_Read(stream_t *s, void *buf, size_t len)
return demuxstream->pf_read(demuxstream, buf, len);
}
-static block_t * ts_stream_wrapper_ReadBlock(stream_t *s, bool *eof)
+static block_t * ts_stream_wrapper_ReadBlock(stream_t *s, bool *restrict eof)
{
stream_t *demuxstream = s->p_sys;
return demuxstream->pf_block(demuxstream, eof);
=====================================
modules/lua/libs/variables.c
=====================================
@@ -346,7 +346,7 @@ static int vlclua_countchoices( lua_State *L )
{
vlc_object_t **pp_obj = luaL_checkudata( L, 1, "vlc_object" );
const char *psz_var = luaL_checkstring( L, 2 );
- int i_count = var_CountChoices( *pp_obj, psz_var );
+ size_t i_count = var_CountChoices( *pp_obj, psz_var );
lua_pushinteger( L, i_count );
return 1;
=====================================
modules/misc/medialibrary/fs/device.cpp
=====================================
@@ -26,7 +26,7 @@
#include <algorithm>
#include <cassert>
-#include <strings.h>
+#include <cstring>
namespace vlc {
namespace medialibrary {
=====================================
modules/misc/medialibrary/fs/devicelister.cpp
=====================================
@@ -72,7 +72,8 @@ bool DeviceLister::start( ml::IDeviceListerCb* cb )
MediaSource s{ mediaSource };
static const vlc_media_tree_callbacks cbs {
- &onChildrenReset, &onChildrenAdded, &onChildrenRemoved, nullptr
+ &DeviceLister::onChildrenReset, &DeviceLister::onChildrenAdded,
+ &DeviceLister::onChildrenRemoved, nullptr
};
s.l = vlc_media_tree_AddListener( s.s->tree, &cbs, this, true );
=====================================
modules/packetizer/mpeg4audio.c
=====================================
@@ -177,9 +177,9 @@ static const int pi_sample_rates[16] =
static int ChannelConfigurationToVLC(uint8_t i_channel)
{
if (i_channel == 7)
- i_channel = 8; // 7.1
- else if (i_channel >= 8)
- i_channel = -1;
+ return 8; // 7.1
+ if (i_channel >= 8)
+ return -1;
return i_channel;
}
=====================================
modules/text_renderer/freetype/fonts/win32.c
=====================================
@@ -165,7 +165,7 @@ static int GetFileFontByName( const WCHAR * font_name, char **psz_filename, int
return 0;
}
-static char* GetWindowsFontPath()
+static char* GetWindowsFontPath(void)
{
wchar_t wdir[MAX_PATH];
if( S_OK != SHGetFolderPathW( NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, wdir ) )
=====================================
modules/video_output/win32/d3d_dynamic_shader.c
=====================================
@@ -324,7 +324,7 @@ static HRESULT CompileShader(vlc_object_t *obj, const d3d_shader_compiler_t *com
#ifdef VLC_WINSTORE_APP
VLC_UNUSED(compiler);
#else
-# define D3DCompile(args...) compiler->OurD3DCompile(args)
+# define D3DCompile(a,b,c,d,e,f,g,h,i,j,k) compiler->OurD3DCompile(a,b,c,d,e,f,g,h,i,j,k)
# if !defined(NDEBUG)
if (IsDebuggerPresent())
compileFlags += D3DCOMPILE_DEBUG;
=====================================
modules/video_output/win32/d3d_shaders.h
=====================================
@@ -104,7 +104,11 @@ static inline void D3D_ShaderBlobRelease(d3d_shader_blob *blob)
{
if (blob->pf_release)
blob->pf_release(blob);
- *blob = (d3d_shader_blob) { };
+#ifdef __cplusplus
+ *blob = { };
+#else
+ *blob = (d3d_shader_blob) { .pf_release = NULL };
+#endif
}
float D3D_GetFormatLuminance(vlc_object_t *, const video_format_t *);
=====================================
modules/video_output/win32/sensors.cpp
=====================================
@@ -155,7 +155,7 @@ private:
void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
{
ComPtr<ISensorManager> pSensorManager;
- HRESULT hr = CoCreateInstance( CLSID_SensorManager,
+ HRESULT hr = CoCreateInstance( __uuidof(SensorManager),
NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(pSensorManager.GetAddressOf()) );
if (FAILED(hr))
=====================================
src/config/cmdline.c
=====================================
@@ -379,12 +379,16 @@ int config_LoadCmdLine( libvlc_int_t *p_this, int i_argc,
/* Internal error: unknown option or missing option value */
char *optlabel;
- if ( (state.opt && asprintf(&optlabel, "%s-%c%s",
- color ? TS_YELLOW : "", state.opt,
- color ? TS_RESET : "") < 0)
- || (!state.opt && asprintf(&optlabel, "%s%s%s",
- color ? TS_YELLOW : "", ppsz_argv[state.ind-1],
- color ? TS_RESET : "") < 0) )
+ int aspret;
+ if ( state.opt )
+ aspret = asprintf(&optlabel, "%s-%c%s", color ? TS_YELLOW : "",
+ state.opt,
+ color ? TS_RESET : "");
+ else
+ aspret = asprintf(&optlabel, "%s%s%s", color ? TS_YELLOW : "",
+ ppsz_argv[state.ind-1],
+ color ? TS_RESET : "");
+ if ( aspret < 0 )
{
/* just ignore failure - unlikely and not worth trying to handle in some way */
optlabel = NULL;
=====================================
src/network/httpd.c
=====================================
@@ -309,7 +309,7 @@ httpd_FileCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
httpd_message_t *answer, const httpd_message_t *query)
{
httpd_file_t *file = (httpd_file_t*)p_sys;
- uint8_t **pp_body, *p_body;
+ uint8_t **pp_body, *p_body = NULL;
int *pi_body, i_body;
if (!answer || !query )
@@ -329,7 +329,6 @@ httpd_FileCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
pi_body = &answer->i_body;
} else {
/* The file still needs to be executed. */
- p_body = NULL;
i_body = 0;
pp_body = &p_body;
pi_body = &i_body;
@@ -1154,7 +1153,7 @@ static void httpd_MsgInit(httpd_message_t *msg)
msg->cl = NULL;
msg->i_type = HTTPD_MSG_NONE;
msg->i_proto = HTTPD_PROTO_NONE;
- msg->i_version = -1; /* FIXME */
+ msg->i_version = 0;
msg->i_status = 0;
=====================================
src/text/unicode.c
=====================================
@@ -89,7 +89,9 @@ int utf8_vfprintf( FILE *stream, const char *fmt, va_list ap )
}
else
res = -1;
+#ifndef VLC_WINSTORE_APP
out:
+#endif
free (str);
return res;
#endif
@@ -307,4 +309,3 @@ void *ToCharset(const char *charset, const char *in, size_t *outsize)
vlc_iconv_close (hd);
return res;
}
-
=====================================
src/win32/spawn.c
=====================================
@@ -250,9 +250,11 @@ int vlc_waitpid(pid_t pid)
WaitForSingleObject(process, INFINITE);
- DWORD exit_code = -1;
- GetExitCodeProcess(process, &exit_code);
+ DWORD exit_code;
+ BOOL success = GetExitCodeProcess(process, &exit_code);
CloseHandle(process);
- return exit_code;
+ if (success)
+ return exit_code;
+ return -1;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/be7ce3d1815c0348e2ee0d8cc0f8e2ba388ba6a0...674cc68b264931069c7d0fb6843f1ac1d43765ee
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/be7ce3d1815c0348e2ee0d8cc0f8e2ba388ba6a0...674cc68b264931069c7d0fb6843f1ac1d43765ee
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