<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>I commented on it in the commit log here. I'm happy to use this dynamic allocation implementation instead if you'd prefer.</div><div><br></div><div></div><div>The thing is, MAX_PATH is defined as only 260. Windows 10 builds after version 1607 have removed this limit for some common functions, but GetTempPath is not among them. Since the maximum possible size of the string returned is fixed at 260*sizeof(wchar_t) bytes, I felt that a fixed array was possibly better compared to the overhead of the dynamic model.</div><div><br></div><div>I don't care which implementation is chosen though.</div><div><br></div><div>Attached is a replacement for patches #1 and #4, the former to make use of the dynamic implementation (plus addressing Steve's duplication comment), the latter just to adjust the commit log accordingly. If you'd rather not in fact use the dynamic model, the alternate copy sent in reply to Steve should be used instead.</div><div><br></div><div><br></div><div>On Wed, 2020-10-14 at 09:49 +0300, Rémi Denis-Courmont wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">Hi,<br><br>Shouldn't this logic be used in the Win32 GetTempPath() instead of a fixed size stack array?<br><br><div class="gmail_quote">Le 14 octobre 2020 05:53:03 GMT+03:00, Lyndon Brown <jnqnfe@gmail.com> a écrit :<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<pre>From: Lyndon Brown <jnqnfe@gmail.com></pre><br><pre>Date: Fri, 9 Oct 2020 19:28:38 +0100</pre><br><pre>Subject: es_out_timeshift: simplify win32 case with config_GetTempPath()</pre><br><br><pre>this changes the functionality slightly, with the old code dynamically</pre><br><pre>allocating a buffer of the necessary size to hold the path, whilst the</pre><br><pre>config_GetTempPath() function just uses PATH_MAX. But if the implementation</pre><br><pre>of config_GetTempPath() using PATH_MX is inadequate, it should be changed</pre><br><pre>to use the model replaced here.</pre><br><br><pre>diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c</pre><br><pre>index 8ffa1ea400..02735e807b 100644</pre><br><pre>--- a/src/input/es_out_timeshift.c</pre><br><pre>+++ b/src/input/es_out_timeshift.c</pre><br><pre>@@ -364,20 +364,7 @@ es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out</pre><br><pre>     p_sys->psz_tmp_path = var_InheritString( p_input, "input-timeshift-path" );</pre><br><pre> #if defined (_WIN32) && !VLC_WINSTORE_APP</pre><br><pre>     if( p_sys->psz_tmp_path == NULL )</pre><br><pre>-    {</pre><br><pre>-        const DWORD count = GetTempPath( 0, NULL );</pre><br><pre>-        if( count > 0 )</pre><br><pre>-        {</pre><br><pre>-            WCHAR *path = vlc_alloc( count + 1, sizeof(WCHAR) );</pre><br><pre>-            if( path != NULL )</pre><br><pre>-            {</pre><br><pre>-                DWORD ret = GetTempPath( count + 1, path );</pre><br><pre>-                if( ret != 0 && ret <= count )</pre><br><pre>-                    p_sys->psz_tmp_path = FromWide( path );</pre><br><pre>-                free( path );</pre><br><pre>-            }</pre><br><pre>-        }</pre><br><pre>-    }</pre><br><pre>+        p_sys->psz_tmp_path = config_GetTempPath();</pre><br><pre>     if( p_sys->psz_tmp_path == NULL )</pre><br><pre>     {</pre><br><pre>         wchar_t *wpath = _wgetcwd( NULL, 0 );</pre><pre>vlc-devel mailing list</pre><br><pre>To unsubscribe or modify your subscription options:</pre><br><a href="https://mailman.videolan.org/listinfo/vlc-devel"><pre>https://mailman.videolan.org/listinfo/vlc-devel</pre></a></blockquote></div><br><pre>_______________________________________________</pre><pre>vlc-devel mailing list</pre><pre>To unsubscribe or modify your subscription options:</pre><a href="https://mailman.videolan.org/listinfo/vlc-devel"><pre>https://mailman.videolan.org/listinfo/vlc-devel</pre></a></blockquote></body></html>