[vlc-devel] [PATCH v3 4/14] es_out_timeshift: simplify win32 case with config_GetTempPath()

Rémi Denis-Courmont remi at remlab.net
Wed Oct 14 08:49:58 CEST 2020


Hi,

Shouldn't this logic be used in the Win32 GetTempPath() instead of a fixed size stack array?

Le 14 octobre 2020 05:53:03 GMT+03:00, Lyndon Brown <jnqnfe at gmail.com> a écrit :
>From: Lyndon Brown <jnqnfe at gmail.com>
>Date: Fri, 9 Oct 2020 19:28:38 +0100
>Subject: es_out_timeshift: simplify win32 case with
>config_GetTempPath()
>
>this changes the functionality slightly, with the old code dynamically
>allocating a buffer of the necessary size to hold the path, whilst the
>config_GetTempPath() function just uses PATH_MAX. But if the
>implementation
>of config_GetTempPath() using PATH_MX is inadequate, it should be
>changed
>to use the model replaced here.
>
>diff --git a/src/input/es_out_timeshift.c
>b/src/input/es_out_timeshift.c
>index 8ffa1ea400..02735e807b 100644
>--- a/src/input/es_out_timeshift.c
>+++ b/src/input/es_out_timeshift.c
>@@ -364,20 +364,7 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t
>*p_input, es_out_t *p_next_out
>p_sys->psz_tmp_path = var_InheritString( p_input,
>"input-timeshift-path" );
> #if defined (_WIN32) && !VLC_WINSTORE_APP
>     if( p_sys->psz_tmp_path == NULL )
>-    {
>-        const DWORD count = GetTempPath( 0, NULL );
>-        if( count > 0 )
>-        {
>-            WCHAR *path = vlc_alloc( count + 1, sizeof(WCHAR) );
>-            if( path != NULL )
>-            {
>-                DWORD ret = GetTempPath( count + 1, path );
>-                if( ret != 0 && ret <= count )
>-                    p_sys->psz_tmp_path = FromWide( path );
>-                free( path );
>-            }
>-        }
>-    }
>+        p_sys->psz_tmp_path = config_GetTempPath();
>     if( p_sys->psz_tmp_path == NULL )
>     {
>         wchar_t *wpath = _wgetcwd( NULL, 0 );
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20201014/abebf81c/attachment.html>


More information about the vlc-devel mailing list