[libdvdcss-devel] libdvdcss: Avoid need for local cache filename buffer in dvdcss_open().

[email protected] (Diego Biurrun)
Newsgroups gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
libdvdcss | branch: master | Diego Biurrun <[email protected]> | Fri Oct 31 20:06:28 2014 +0100| [2697472efc58b75d0a66a4d605215a6689301213] | committer: Diego Biurrun

libdvdcss: Avoid need for local cache filename buffer in dvdcss_open().

There is a buffer in the global dvdcss struct that can be used instead.

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=2697472efc58b75d0a66a4d605215a6689301213
---

 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 */
     }

_______________________________________________
libdvdcss-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvdcss-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.