[libdvdcss-devel] [PATCH 4/4] libdvdcss: Avoid need for local cache filename buffer in dvdcss_open().
Jean-Baptiste Kempf
jb at videolan.org
Sat Nov 1 18:07:48 CET 2014
OK.
On 01 Nov, Diego Biurrun wrote :
> There is a buffer in the global dvdcss struct that can be used instead.
> ---
> src/libdvdcss.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/src/libdvdcss.c b/src/libdvdcss.c
> index c6ef8be..826e599 100644
> --- a/src/libdvdcss.c
> +++ b/src/libdvdcss.c
> @@ -196,7 +196,6 @@ static int set_access_method( dvdcss_t dvdcss )
> */
> LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
> {
> - char psz_buffer[PATH_MAX];
> int i_ret;
>
> const char *psz_cache = getenv( "DVDCSS_CACHE" );
> @@ -241,9 +240,9 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
> if (SHGetFolderPathA (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
> NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK)
> {
> - snprintf( psz_buffer, PATH_MAX, "%s\\dvdcss", psz_home );
> - psz_buffer[PATH_MAX-1] = '\0';
> - psz_cache = psz_buffer;
> + snprintf( dvdcss->psz_cachefile, PATH_MAX, "%s\\dvdcss", psz_home );
> + dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
> + psz_cache = dvdcss->psz_cachefile;
> }
> #else
> char *psz_home = NULL;
> @@ -282,15 +281,15 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
> psz_unixroot[1] == ':' &&
> psz_unixroot[2] == '\0')
> {
> - strcpy( psz_buffer, psz_unixroot );
> + strcpy( dvdcss->psz_cachefile, psz_unixroot );
> home_pos = 2;
> }
> }
> #endif /* __OS2__ */
> - snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
> + snprintf( dvdcss->psz_cachefile + home_pos, PATH_MAX - home_pos,
> "%s/.dvdcss", psz_home );
> - psz_buffer[PATH_MAX-1] = '\0';
> - psz_cache = psz_buffer;
> + dvdcss->psz_cachefile[PATH_MAX - 1] = '\0';
> + psz_cache = dvdcss->psz_cachefile;
> }
> #endif /* ! defined(_WIN32_IE) && _WIN32_IE >= 0x500 */
> }
> --
> 1.9.1
>
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the libdvdcss-devel
mailing list